software.amazon.awssdk.services.appsync.model.CreateDataSourceRequest Maven / Gradle / Ivy
Show all versions of appsync Show documentation
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.appsync.model;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class CreateDataSourceRequest extends AppSyncRequest implements
ToCopyableBuilder {
private static final SdkField API_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("apiId")
.getter(getter(CreateDataSourceRequest::apiId)).setter(setter(Builder::apiId))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("apiId").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("name")
.getter(getter(CreateDataSourceRequest::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("description").getter(getter(CreateDataSourceRequest::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("description").build()).build();
private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("type")
.getter(getter(CreateDataSourceRequest::typeAsString)).setter(setter(Builder::type))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("type").build()).build();
private static final SdkField SERVICE_ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("serviceRoleArn").getter(getter(CreateDataSourceRequest::serviceRoleArn))
.setter(setter(Builder::serviceRoleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("serviceRoleArn").build()).build();
private static final SdkField DYNAMODB_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("dynamodbConfig")
.getter(getter(CreateDataSourceRequest::dynamodbConfig)).setter(setter(Builder::dynamodbConfig))
.constructor(DynamodbDataSourceConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("dynamodbConfig").build()).build();
private static final SdkField LAMBDA_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("lambdaConfig")
.getter(getter(CreateDataSourceRequest::lambdaConfig)).setter(setter(Builder::lambdaConfig))
.constructor(LambdaDataSourceConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lambdaConfig").build()).build();
private static final SdkField ELASTICSEARCH_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("elasticsearchConfig")
.getter(getter(CreateDataSourceRequest::elasticsearchConfig)).setter(setter(Builder::elasticsearchConfig))
.constructor(ElasticsearchDataSourceConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("elasticsearchConfig").build())
.build();
private static final SdkField OPEN_SEARCH_SERVICE_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("openSearchServiceConfig")
.getter(getter(CreateDataSourceRequest::openSearchServiceConfig)).setter(setter(Builder::openSearchServiceConfig))
.constructor(OpenSearchServiceDataSourceConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("openSearchServiceConfig").build())
.build();
private static final SdkField HTTP_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("httpConfig")
.getter(getter(CreateDataSourceRequest::httpConfig)).setter(setter(Builder::httpConfig))
.constructor(HttpDataSourceConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("httpConfig").build()).build();
private static final SdkField RELATIONAL_DATABASE_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("relationalDatabaseConfig")
.getter(getter(CreateDataSourceRequest::relationalDatabaseConfig)).setter(setter(Builder::relationalDatabaseConfig))
.constructor(RelationalDatabaseDataSourceConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("relationalDatabaseConfig").build())
.build();
private static final SdkField EVENT_BRIDGE_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("eventBridgeConfig")
.getter(getter(CreateDataSourceRequest::eventBridgeConfig)).setter(setter(Builder::eventBridgeConfig))
.constructor(EventBridgeDataSourceConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("eventBridgeConfig").build()).build();
private static final SdkField METRICS_CONFIG_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("metricsConfig").getter(getter(CreateDataSourceRequest::metricsConfigAsString))
.setter(setter(Builder::metricsConfig))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("metricsConfig").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(API_ID_FIELD, NAME_FIELD,
DESCRIPTION_FIELD, TYPE_FIELD, SERVICE_ROLE_ARN_FIELD, DYNAMODB_CONFIG_FIELD, LAMBDA_CONFIG_FIELD,
ELASTICSEARCH_CONFIG_FIELD, OPEN_SEARCH_SERVICE_CONFIG_FIELD, HTTP_CONFIG_FIELD, RELATIONAL_DATABASE_CONFIG_FIELD,
EVENT_BRIDGE_CONFIG_FIELD, METRICS_CONFIG_FIELD));
private final String apiId;
private final String name;
private final String description;
private final String type;
private final String serviceRoleArn;
private final DynamodbDataSourceConfig dynamodbConfig;
private final LambdaDataSourceConfig lambdaConfig;
private final ElasticsearchDataSourceConfig elasticsearchConfig;
private final OpenSearchServiceDataSourceConfig openSearchServiceConfig;
private final HttpDataSourceConfig httpConfig;
private final RelationalDatabaseDataSourceConfig relationalDatabaseConfig;
private final EventBridgeDataSourceConfig eventBridgeConfig;
private final String metricsConfig;
private CreateDataSourceRequest(BuilderImpl builder) {
super(builder);
this.apiId = builder.apiId;
this.name = builder.name;
this.description = builder.description;
this.type = builder.type;
this.serviceRoleArn = builder.serviceRoleArn;
this.dynamodbConfig = builder.dynamodbConfig;
this.lambdaConfig = builder.lambdaConfig;
this.elasticsearchConfig = builder.elasticsearchConfig;
this.openSearchServiceConfig = builder.openSearchServiceConfig;
this.httpConfig = builder.httpConfig;
this.relationalDatabaseConfig = builder.relationalDatabaseConfig;
this.eventBridgeConfig = builder.eventBridgeConfig;
this.metricsConfig = builder.metricsConfig;
}
/**
*
* The API ID for the GraphQL API for the DataSource
.
*
*
* @return The API ID for the GraphQL API for the DataSource
.
*/
public final String apiId() {
return apiId;
}
/**
*
* A user-supplied name for the DataSource
.
*
*
* @return A user-supplied name for the DataSource
.
*/
public final String name() {
return name;
}
/**
*
* A description of the DataSource
.
*
*
* @return A description of the DataSource
.
*/
public final String description() {
return description;
}
/**
*
* The type of the DataSource
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link DataSourceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return The type of the DataSource
.
* @see DataSourceType
*/
public final DataSourceType type() {
return DataSourceType.fromValue(type);
}
/**
*
* The type of the DataSource
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link DataSourceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return The type of the DataSource
.
* @see DataSourceType
*/
public final String typeAsString() {
return type;
}
/**
*
* The Identity and Access Management (IAM) service role Amazon Resource Name (ARN) for the data source. The system
* assumes this role when accessing the data source.
*
*
* @return The Identity and Access Management (IAM) service role Amazon Resource Name (ARN) for the data source. The
* system assumes this role when accessing the data source.
*/
public final String serviceRoleArn() {
return serviceRoleArn;
}
/**
*
* Amazon DynamoDB settings.
*
*
* @return Amazon DynamoDB settings.
*/
public final DynamodbDataSourceConfig dynamodbConfig() {
return dynamodbConfig;
}
/**
*
* Lambda settings.
*
*
* @return Lambda settings.
*/
public final LambdaDataSourceConfig lambdaConfig() {
return lambdaConfig;
}
/**
*
* Amazon OpenSearch Service settings.
*
*
* As of September 2021, Amazon Elasticsearch service is Amazon OpenSearch Service. This configuration is
* deprecated. For new data sources, use CreateDataSourceRequest$openSearchServiceConfig to create an
* OpenSearch data source.
*
*
* @return Amazon OpenSearch Service settings.
*
* As of September 2021, Amazon Elasticsearch service is Amazon OpenSearch Service. This configuration is
* deprecated. For new data sources, use CreateDataSourceRequest$openSearchServiceConfig to create an
* OpenSearch data source.
*/
public final ElasticsearchDataSourceConfig elasticsearchConfig() {
return elasticsearchConfig;
}
/**
*
* Amazon OpenSearch Service settings.
*
*
* @return Amazon OpenSearch Service settings.
*/
public final OpenSearchServiceDataSourceConfig openSearchServiceConfig() {
return openSearchServiceConfig;
}
/**
*
* HTTP endpoint settings.
*
*
* @return HTTP endpoint settings.
*/
public final HttpDataSourceConfig httpConfig() {
return httpConfig;
}
/**
*
* Relational database settings.
*
*
* @return Relational database settings.
*/
public final RelationalDatabaseDataSourceConfig relationalDatabaseConfig() {
return relationalDatabaseConfig;
}
/**
*
* Amazon EventBridge settings.
*
*
* @return Amazon EventBridge settings.
*/
public final EventBridgeDataSourceConfig eventBridgeConfig() {
return eventBridgeConfig;
}
/**
*
* Enables or disables enhanced data source metrics for specified data sources. Note that metricsConfig
* won't be used unless the dataSourceLevelMetricsBehavior
value is set to
* PER_DATA_SOURCE_METRICS
. If the dataSourceLevelMetricsBehavior
is set to
* FULL_REQUEST_DATA_SOURCE_METRICS
instead, metricsConfig
will be ignored. However, you
* can still set its value.
*
*
* metricsConfig
can be ENABLED
or DISABLED
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #metricsConfig}
* will return {@link DataSourceLevelMetricsConfig#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #metricsConfigAsString}.
*
*
* @return Enables or disables enhanced data source metrics for specified data sources. Note that
* metricsConfig
won't be used unless the dataSourceLevelMetricsBehavior
value is
* set to PER_DATA_SOURCE_METRICS
. If the dataSourceLevelMetricsBehavior
is set to
* FULL_REQUEST_DATA_SOURCE_METRICS
instead, metricsConfig
will be ignored.
* However, you can still set its value.
*
* metricsConfig
can be ENABLED
or DISABLED
.
* @see DataSourceLevelMetricsConfig
*/
public final DataSourceLevelMetricsConfig metricsConfig() {
return DataSourceLevelMetricsConfig.fromValue(metricsConfig);
}
/**
*
* Enables or disables enhanced data source metrics for specified data sources. Note that metricsConfig
* won't be used unless the dataSourceLevelMetricsBehavior
value is set to
* PER_DATA_SOURCE_METRICS
. If the dataSourceLevelMetricsBehavior
is set to
* FULL_REQUEST_DATA_SOURCE_METRICS
instead, metricsConfig
will be ignored. However, you
* can still set its value.
*
*
* metricsConfig
can be ENABLED
or DISABLED
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #metricsConfig}
* will return {@link DataSourceLevelMetricsConfig#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #metricsConfigAsString}.
*
*
* @return Enables or disables enhanced data source metrics for specified data sources. Note that
* metricsConfig
won't be used unless the dataSourceLevelMetricsBehavior
value is
* set to PER_DATA_SOURCE_METRICS
. If the dataSourceLevelMetricsBehavior
is set to
* FULL_REQUEST_DATA_SOURCE_METRICS
instead, metricsConfig
will be ignored.
* However, you can still set its value.
*
* metricsConfig
can be ENABLED
or DISABLED
.
* @see DataSourceLevelMetricsConfig
*/
public final String metricsConfigAsString() {
return metricsConfig;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(apiId());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(typeAsString());
hashCode = 31 * hashCode + Objects.hashCode(serviceRoleArn());
hashCode = 31 * hashCode + Objects.hashCode(dynamodbConfig());
hashCode = 31 * hashCode + Objects.hashCode(lambdaConfig());
hashCode = 31 * hashCode + Objects.hashCode(elasticsearchConfig());
hashCode = 31 * hashCode + Objects.hashCode(openSearchServiceConfig());
hashCode = 31 * hashCode + Objects.hashCode(httpConfig());
hashCode = 31 * hashCode + Objects.hashCode(relationalDatabaseConfig());
hashCode = 31 * hashCode + Objects.hashCode(eventBridgeConfig());
hashCode = 31 * hashCode + Objects.hashCode(metricsConfigAsString());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateDataSourceRequest)) {
return false;
}
CreateDataSourceRequest other = (CreateDataSourceRequest) obj;
return Objects.equals(apiId(), other.apiId()) && Objects.equals(name(), other.name())
&& Objects.equals(description(), other.description()) && Objects.equals(typeAsString(), other.typeAsString())
&& Objects.equals(serviceRoleArn(), other.serviceRoleArn())
&& Objects.equals(dynamodbConfig(), other.dynamodbConfig())
&& Objects.equals(lambdaConfig(), other.lambdaConfig())
&& Objects.equals(elasticsearchConfig(), other.elasticsearchConfig())
&& Objects.equals(openSearchServiceConfig(), other.openSearchServiceConfig())
&& Objects.equals(httpConfig(), other.httpConfig())
&& Objects.equals(relationalDatabaseConfig(), other.relationalDatabaseConfig())
&& Objects.equals(eventBridgeConfig(), other.eventBridgeConfig())
&& Objects.equals(metricsConfigAsString(), other.metricsConfigAsString());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("CreateDataSourceRequest").add("ApiId", apiId()).add("Name", name())
.add("Description", description()).add("Type", typeAsString()).add("ServiceRoleArn", serviceRoleArn())
.add("DynamodbConfig", dynamodbConfig()).add("LambdaConfig", lambdaConfig())
.add("ElasticsearchConfig", elasticsearchConfig()).add("OpenSearchServiceConfig", openSearchServiceConfig())
.add("HttpConfig", httpConfig()).add("RelationalDatabaseConfig", relationalDatabaseConfig())
.add("EventBridgeConfig", eventBridgeConfig()).add("MetricsConfig", metricsConfigAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "apiId":
return Optional.ofNullable(clazz.cast(apiId()));
case "name":
return Optional.ofNullable(clazz.cast(name()));
case "description":
return Optional.ofNullable(clazz.cast(description()));
case "type":
return Optional.ofNullable(clazz.cast(typeAsString()));
case "serviceRoleArn":
return Optional.ofNullable(clazz.cast(serviceRoleArn()));
case "dynamodbConfig":
return Optional.ofNullable(clazz.cast(dynamodbConfig()));
case "lambdaConfig":
return Optional.ofNullable(clazz.cast(lambdaConfig()));
case "elasticsearchConfig":
return Optional.ofNullable(clazz.cast(elasticsearchConfig()));
case "openSearchServiceConfig":
return Optional.ofNullable(clazz.cast(openSearchServiceConfig()));
case "httpConfig":
return Optional.ofNullable(clazz.cast(httpConfig()));
case "relationalDatabaseConfig":
return Optional.ofNullable(clazz.cast(relationalDatabaseConfig()));
case "eventBridgeConfig":
return Optional.ofNullable(clazz.cast(eventBridgeConfig()));
case "metricsConfig":
return Optional.ofNullable(clazz.cast(metricsConfigAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function