io.cloudshiftdev.awscdk.services.appsync.GraphqlApiAttributes.kt Maven / Gradle / Ivy
The newest version!
@file:Suppress("RedundantVisibilityModifier","RedundantUnitReturnType","RemoveRedundantQualifierName","unused","UnusedImport","ClassName","REDUNDANT_PROJECTION","DEPRECATION")
package io.cloudshiftdev.awscdk.services.appsync
import io.cloudshiftdev.awscdk.common.CdkDslMarker
import io.cloudshiftdev.awscdk.common.CdkObject
import io.cloudshiftdev.awscdk.common.CdkObjectWrappers
import kotlin.String
import kotlin.Unit
import kotlin.collections.List
/**
* Attributes for GraphQL imports.
*
* Example:
*
* ```
* GraphqlApi sourceApi = GraphqlApi.Builder.create(this, "FirstSourceAPI")
* .name("FirstSourceAPI")
* .definition(Definition.fromFile(join(__dirname, "appsync.merged-api-1.graphql")))
* .build();
* IGraphqlApi importedMergedApi = GraphqlApi.fromGraphqlApiAttributes(this, "ImportedMergedApi",
* GraphqlApiAttributes.builder()
* .graphqlApiId("MyApiId")
* .graphqlApiArn("MyApiArn")
* .build());
* IRole importedExecutionRole = Role.fromRoleArn(this, "ExecutionRole",
* "arn:aws:iam::ACCOUNT:role/MyExistingRole");
* SourceApiAssociation.Builder.create(this, "SourceApiAssociation2")
* .sourceApi(sourceApi)
* .mergedApi(importedMergedApi)
* .mergeType(MergeType.MANUAL_MERGE)
* .mergedApiExecutionRole(importedExecutionRole)
* .build();
* ```
*/
public interface GraphqlApiAttributes {
/**
* The GraphQl endpoint arn for the GraphQL API.
*
* Default: - none, required to construct event rules from imported APIs
*/
public fun graphQLEndpointArn(): String? = unwrap(this).getGraphQLEndpointArn()
/**
* the arn for the GraphQL Api.
*
* Default: - autogenerated arn
*/
public fun graphqlApiArn(): String? = unwrap(this).getGraphqlApiArn()
/**
* an unique AWS AppSync GraphQL API identifier i.e. 'lxz775lwdrgcndgz3nurvac7oa'.
*/
public fun graphqlApiId(): String
/**
* The Authorization Types for this GraphQL Api.
*
* Default: - none, required to construct event rules from imported APIs
*/
public fun modes(): List =
unwrap(this).getModes()?.map(AuthorizationType::wrap) ?: emptyList()
/**
* The GraphQl API visibility.
*
* Default: - GLOBAL
*/
public fun visibility(): Visibility? = unwrap(this).getVisibility()?.let(Visibility::wrap)
/**
* A builder for [GraphqlApiAttributes]
*/
@CdkDslMarker
public interface Builder {
/**
* @param graphQlEndpointArn The GraphQl endpoint arn for the GraphQL API.
*/
public fun graphQlEndpointArn(graphQlEndpointArn: String)
/**
* @param graphqlApiArn the arn for the GraphQL Api.
*/
public fun graphqlApiArn(graphqlApiArn: String)
/**
* @param graphqlApiId an unique AWS AppSync GraphQL API identifier i.e.
* 'lxz775lwdrgcndgz3nurvac7oa'.
*/
public fun graphqlApiId(graphqlApiId: String)
/**
* @param modes The Authorization Types for this GraphQL Api.
*/
public fun modes(modes: List)
/**
* @param modes The Authorization Types for this GraphQL Api.
*/
public fun modes(vararg modes: AuthorizationType)
/**
* @param visibility The GraphQl API visibility.
*/
public fun visibility(visibility: Visibility)
}
private class BuilderImpl : Builder {
private val cdkBuilder: software.amazon.awscdk.services.appsync.GraphqlApiAttributes.Builder =
software.amazon.awscdk.services.appsync.GraphqlApiAttributes.builder()
/**
* @param graphQlEndpointArn The GraphQl endpoint arn for the GraphQL API.
*/
override fun graphQlEndpointArn(graphQlEndpointArn: String) {
cdkBuilder.graphQlEndpointArn(graphQlEndpointArn)
}
/**
* @param graphqlApiArn the arn for the GraphQL Api.
*/
override fun graphqlApiArn(graphqlApiArn: String) {
cdkBuilder.graphqlApiArn(graphqlApiArn)
}
/**
* @param graphqlApiId an unique AWS AppSync GraphQL API identifier i.e.
* 'lxz775lwdrgcndgz3nurvac7oa'.
*/
override fun graphqlApiId(graphqlApiId: String) {
cdkBuilder.graphqlApiId(graphqlApiId)
}
/**
* @param modes The Authorization Types for this GraphQL Api.
*/
override fun modes(modes: List) {
cdkBuilder.modes(modes.map(AuthorizationType.Companion::unwrap))
}
/**
* @param modes The Authorization Types for this GraphQL Api.
*/
override fun modes(vararg modes: AuthorizationType): Unit = modes(modes.toList())
/**
* @param visibility The GraphQl API visibility.
*/
override fun visibility(visibility: Visibility) {
cdkBuilder.visibility(visibility.let(Visibility.Companion::unwrap))
}
public fun build(): software.amazon.awscdk.services.appsync.GraphqlApiAttributes =
cdkBuilder.build()
}
private class Wrapper(
cdkObject: software.amazon.awscdk.services.appsync.GraphqlApiAttributes,
) : CdkObject(cdkObject),
GraphqlApiAttributes {
/**
* The GraphQl endpoint arn for the GraphQL API.
*
* Default: - none, required to construct event rules from imported APIs
*/
override fun graphQLEndpointArn(): String? = unwrap(this).getGraphQLEndpointArn()
/**
* the arn for the GraphQL Api.
*
* Default: - autogenerated arn
*/
override fun graphqlApiArn(): String? = unwrap(this).getGraphqlApiArn()
/**
* an unique AWS AppSync GraphQL API identifier i.e. 'lxz775lwdrgcndgz3nurvac7oa'.
*/
override fun graphqlApiId(): String = unwrap(this).getGraphqlApiId()
/**
* The Authorization Types for this GraphQL Api.
*
* Default: - none, required to construct event rules from imported APIs
*/
override fun modes(): List =
unwrap(this).getModes()?.map(AuthorizationType::wrap) ?: emptyList()
/**
* The GraphQl API visibility.
*
* Default: - GLOBAL
*/
override fun visibility(): Visibility? = unwrap(this).getVisibility()?.let(Visibility::wrap)
}
public companion object {
public operator fun invoke(block: Builder.() -> Unit = {}): GraphqlApiAttributes {
val builderImpl = BuilderImpl()
return Wrapper(builderImpl.apply(block).build())
}
internal fun wrap(cdkObject: software.amazon.awscdk.services.appsync.GraphqlApiAttributes):
GraphqlApiAttributes = CdkObjectWrappers.wrap(cdkObject) as? GraphqlApiAttributes ?:
Wrapper(cdkObject)
internal fun unwrap(wrapped: GraphqlApiAttributes):
software.amazon.awscdk.services.appsync.GraphqlApiAttributes = (wrapped as
CdkObject).cdkObject as software.amazon.awscdk.services.appsync.GraphqlApiAttributes
}
}