Api
Manages an API within an API Management Service.
Example Usage
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
{
Location = "West Europe",
});
var exampleService = new Azure.ApiManagement.Service("exampleService", new Azure.ApiManagement.ServiceArgs
{
Location = exampleResourceGroup.Location,
ResourceGroupName = exampleResourceGroup.Name,
PublisherName = "My Company",
PublisherEmail = "company@exmaple.com",
SkuName = "Developer_1",
});
var exampleApi = new Azure.ApiManagement.Api("exampleApi", new Azure.ApiManagement.ApiArgs
{
ResourceGroupName = exampleResourceGroup.Name,
ApiManagementName = exampleService.Name,
Revision = "1",
DisplayName = "Example API",
Path = "example",
Protocols =
{
"https",
},
Import = new Azure.ApiManagement.Inputs.ApiImportArgs
{
ContentFormat = "swagger-link-json",
ContentValue = "http://conferenceapi.azurewebsites.net/?format=json",
},
});
}
}
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/apimanagement"
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/core"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
exampleService, err := apimanagement.NewService(ctx, "exampleService", &apimanagement.ServiceArgs{
Location: exampleResourceGroup.Location,
ResourceGroupName: exampleResourceGroup.Name,
PublisherName: pulumi.String("My Company"),
PublisherEmail: pulumi.String("company@exmaple.com"),
SkuName: pulumi.String("Developer_1"),
})
if err != nil {
return err
}
_, err = apimanagement.NewApi(ctx, "exampleApi", &apimanagement.ApiArgs{
ResourceGroupName: exampleResourceGroup.Name,
ApiManagementName: exampleService.Name,
Revision: pulumi.String("1"),
DisplayName: pulumi.String("Example API"),
Path: pulumi.String("example"),
Protocols: pulumi.StringArray{
pulumi.String("https"),
},
Import: &apimanagement.ApiImportArgs{
ContentFormat: pulumi.String("swagger-link-json"),
ContentValue: pulumi.String("http://conferenceapi.azurewebsites.net/?format=json"),
},
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_service = azure.apimanagement.Service("exampleService",
location=example_resource_group.location,
resource_group_name=example_resource_group.name,
publisher_name="My Company",
publisher_email="company@exmaple.com",
sku_name="Developer_1")
example_api = azure.apimanagement.Api("exampleApi",
resource_group_name=example_resource_group.name,
api_management_name=example_service.name,
revision="1",
display_name="Example API",
path="example",
protocols=["https"],
import_={
"contentFormat": "swagger-link-json",
"contentValue": "http://conferenceapi.azurewebsites.net/?format=json",
})import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const exampleService = new azure.apimanagement.Service("exampleService", {
location: exampleResourceGroup.location,
resourceGroupName: exampleResourceGroup.name,
publisherName: "My Company",
publisherEmail: "company@exmaple.com",
skuName: "Developer_1",
});
const exampleApi = new azure.apimanagement.Api("exampleApi", {
resourceGroupName: exampleResourceGroup.name,
apiManagementName: exampleService.name,
revision: "1",
displayName: "Example API",
path: "example",
protocols: ["https"],
"import": {
contentFormat: "swagger-link-json",
contentValue: "http://conferenceapi.azurewebsites.net/?format=json",
},
});Create a Api Resource
new Api(name: string, args: ApiArgs, opts?: CustomResourceOptions);def Api(resource_name, opts=None, api_management_name=None, description=None, display_name=None, import_=None, name=None, path=None, protocols=None, resource_group_name=None, revision=None, service_url=None, soap_pass_through=None, subscription_key_parameter_names=None, subscription_required=None, version=None, version_set_id=None, __props__=None);public Api(string name, ApiArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args ApiArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args ApiArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ApiArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
Api Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The Api resource accepts the following input properties:
- Api
Management stringName The Name of the API Management Service where this API should be created. Changing this forces a new resource to be created.
- Display
Name string The display name of the API.
- Path string
The Path for this API Management API, which is a relative URL which uniquely identifies this API and all of it’s resource paths within the API Management Service.
- Protocols List<string>
A list of protocols the operations in this API can be invoked. Possible values are
httpandhttps.- Resource
Group stringName The Name of the Resource Group where the API Management API exists. Changing this forces a new resource to be created.
- Revision string
The Revision which used for this API.
- Description string
A description of the API Management API, which may include HTML formatting tags.
- Import
Api
Import Args A
importblock as documented below.- Name string
The name of the API Management API. Changing this forces a new resource to be created.
- Service
Url string Absolute URL of the backend service implementing this API.
- Soap
Pass boolThrough Should this API expose a SOAP frontend, rather than a HTTP frontend? Defaults to
false.- Subscription
Key ApiParameter Names Subscription Key Parameter Names Args A
subscription_key_parameter_namesblock as documented below.- Subscription
Required bool Should this API require a subscription key?
- Version string
The Version number of this API, if this API is versioned.
- Version
Set stringId The ID of the Version Set which this API is associated with.
- Api
Management stringName The Name of the API Management Service where this API should be created. Changing this forces a new resource to be created.
- Display
Name string The display name of the API.
- Path string
The Path for this API Management API, which is a relative URL which uniquely identifies this API and all of it’s resource paths within the API Management Service.
- Protocols []string
A list of protocols the operations in this API can be invoked. Possible values are
httpandhttps.- Resource
Group stringName The Name of the Resource Group where the API Management API exists. Changing this forces a new resource to be created.
- Revision string
The Revision which used for this API.
- Description string
A description of the API Management API, which may include HTML formatting tags.
- Import
Api
Import A
importblock as documented below.- Name string
The name of the API Management API. Changing this forces a new resource to be created.
- Service
Url string Absolute URL of the backend service implementing this API.
- Soap
Pass boolThrough Should this API expose a SOAP frontend, rather than a HTTP frontend? Defaults to
false.- Subscription
Key ApiParameter Names Subscription Key Parameter Names A
subscription_key_parameter_namesblock as documented below.- Subscription
Required bool Should this API require a subscription key?
- Version string
The Version number of this API, if this API is versioned.
- Version
Set stringId The ID of the Version Set which this API is associated with.
- api
Management stringName The Name of the API Management Service where this API should be created. Changing this forces a new resource to be created.
- display
Name string The display name of the API.
- path string
The Path for this API Management API, which is a relative URL which uniquely identifies this API and all of it’s resource paths within the API Management Service.
- protocols string[]
A list of protocols the operations in this API can be invoked. Possible values are
httpandhttps.- resource
Group stringName The Name of the Resource Group where the API Management API exists. Changing this forces a new resource to be created.
- revision string
The Revision which used for this API.
- description string
A description of the API Management API, which may include HTML formatting tags.
- import
Api
Import A
importblock as documented below.- name string
The name of the API Management API. Changing this forces a new resource to be created.
- service
Url string Absolute URL of the backend service implementing this API.
- soap
Pass booleanThrough Should this API expose a SOAP frontend, rather than a HTTP frontend? Defaults to
false.- subscription
Key ApiParameter Names Subscription Key Parameter Names A
subscription_key_parameter_namesblock as documented below.- subscription
Required boolean Should this API require a subscription key?
- version string
The Version number of this API, if this API is versioned.
- version
Set stringId The ID of the Version Set which this API is associated with.
- api_
management_ strname The Name of the API Management Service where this API should be created. Changing this forces a new resource to be created.
- display_
name str The display name of the API.
- path str
The Path for this API Management API, which is a relative URL which uniquely identifies this API and all of it’s resource paths within the API Management Service.
- protocols List[str]
A list of protocols the operations in this API can be invoked. Possible values are
httpandhttps.- resource_
group_ strname The Name of the Resource Group where the API Management API exists. Changing this forces a new resource to be created.
- revision str
The Revision which used for this API.
- description str
A description of the API Management API, which may include HTML formatting tags.
- import_
Dict[Api
Import] A
importblock as documented below.- name str
The name of the API Management API. Changing this forces a new resource to be created.
- service_
url str Absolute URL of the backend service implementing this API.
- soap_
pass_ boolthrough Should this API expose a SOAP frontend, rather than a HTTP frontend? Defaults to
false.- subscription_
key_ Dict[Apiparameter_ names Subscription Key Parameter Names] A
subscription_key_parameter_namesblock as documented below.- subscription_
required bool Should this API require a subscription key?
- version str
The Version number of this API, if this API is versioned.
- version_
set_ strid The ID of the Version Set which this API is associated with.
Outputs
All input properties are implicitly available as output properties. Additionally, the Api resource produces the following output properties:
Look up an Existing Api Resource
Get an existing Api resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: ApiState, opts?: CustomResourceOptions): Apistatic get(resource_name, id, opts=None, api_management_name=None, description=None, display_name=None, import_=None, is_current=None, is_online=None, name=None, path=None, protocols=None, resource_group_name=None, revision=None, service_url=None, soap_pass_through=None, subscription_key_parameter_names=None, subscription_required=None, version=None, version_set_id=None, __props__=None);public static Api Get(string name, Input<string> id, ApiState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Api
Management stringName The Name of the API Management Service where this API should be created. Changing this forces a new resource to be created.
- Description string
A description of the API Management API, which may include HTML formatting tags.
- Display
Name string The display name of the API.
- Import
Api
Import Args A
importblock as documented below.- Is
Current bool Is this the current API Revision?
- Is
Online bool Is this API Revision online/accessible via the Gateway?
- Name string
The name of the API Management API. Changing this forces a new resource to be created.
- Path string
The Path for this API Management API, which is a relative URL which uniquely identifies this API and all of it’s resource paths within the API Management Service.
- Protocols List<string>
A list of protocols the operations in this API can be invoked. Possible values are
httpandhttps.- Resource
Group stringName The Name of the Resource Group where the API Management API exists. Changing this forces a new resource to be created.
- Revision string
The Revision which used for this API.
- Service
Url string Absolute URL of the backend service implementing this API.
- Soap
Pass boolThrough Should this API expose a SOAP frontend, rather than a HTTP frontend? Defaults to
false.- Subscription
Key ApiParameter Names Subscription Key Parameter Names Args A
subscription_key_parameter_namesblock as documented below.- Subscription
Required bool Should this API require a subscription key?
- Version string
The Version number of this API, if this API is versioned.
- Version
Set stringId The ID of the Version Set which this API is associated with.
- Api
Management stringName The Name of the API Management Service where this API should be created. Changing this forces a new resource to be created.
- Description string
A description of the API Management API, which may include HTML formatting tags.
- Display
Name string The display name of the API.
- Import
Api
Import A
importblock as documented below.- Is
Current bool Is this the current API Revision?
- Is
Online bool Is this API Revision online/accessible via the Gateway?
- Name string
The name of the API Management API. Changing this forces a new resource to be created.
- Path string
The Path for this API Management API, which is a relative URL which uniquely identifies this API and all of it’s resource paths within the API Management Service.
- Protocols []string
A list of protocols the operations in this API can be invoked. Possible values are
httpandhttps.- Resource
Group stringName The Name of the Resource Group where the API Management API exists. Changing this forces a new resource to be created.
- Revision string
The Revision which used for this API.
- Service
Url string Absolute URL of the backend service implementing this API.
- Soap
Pass boolThrough Should this API expose a SOAP frontend, rather than a HTTP frontend? Defaults to
false.- Subscription
Key ApiParameter Names Subscription Key Parameter Names A
subscription_key_parameter_namesblock as documented below.- Subscription
Required bool Should this API require a subscription key?
- Version string
The Version number of this API, if this API is versioned.
- Version
Set stringId The ID of the Version Set which this API is associated with.
- api
Management stringName The Name of the API Management Service where this API should be created. Changing this forces a new resource to be created.
- description string
A description of the API Management API, which may include HTML formatting tags.
- display
Name string The display name of the API.
- import
Api
Import A
importblock as documented below.- is
Current boolean Is this the current API Revision?
- is
Online boolean Is this API Revision online/accessible via the Gateway?
- name string
The name of the API Management API. Changing this forces a new resource to be created.
- path string
The Path for this API Management API, which is a relative URL which uniquely identifies this API and all of it’s resource paths within the API Management Service.
- protocols string[]
A list of protocols the operations in this API can be invoked. Possible values are
httpandhttps.- resource
Group stringName The Name of the Resource Group where the API Management API exists. Changing this forces a new resource to be created.
- revision string
The Revision which used for this API.
- service
Url string Absolute URL of the backend service implementing this API.
- soap
Pass booleanThrough Should this API expose a SOAP frontend, rather than a HTTP frontend? Defaults to
false.- subscription
Key ApiParameter Names Subscription Key Parameter Names A
subscription_key_parameter_namesblock as documented below.- subscription
Required boolean Should this API require a subscription key?
- version string
The Version number of this API, if this API is versioned.
- version
Set stringId The ID of the Version Set which this API is associated with.
- api_
management_ strname The Name of the API Management Service where this API should be created. Changing this forces a new resource to be created.
- description str
A description of the API Management API, which may include HTML formatting tags.
- display_
name str The display name of the API.
- import_
Dict[Api
Import] A
importblock as documented below.- is_
current bool Is this the current API Revision?
- is_
online bool Is this API Revision online/accessible via the Gateway?
- name str
The name of the API Management API. Changing this forces a new resource to be created.
- path str
The Path for this API Management API, which is a relative URL which uniquely identifies this API and all of it’s resource paths within the API Management Service.
- protocols List[str]
A list of protocols the operations in this API can be invoked. Possible values are
httpandhttps.- resource_
group_ strname The Name of the Resource Group where the API Management API exists. Changing this forces a new resource to be created.
- revision str
The Revision which used for this API.
- service_
url str Absolute URL of the backend service implementing this API.
- soap_
pass_ boolthrough Should this API expose a SOAP frontend, rather than a HTTP frontend? Defaults to
false.- subscription_
key_ Dict[Apiparameter_ names Subscription Key Parameter Names] A
subscription_key_parameter_namesblock as documented below.- subscription_
required bool Should this API require a subscription key?
- version str
The Version number of this API, if this API is versioned.
- version_
set_ strid The ID of the Version Set which this API is associated with.
Supporting Types
ApiImport
- Content
Format string The format of the content from which the API Definition should be imported. Possible values are:
openapi,openapi+json,openapi+json-link,openapi-link,swagger-json,swagger-link-json,wadl-link-json,wadl-xml,wsdlandwsdl-link.- Content
Value string The Content from which the API Definition should be imported. When a
content_formatof*-link-*is specified this must be a URL, otherwise this must be defined inline.- Wsdl
Selector ApiImport Wsdl Selector Args A
wsdl_selectorblock as defined below, which allows you to limit the import of a WSDL to only a subset of the document. This can only be specified whencontent_formatiswsdlorwsdl-link.
- Content
Format string The format of the content from which the API Definition should be imported. Possible values are:
openapi,openapi+json,openapi+json-link,openapi-link,swagger-json,swagger-link-json,wadl-link-json,wadl-xml,wsdlandwsdl-link.- Content
Value string The Content from which the API Definition should be imported. When a
content_formatof*-link-*is specified this must be a URL, otherwise this must be defined inline.- Wsdl
Selector ApiImport Wsdl Selector A
wsdl_selectorblock as defined below, which allows you to limit the import of a WSDL to only a subset of the document. This can only be specified whencontent_formatiswsdlorwsdl-link.
- content
Format string The format of the content from which the API Definition should be imported. Possible values are:
openapi,openapi+json,openapi+json-link,openapi-link,swagger-json,swagger-link-json,wadl-link-json,wadl-xml,wsdlandwsdl-link.- content
Value string The Content from which the API Definition should be imported. When a
content_formatof*-link-*is specified this must be a URL, otherwise this must be defined inline.- wsdl
Selector ApiImport Wsdl Selector A
wsdl_selectorblock as defined below, which allows you to limit the import of a WSDL to only a subset of the document. This can only be specified whencontent_formatiswsdlorwsdl-link.
- content
Format str The format of the content from which the API Definition should be imported. Possible values are:
openapi,openapi+json,openapi+json-link,openapi-link,swagger-json,swagger-link-json,wadl-link-json,wadl-xml,wsdlandwsdl-link.- content
Value str The Content from which the API Definition should be imported. When a
content_formatof*-link-*is specified this must be a URL, otherwise this must be defined inline.- wsdl
Selector Dict[ApiImport Wsdl Selector] A
wsdl_selectorblock as defined below, which allows you to limit the import of a WSDL to only a subset of the document. This can only be specified whencontent_formatiswsdlorwsdl-link.
ApiImportWsdlSelector
- Endpoint
Name string The name of endpoint (port) to import from WSDL.
- Service
Name string The name of service to import from WSDL.
- Endpoint
Name string The name of endpoint (port) to import from WSDL.
- Service
Name string The name of service to import from WSDL.
- endpoint
Name string The name of endpoint (port) to import from WSDL.
- service
Name string The name of service to import from WSDL.
- endpoint
Name str The name of endpoint (port) to import from WSDL.
- service_
name str The name of service to import from WSDL.
ApiSubscriptionKeyParameterNames
Package Details
- Repository
- https://github.com/pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.