alicloud logo
Alibaba Cloud v3.34.0, Mar 17 23

alicloud.apigateway.Plugin

Provides a Api Gateway Plugin resource.

For information about Api Gateway Plugin and how to use it, see What is Plugin.

NOTE: Available in v1.187.0+.

Example Usage

Basic Usage

using System.Collections.Generic;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var @default = new AliCloud.ApiGateway.Plugin("default", new()
    {
        Description = @var.Name,
        PluginName = @var.Name,
        PluginData = "{\"allowOrigins\": \"api.foo.com\",\"allowMethods\": \"GET,POST,PUT,DELETE,HEAD,OPTIONS,PATCH\",\"allowHeaders\": \"Authorization,Accept,Accept-Ranges,Cache-Control,Range,Date,Content-Type,Content-Length,Content-MD5,User-Agent,X-Ca-Signature,X-Ca-Signature-Headers,X-Ca-Signature-Method,X-Ca-Key,X-Ca-Timestamp,X-Ca-Nonce,X-Ca-Stage,X-Ca-Request-Mode,x-ca-deviceid\",\"exposeHeaders\": \"Content-MD5,Server,Date,Latency,X-Ca-Request-Id,X-Ca-Error-Code,X-Ca-Error-Message\",\"maxAge\": 172800,\"allowCredentials\": true}",
        PluginType = "cors",
        Tags = 
        {
            { "Created", "TF" },
            { "For", "Acceptance-test" },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/apigateway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := apigateway.NewPlugin(ctx, "default", &apigateway.PluginArgs{
			Description: pulumi.Any(_var.Name),
			PluginName:  pulumi.Any(_var.Name),
			PluginData:  pulumi.String("{\"allowOrigins\": \"api.foo.com\",\"allowMethods\": \"GET,POST,PUT,DELETE,HEAD,OPTIONS,PATCH\",\"allowHeaders\": \"Authorization,Accept,Accept-Ranges,Cache-Control,Range,Date,Content-Type,Content-Length,Content-MD5,User-Agent,X-Ca-Signature,X-Ca-Signature-Headers,X-Ca-Signature-Method,X-Ca-Key,X-Ca-Timestamp,X-Ca-Nonce,X-Ca-Stage,X-Ca-Request-Mode,x-ca-deviceid\",\"exposeHeaders\": \"Content-MD5,Server,Date,Latency,X-Ca-Request-Id,X-Ca-Error-Code,X-Ca-Error-Message\",\"maxAge\": 172800,\"allowCredentials\": true}"),
			PluginType:  pulumi.String("cors"),
			Tags: pulumi.AnyMap{
				"Created": pulumi.Any("TF"),
				"For":     pulumi.Any("Acceptance-test"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.apigateway.Plugin;
import com.pulumi.alicloud.apigateway.PluginArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var default_ = new Plugin("default", PluginArgs.builder()        
            .description(var_.name())
            .pluginName(var_.name())
            .pluginData("{\"allowOrigins\": \"api.foo.com\",\"allowMethods\": \"GET,POST,PUT,DELETE,HEAD,OPTIONS,PATCH\",\"allowHeaders\": \"Authorization,Accept,Accept-Ranges,Cache-Control,Range,Date,Content-Type,Content-Length,Content-MD5,User-Agent,X-Ca-Signature,X-Ca-Signature-Headers,X-Ca-Signature-Method,X-Ca-Key,X-Ca-Timestamp,X-Ca-Nonce,X-Ca-Stage,X-Ca-Request-Mode,x-ca-deviceid\",\"exposeHeaders\": \"Content-MD5,Server,Date,Latency,X-Ca-Request-Id,X-Ca-Error-Code,X-Ca-Error-Message\",\"maxAge\": 172800,\"allowCredentials\": true}")
            .pluginType("cors")
            .tags(Map.ofEntries(
                Map.entry("Created", "TF"),
                Map.entry("For", "Acceptance-test")
            ))
            .build());

    }
}
import pulumi
import pulumi_alicloud as alicloud

default = alicloud.apigateway.Plugin("default",
    description=var["name"],
    plugin_name=var["name"],
    plugin_data="{\"allowOrigins\": \"api.foo.com\",\"allowMethods\": \"GET,POST,PUT,DELETE,HEAD,OPTIONS,PATCH\",\"allowHeaders\": \"Authorization,Accept,Accept-Ranges,Cache-Control,Range,Date,Content-Type,Content-Length,Content-MD5,User-Agent,X-Ca-Signature,X-Ca-Signature-Headers,X-Ca-Signature-Method,X-Ca-Key,X-Ca-Timestamp,X-Ca-Nonce,X-Ca-Stage,X-Ca-Request-Mode,x-ca-deviceid\",\"exposeHeaders\": \"Content-MD5,Server,Date,Latency,X-Ca-Request-Id,X-Ca-Error-Code,X-Ca-Error-Message\",\"maxAge\": 172800,\"allowCredentials\": true}",
    plugin_type="cors",
    tags={
        "Created": "TF",
        "For": "Acceptance-test",
    })
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const _default = new alicloud.apigateway.Plugin("default", {
    description: _var.name,
    pluginName: _var.name,
    pluginData: "{\"allowOrigins\": \"api.foo.com\",\"allowMethods\": \"GET,POST,PUT,DELETE,HEAD,OPTIONS,PATCH\",\"allowHeaders\": \"Authorization,Accept,Accept-Ranges,Cache-Control,Range,Date,Content-Type,Content-Length,Content-MD5,User-Agent,X-Ca-Signature,X-Ca-Signature-Headers,X-Ca-Signature-Method,X-Ca-Key,X-Ca-Timestamp,X-Ca-Nonce,X-Ca-Stage,X-Ca-Request-Mode,x-ca-deviceid\",\"exposeHeaders\": \"Content-MD5,Server,Date,Latency,X-Ca-Request-Id,X-Ca-Error-Code,X-Ca-Error-Message\",\"maxAge\": 172800,\"allowCredentials\": true}",
    pluginType: "cors",
    tags: {
        Created: "TF",
        For: "Acceptance-test",
    },
});
resources:
  default:
    type: alicloud:apigateway:Plugin
    properties:
      description: ${var.name}
      pluginName: ${var.name}
      pluginData: '{"allowOrigins": "api.foo.com","allowMethods": "GET,POST,PUT,DELETE,HEAD,OPTIONS,PATCH","allowHeaders": "Authorization,Accept,Accept-Ranges,Cache-Control,Range,Date,Content-Type,Content-Length,Content-MD5,User-Agent,X-Ca-Signature,X-Ca-Signature-Headers,X-Ca-Signature-Method,X-Ca-Key,X-Ca-Timestamp,X-Ca-Nonce,X-Ca-Stage,X-Ca-Request-Mode,x-ca-deviceid","exposeHeaders": "Content-MD5,Server,Date,Latency,X-Ca-Request-Id,X-Ca-Error-Code,X-Ca-Error-Message","maxAge": 172800,"allowCredentials": true}'
      pluginType: cors
      tags:
        Created: TF
        For: Acceptance-test

Create Plugin Resource

new Plugin(name: string, args: PluginArgs, opts?: CustomResourceOptions);
@overload
def Plugin(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           description: Optional[str] = None,
           plugin_data: Optional[str] = None,
           plugin_name: Optional[str] = None,
           plugin_type: Optional[str] = None,
           tags: Optional[Mapping[str, Any]] = None)
@overload
def Plugin(resource_name: str,
           args: PluginArgs,
           opts: Optional[ResourceOptions] = None)
func NewPlugin(ctx *Context, name string, args PluginArgs, opts ...ResourceOption) (*Plugin, error)
public Plugin(string name, PluginArgs args, CustomResourceOptions? opts = null)
public Plugin(String name, PluginArgs args)
public Plugin(String name, PluginArgs args, CustomResourceOptions options)
type: alicloud:apigateway:Plugin
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args PluginArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args PluginArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args PluginArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args PluginArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args PluginArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Plugin Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Plugin resource accepts the following input properties:

PluginData string

The definition statement of the plug-in. Plug-in definition statements in the JSON and YAML formats are supported.

PluginName string

The name of the plug-in that you want to create. It can contain uppercase English letters, lowercase English letters, Chinese characters, numbers, and underscores (). It must be 4 to 50 characters in length and cannot start with an underscore ().

PluginType string

The type of the plug-in. Valid values: backendSignature, caching, cors, ipControl, jwtAuth, trafficControl.

  • ipControl: indicates IP address-based access control.
  • trafficControl: indicates throttling.
  • backendSignature: indicates backend signature.
  • jwtAuth: indicates JWT (OpenId Connect).
  • cors: indicates cross-origin resource access (CORS).
  • caching: indicates caching.
Description string

The description of the plug-in, which cannot exceed 200 characters.

Tags Dictionary<string, object>

A mapping of tags to assign to the resource.

PluginData string

The definition statement of the plug-in. Plug-in definition statements in the JSON and YAML formats are supported.

PluginName string

The name of the plug-in that you want to create. It can contain uppercase English letters, lowercase English letters, Chinese characters, numbers, and underscores (). It must be 4 to 50 characters in length and cannot start with an underscore ().

PluginType string

The type of the plug-in. Valid values: backendSignature, caching, cors, ipControl, jwtAuth, trafficControl.

  • ipControl: indicates IP address-based access control.
  • trafficControl: indicates throttling.
  • backendSignature: indicates backend signature.
  • jwtAuth: indicates JWT (OpenId Connect).
  • cors: indicates cross-origin resource access (CORS).
  • caching: indicates caching.
Description string

The description of the plug-in, which cannot exceed 200 characters.

Tags map[string]interface{}

A mapping of tags to assign to the resource.

pluginData String

The definition statement of the plug-in. Plug-in definition statements in the JSON and YAML formats are supported.

pluginName String

The name of the plug-in that you want to create. It can contain uppercase English letters, lowercase English letters, Chinese characters, numbers, and underscores (). It must be 4 to 50 characters in length and cannot start with an underscore ().

pluginType String

The type of the plug-in. Valid values: backendSignature, caching, cors, ipControl, jwtAuth, trafficControl.

  • ipControl: indicates IP address-based access control.
  • trafficControl: indicates throttling.
  • backendSignature: indicates backend signature.
  • jwtAuth: indicates JWT (OpenId Connect).
  • cors: indicates cross-origin resource access (CORS).
  • caching: indicates caching.
description String

The description of the plug-in, which cannot exceed 200 characters.

tags Map<String,Object>

A mapping of tags to assign to the resource.

pluginData string

The definition statement of the plug-in. Plug-in definition statements in the JSON and YAML formats are supported.

pluginName string

The name of the plug-in that you want to create. It can contain uppercase English letters, lowercase English letters, Chinese characters, numbers, and underscores (). It must be 4 to 50 characters in length and cannot start with an underscore ().

pluginType string

The type of the plug-in. Valid values: backendSignature, caching, cors, ipControl, jwtAuth, trafficControl.

  • ipControl: indicates IP address-based access control.
  • trafficControl: indicates throttling.
  • backendSignature: indicates backend signature.
  • jwtAuth: indicates JWT (OpenId Connect).
  • cors: indicates cross-origin resource access (CORS).
  • caching: indicates caching.
description string

The description of the plug-in, which cannot exceed 200 characters.

tags {[key: string]: any}

A mapping of tags to assign to the resource.

plugin_data str

The definition statement of the plug-in. Plug-in definition statements in the JSON and YAML formats are supported.

plugin_name str

The name of the plug-in that you want to create. It can contain uppercase English letters, lowercase English letters, Chinese characters, numbers, and underscores (). It must be 4 to 50 characters in length and cannot start with an underscore ().

plugin_type str

The type of the plug-in. Valid values: backendSignature, caching, cors, ipControl, jwtAuth, trafficControl.

  • ipControl: indicates IP address-based access control.
  • trafficControl: indicates throttling.
  • backendSignature: indicates backend signature.
  • jwtAuth: indicates JWT (OpenId Connect).
  • cors: indicates cross-origin resource access (CORS).
  • caching: indicates caching.
description str

The description of the plug-in, which cannot exceed 200 characters.

tags Mapping[str, Any]

A mapping of tags to assign to the resource.

pluginData String

The definition statement of the plug-in. Plug-in definition statements in the JSON and YAML formats are supported.

pluginName String

The name of the plug-in that you want to create. It can contain uppercase English letters, lowercase English letters, Chinese characters, numbers, and underscores (). It must be 4 to 50 characters in length and cannot start with an underscore ().

pluginType String

The type of the plug-in. Valid values: backendSignature, caching, cors, ipControl, jwtAuth, trafficControl.

  • ipControl: indicates IP address-based access control.
  • trafficControl: indicates throttling.
  • backendSignature: indicates backend signature.
  • jwtAuth: indicates JWT (OpenId Connect).
  • cors: indicates cross-origin resource access (CORS).
  • caching: indicates caching.
description String

The description of the plug-in, which cannot exceed 200 characters.

tags Map<Any>

A mapping of tags to assign to the resource.

Outputs

All input properties are implicitly available as output properties. Additionally, the Plugin resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing Plugin Resource

Get an existing Plugin 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?: PluginState, opts?: CustomResourceOptions): Plugin
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        description: Optional[str] = None,
        plugin_data: Optional[str] = None,
        plugin_name: Optional[str] = None,
        plugin_type: Optional[str] = None,
        tags: Optional[Mapping[str, Any]] = None) -> Plugin
func GetPlugin(ctx *Context, name string, id IDInput, state *PluginState, opts ...ResourceOption) (*Plugin, error)
public static Plugin Get(string name, Input<string> id, PluginState? state, CustomResourceOptions? opts = null)
public static Plugin get(String name, Output<String> id, PluginState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
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.
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:
Description string

The description of the plug-in, which cannot exceed 200 characters.

PluginData string

The definition statement of the plug-in. Plug-in definition statements in the JSON and YAML formats are supported.

PluginName string

The name of the plug-in that you want to create. It can contain uppercase English letters, lowercase English letters, Chinese characters, numbers, and underscores (). It must be 4 to 50 characters in length and cannot start with an underscore ().

PluginType string

The type of the plug-in. Valid values: backendSignature, caching, cors, ipControl, jwtAuth, trafficControl.

  • ipControl: indicates IP address-based access control.
  • trafficControl: indicates throttling.
  • backendSignature: indicates backend signature.
  • jwtAuth: indicates JWT (OpenId Connect).
  • cors: indicates cross-origin resource access (CORS).
  • caching: indicates caching.
Tags Dictionary<string, object>

A mapping of tags to assign to the resource.

Description string

The description of the plug-in, which cannot exceed 200 characters.

PluginData string

The definition statement of the plug-in. Plug-in definition statements in the JSON and YAML formats are supported.

PluginName string

The name of the plug-in that you want to create. It can contain uppercase English letters, lowercase English letters, Chinese characters, numbers, and underscores (). It must be 4 to 50 characters in length and cannot start with an underscore ().

PluginType string

The type of the plug-in. Valid values: backendSignature, caching, cors, ipControl, jwtAuth, trafficControl.

  • ipControl: indicates IP address-based access control.
  • trafficControl: indicates throttling.
  • backendSignature: indicates backend signature.
  • jwtAuth: indicates JWT (OpenId Connect).
  • cors: indicates cross-origin resource access (CORS).
  • caching: indicates caching.
Tags map[string]interface{}

A mapping of tags to assign to the resource.

description String

The description of the plug-in, which cannot exceed 200 characters.

pluginData String

The definition statement of the plug-in. Plug-in definition statements in the JSON and YAML formats are supported.

pluginName String

The name of the plug-in that you want to create. It can contain uppercase English letters, lowercase English letters, Chinese characters, numbers, and underscores (). It must be 4 to 50 characters in length and cannot start with an underscore ().

pluginType String

The type of the plug-in. Valid values: backendSignature, caching, cors, ipControl, jwtAuth, trafficControl.

  • ipControl: indicates IP address-based access control.
  • trafficControl: indicates throttling.
  • backendSignature: indicates backend signature.
  • jwtAuth: indicates JWT (OpenId Connect).
  • cors: indicates cross-origin resource access (CORS).
  • caching: indicates caching.
tags Map<String,Object>

A mapping of tags to assign to the resource.

description string

The description of the plug-in, which cannot exceed 200 characters.

pluginData string

The definition statement of the plug-in. Plug-in definition statements in the JSON and YAML formats are supported.

pluginName string

The name of the plug-in that you want to create. It can contain uppercase English letters, lowercase English letters, Chinese characters, numbers, and underscores (). It must be 4 to 50 characters in length and cannot start with an underscore ().

pluginType string

The type of the plug-in. Valid values: backendSignature, caching, cors, ipControl, jwtAuth, trafficControl.

  • ipControl: indicates IP address-based access control.
  • trafficControl: indicates throttling.
  • backendSignature: indicates backend signature.
  • jwtAuth: indicates JWT (OpenId Connect).
  • cors: indicates cross-origin resource access (CORS).
  • caching: indicates caching.
tags {[key: string]: any}

A mapping of tags to assign to the resource.

description str

The description of the plug-in, which cannot exceed 200 characters.

plugin_data str

The definition statement of the plug-in. Plug-in definition statements in the JSON and YAML formats are supported.

plugin_name str

The name of the plug-in that you want to create. It can contain uppercase English letters, lowercase English letters, Chinese characters, numbers, and underscores (). It must be 4 to 50 characters in length and cannot start with an underscore ().

plugin_type str

The type of the plug-in. Valid values: backendSignature, caching, cors, ipControl, jwtAuth, trafficControl.

  • ipControl: indicates IP address-based access control.
  • trafficControl: indicates throttling.
  • backendSignature: indicates backend signature.
  • jwtAuth: indicates JWT (OpenId Connect).
  • cors: indicates cross-origin resource access (CORS).
  • caching: indicates caching.
tags Mapping[str, Any]

A mapping of tags to assign to the resource.

description String

The description of the plug-in, which cannot exceed 200 characters.

pluginData String

The definition statement of the plug-in. Plug-in definition statements in the JSON and YAML formats are supported.

pluginName String

The name of the plug-in that you want to create. It can contain uppercase English letters, lowercase English letters, Chinese characters, numbers, and underscores (). It must be 4 to 50 characters in length and cannot start with an underscore ().

pluginType String

The type of the plug-in. Valid values: backendSignature, caching, cors, ipControl, jwtAuth, trafficControl.

  • ipControl: indicates IP address-based access control.
  • trafficControl: indicates throttling.
  • backendSignature: indicates backend signature.
  • jwtAuth: indicates JWT (OpenId Connect).
  • cors: indicates cross-origin resource access (CORS).
  • caching: indicates caching.
tags Map<Any>

A mapping of tags to assign to the resource.

Import

Api Gateway Plugin can be imported using the id, e.g.

 $ pulumi import alicloud:apigateway/plugin:Plugin example <id>

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.