CfnGraphQLApi
- class aws_cdk.aws_appsync.CfnGraphQLApi(scope, id, *, authentication_type, name, additional_authentication_providers=None, api_type=None, lambda_authorizer_config=None, log_config=None, merged_api_execution_role_arn=None, open_id_connect_config=None, owner_contact=None, tags=None, user_pool_config=None, visibility=None, xray_enabled=None)
Bases:
CfnResource
A CloudFormation
AWS::AppSync::GraphQLApi
.The
AWS::AppSync::GraphQLApi
resource creates a new AWS AppSync GraphQL API. This is the top-level construct for your application. For more information, see Quick Start in the AWS AppSync Developer Guide .- CloudformationResource:
AWS::AppSync::GraphQLApi
- Link:
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-graphqlapi.html
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_appsync as appsync cfn_graph_qLApi = appsync.CfnGraphQLApi(self, "MyCfnGraphQLApi", authentication_type="authenticationType", name="name", # the properties below are optional additional_authentication_providers=[appsync.CfnGraphQLApi.AdditionalAuthenticationProviderProperty( authentication_type="authenticationType", # the properties below are optional lambda_authorizer_config=appsync.CfnGraphQLApi.LambdaAuthorizerConfigProperty( authorizer_result_ttl_in_seconds=123, authorizer_uri="authorizerUri", identity_validation_expression="identityValidationExpression" ), open_id_connect_config=appsync.CfnGraphQLApi.OpenIDConnectConfigProperty( auth_ttl=123, client_id="clientId", iat_ttl=123, issuer="issuer" ), user_pool_config=appsync.CfnGraphQLApi.CognitoUserPoolConfigProperty( app_id_client_regex="appIdClientRegex", aws_region="awsRegion", user_pool_id="userPoolId" ) )], api_type="apiType", lambda_authorizer_config=appsync.CfnGraphQLApi.LambdaAuthorizerConfigProperty( authorizer_result_ttl_in_seconds=123, authorizer_uri="authorizerUri", identity_validation_expression="identityValidationExpression" ), log_config=appsync.CfnGraphQLApi.LogConfigProperty( cloud_watch_logs_role_arn="cloudWatchLogsRoleArn", exclude_verbose_content=False, field_log_level="fieldLogLevel" ), merged_api_execution_role_arn="mergedApiExecutionRoleArn", open_id_connect_config=appsync.CfnGraphQLApi.OpenIDConnectConfigProperty( auth_ttl=123, client_id="clientId", iat_ttl=123, issuer="issuer" ), owner_contact="ownerContact", tags=[CfnTag( key="key", value="value" )], user_pool_config=appsync.CfnGraphQLApi.UserPoolConfigProperty( app_id_client_regex="appIdClientRegex", aws_region="awsRegion", default_action="defaultAction", user_pool_id="userPoolId" ), visibility="visibility", xray_enabled=False )
Create a new
AWS::AppSync::GraphQLApi
.- Parameters:
scope (
Construct
) –scope in which this resource is defined.
id (
str
) –scoped id of the resource.
authentication_type (
str
) – Security configuration for your GraphQL API. For allowed values (such asAPI_KEY
,AWS_IAM
,AMAZON_COGNITO_USER_POOLS
,OPENID_CONNECT
, orAWS_LAMBDA
), see Security in the AWS AppSync Developer Guide .name (
str
) – The API name.additional_authentication_providers (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,AdditionalAuthenticationProviderProperty
,Dict
[str
,Any
]]],None
]) – A list of additional authentication providers for theGraphqlApi
API.api_type (
Optional
[str
]) – The value that indicates whether the GraphQL API is a standard API (GRAPHQL
) or merged API (MERGED
). The following values are valid:GRAPHQL | MERGED
lambda_authorizer_config (
Union
[IResolvable
,LambdaAuthorizerConfigProperty
,Dict
[str
,Any
],None
]) – ALambdaAuthorizerConfig
holds configuration on how to authorize AWS AppSync API access when using theAWS_LAMBDA
authorizer mode. Be aware that an AWS AppSync API may have only one Lambda authorizer configured at a time.log_config (
Union
[IResolvable
,LogConfigProperty
,Dict
[str
,Any
],None
]) – The Amazon CloudWatch Logs configuration.merged_api_execution_role_arn (
Optional
[str
]) – The AWS Identity and Access Management service role ARN for a merged API. The AppSync service assumes this role on behalf of the Merged API to validate access to source APIs at runtime and to prompt theAUTO_MERGE
to update the merged API endpoint with the source API changes automatically.open_id_connect_config (
Union
[IResolvable
,OpenIDConnectConfigProperty
,Dict
[str
,Any
],None
]) – The OpenID Connect configuration.owner_contact (
Optional
[str
]) – The owner contact information for an API resource. This field accepts any string input with a length of 0 - 256 characters.tags (
Optional
[Sequence
[Union
[CfnTag
,Dict
[str
,Any
]]]]) – An arbitrary set of tags (key-value pairs) for this GraphQL API.user_pool_config (
Union
[IResolvable
,UserPoolConfigProperty
,Dict
[str
,Any
],None
]) – Optional authorization configuration for using Amazon Cognito user pools with your GraphQL endpoint.visibility (
Optional
[str
]) – Sets the scope of the GraphQL API to public (GLOBAL
) or private (PRIVATE
). By default, the scope is set toGlobal
if no value is provided.xray_enabled (
Union
[bool
,IResolvable
,None
]) – A flag indicating whether to use AWS X-Ray tracing for thisGraphqlApi
.
Methods
- add_deletion_override(path)
Syntactic sugar for
addOverride(path, undefined)
.- Parameters:
path (
str
) – The path of the value to delete.- Return type:
None
- add_depends_on(target)
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
- Parameters:
target (
CfnResource
)- Return type:
None
- add_metadata(key, value)
Add a value to the CloudFormation Resource Metadata.
- Parameters:
key (
str
)value (
Any
)
- See:
- Return type:
None
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- add_override(path, value)
Adds an override to the synthesized CloudFormation resource.
To add a property override, either use
addPropertyOverride
or prefixpath
with “Properties.” (i.e.Properties.TopicName
).If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal
.
in the property name, prefix with a\
. In most programming languages you will need to write this as"\\."
because the\
itself will need to be escaped.For example:
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"]) cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")
would add the overrides Example:
"Properties": { "GlobalSecondaryIndexes": [ { "Projection": { "NonKeyAttributes": [ "myattribute" ] ... } ... }, { "ProjectionType": "INCLUDE" ... }, ] ... }
The
value
argument toaddOverride
will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.- Parameters:
path (
str
) –The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
value (
Any
) –The value. Could be primitive or complex.
- Return type:
None
- add_property_deletion_override(property_path)
Adds an override that deletes the value of a property from the resource definition.
- Parameters:
property_path (
str
) – The path to the property.- Return type:
None
- add_property_override(property_path, value)
Adds an override to a resource property.
Syntactic sugar for
addOverride("Properties.<...>", value)
.- Parameters:
property_path (
str
) – The path of the property.value (
Any
) – The value.
- Return type:
None
- apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)
Sets the deletion policy of the resource based on the removal policy specified.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
).- Parameters:
policy (
Optional
[RemovalPolicy
])apply_to_update_replace_policy (
Optional
[bool
]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: truedefault (
Optional
[RemovalPolicy
]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resoure, please consult that specific resource’s documentation.
- Return type:
None
- get_att(attribute_name)
Returns a token for an runtime attribute of this resource.
Ideally, use generated attribute accessors (e.g.
resource.arn
), but this can be used for future compatibility in case there is no generated attribute.- Parameters:
attribute_name (
str
) – The name of the attribute.- Return type:
- get_metadata(key)
Retrieve a value value from the CloudFormation Resource Metadata.
- Parameters:
key (
str
)- See:
- Return type:
Any
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- inspect(inspector)
Examines the CloudFormation resource and discloses attributes.
- Parameters:
inspector (
TreeInspector
) –tree inspector to collect and process attributes.
- Return type:
None
- override_logical_id(new_logical_id)
Overrides the auto-generated logical ID with a specific ID.
- Parameters:
new_logical_id (
str
) – The new logical ID to use for this stack element.- Return type:
None
- to_string()
Returns a string representation of this construct.
- Return type:
str
- Returns:
a string representation of this resource
Attributes
- CFN_RESOURCE_TYPE_NAME = 'AWS::AppSync::GraphQLApi'
- additional_authentication_providers
A list of additional authentication providers for the
GraphqlApi
API.
- api_type
The value that indicates whether the GraphQL API is a standard API (
GRAPHQL
) or merged API (MERGED
).The following values are valid:
GRAPHQL | MERGED
- attr_api_id
Unique AWS AppSync GraphQL API identifier.
- CloudformationAttribute:
ApiId
- attr_arn
The Amazon Resource Name (ARN) of the API key, such as
arn:aws:appsync:us-east-1:123456789012:apis/graphqlapiid
.- CloudformationAttribute:
Arn
- attr_graph_ql_dns
The fully qualified domain name (FQDN) of the endpoint URL of your GraphQL API.
- CloudformationAttribute:
GraphQLDns
- attr_graph_ql_url
The Endpoint URL of your GraphQL API.
- CloudformationAttribute:
GraphQLUrl
- attr_realtime_dns
The fully qualified domain name (FQDN) of the real-time endpoint URL of your GraphQL API.
- CloudformationAttribute:
RealtimeDns
- attr_realtime_url
The GraphQL API real-time endpoint URL.
For more information, see Discovering the real-time endpoint from the GraphQL endpoint .
- CloudformationAttribute:
RealtimeUrl
- authentication_type
Security configuration for your GraphQL API.
For allowed values (such as
API_KEY
,AWS_IAM
,AMAZON_COGNITO_USER_POOLS
,OPENID_CONNECT
, orAWS_LAMBDA
), see Security in the AWS AppSync Developer Guide .
- cfn_options
Options for this resource, such as condition, update policy etc.
- cfn_resource_type
AWS resource type.
- creation_stack
return:
the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.
- lambda_authorizer_config
A
LambdaAuthorizerConfig
holds configuration on how to authorize AWS AppSync API access when using theAWS_LAMBDA
authorizer mode.Be aware that an AWS AppSync API may have only one Lambda authorizer configured at a time.
- log_config
The Amazon CloudWatch Logs configuration.
- logical_id
The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use
overrideLogicalId(newLogicalId)
.- Returns:
the logical ID as a stringified token. This value will only get resolved during synthesis.
- merged_api_execution_role_arn
The AWS Identity and Access Management service role ARN for a merged API.
The AppSync service assumes this role on behalf of the Merged API to validate access to source APIs at runtime and to prompt the
AUTO_MERGE
to update the merged API endpoint with the source API changes automatically.
- name
The API name.
- node
The construct tree node associated with this construct.
- open_id_connect_config
The OpenID Connect configuration.
- owner_contact
The owner contact information for an API resource.
This field accepts any string input with a length of 0 - 256 characters.
- ref
Return a string that will be resolved to a CloudFormation
{ Ref }
for this element.If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through
Lazy.any({ produce: resource.ref })
.
- stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
- tags
An arbitrary set of tags (key-value pairs) for this GraphQL API.
- user_pool_config
Optional authorization configuration for using Amazon Cognito user pools with your GraphQL endpoint.
- visibility
Sets the scope of the GraphQL API to public (
GLOBAL
) or private (PRIVATE
).By default, the scope is set to
Global
if no value is provided.
- xray_enabled
A flag indicating whether to use AWS X-Ray tracing for this
GraphqlApi
.
Static Methods
- classmethod is_cfn_element(x)
Returns
true
if a construct is a stack element (i.e. part of the synthesized cloudformation template).Uses duck-typing instead of
instanceof
to allow stack elements from different versions of this library to be included in the same stack.- Parameters:
x (
Any
)- Return type:
bool
- Returns:
The construct as a stack element or undefined if it is not a stack element.
- classmethod is_cfn_resource(construct)
Check whether the given construct is a CfnResource.
- Parameters:
construct (
IConstruct
)- Return type:
bool
- classmethod is_construct(x)
Return whether the given object is a Construct.
- Parameters:
x (
Any
)- Return type:
bool
AdditionalAuthenticationProviderProperty
- class CfnGraphQLApi.AdditionalAuthenticationProviderProperty(*, authentication_type, lambda_authorizer_config=None, open_id_connect_config=None, user_pool_config=None)
Bases:
object
Describes an additional authentication provider.
- Parameters:
authentication_type (
str
) – The authentication type for API key, AWS Identity and Access Management , OIDC, Amazon Cognito user pools , or AWS Lambda . Valid Values:API_KEY
|AWS_IAM
|OPENID_CONNECT
|AMAZON_COGNITO_USER_POOLS
|AWS_LAMBDA
lambda_authorizer_config (
Union
[IResolvable
,LambdaAuthorizerConfigProperty
,Dict
[str
,Any
],None
]) – Configuration for AWS Lambda function authorization.open_id_connect_config (
Union
[IResolvable
,OpenIDConnectConfigProperty
,Dict
[str
,Any
],None
]) – The OIDC configuration.user_pool_config (
Union
[IResolvable
,CognitoUserPoolConfigProperty
,Dict
[str
,Any
],None
]) – The Amazon Cognito user pool configuration.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_appsync as appsync additional_authentication_provider_property = appsync.CfnGraphQLApi.AdditionalAuthenticationProviderProperty( authentication_type="authenticationType", # the properties below are optional lambda_authorizer_config=appsync.CfnGraphQLApi.LambdaAuthorizerConfigProperty( authorizer_result_ttl_in_seconds=123, authorizer_uri="authorizerUri", identity_validation_expression="identityValidationExpression" ), open_id_connect_config=appsync.CfnGraphQLApi.OpenIDConnectConfigProperty( auth_ttl=123, client_id="clientId", iat_ttl=123, issuer="issuer" ), user_pool_config=appsync.CfnGraphQLApi.CognitoUserPoolConfigProperty( app_id_client_regex="appIdClientRegex", aws_region="awsRegion", user_pool_id="userPoolId" ) )
Attributes
- authentication_type
The authentication type for API key, AWS Identity and Access Management , OIDC, Amazon Cognito user pools , or AWS Lambda .
Valid Values:
API_KEY
|AWS_IAM
|OPENID_CONNECT
|AMAZON_COGNITO_USER_POOLS
|AWS_LAMBDA
- lambda_authorizer_config
Configuration for AWS Lambda function authorization.
- open_id_connect_config
The OIDC configuration.
- user_pool_config
The Amazon Cognito user pool configuration.
CognitoUserPoolConfigProperty
- class CfnGraphQLApi.CognitoUserPoolConfigProperty(*, app_id_client_regex=None, aws_region=None, user_pool_id=None)
Bases:
object
Describes an Amazon Cognito user pool configuration.
- Parameters:
app_id_client_regex (
Optional
[str
]) – A regular expression for validating the incoming Amazon Cognito user pool app client ID. If this value isn’t set, no filtering is applied.aws_region (
Optional
[str
]) – The AWS Region in which the user pool was created.user_pool_id (
Optional
[str
]) – The user pool ID.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_appsync as appsync cognito_user_pool_config_property = appsync.CfnGraphQLApi.CognitoUserPoolConfigProperty( app_id_client_regex="appIdClientRegex", aws_region="awsRegion", user_pool_id="userPoolId" )
Attributes
- app_id_client_regex
A regular expression for validating the incoming Amazon Cognito user pool app client ID.
If this value isn’t set, no filtering is applied.
- aws_region
The AWS Region in which the user pool was created.
LogConfigProperty
- class CfnGraphQLApi.LogConfigProperty(*, cloud_watch_logs_role_arn=None, exclude_verbose_content=None, field_log_level=None)
Bases:
object
The
LogConfig
property type specifies the logging configuration when writing GraphQL operations and tracing to Amazon CloudWatch for an AWS AppSync GraphQL API.LogConfig
is a property of the AWS::AppSync::GraphQLApi property type.- Parameters:
cloud_watch_logs_role_arn (
Optional
[str
]) – The service role that AWS AppSync will assume to publish to Amazon CloudWatch Logs in your account.exclude_verbose_content (
Union
[bool
,IResolvable
,None
]) – Set to TRUE to exclude sections that contain information such as headers, context, and evaluated mapping templates, regardless of logging level.field_log_level (
Optional
[str
]) – The field logging level. Values can be NONE, ERROR, or ALL. - NONE : No field-level logs are captured. - ERROR : Logs the following information only for the fields that are in error: - The error section in the server response. - Field-level errors. - The generated request/response functions that got resolved for error fields. - ALL : The following information is logged for all fields in the query: - Field-level tracing information. - The generated request/response functions that got resolved for each field.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_appsync as appsync log_config_property = appsync.CfnGraphQLApi.LogConfigProperty( cloud_watch_logs_role_arn="cloudWatchLogsRoleArn", exclude_verbose_content=False, field_log_level="fieldLogLevel" )
Attributes
- cloud_watch_logs_role_arn
The service role that AWS AppSync will assume to publish to Amazon CloudWatch Logs in your account.
- exclude_verbose_content
Set to TRUE to exclude sections that contain information such as headers, context, and evaluated mapping templates, regardless of logging level.
- field_log_level
The field logging level. Values can be NONE, ERROR, or ALL.
NONE : No field-level logs are captured.
ERROR : Logs the following information only for the fields that are in error:
The error section in the server response.
Field-level errors.
The generated request/response functions that got resolved for error fields.
ALL : The following information is logged for all fields in the query:
Field-level tracing information.
The generated request/response functions that got resolved for each field.
OpenIDConnectConfigProperty
- class CfnGraphQLApi.OpenIDConnectConfigProperty(*, auth_ttl=None, client_id=None, iat_ttl=None, issuer=None)
Bases:
object
The
OpenIDConnectConfig
property type specifies the optional authorization configuration for using an OpenID Connect compliant service with your GraphQL endpoint for an AWS AppSync GraphQL API.OpenIDConnectConfig
is a property of the AWS::AppSync::GraphQLApi property type.- Parameters:
auth_ttl (
Union
[int
,float
,None
]) – The number of milliseconds that a token is valid after being authenticated.client_id (
Optional
[str
]) – The client identifier of the Relying party at the OpenID identity provider. This identifier is typically obtained when the Relying party is registered with the OpenID identity provider. You can specify a regular expression so that AWS AppSync can validate against multiple client identifiers at a time.iat_ttl (
Union
[int
,float
,None
]) – The number of milliseconds that a token is valid after it’s issued to a user.issuer (
Optional
[str
]) – The issuer for the OIDC configuration. The issuer returned by discovery must exactly match the value ofiss
in the ID token.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_appsync as appsync open_iDConnect_config_property = appsync.CfnGraphQLApi.OpenIDConnectConfigProperty( auth_ttl=123, client_id="clientId", iat_ttl=123, issuer="issuer" )
Attributes
- auth_ttl
The number of milliseconds that a token is valid after being authenticated.
- client_id
The client identifier of the Relying party at the OpenID identity provider.
This identifier is typically obtained when the Relying party is registered with the OpenID identity provider. You can specify a regular expression so that AWS AppSync can validate against multiple client identifiers at a time.
- iat_ttl
The number of milliseconds that a token is valid after it’s issued to a user.
- issuer
The issuer for the OIDC configuration.
The issuer returned by discovery must exactly match the value of
iss
in the ID token.
UserPoolConfigProperty
- class CfnGraphQLApi.UserPoolConfigProperty(*, app_id_client_regex=None, aws_region=None, default_action=None, user_pool_id=None)
Bases:
object
The
UserPoolConfig
property type specifies the optional authorization configuration for using Amazon Cognito user pools with your GraphQL endpoint for an AWS AppSync GraphQL API.- Parameters:
app_id_client_regex (
Optional
[str
]) – A regular expression for validating the incoming Amazon Cognito user pool app client ID. If this value isn’t set, no filtering is applied.aws_region (
Optional
[str
]) – The AWS Region in which the user pool was created.default_action (
Optional
[str
]) – The action that you want your GraphQL API to take when a request that uses Amazon Cognito user pool authentication doesn’t match the Amazon Cognito user pool configuration. When specifying Amazon Cognito user pools as the default authentication, you must set the value forDefaultAction
toALLOW
if specifyingAdditionalAuthenticationProviders
.user_pool_id (
Optional
[str
]) – The user pool ID.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_appsync as appsync user_pool_config_property = appsync.CfnGraphQLApi.UserPoolConfigProperty( app_id_client_regex="appIdClientRegex", aws_region="awsRegion", default_action="defaultAction", user_pool_id="userPoolId" )
Attributes
- app_id_client_regex
A regular expression for validating the incoming Amazon Cognito user pool app client ID.
If this value isn’t set, no filtering is applied.
- aws_region
The AWS Region in which the user pool was created.
- default_action
The action that you want your GraphQL API to take when a request that uses Amazon Cognito user pool authentication doesn’t match the Amazon Cognito user pool configuration.
When specifying Amazon Cognito user pools as the default authentication, you must set the value for
DefaultAction
toALLOW
if specifyingAdditionalAuthenticationProviders
.