Skip to content

azurermApiManagementApiOperation

Manages an API Operation within an API Management Service.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const dataAzurermApiManagementApiExample =
  new azurerm.dataAzurermApiManagementApi.DataAzurermApiManagementApi(
    this,
    "example",
    {
      api_management_name: "search-api-management",
      name: "search-api",
      resource_group_name: "search-service",
      revision: "2",
    }
  );
const azurermApiManagementApiOperationExample =
  new azurerm.apiManagementApiOperation.ApiManagementApiOperation(
    this,
    "example_1",
    {
      api_management_name: dataAzurermApiManagementApiExample.apiManagementName,
      api_name: dataAzurermApiManagementApiExample.name,
      description: "This can only be done by the logged in user.",
      display_name: "Delete User Operation",
      method: "DELETE",
      operation_id: "user-delete",
      resource_group_name: dataAzurermApiManagementApiExample.resourceGroupName,
      response: [
        {
          status_code: 200,
        },
      ],
      url_template: "/users/{id}/delete",
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermApiManagementApiOperationExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • operationId - (Required) A unique identifier for this API Operation. Changing this forces a new resource to be created.

  • apiName - (Required) The name of the API within the API Management Service where this API Operation should be created. Changing this forces a new resource to be created.

  • apiManagementName - (Required) The Name of the API Management Service where the API exists. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) The Name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.

  • displayName - (Required) The Display Name for this API Management Operation.

  • method - (Required) The HTTP Method used for this API Management Operation, like get, delete, put or post - but not limited to these values.

  • urlTemplate - (Required) The relative URL Template identifying the target resource for this operation, which may include parameters.


  • description - (Optional) A description for this API Operation, which may include HTML formatting tags.

  • request - (Optional) A request block as defined below.

  • response - (Optional) One or more response blocks as defined below.

  • templateParameter - (Optional) One or more templateParameter blocks as defined below.


An example block supports the following:

  • name - (Required) The name of this example.

  • summary - (Optional) A short description for this example.

  • description - (Optional) A long description for this example.

  • value - (Optional) The example of the representation.

  • externalValue - (Optional) A URL that points to the literal example.


A formParameter block supports the following:

  • name - (Required) The Name of this Form Parameter.

  • required - (Required) Is this Form Parameter Required?

  • type - (Required) The Type of this Form Parameter, such as a string.

  • description - (Optional) A description of this Form Parameter.

  • defaultValue - (Optional) The default value for this Form Parameter.

  • values - (Optional) One or more acceptable values for this Form Parameter.

  • example - (Optional) (Optional) One or more example blocks as defined above.

  • schemaId - (Optional) The name of the Schema.

  • typeName - (Optional) The type name defined by the Schema.


A header block supports the following:

  • name - (Required) The Name of this Header.

  • required - (Required) Is this Header Required?

  • type - (Required) The Type of this Header, such as a string.

  • description - (Optional) A description of this Header.

  • defaultValue - (Optional) The default value for this Header.

  • values - (Optional) One or more acceptable values for this Header.

  • example - (Optional) (Optional) One or more example blocks as defined above.

  • schemaId - (Optional) The name of the Schema.

  • typeName - (Optional) The type name defined by the Schema.


A queryParameter block supports the following:

  • name - (Required) The Name of this Query Parameter.

  • required - (Required) Is this Query Parameter Required?

  • type - (Required) The Type of this Query Parameter, such as a string.

  • description - (Optional) A description of this Query Parameter.

  • defaultValue - (Optional) The default value for this Query Parameter.

  • values - (Optional) One or more acceptable values for this Query Parameter.

  • example - (Optional) (Optional) One or more example blocks as defined above.

  • schemaId - (Optional) The name of the Schema.

  • typeName - (Optional) The type name defined by the Schema.


A request block supports the following:

  • description - (Optional) A description of the HTTP Request, which may include HTML tags.

  • header - (Optional) One or more header blocks as defined above.

  • queryParameter - (Optional) One or more queryParameter blocks as defined above.

  • representation - (Optional) One or more representation blocks as defined below.


A representation block supports the following:

  • contentType - (Required) The Content Type of this representation, such as application/json.

  • formParameter - (Optional) One or more formParameter block as defined above.

-> NOTE: This is Required when contentType is set to application/xWwwFormUrlencoded or multipart/formData.

  • example - (Optional) One or more example blocks as defined above.

  • schemaId - (Optional) The ID of an API Management Schema which represents this Response.

-> NOTE: This can only be specified when contentType is not set to application/xWwwFormUrlencoded or multipart/formData.

  • typeName - (Optional) The Type Name defined by the Schema.

-> NOTE: This can only be specified when contentType is not set to application/xWwwFormUrlencoded or multipart/formData.


A response block supports the following:

  • statusCode - (Required) The HTTP Status Code.

  • description - (Optional) A description of the HTTP Response, which may include HTML tags.

  • header - (Optional) One or more header blocks as defined above.

  • representation - (Optional) One or more representation blocks as defined below.


A templateParameter block supports the following:

  • name - (Required) The Name of this Template Parameter.

  • required - (Required) Is this Template Parameter Required?

  • type - (Required) The Type of this Template Parameter, such as a string.

  • description - (Optional) A description of this Template Parameter.

  • defaultValue - (Optional) The default value for this Template Parameter.

  • values - (Optional) One or more acceptable values for this Template Parameter.

  • example - (Optional) (Optional) One or more example blocks as defined above.

  • schemaId - (Optional) The name of the Schema.

  • typeName - (Optional) The type name defined by the Schema.


Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - The ID of the API Management API Operation.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the API Management API Operation.
  • update - (Defaults to 30 minutes) Used when updating the API Management API Operation.
  • read - (Defaults to 5 minutes) Used when retrieving the API Management API Operation.
  • delete - (Defaults to 30 minutes) Used when deleting the API Management API Operation.

Import

API Management API Operation's can be imported using the resourceId, e.g.

terraform import azurerm_api_management_api_operation.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.ApiManagement/service/instance1/apis/api1/operations/operation1