Chapter 4. The 3scale toolbox
The 3scale toolbox is a Ruby client that enables you to manage 3scale products from the command line.
Within 3scale documentation, there is information about the installation of the 3scale toolbox, supported toolbox commands, services, plans, troubleshooting issues with SSL and TLS, etc. Refer to one of the sections below for more details:
- Section 4.1, “Installing the toolbox”
- Section 4.2, “Supported toolbox commands”
- Section 4.3, “Importing services”
- Section 4.4, “Copying services”
- Section 4.5, “Copying service settings only”
- Section 4.6, “Importing OpenAPI definitions”
- Section 4.7, “Managing remote access credentials”
- Section 4.8, “Creating application plans”
- Section 4.9, “Creating metrics”
- Section 4.10, “Creating methods”
- Section 4.11, “Creating services”
- Section 4.12, “Creating ActiveDocs”
- Section 4.13, “Listing proxy configurations”
- Section 4.14, “Copying a policy registry”
- Section 4.15, “Listing applications”
- Section 4.16, “Copying API backends”
- Section 4.17, “Troubleshooting issues with SSL and TLS”
4.1. Installing the toolbox Copy linkLink copied to clipboard!
The officially supported method of installing the 3scale toolbox is using the 3scale toolbox container image.
4.1.1. Installing the toolbox container image Copy linkLink copied to clipboard!
This section explains how to install the toolbox container image.
Prerequisites
- See the 3scale toolbox image in the Red Hat Ecosystem Catalog.
- You must have a Red Hat registry service account.
- The examples in this topic assume that you have Podman installed.
Procedure
Log in to the Red Hat Ecosystem Catalog:
podman login registry.redhat.io
$ podman login registry.redhat.io Username: ${REGISTRY-SERVICE-ACCOUNT-USERNAME} Password: ${REGISTRY-SERVICE-ACCOUNT-PASSWORD} Login Succeeded!
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Pull the toolbox container image:
podman pull registry.redhat.io/3scale-amp2/toolbox-rhel7:3scale2.10
$ podman pull registry.redhat.io/3scale-amp2/toolbox-rhel7:3scale2.10
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the installation:
podman run registry.redhat.io/3scale-amp2/toolbox-rhel7:3scale2.10 3scale help
$ podman run registry.redhat.io/3scale-amp2/toolbox-rhel7:3scale2.10 3scale help
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.1.2. Installing unsupported toolbox versions Copy linkLink copied to clipboard!
Procedure
-
You can install unsupported toolbox versions on Fedora Linux, Ubuntu Linux, Windows, or macOS by downloading and installing the latest
.rpm
,.deb
,.msi
or.pkg
file from GitHub.
Additional resources
- For details on installing the toolbox image with OpenShift, Podman, or Docker, see the instructions on getting the image in the Red Hat Ecosystem Catalog.
-
See also the instructions for installing the 3scale toolbox on Kubernetes. You must use the correct image name and the
oc
command instead ofkubectl
on OpenShift.
4.2. Supported toolbox commands Copy linkLink copied to clipboard!
Use the 3scale toolbox to manage your API from the command line tool (CLI).
The update command has been deprecated and replaced by the copy command. The use of deprecated commands is not supported.
The following commands are supported:
4.3. Importing services Copy linkLink copied to clipboard!
Import services from a CSV file by specifying the following fields in the order specified below. Include these headers in your CSV file:
service_name,endpoint_name,endpoint_http_method,endpoint_path,auth_mode,endpoint_system_name,type
service_name,endpoint_name,endpoint_http_method,endpoint_path,auth_mode,endpoint_system_name,type
You need the following information:
-
A 3scale admin account:
{3SCALE_ADMIN}
The domain your 3scale instance is running on:
{DOMAIN_NAME}
- If you are using hosted APICast this is 3scale.net
-
The access key of your account:
{ACCESS_KEY}
-
The CSV file of services, for example:
examples/import_example.csv
Import the services by running:
Example
podman run -v $PWD/examples/import_example.csv:/tmp/import_example.csv registry.redhat.io/3scale-amp2/toolbox-rhel7:3scale2.10 3scale import csv --destination=https://{ACCESS_KEY}@{3SCALE_ADMIN}-admin.{DOMAIN_NAME} --file=/tmp/import_example.csv
$ podman run -v $PWD/examples/import_example.csv:/tmp/import_example.csv registry.redhat.io/3scale-amp2/toolbox-rhel7:3scale2.10 3scale import csv --destination=https://{ACCESS_KEY}@{3SCALE_ADMIN}-admin.{DOMAIN_NAME} --file=/tmp/import_example.csv
This example uses a Podman volume to mount the resource file in the container. It assumes that the file is available in the current $PWD
folder.
4.4. Copying services Copy linkLink copied to clipboard!
Create a new service based on an existing one from the same account or from another account. When you copy a service, the relevant ActiveDocs are also copied.
You need the following information:
-
The service id you want to copy:
{SERVICE_ID}
-
A 3scale admin account:
{3SCALE_ADMIN}
The domain your 3scale instance is running on:
{DOMAIN_NAME}
- If you are using hosted APICast this is 3scale.net
-
The access key of your account:
{ACCESS_KEY}
-
The access key of the destination account if you are copying to a different account:
{DEST_KEY}
-
The name for the new service:
{NEW_NAME}
Example
podman run registry.redhat.io/3scale-amp2/toolbox-rhel7:3scale2.10 3scale copy service {SERVICE_ID} --source=https://{ACCESS_KEY}@{3SCALE_ADMIN}-admin.{DOMAIN_NAME} --destination=https://{DEST_KEY}@{3SCALE_ADMIN}-admin.{DOMAIN_NAME} --target_system_name={NEW_NAME}
$ podman run registry.redhat.io/3scale-amp2/toolbox-rhel7:3scale2.10 3scale copy service {SERVICE_ID} --source=https://{ACCESS_KEY}@{3SCALE_ADMIN}-admin.{DOMAIN_NAME} --destination=https://{DEST_KEY}@{3SCALE_ADMIN}-admin.{DOMAIN_NAME} --target_system_name={NEW_NAME}
If the service to be copied has custom policies, make sure that their respective custom policy definitions already exist in the destination where the service is to be copied. To learn more about copying custom policy definitions check out the Copying a policy registry
4.5. Copying service settings only Copy linkLink copied to clipboard!
You can bulk copy and update the service and proxy settings, metrics, methods, application plans, application plan limits, as well as mapping rules from a service to another existing service.
You need the following information:
-
The service id you want to copy:
{SERVICE_ID}
-
The service id of the destination:
{DEST_ID}
-
A 3scale admin account:
{3SCALE_ADMIN}
The domain your 3scale instance is running on:
{DOMAIN_NAME}
- If you are using hosted APICast this is 3scale.net
-
The access key of your account:
{ACCESS_KEY}
-
The access key of the destination account:
{DEST_KEY}
Additionally, you can use the optional flags:
-
The
-f
flag to remove existing target service mapping rules before copying. -
The
-r
flag to copy only mapping rules to target service.
The update
command has been deprecated and replaced by the copy
command. The use of deprecated commands is not supported.
The following example command does a bulk update from one service to another existing service:
podman run registry.redhat.io/3scale-amp2/toolbox-rhel7:3scale2.10 3scale update [opts] service --source=https://{ACCESS_KEY}@{3SCALE_ADMIN}-admin.{DOMAIN_NAME} --destination=https://{DEST_KEY}@{3SCALE_ADMIN}-admin.{DOMAIN_NAME} {SERVICE_ID} {DEST_ID}
$ podman run registry.redhat.io/3scale-amp2/toolbox-rhel7:3scale2.10 3scale update [opts] service --source=https://{ACCESS_KEY}@{3SCALE_ADMIN}-admin.{DOMAIN_NAME} --destination=https://{DEST_KEY}@{3SCALE_ADMIN}-admin.{DOMAIN_NAME} {SERVICE_ID} {DEST_ID}
4.6. Importing OpenAPI definitions Copy linkLink copied to clipboard!
To create a new service or to update an existing service, you can import the OpenAPI definition from a local file or a URL. The default service name for the import is specified by the info.title
in the OpenAPI definition. However, you can override this service name using --target_system_name=<NEW NAME>
. This will update the service name if it already exists, or create a new service name if it does not.
The import openapi
command has the following format:
3scale import openapi [opts] -d=<destination> <specification>
3scale import openapi [opts] -d=<destination> <specification>
The OpenAPI <specification>
can be one of the following:
-
/path/to/your/definition/file.[json|yaml|yml]
-
http[s]://domain/resource/path.[json|yaml|yml]
Example
podman run registry.redhat.io/3scale-amp2/toolbox-rhel7:3scale2.10 3scale import openapi [opts] -d=https://{DEST_KEY}@{3SCALE_ADMIN}-admin.{DOMAIN_NAME} my-test-api.json
$ podman run registry.redhat.io/3scale-amp2/toolbox-rhel7:3scale2.10 3scale import openapi [opts] -d=https://{DEST_KEY}@{3SCALE_ADMIN}-admin.{DOMAIN_NAME} my-test-api.json
Command options
The import openapi
command options include:
-d --destination=<value>
-
3scale target instance in format:
http[s]://<authentication>@3scale_domain
. -t --target_system_name=<value>
- 3scale target system name.
--backend-api-secret-token=<value>
- Custom secret token sent by the API gateway to the backend API.
--backend-api-host-header=<value>
- Custom host header sent by the API gateway to the backend API.
For more options, see the 3scale import openapi --help
command.
OpenAPI import rules
The following rules apply when importing OpenAPI definitions:
- Definitions are validated as OpenAPI 2.0 or OpenAPI 3.0.
- All mapping rules in the 3scale product are deleted.
-
To be replaced, all method names must be identical to methods defined in the OpenAPI definition
operation.operationId
by using exact pattern matching. - Only methods included in the OpenAPI definition are modified.
-
All methods that were present only in the OpenAPI definition are attached to the
Hits
metric. - All mapping rules from the OpenAPI definition are imported. You can view these in API > Integration.
-
The supported security schemes are
apiKey
andoauth2
with any OAuth flow type. The OpenAPI specification must be one of the following:
- Filename in the available path.
-
URL from where toolbox can download the content. The supported schemes are
http
andhttps
. -
Read from
stdin
standard input stream. This is controlled by setting the-
value.
While there is no security requirement in the specification, the service is considered as an OpenAPI. The toolbox will add a default_credentials
policy, which is also known as an anonymous_policy
, if it is not already in the policy chain. The default_credentials
policy will be configured with the userkey provided in an optional parameter --default-credentials-userkey
.
OpenAPI 3.0 limitations
The following limitations apply when importing OpenAPI 3.0 definitions:
-
Only the first
server.url
element in theservers
list is parsed as a private URL. Theserver.url
element’spath
component will be used as the OpenAPI’sbasePath
property. - The toolbox will not parse servers in the path item and servers in the operation objects.
- Multiple flows in the security scheme object not supported.
4.7. Managing remote access credentials Copy linkLink copied to clipboard!
To facilitate working with remote 3scale instances, you can use the 3scale toolbox to define the remote URL addresses and authentication details to access those remote instances in a configuration file. You can then refer to these remotes using a short name in any toolbox command.
The default location for the configuration file is $HOME/.3scalerc.yaml
. However, you can specify another location using the THREESCALE_CLI_CONFIG
environment variable or the --config-file <config_file>
toolbox option.
When adding remote access credentials, you can specify an access_token
or a provider_key
:
-
http[s]://<access_token>@<3scale-instance-domain>
-
http[s]://<provider_key>@<3scale-instance-domain>
4.7.1. Adding remote access credentials Copy linkLink copied to clipboard!
The following example command adds a remote 3scale instance with the short <name>
at <url>
:
3scale remote add [--config-file <config_file>] <name> <url>
3scale remote add [--config-file <config_file>] <name> <url>
Example
podman run --name toolbox-container registry.redhat.io/3scale-amp2/toolbox-rhel7:3scale2.10 3scale remote add instance_a https://123456789@example_a.net podman commit toolbox-container toolbox
$ podman run --name toolbox-container registry.redhat.io/3scale-amp2/toolbox-rhel7:3scale2.10 3scale remote add instance_a https://123456789@example_a.net
$ podman commit toolbox-container toolbox
This example creates the remote instance and commits the container to create a new image. You can then run the new image with the remote information included. For example, the following command uses the new image to show the newly added remote:
podman run toolbox 3scale remote list
$ podman run toolbox 3scale remote list
instance_a https://example_a.net 123456789
Other toolbox commands can then use the newly created image to access the added remotes. This example uses an image named toolbox
instead of registry.redhat.io/3scale-amp2/toolbox-rhel7:3scale2.10
.
Storing secrets for toolbox in a container is a potential security risk, for example when distributing the container with secrets to other users or using the container for automation. Use secured volumes in Podman or secrets in OpenShift.
Additional resources
For more details on using Podman, see:
4.7.2. Listing remote access credentials Copy linkLink copied to clipboard!
The following example command shows how to list remote access credentials:
3scale remote list [--config-file <config_file>]
3scale remote list [--config-file <config_file>]
This command shows the list of added remote 3scale instances in the following format: <name>
<URL>
<authentication-key>
:
Example
podman run <toolbox_image_with_remotes_added> 3scale remote list
$ podman run <toolbox_image_with_remotes_added> 3scale remote list
instance_a https://example_a.net 123456789
instance_b https://example_b.net 987654321
4.7.3. Removing remote access credentials Copy linkLink copied to clipboard!
The following example command shows how to remove remote access credentials:
3scale remote remove [--config-file <config_file>] <name>
3scale remote remove [--config-file <config_file>] <name>
This command removes the remote 3scale instance with the short <name>
:
Example
podman run <toolbox_image_with_remote_added> 3scale remote remove instance_a
$ podman run <toolbox_image_with_remote_added> 3scale remote remove instance_a
4.7.4. Renaming remote access credentials Copy linkLink copied to clipboard!
The following example command shows how to rename remote access credentials:
3scale remote rename [--config-file <config_file>] <old_name> <new_name>
3scale remote rename [--config-file <config_file>] <old_name> <new_name>
This command renames the remote 3scale instance with the short <old_name>
to <new_name>
:
Example
podman run <toolbox_image_with_remote_added> 3scale remote rename instance_a instance_b
$ podman run <toolbox_image_with_remote_added> 3scale remote rename instance_a instance_b
4.8. Creating application plans Copy linkLink copied to clipboard!
Use the 3scale toolbox to create, update, list, delete, show, or export/import application plans in your Developer Portal.
4.8.1. Creating a new application plan Copy linkLink copied to clipboard!
Use the following steps to create a new application plan:
- You have to provide the application plan name.
-
To override the
system-name
, use the optional parameter. - If an application plan with the same name already exists, you will see an error message.
-
Set as
default
the application plan by using the--default
flag. Create a
published
application plan by using the--publish
flag.-
By default, it will be
hidden
.
-
By default, it will be
Create a
disabled
application plan by using the--disabled
flag.-
By default, it will be
enabled
.
-
By default, it will be
The
service
positional argument is a service reference and can be either serviceid
or servicesystem_name
.- The toolbox uses either one.
The following command creates a new application plan:
3scale application-plan create [opts] <remote> <service> <plan-name>
3scale application-plan create [opts] <remote> <service> <plan-name>
Use the following options while creating application plans:
4.8.2. Creating or updating application plans Copy linkLink copied to clipboard!
Use the following steps to create a new application plan if it does not exist, or to update an existing one:
-
Update the
default
application plan by using the--default
flag. -
Update the
published
application plan by using the--publish
flag. -
Update the
hidden
application plan by using the--hide
flag. -
Update the
disabled
application plan by using the--disabled
flag. -
Update the
enabled
application plan by using the--enabled
flag.
The
service
positional argument is a service reference and can be either serviceid
or servicesystem_name
.- The toolbox uses either one.
The
plan
positional argument is a plan reference and can be either planid
or plansystem_name
.- The toolbox uses either one.
The following command updates the application plan:
3scale application-plan create [opts] <remote> <service> <plan>
3scale application-plan create [opts] <remote> <service> <plan>
Use the following options while updating application plans:
4.8.3. Listing application plans Copy linkLink copied to clipboard!
The following command lists the application plan:
3scale application-plan list [opts] <remote> <service>
3scale application-plan list [opts] <remote> <service>
Use the following options while listing application plans:
4.8.4. Showing application plans Copy linkLink copied to clipboard!
The following command shows the application plan:
3scale application-plan show [opts] <remote> <service> <plan>
3scale application-plan show [opts] <remote> <service> <plan>
Use the following options while showing application plans:
4.8.5. Deleting application plans Copy linkLink copied to clipboard!
The following command deletes the application plan:
3scale application-plan delete [opts] <remote> <service> <plan>
3scale application-plan delete [opts] <remote> <service> <plan>
Use the following options while deleting application plans:
4.8.6. Exporting/importing application plans Copy linkLink copied to clipboard!
You can export or import a single application plan to or from yaml
content.
Note the following:
- Limits defined in the application plan are included.
- Pricing rules defined in the application plan are included.
- Metrics/methods referenced by limits and pricing rules are included.
- Features defined in the application plan are included.
-
Service can be referenced by
id
orsystem_name
. -
Application Plan can be referenced by
id
orsystem_name
.
4.8.6.1. Exporting an application plan to a file Copy linkLink copied to clipboard!
The following command exports the application plan:
3scale application-plan export [opts] <remote> <service_system_name> <plan_system_name>
3scale application-plan export [opts] <remote> <service_system_name> <plan_system_name>
Example
podman run -u root -v $PWD:/tmp registry.redhat.io/3scale-amp2/toolbox-rhel7:3scale2.10 3scale application-plan export --file=/tmp/plan.yaml remote_name service_name plan_name
$ podman run -u root -v $PWD:/tmp registry.redhat.io/3scale-amp2/toolbox-rhel7:3scale2.10 3scale application-plan export --file=/tmp/plan.yaml remote_name service_name plan_name
This example uses a Podman volume to mount the exported file in the container for output to the current $PWD
folder.
Specific to the export
command:
- Read only operation on remote service and application plan.
Command output can be
stdout
or file.-
If not specified by
-f
option, by default,yaml
content will be written onstdout
.
-
If not specified by
Use the following options while exporting application plans:
4.8.6.2. Importing an application plan from a file Copy linkLink copied to clipboard!
The following command imports the application plan:
3scale application-plan import [opts] <remote> <service_system_name>
3scale application-plan import [opts] <remote> <service_system_name>
Example
podman run -v $PWD/plan.yaml:/tmp/plan.yaml registry.redhat.io/3scale-amp2/toolbox-rhel7:3scale2.10 3scale application-plan import --file=/tmp/plan.yaml remote_name service_name
$ podman run -v $PWD/plan.yaml:/tmp/plan.yaml registry.redhat.io/3scale-amp2/toolbox-rhel7:3scale2.10 3scale application-plan import --file=/tmp/plan.yaml remote_name service_name
This example uses a Podman volume to mount the imported file in the container from the current $PWD
folder.
4.8.6.3. Importing an application plan from a URL Copy linkLink copied to clipboard!
3scale application-plan import -f http[s]://domain/resource/path.yaml remote_name service_name
3scale application-plan import -f http[s]://domain/resource/path.yaml remote_name service_name
Specific to import command:
Command input content can be
stdin
, file or URL format.-
If not specified by
-f
option, by default,yaml
content will be read fromstdin
.
-
If not specified by
- If application plan cannot be found in remote service, it will be created.
Optional param
-p
,--plan
to override remote target application planid
orsystem_name
.-
If not specified by
-p
option, by default, application plan will be referenced by plan attributesystem_name
fromyaml
content.
-
If not specified by
- Any metric or method from yaml content that cannot be found in remote service, will be created.
Use the following options while importing application plans:
4.9. Creating metrics Copy linkLink copied to clipboard!
Use the 3scale toolbox to create, update, list, and delete metrics in your Developer Portal.
Use the following steps for creating metrics:
- You have to provide the metric name.
-
To override the
system-name
, use the optional parameter. - If metrics with the same name already exist, you will see an error message.
Create a
disabled
metric by using the--disabled
flag.-
By default, it will be
enabled
.
-
By default, it will be
The
service
positional argument is a service reference and can be either serviceid
or servicesystem_name
.- The toolbox uses either one.
The following command creates metrics:
3scale metric create [opts] <remote> <service> <metric-name>
3scale metric create [opts] <remote> <service> <metric-name>
Use the following options while creating metrics:
4.9.1. Creating or updating metrics Copy linkLink copied to clipboard!
Use the following steps to create new metrics if they do not exist, or to update an existing one:
- If metrics with the same name already exist, you will see an error message.
-
Update a
disabled
metric by using the--disabled
flag. -
Update to
enabled
metric by using the--enabled
flag.
The
service
positional argument is a service reference and can be either serviceid
or servicesystem_name
.- The toolbox uses either one.
The
metric
positional argument is a metric reference and can be either metricid
or metricsystem_name
.- The toolbox uses either one.
The following commmand updates metrics:
3scale metric apply [opts] <remote> <service> <metric>
3scale metric apply [opts] <remote> <service> <metric>
Use the following options while updating metrics:
4.9.2. Listing metrics Copy linkLink copied to clipboard!
The following command lists metrics:
3scale metric list [opts] <remote> <service>
3scale metric list [opts] <remote> <service>
Use the following options while listing metrics:
4.9.3. Deleting metrics Copy linkLink copied to clipboard!
The following command deletes metrics:
3scale metric delete [opts] <remote> <service> <metric>
3scale metric delete [opts] <remote> <service> <metric>
Use the following options while deleting metrics:
4.10. Creating methods Copy linkLink copied to clipboard!
Use the 3scale toolbox to create, apply, list, and delete methods in your Developer Portal.
4.10.1. Creating methods Copy linkLink copied to clipboard!
Use the following steps for creating methods:
- You have to provide the method name.
-
To override the
system-name
, use the optional parameter. - If a method with the same name already exists, you will see an error message.
Create a
disabled
method by--disabled
flag.-
By default, it will be
enabled
.
-
By default, it will be
The
service
positional argument is a service reference and can be either serviceid
or servicesystem_name
.- The toolbox uses either one.
The following command creates a method:
3scale method create [opts] <remote> <service> <method-name>
3scale method create [opts] <remote> <service> <method-name>
Use the following options while creating methods:
4.10.2. Creating or updating methods Copy linkLink copied to clipboard!
Use the steps below for creating new methods if they do not exist, or to update existing ones:
- If a method with the same name already exists, the command will return an error message.
-
Update to
disabled
method by using--disabled flag
. -
Update to
enabled
method by using--enabled flag
.
The
service
positional argument is a service reference and can be either serviceid
or servicesystem_name
.- The toolbox uses either one.
The
method
positional argument is a method reference and can be either methodid
or methodsystem_name
.- The toolbox uses either one.
The following command updates a method:
3scale method apply [opts] <remote> <service> <method>
3scale method apply [opts] <remote> <service> <method>
Use the following options while updating methods:
4.10.3. Listing methods Copy linkLink copied to clipboard!
The following command lists methods:
3scale method list [opts] <remote> <service>
3scale method list [opts] <remote> <service>
Use the following options while listing methods:
4.10.4. Deleting methods Copy linkLink copied to clipboard!
The following command deletes methods:
3scale method delete [opts] <remote> <service> <metric>
3scale method delete [opts] <remote> <service> <metric>
Use the following options while deleting methods:
4.11. Creating services Copy linkLink copied to clipboard!
Use the 3scale toolbox to create, apply, list, show, or delete services in your Developer Portal.
4.11.1. Creating a new service Copy linkLink copied to clipboard!
The following command creates a new service:
3scale service create [options] <remote> <service-name>
3scale service create [options] <remote> <service-name>
Use the following options while creating services:
4.11.2. Creating or updating services Copy linkLink copied to clipboard!
Use the following to create new services if they do not exist, or to update an existing one:
service-id_or_system-name
positional argument is a service reference.-
It can be either service
id
, or servicesystem_name
. - Toolbox will automatically figure this out.
-
It can be either service
-
This command is
idempotent
.
The following command updates services:
3scale service apply <remote> <service-id_or_system-name>
3scale service apply <remote> <service-id_or_system-name>
Use the following options while updating services:
4.11.3. Listing services Copy linkLink copied to clipboard!
The following command lists services:
3scale service list <remote>
3scale service list <remote>
Use the following options while listing services:
4.11.4. Showing services Copy linkLink copied to clipboard!
The following command shows services:
3scale service show <remote> <service-id_or_system-name>
3scale service show <remote> <service-id_or_system-name>
Use the following options while showing services:
4.11.5. Deleting services Copy linkLink copied to clipboard!
The following command deletes services:
3scale service delete <remote> <service-id_or_system-name>
3scale service delete <remote> <service-id_or_system-name>
Use the following options while deleting services:
4.12. Creating ActiveDocs Copy linkLink copied to clipboard!
Use the 3scale toolbox to create, update, list, or delete ActiveDocs in your Developer Portal.
4.12.1. Creating new ActiveDocs Copy linkLink copied to clipboard!
To create a new ActiveDocs from your API definition compliant with the OpenAPI specification:
Add your API definition to 3scale, optionally giving it a name:
3scale activedocs create <remote> <activedocs-name> <specification>
3scale activedocs create <remote> <activedocs-name> <specification>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The OpenAPI specification for the ActiveDocs is required and must be one of the following values:
- Filename in the available path.
-
URL from where toolbox can download the content. The supported schemes are
http
andhttps
. Read from
stdin
standard input stream. This is controlled by setting the-
value.Use the following options while creating ActiveDocs:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
- Publish the definition in your Developer Portal.
4.12.2. Creating or updating ActiveDocs Copy linkLink copied to clipboard!
Use the following command to create new ActiveDocs if they do not exist, or to update existing ActiveDocs with a new API definition:
3scale activedocs apply <remote> <activedocs_id_or_system_name>
3scale activedocs apply <remote> <activedocs_id_or_system_name>
Use the following options while updating ActiveDocs:
The behavior of activedocs apply --skip-swagger-validations
changed in 3scale 2.8. You may need to update existing scripts using activedocs apply
. Previously, if you did not specify this option in each activedocs apply
command, validation was not skipped. Now, --skip-swagger-validations
is true
by default.
4.12.3. Listing ActiveDocs Copy linkLink copied to clipboard!
Use the following command to get information about all ActiveDocs in the Developer Portal, including:
- id
- name
- system name
- description
- published (which means it can be shown in the developer portal)
- creation date
- latest updated date
The following command lists all defined ActiveDocs:
3scale activedocs list <remote>
3scale activedocs list <remote>
Use the following options while listing ActiveDocs:
4.12.4. Deleting ActiveDocs Copy linkLink copied to clipboard!
The following command removes ActiveDocs:
3scale activedocs delete <remote> <activedocs-id_or-system-name>
3scale activedocs delete <remote> <activedocs-id_or-system-name>
Use the following options while deleting ActiveDocs:
4.13. Listing proxy configurations Copy linkLink copied to clipboard!
Use the 3scale toolbox to list, show, promote all defined proxy configurations in your Developer Portal.
The following command lists proxy configurations:
3scale proxy-config list <remote> <service> <environment>
3scale proxy-config list <remote> <service> <environment>
Use the following options while listing proxy configurations:
4.13.1. Showing proxy configurations Copy linkLink copied to clipboard!
The following command shows proxy configurations:
3scale proxy-config show <remote> <service> <environment>
3scale proxy-config show <remote> <service> <environment>
Use the following options while showing proxy configurations:
4.13.2. Promoting proxy configurations Copy linkLink copied to clipboard!
The following command promotes the latest staging proxy configuration to the production environment:
3scale proxy-config promote <remote> <service>
3scale proxy-config promote <remote> <service>
Use the following options while promoting the latest staging proxy configurations to the production environment:
4.14. Copying a policy registry Copy linkLink copied to clipboard!
Use the toolbox command to copy a policy registry from a 3scale source account to a target account when:
- Missing custom policies are being created in target account.
- Matching custom policies are being updated in target account.
- This copy command is idempotent.
- Missing custom policies are defined as custom policies that exist in source account and do not exist in an account tenant.
- Matching custom policies are defined as custom policies that exists in both source and target account.
The following command copies a policy registry:
3scale policy-registry copy [opts] <source_remote> <target_remote>
3scale policy-registry copy [opts] <source_remote> <target_remote>
4.15. Listing applications Copy linkLink copied to clipboard!
Use the 3scale toolbox to list, create, show, apply, or delete applications Developer Portal.
The following command lists applications:
3scale application list [opts] <remote>
3scale application list [opts] <remote>
Use the following options while listing applications:
4.15.1. Creating applications Copy linkLink copied to clipboard!
Use the create command to create one application linked to a given 3scale account and application plan.
The required positional paramaters are as follows:
-
<service>
reference. It can be either serviceid
, or servicesystem_name
. <account>
reference. It can be one of the following:-
Account
id
-
username
,email
, oruser_id
of the admin user of the account -
provider_key
-
Account
-
<application plan>
reference. It can be either planid
, or plansystem_name
. -
<name>
application name.
The following command creates applications:
3scale application create [opts] <remote> <account> <service> <application-plan> <name>
3scale application create [opts] <remote> <account> <service> <application-plan> <name>
Use the following options while creating applications:
4.15.2. Showing applications Copy linkLink copied to clipboard!
The following command shows applications:
3scale application show [opts] <remote> <application>
3scale application show [opts] <remote> <application>
Application parameters allow:
-
User_key
- API key -
App_id
- from app_id/app_key pair or Client ID for OAuth and OpenID Connect (OIDC) authentication modes -
Application internal
id
4.15.3. Creating or updating applications Copy linkLink copied to clipboard!
Use the following command to create new applications if they do not exist, or to update existing applications:
3scale application apply [opts] <remote> <application>
3scale application apply [opts] <remote> <application>
Application parameters allow:
-
User_key
- API key -
App_id
- from app_id/app_key pair or Client ID for OAuth and OIDC authentication modes -
Application internal
id
account
optional argument is required when application is not found and needs to be created. It can be one of the following:-
Account
id
-
username
,email
, oruser_id
of the administrator user of the 3scale account -
provider_key
-
Account
-
name
cannot be used as unique identifier because application name is not unique in 3scale. -
Resume a suspended application by
--resume
flag. -
Suspends an application - changes the state to suspended by the
--suspend
flag.
Use the following options while updating applications:
4.15.4. Deleting applications Copy linkLink copied to clipboard!
The following command deletes an application:
3scale application delete [opts] <remote> <application>
3scale application delete [opts] <remote> <application>
Application parameters allow:
-
User_key
- API key -
App_id
- from app_id/app_key pair or Client ID for OAuth and OIDC authentication modes -
Application internal
id
4.16. Copying API backends Copy linkLink copied to clipboard!
Create a copy of the specified source API backend on the specified 3scale system. The target system is first searched by the source backend system name by default:
- If a backend with the selected system name is not found, it is created.
- If a backend with the selected system name is found, it is updated. Only missing components are created, for example, metrics, methods, or mapping rules.
You can override the system name using the --target_system_name
option.
Copied components
The following API backend components are copied:
- Metrics
- Methods
- Mapping rules
Procedure
Enter the following command to copy an API backend:
3scale backend copy [opts] -s <source_remote> -d <target_remote> <source_backend>
3scale backend copy [opts] -s <source_remote> -d <target_remote> <source_backend>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The specified 3scale instance can be a remote name or a URL.
NoteYou can copy a single API backend only per command. You can copy multiple backends using multiple commands. You can copy the same backend multiple times by specifying a different
--target_system_name name
.
Use following options when copying API backends:
+ The following example command shows you how to copy an API backend multiple times by specifying a different --target_system_name name
:
+
podman run registry.redhat.io/3scale-amp2/toolbox-rhel7:3scale2.10 3scale backend copy [-t target_system_name] -s 3scale1 -d 3scale2 api_backend_01
$ podman run registry.redhat.io/3scale-amp2/toolbox-rhel7:3scale2.10 3scale backend copy [-t target_system_name] -s 3scale1 -d 3scale2 api_backend_01
4.16.1. Copying API products Copy linkLink copied to clipboard!
Create a copy of the specified source API product on the target 3scale system. By default, the source API product system name first searches the target system:
-
If a product with the selected
system-name
is not found, it is created. -
If a product with the selected
system-name
is found, it is updated. Only missing components are created; for example, metrics, methods, mapping rules, and other configurations.
You can override the system name using the --target_system_name
option.
Copied components
The following API product components are copied:
- Configuration and settings
- Metrics and methods
- Mapping rules
- Application plans, pricing rules, and limits
- Application usage rules
- Policies
- Backends
- ActiveDocs
Procedure
Enter the following command to copy an API product:
3scale product copy [opts] -s <source_remote> -d <target_remote> <source_product>
3scale product copy [opts] -s <source_remote> -d <target_remote> <source_product>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The specified 3scale instance can be a remote name or a URL.
NoteYou can copy a single API product only per command. You can copy multiple products using multiple commands. You can copy the same product multiple times by specifying a different
--target_system_name name
.
Use following options when copying API products:
+ The following example command shows you how to copy an API product multiple times by specifying a different --target_system_name name
:
+
podman run registry.redhat.io/3scale-amp2/toolbox-rhel7:3scale2.10 3scale product copy [-t target_system_name] -s 3scale1 -d 3scale2 my_api_product_01
$ podman run registry.redhat.io/3scale-amp2/toolbox-rhel7:3scale2.10 3scale product copy [-t target_system_name] -s 3scale1 -d 3scale2 my_api_product_01
4.17. Troubleshooting issues with SSL and TLS Copy linkLink copied to clipboard!
This section explains how to resolve issues with Secure Sockets Layer/Transport Layer Security (SSL/TLS).
If you are experiencing issues related to self-signed SSL certificates, you can download and use remote host certificates as described in this section. For example, typical errors include SSL certificate problem: self signed certificate
or self signed certificate in certificate chain
.
Procedure
Download the remote host certificate using
openssl
. For example:echo | openssl s_client -showcerts -servername self-signed.badssl.com -connect self-signed.badssl.com:443 2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > self-signed-cert.pem
$ echo | openssl s_client -showcerts -servername self-signed.badssl.com -connect self-signed.badssl.com:443 2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > self-signed-cert.pem
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Ensure that the certificate is working correctly using
curl
. For example:SSL_CERT_FILE=self-signed-cert.pem curl -v https://self-signed.badssl.com
$ SSL_CERT_FILE=self-signed-cert.pem curl -v https://self-signed.badssl.com
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the certificate is working correctly, you will no longer get the SSL error. If the certificate is not working correctly, try running the
curl
command with the-k
option (or its long form,--insecure
). This indicates that you want to proceed even for server connections that are otherwise considered insecure.Add the
SSL_CERT_FILE
environment variable to your3scale
commands. For example:podman run --env "SSL_CERT_FILE=/tmp/self-signed-cert.pem" -v $PWD/self-signed-cert.pem:/tmp/self-signed-cert.pem egistry.redhat.io/3scale-amp2/toolbox-rhel7:3scale2.10 3scale service list https://{ACCESS_KEY}@{3SCALE_ADMIN}-admin.{DOMAIN_NAME}
$ podman run --env "SSL_CERT_FILE=/tmp/self-signed-cert.pem" -v $PWD/self-signed-cert.pem:/tmp/self-signed-cert.pem egistry.redhat.io/3scale-amp2/toolbox-rhel7:3scale2.10 3scale service list https://{ACCESS_KEY}@{3SCALE_ADMIN}-admin.{DOMAIN_NAME}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow This example uses a Podman volume to mount the certificate file in the container. It assumes that the file is available in the current
$PWD
folder.An alternative approach would be to create your own toolbox image using the 3scale toolbox image as the base image and then install your own trusted certificate store.
Additional resources
- For more details on SSL certificates, see the Red Hat Certificate System documentation.
- For more details on Podman, see Building, running, and managing Linux containers on Red Hat Enterprise Linux 8.