CAPI classes in MID Server script includes
-
- UpdatedAug 1, 2024
- 6 minutes to read
- Xanadu
- Cloud Management
Cloud Provisioning and Governance provides several JavaScript classes that make REST calls to cloud providers. These classes are called from MID Server script includes (for Azure by default) or from Java calls in the system (for AWS by default). If you create custom providers, interfaces, or CAPI APIs (for any cloud provider), you can use MID Server script includes to call the classes.
View CAPI classes by navigating to base system instance interface (not the Cloud Admin Portal). You search for the name of a class in the Go to search box using the Name column:
in theBase classes
These base classes are available by default. They form a basis for the Azure and AWS classes that make the actual REST calls.
- CloudAPIBase
CloudAPIBase is a provider-agnostic API that communicates with all types of cloud APIs. It provides functions for basic debugging and logging, and for collecting proxy information on the MID Server. It also defines Headers, Parameters, Endpoints, and
this.parameter
.- AWSCloudAPIBase
- This class is extended from CloudAPIBase and provides functions that call the invoker to
make GET, PUT, POST, and DELETE requests. The class provides the option of an
executeAction
method, which is an AWS implementation of GET, or the invoke method, which provides REST API calls. - AzureCloudAPIBase
This class is extended from CloudAPIBase and provides functions that do these actions:
- Fetch resource IDs.
- Fetch endpoint properties.
- List resources.
- Call the invoker to make GET, PUT, POST, and DELETE requests.
AzureCloudAPIBase utilizes the _invokeRequest
method to make REST API calls
to Azure using the standard REST API calls.

Invoker classes
Invoker classes perform the actual REST calls to the cloud provider. If you create a custom CAPI interface and API, you should extend CloudRestAPIInvoker to create your REST calls.
- CloudRestAPIInvoker
This class is an abstracted class for making REST API calls. If there are headers and/or parameters to send with a request, classes that implement the invoker must extend this object. They also must provide overrides for getEndpointUrl to return the targeted endpoint, and for getHeaders and getParameters. For example, with Azure REST APIs, authentication requires the passing of a token as a header. The extension implementing it should provide a response from getHeaders that performs the token creation or retrieval and sets it. This base object invokes getHeaders and sends whatever it gets back with the request. This class also provides a getResponse method to handle the response from the cloud provider.
If you create a custom CAPI API, you should extend CloudRestAPIInvoker to make REST calls to the cloud provider.
- AmazonWebServicesAPIInvoker
- This class is extended from CloudRestAPIInvoker and provides methods for making REST API calls to the cloud provider.
- AzureAPIInvoker
- This class is extended from CloudRestAPIInvoker and provides functions that make these REST API calls to Azure Resource Manager:
- Sets the Service Principal, headers, and parameters for REST calls.
- Gets the endpoint URL, token (client ID, tenant ID, and secret key), and headers/parameters.
- Retrieves and decodes the JSON response body from the cloud provider.
- AzureEAAPIInvoker
- This class returns the token for access to the Azure Enterprise Agreement (EA) REST API.
- AzureStorageAPIInvoker
- This class makes REST calls for Azure storage. The functions in this class can get the token, response, headers, and parameters.
This graphic illustrates how these base classes are used to extend AWS-specific and Azure-specific classes:

Exceptions
- RESTAPIException
- This base class handles exceptions that might occur during the REST call. It returns the response code from the cloud provider.
- AWSAPIException
- This class handles exceptions that might occur during the REST call.
- AzureAPIException
- This class throws a runtime exception when needed during Azure API invocation.

Classes for credentials
- CloudRESTRequestSigningUtil
This class uses overrides that are specified in CAPI API Config Overrides. The AmazonWebServicesRequestSigner class extends this class. For Azure, many signers are built into the MID Server script includes for Method Mappers in Azure CAPI APIs.
- AmazonWebServicesRequestSigner
- This class sets up a secure session for the REST API call by taking information about a request, and creating a signature v4-signed string for the request. This class is extended from CloudRESTRequestSigningUtil.