# OpenSearchDataSourceProps

Properties for the OpenSearch Data Source.

Extends: [BackedDataSourceProps](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.BackedDataSourceProps.html)
Used as props by: [OpenSearchDataSource](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.OpenSearchDataSource.html)

- Source: [`aws-appsync/lib/data-source.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-appsync/lib/data-source.ts#L545)
- Type last changed: v2.60.0 · 12 Jan 2023

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_appsync as appsync } from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';
import { aws_opensearchservice as opensearchservice } from 'aws-cdk-lib';
import { aws_appsync as interfaces_appsync } from 'aws-cdk-lib/interfaces';

declare const domain: opensearchservice.Domain;
declare const graphQLApiRef: interfaces_appsync.IGraphQLApiRef;
declare const role: iam.Role;
const openSearchDataSourceProps: appsync.OpenSearchDataSourceProps = {
  api: graphQLApiRef,
  domain: domain,

  // the properties below are optional
  description: 'description',
  metricsConfig: appsync.DataSourceMetricsConfig.ENABLED,
  name: 'name',
  serviceRole: role,
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_appsync as appsync
from aws_cdk import aws_iam as iam
from aws_cdk import aws_opensearchservice as opensearchservice
from aws_cdk.interfaces import aws_appsync as interfaces_appsync

# domain: opensearchservice.Domain
# graph_ql_api_ref: interfaces_appsync.IGraphQLApiRef
# role: iam.Role

open_search_data_source_props = appsync.OpenSearchDataSourceProps(
    api=graph_ql_api_ref,
    domain=domain,

    # the properties below are optional
    description="description",
    metrics_config=appsync.DataSourceMetricsConfig.ENABLED,
    name="name",
    service_role=role
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.appsync.*;
import software.amazon.awscdk.services.iam.*;
import software.amazon.awscdk.services.opensearchservice.*;
import software.amazon.awscdk.interfaces.appsync.*;

Domain domain;
IGraphQLApiRef graphQLApiRef;
Role role;

OpenSearchDataSourceProps openSearchDataSourceProps = OpenSearchDataSourceProps.builder()
        .api(graphQLApiRef)
        .domain(domain)

        // the properties below are optional
        .description("description")
        .metricsConfig(DataSourceMetricsConfig.ENABLED)
        .name("name")
        .serviceRole(role)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.AppSync;
using Amazon.CDK.AWS.IAM;
using Amazon.CDK.AWS.OpenSearchService;
using Amazon.CDK.Interfaces.AppSync;

Domain domain;
IGraphQLApiRef graphQLApiRef;
Role role;

var openSearchDataSourceProps = new OpenSearchDataSourceProps {
    Api = graphQLApiRef,
    Domain = domain,

    // the properties below are optional
    Description = "description",
    MetricsConfig = DataSourceMetricsConfig.ENABLED,
    Name = "name",
    ServiceRole = role
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var domain Domain
var graphQLApiRef IGraphQLApiRef
var role Role

openSearchDataSourceProps := &OpenSearchDataSourceProps{
	Api: graphQLApiRef,
	Domain: domain,

	// the properties below are optional
	Description: jsii.String("description"),
	MetricsConfig: awscdk.Aws_appsync.DataSourceMetricsConfig_ENABLED,
	Name: jsii.String("name"),
	ServiceRole: role,
}
```

## Properties

- `api`: [IGraphQLApiRef](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_appsync.IGraphQLApiRef.html) (required) — The API to attach this data source to.

- `description`: string = None — the description of the data source.

- `domain`: [IDomain](/cdk/api/v2/docs/aws-cdk-lib.aws_opensearchservice.IDomain.html) (required) — The OpenSearch domain containing the endpoint for the data source.

- `metricsConfig`: [DataSourceMetricsConfig](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.DataSourceMetricsConfig.html) — Whether to enable enhanced metrics of the data source Value will be ignored, if `enhancedMetricsConfig.dataSourceLevelMetricsBehavior` on AppSync GraphqlApi construct is set to `FULL_REQUEST_DATA_SOURCE_METRICS`.

  **Default:** no metrics configuration

- `name`: string — The name of the data source.

  **Default:** id of data source

- `serviceRole`: [IRole](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) — The IAM service role to be assumed by AppSync to interact with the data source.

  **Default:** Create a new role
