Central

Amplify Central – Modify a Resource Using the CLI

Amplify Central - Modify a Resource Using the CLI

The Axway Central CLI can be used to interact with your Central Environment to create, view, and modify various resources such as environments, service accounts, APIs, and much more.

In this blog post, we’ll modify an API Service’s description. This is an example of item #6 of the 10 things you may not know about the CLI blog post.

You will need to have the Axway Central CLI installed. Additionally, you need to have API Services in an Amplify Central Environment.

My existing API Service, translate, in environment v7b, is shown below:

API Service with Original Description

Let’s get started.

Get Resource YAML

The first step is to authenticate using:

axway auth login

This will bring up your browser and you will have to enter your Axway Platform credentials (or IdP credentials, if IdP is enabled).

Then you can get a list of existing API Services using:

axway central get apiservices

Note that you can listing of all resource types using axway central get

A sample response is shown below:

NAME                                  AGE           TITLE       RESOURCE KIND  SCOPE KIND   SCOPE NAME
76e36ebc-7e0e-11eb-b160-005056acbe54  3 months ago  Stockquote  APIService     Environment  v7a
42e7ba2e-b463-11eb-a18c-0242ac110002  12 days ago   PetStore    APIService     Environment  aws
d47c1a63-8d7d-11eb-99ea-0242ac110003  2 months ago  weather     APIService     Environment  v7b
421dddfe-b463-11eb-a18c-0242ac110002  12 days ago   ZooStore    APIService     Environment  aws
2503419d-8cea-11eb-9e62-0242ac110003  2 months ago  translate   APIService     Environment  v7b
c3507ab2-b8e1-11eb-a9da-005056acbe54  6 days ago    comprehend  APIService     Environment  v7a
petstore                              a year ago    Petstore    APIService     Environment  mulesoft
  • Get specific API Service as YAML:
axway central get apiservices 2503419d-8cea-11eb-9e62-0242ac110003 -s v7b -o yaml

The response was:

group: management
apiVersion: v1alpha1
kind: APIService
name: 2503419d-8cea-11eb-9e62-0242ac110003
title: translate
metadata:
  id: 8a2e971c7847ecb0017866326cc510c5
  audit:
    createTimestamp: '2021-03-24T21:44:43.973+0000'
    createUserId: DOSA_8ef309d638c64276bff7f02bac87a437
    modifyTimestamp: '2021-04-20T19:45:08.476+0000'
    modifyUserId: DOSA_8ef309d638c64276bff7f02bac87a437
  scope:
    id: 8a2e8839781407c10178143caeec0031
    kind: Environment
    name: v7b
    selfLink: /management/v1alpha1/environments/v7b
  resourceVersion: '281059'
  references: []
  selfLink: >-
    /management/v1alpha1/environments/v7b/apiservices/2503419d-8cea-11eb-9e62-0242ac110003
attributes:
  apicId: 8a2e963276ab51b40176b545f32e003b
  createdBy: EnterpriseEdgeGatewayDiscoveryAgent
  externalAPIID: 00906064-5679-412f-aa0b-3b0e8d7991c7
  externalAPIName: translate
  GatewayType: Edge
  majorHash: '3052077415685225866'
  minorHash: '6705419841308499834'
finalizers: []
tags:
  - APIID_6c0f53c9-c192-408f-bdce-3206eeef124a
spec:
  icon: {}
  description: API From Edge APIManager

Save the YAML in a file. I called mine resources.yaml.

Modify Description

Let’s first modify the description and save the icon for later. I edited my YAML file and changed the last line as follows:

description: API to translate between languages

The following CLI command will apply the YAML file to the API Service:

axway central apply -f resources.yaml

Response was:

✔ "apiservice/2503419d-8cea-11eb-9e62-0242ac110003" has successfully been updated.
Modified API Service

Note the revised description

Summary

In this blog post, we saw how we can use the Axway Central CLI to modify Amplify Central Resources. We modified an API Service Description with two CLI commands.

Learn more about Amplify Central Integration Webhooks — API Publish Approval.