Class DataSource
Provides an AppSync DataSource.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var exampleTable = new Aws.DynamoDB.Table("exampleTable", new Aws.DynamoDB.TableArgs
{
Attributes =
{
new Aws.DynamoDB.Inputs.TableAttributeArgs
{
Name = "UserId",
Type = "S",
},
},
HashKey = "UserId",
ReadCapacity = 1,
WriteCapacity = 1,
});
var exampleRole = new Aws.Iam.Role("exampleRole", new Aws.Iam.RoleArgs
{
AssumeRolePolicy = @"{
""Version"": ""2012-10-17"",
""Statement"": [
{
""Action"": ""sts:AssumeRole"",
""Principal"": {
""Service"": ""appsync.amazonaws.com""
},
""Effect"": ""Allow""
}
]
}
",
});
var exampleRolePolicy = new Aws.Iam.RolePolicy("exampleRolePolicy", new Aws.Iam.RolePolicyArgs
{
Policy = exampleTable.Arn.Apply(arn => @$"{{
""Version"": ""2012-10-17"",
""Statement"": [
{{
""Action"": [
""dynamodb:*""
],
""Effect"": ""Allow"",
""Resource"": [
""{arn}""
]
}}
]
}}
"),
Role = exampleRole.Id,
});
var exampleGraphQLApi = new Aws.AppSync.GraphQLApi("exampleGraphQLApi", new Aws.AppSync.GraphQLApiArgs
{
AuthenticationType = "API_KEY",
});
var exampleDataSource = new Aws.AppSync.DataSource("exampleDataSource", new Aws.AppSync.DataSourceArgs
{
ApiId = exampleGraphQLApi.Id,
DynamodbConfig = new Aws.AppSync.Inputs.DataSourceDynamodbConfigArgs
{
TableName = exampleTable.Name,
},
ServiceRoleArn = exampleRole.Arn,
Type = "AMAZON_DYNAMODB",
});
}
}
Inherited Members
Namespace: Pulumi.Aws.AppSync
Assembly: Pulumi.Aws.dll
Syntax
public class DataSource : CustomResource
Constructors
View SourceDataSource(String, DataSourceArgs, CustomResourceOptions)
Create a DataSource resource with the given unique name, arguments, and options.
Declaration
public DataSource(string name, DataSourceArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| DataSourceArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceApiId
The API ID for the GraphQL API for the DataSource.
Declaration
public Output<string> ApiId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Arn
The ARN
Declaration
public Output<string> Arn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Description
A description of the DataSource.
Declaration
public Output<string> Description { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
DynamodbConfig
DynamoDB settings. See below
Declaration
public Output<DataSourceDynamodbConfig> DynamodbConfig { get; }
Property Value
| Type | Description |
|---|---|
| Output<DataSourceDynamodbConfig> |
ElasticsearchConfig
Amazon Elasticsearch settings. See below
Declaration
public Output<DataSourceElasticsearchConfig> ElasticsearchConfig { get; }
Property Value
| Type | Description |
|---|---|
| Output<DataSourceElasticsearchConfig> |
HttpConfig
HTTP settings. See below
Declaration
public Output<DataSourceHttpConfig> HttpConfig { get; }
Property Value
| Type | Description |
|---|---|
| Output<DataSourceHttpConfig> |
LambdaConfig
AWS Lambda settings. See below
Declaration
public Output<DataSourceLambdaConfig> LambdaConfig { get; }
Property Value
| Type | Description |
|---|---|
| Output<DataSourceLambdaConfig> |
Name
A user-supplied name for the DataSource.
Declaration
public Output<string> Name { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ServiceRoleArn
The IAM service role ARN for the data source.
Declaration
public Output<string> ServiceRoleArn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Type
The type of the DataSource. Valid values: AWS_LAMBDA, AMAZON_DYNAMODB, AMAZON_ELASTICSEARCH, HTTP, NONE.
Declaration
public Output<string> Type { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, DataSourceState, CustomResourceOptions)
Get an existing DataSource resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static DataSource Get(string name, Input<string> id, DataSourceState 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. |
| DataSourceState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| DataSource |