AWS Classic

v5.16.2 published on Tuesday, Oct 4, 2022 by Pulumi

ApiKey

Provides an AppSync API Key.

Example Usage

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

return await Deployment.RunAsync(() => 
{
    var exampleGraphQLApi = new Aws.AppSync.GraphQLApi("exampleGraphQLApi", new()
    {
        AuthenticationType = "API_KEY",
    });

    var exampleApiKey = new Aws.AppSync.ApiKey("exampleApiKey", new()
    {
        ApiId = exampleGraphQLApi.Id,
        Expires = "2018-05-03T04:00:00Z",
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/appsync"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleGraphQLApi, err := appsync.NewGraphQLApi(ctx, "exampleGraphQLApi", &appsync.GraphQLApiArgs{
			AuthenticationType: pulumi.String("API_KEY"),
		})
		if err != nil {
			return err
		}
		_, err = appsync.NewApiKey(ctx, "exampleApiKey", &appsync.ApiKeyArgs{
			ApiId:   exampleGraphQLApi.ID(),
			Expires: pulumi.String("2018-05-03T04:00:00Z"),
		})
		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.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 exampleGraphQLApi = new GraphQLApi("exampleGraphQLApi", GraphQLApiArgs.builder()        
            .authenticationType("API_KEY")
            .build());

        var exampleApiKey = new ApiKey("exampleApiKey", ApiKeyArgs.builder()        
            .apiId(exampleGraphQLApi.id())
            .expires("2018-05-03T04:00:00Z")
            .build());

    }
}
import pulumi
import pulumi_aws as aws

example_graph_ql_api = aws.appsync.GraphQLApi("exampleGraphQLApi", authentication_type="API_KEY")
example_api_key = aws.appsync.ApiKey("exampleApiKey",
    api_id=example_graph_ql_api.id,
    expires="2018-05-03T04:00:00Z")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const exampleGraphQLApi = new aws.appsync.GraphQLApi("exampleGraphQLApi", {authenticationType: "API_KEY"});
const exampleApiKey = new aws.appsync.ApiKey("exampleApiKey", {
    apiId: exampleGraphQLApi.id,
    expires: "2018-05-03T04:00:00Z",
});
resources:
  exampleGraphQLApi:
    type: aws:appsync:GraphQLApi
    properties:
      authenticationType: API_KEY
  exampleApiKey:
    type: aws:appsync:ApiKey
    properties:
      apiId: ${exampleGraphQLApi.id}
      expires: 2018-05-03T04:00:00Z

Create a ApiKey Resource

new ApiKey(name: string, args: ApiKeyArgs, opts?: CustomResourceOptions);
@overload
def ApiKey(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           api_id: Optional[str] = None,
           description: Optional[str] = None,
           expires: Optional[str] = None)
@overload
def ApiKey(resource_name: str,
           args: ApiKeyArgs,
           opts: Optional[ResourceOptions] = 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.

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.

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 an 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

aws_appsync_api_key can be imported using the AppSync API ID and key separated by :, e.g.,

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

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.