Class GraphQLApi
Provides an AppSync GraphQL API.
Example Usage
API Key Authentication
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.AppSync.GraphQLApi("example", new Aws.AppSync.GraphQLApiArgs
{
AuthenticationType = "API_KEY",
});
}
}
AWS Cognito User Pool Authentication
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.AppSync.GraphQLApi("example", new Aws.AppSync.GraphQLApiArgs
{
AuthenticationType = "AMAZON_COGNITO_USER_POOLS",
UserPoolConfig = new Aws.AppSync.Inputs.GraphQLApiUserPoolConfigArgs
{
AwsRegion = data.Aws_region.Current.Name,
DefaultAction = "DENY",
UserPoolId = aws_cognito_user_pool.Example.Id,
},
});
}
}
AWS IAM Authentication
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.AppSync.GraphQLApi("example", new Aws.AppSync.GraphQLApiArgs
{
AuthenticationType = "AWS_IAM",
});
}
}
With Schema
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.AppSync.GraphQLApi("example", new Aws.AppSync.GraphQLApiArgs
{
AuthenticationType = "AWS_IAM",
Schema = @"schema {
query: Query
}
type Query {
test: Int
}
",
});
}
}
OpenID Connect Authentication
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.AppSync.GraphQLApi("example", new Aws.AppSync.GraphQLApiArgs
{
AuthenticationType = "OPENID_CONNECT",
OpenidConnectConfig = new Aws.AppSync.Inputs.GraphQLApiOpenidConnectConfigArgs
{
Issuer = "https://example.com",
},
});
}
}
With Multiple Authentication Providers
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.AppSync.GraphQLApi("example", new Aws.AppSync.GraphQLApiArgs
{
AdditionalAuthenticationProviders =
{
new Aws.AppSync.Inputs.GraphQLApiAdditionalAuthenticationProviderArgs
{
AuthenticationType = "AWS_IAM",
},
},
AuthenticationType = "API_KEY",
});
}
}
Enabling Logging
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var exampleRole = new Aws.Iam.Role("exampleRole", new Aws.Iam.RoleArgs
{
AssumeRolePolicy = @"{
""Version"": ""2012-10-17"",
""Statement"": [
{
""Effect"": ""Allow"",
""Principal"": {
""Service"": ""appsync.amazonaws.com""
},
""Action"": ""sts:AssumeRole""
}
]
}
",
});
var exampleRolePolicyAttachment = new Aws.Iam.RolePolicyAttachment("exampleRolePolicyAttachment", new Aws.Iam.RolePolicyAttachmentArgs
{
PolicyArn = "arn:aws:iam::aws:policy/service-role/AWSAppSyncPushToCloudWatchLogs",
Role = exampleRole.Name,
});
var exampleGraphQLApi = new Aws.AppSync.GraphQLApi("exampleGraphQLApi", new Aws.AppSync.GraphQLApiArgs
{
LogConfig = new Aws.AppSync.Inputs.GraphQLApiLogConfigArgs
{
CloudwatchLogsRoleArn = exampleRole.Arn,
FieldLogLevel = "ERROR",
},
});
}
}
Inherited Members
Namespace: Pulumi.Aws.AppSync
Assembly: Pulumi.Aws.dll
Syntax
public class GraphQLApi : CustomResource
Constructors
View SourceGraphQLApi(String, GraphQLApiArgs, CustomResourceOptions)
Create a GraphQLApi resource with the given unique name, arguments, and options.
Declaration
public GraphQLApi(string name, GraphQLApiArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| GraphQLApiArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceAdditionalAuthenticationProviders
One or more additional authentication providers for the GraphqlApi. Defined below.
Declaration
public Output<ImmutableArray<GraphQLApiAdditionalAuthenticationProvider>> AdditionalAuthenticationProviders { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<GraphQLApiAdditionalAuthenticationProvider>> |
Arn
The ARN
Declaration
public Output<string> Arn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
AuthenticationType
The authentication type. Valid values: API_KEY, AWS_IAM, AMAZON_COGNITO_USER_POOLS, OPENID_CONNECT
Declaration
public Output<string> AuthenticationType { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
LogConfig
Nested argument containing logging configuration. Defined below.
Declaration
public Output<GraphQLApiLogConfig> LogConfig { get; }
Property Value
| Type | Description |
|---|---|
| Output<GraphQLApiLogConfig> |
Name
A user-supplied name for the GraphqlApi.
Declaration
public Output<string> Name { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
OpenidConnectConfig
Nested argument containing OpenID Connect configuration. Defined below.
Declaration
public Output<GraphQLApiOpenidConnectConfig> OpenidConnectConfig { get; }
Property Value
| Type | Description |
|---|---|
| Output<GraphQLApiOpenidConnectConfig> |
Schema
The schema definition, in GraphQL schema language format. This provider cannot perform drift detection of this configuration.
Declaration
public Output<string> Schema { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Tags
A map of tags to assign to the resource.
Declaration
public Output<ImmutableDictionary<string, object>> Tags { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.Object>> |
Uris
Map of URIs associated with the API. e.g. uris["GRAPHQL"] = https://ID.appsync-api.REGION.amazonaws.com/graphql
Declaration
public Output<ImmutableDictionary<string, string>> Uris { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.String>> |
UserPoolConfig
The Amazon Cognito User Pool configuration. Defined below.
Declaration
public Output<GraphQLApiUserPoolConfig> UserPoolConfig { get; }
Property Value
| Type | Description |
|---|---|
| Output<GraphQLApiUserPoolConfig> |
XrayEnabled
Whether tracing with X-ray is enabled. Defaults to false.
Declaration
public Output<bool?> XrayEnabled { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
Methods
View SourceGet(String, Input<String>, GraphQLApiState, CustomResourceOptions)
Get an existing GraphQLApi resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static GraphQLApi Get(string name, Input<string> id, GraphQLApiState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| GraphQLApiState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| GraphQLApi |