1. Packages
  2. AWS Classic
  3. API Docs
  4. appsync
  5. ApiKey

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.41.0 published on Tuesday, Jun 18, 2024 by Pulumi

aws.appsync.ApiKey

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.41.0 published on Tuesday, Jun 18, 2024 by Pulumi

    Provides an AppSync API Key.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.appsync.GraphQLApi("example", {
        authenticationType: "API_KEY",
        name: "example",
    });
    const exampleApiKey = new aws.appsync.ApiKey("example", {
        apiId: example.id,
        expires: "2018-05-03T04:00:00Z",
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.appsync.GraphQLApi("example",
        authentication_type="API_KEY",
        name="example")
    example_api_key = aws.appsync.ApiKey("example",
        api_id=example.id,
        expires="2018-05-03T04:00:00Z")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appsync"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := appsync.NewGraphQLApi(ctx, "example", &appsync.GraphQLApiArgs{
    			AuthenticationType: pulumi.String("API_KEY"),
    			Name:               pulumi.String("example"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = appsync.NewApiKey(ctx, "example", &appsync.ApiKeyArgs{
    			ApiId:   example.ID(),
    			Expires: pulumi.String("2018-05-03T04:00:00Z"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.AppSync.GraphQLApi("example", new()
        {
            AuthenticationType = "API_KEY",
            Name = "example",
        });
    
        var exampleApiKey = new Aws.AppSync.ApiKey("example", new()
        {
            ApiId = example.Id,
            Expires = "2018-05-03T04:00:00Z",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.appsync.GraphQLApi;
    import com.pulumi.aws.appsync.GraphQLApiArgs;
    import com.pulumi.aws.appsync.ApiKey;
    import com.pulumi.aws.appsync.ApiKeyArgs;
    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 example = new GraphQLApi("example", GraphQLApiArgs.builder()
                .authenticationType("API_KEY")
                .name("example")
                .build());
    
            var exampleApiKey = new ApiKey("exampleApiKey", ApiKeyArgs.builder()
                .apiId(example.id())
                .expires("2018-05-03T04:00:00Z")
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:appsync:GraphQLApi
        properties:
          authenticationType: API_KEY
          name: example
      exampleApiKey:
        type: aws:appsync:ApiKey
        name: example
        properties:
          apiId: ${example.id}
          expires: 2018-05-03T04:00:00Z
    

    Create ApiKey Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ApiKey(name: string, args: ApiKeyArgs, opts?: CustomResourceOptions);
    @overload
    def ApiKey(resource_name: str,
               args: ApiKeyArgs,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def ApiKey(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               api_id: Optional[str] = None,
               description: Optional[str] = None,
               expires: Optional[str] = None)
    func NewApiKey(ctx *Context, name string, args ApiKeyArgs, opts ...ResourceOption) (*ApiKey, error)
    public ApiKey(string name, ApiKeyArgs args, CustomResourceOptions? opts = null)
    public ApiKey(String name, ApiKeyArgs args)
    public ApiKey(String name, ApiKeyArgs args, CustomResourceOptions options)
    
    type: aws:appsync:ApiKey
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ApiKeyArgs
    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 ApiKeyArgs
    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 ApiKeyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ApiKeyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ApiKeyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var awsApiKeyResource = new Aws.AppSync.ApiKey("awsApiKeyResource", new()
    {
        ApiId = "string",
        Description = "string",
        Expires = "string",
    });
    
    example, err := appsync.NewApiKey(ctx, "awsApiKeyResource", &appsync.ApiKeyArgs{
    	ApiId:       pulumi.String("string"),
    	Description: pulumi.String("string"),
    	Expires:     pulumi.String("string"),
    })
    
    var awsApiKeyResource = new ApiKey("awsApiKeyResource", ApiKeyArgs.builder()
        .apiId("string")
        .description("string")
        .expires("string")
        .build());
    
    aws_api_key_resource = aws.appsync.ApiKey("awsApiKeyResource",
        api_id="string",
        description="string",
        expires="string")
    
    const awsApiKeyResource = new aws.appsync.ApiKey("awsApiKeyResource", {
        apiId: "string",
        description: "string",
        expires: "string",
    });
    
    type: aws:appsync:ApiKey
    properties:
        apiId: string
        description: string
        expires: string
    

    ApiKey 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 ApiKey resource accepts the following input properties:

    ApiId string
    ID of the associated AppSync API
    Description string
    API key description. Defaults to "Managed by Pulumi".
    Expires string
    RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.
    ApiId string
    ID of the associated AppSync API
    Description string
    API key description. Defaults to "Managed by Pulumi".
    Expires string
    RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.
    apiId String
    ID of the associated AppSync API
    description String
    API key description. Defaults to "Managed by Pulumi".
    expires String
    RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.
    apiId string
    ID of the associated AppSync API
    description string
    API key description. Defaults to "Managed by Pulumi".
    expires string
    RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.
    api_id str
    ID of the associated AppSync API
    description str
    API key description. Defaults to "Managed by Pulumi".
    expires str
    RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.
    apiId String
    ID of the associated AppSync API
    description String
    API key description. Defaults to "Managed by Pulumi".
    expires String
    RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Key string
    API key
    Id string
    The provider-assigned unique ID for this managed resource.
    Key string
    API key
    id String
    The provider-assigned unique ID for this managed resource.
    key String
    API key
    id string
    The provider-assigned unique ID for this managed resource.
    key string
    API key
    id str
    The provider-assigned unique ID for this managed resource.
    key str
    API key
    id String
    The provider-assigned unique ID for this managed resource.
    key String
    API key

    Look up Existing ApiKey Resource

    Get an existing ApiKey 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?: ApiKeyState, opts?: CustomResourceOptions): ApiKey
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            api_id: Optional[str] = None,
            description: Optional[str] = None,
            expires: Optional[str] = None,
            key: Optional[str] = None) -> ApiKey
    func GetApiKey(ctx *Context, name string, id IDInput, state *ApiKeyState, opts ...ResourceOption) (*ApiKey, error)
    public static ApiKey Get(string name, Input<string> id, ApiKeyState? state, CustomResourceOptions? opts = null)
    public static ApiKey get(String name, Output<String> id, ApiKeyState 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:
    ApiId string
    ID of the associated AppSync API
    Description string
    API key description. Defaults to "Managed by Pulumi".
    Expires string
    RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.
    Key string
    API key
    ApiId string
    ID of the associated AppSync API
    Description string
    API key description. Defaults to "Managed by Pulumi".
    Expires string
    RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.
    Key string
    API key
    apiId String
    ID of the associated AppSync API
    description String
    API key description. Defaults to "Managed by Pulumi".
    expires String
    RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.
    key String
    API key
    apiId string
    ID of the associated AppSync API
    description string
    API key description. Defaults to "Managed by Pulumi".
    expires string
    RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.
    key string
    API key
    api_id str
    ID of the associated AppSync API
    description str
    API key description. Defaults to "Managed by Pulumi".
    expires str
    RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.
    key str
    API key
    apiId String
    ID of the associated AppSync API
    description String
    API key description. Defaults to "Managed by Pulumi".
    expires String
    RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.
    key String
    API key

    Import

    Using pulumi import, import aws_appsync_api_key using the AppSync API ID and key separated by :. For example:

    $ pulumi import aws:appsync/apiKey:ApiKey example xxxxx:yyyyy
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.41.0 published on Tuesday, Jun 18, 2024 by Pulumi