All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.ssmsap.model.Database Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Ssm Sap module holds the client classes that are used for communicating with Ssm Sap.

There is a newer version: 2.28.6
Show newest version
/*
 * 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.ssmsap.model;

import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collection;
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 java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* The SAP HANA database of the application registered with AWS Systems Manager for SAP. *

*/ @Generated("software.amazon.awssdk:codegen") public final class Database implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField APPLICATION_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ApplicationId").getter(getter(Database::applicationId)).setter(setter(Builder::applicationId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ApplicationId").build()).build(); private static final SdkField COMPONENT_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ComponentId").getter(getter(Database::componentId)).setter(setter(Builder::componentId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ComponentId").build()).build(); private static final SdkField> CREDENTIALS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Credentials") .getter(getter(Database::credentials)) .setter(setter(Builder::credentials)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Credentials").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(ApplicationCredential::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField DATABASE_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("DatabaseId").getter(getter(Database::databaseId)).setter(setter(Builder::databaseId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DatabaseId").build()).build(); private static final SdkField DATABASE_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("DatabaseName").getter(getter(Database::databaseName)).setter(setter(Builder::databaseName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DatabaseName").build()).build(); private static final SdkField DATABASE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("DatabaseType").getter(getter(Database::databaseTypeAsString)).setter(setter(Builder::databaseType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DatabaseType").build()).build(); private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Arn") .getter(getter(Database::arn)).setter(setter(Builder::arn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Arn").build()).build(); private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status") .getter(getter(Database::statusAsString)).setter(setter(Builder::status)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build(); private static final SdkField PRIMARY_HOST_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("PrimaryHost").getter(getter(Database::primaryHost)).setter(setter(Builder::primaryHost)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PrimaryHost").build()).build(); private static final SdkField SQL_PORT_FIELD = SdkField. builder(MarshallingType.INTEGER) .memberName("SQLPort").getter(getter(Database::sqlPort)).setter(setter(Builder::sqlPort)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SQLPort").build()).build(); private static final SdkField LAST_UPDATED_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("LastUpdated").getter(getter(Database::lastUpdated)).setter(setter(Builder::lastUpdated)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastUpdated").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(APPLICATION_ID_FIELD, COMPONENT_ID_FIELD, CREDENTIALS_FIELD, DATABASE_ID_FIELD, DATABASE_NAME_FIELD, DATABASE_TYPE_FIELD, ARN_FIELD, STATUS_FIELD, PRIMARY_HOST_FIELD, SQL_PORT_FIELD, LAST_UPDATED_FIELD)); private static final long serialVersionUID = 1L; private final String applicationId; private final String componentId; private final List credentials; private final String databaseId; private final String databaseName; private final String databaseType; private final String arn; private final String status; private final String primaryHost; private final Integer sqlPort; private final Instant lastUpdated; private Database(BuilderImpl builder) { this.applicationId = builder.applicationId; this.componentId = builder.componentId; this.credentials = builder.credentials; this.databaseId = builder.databaseId; this.databaseName = builder.databaseName; this.databaseType = builder.databaseType; this.arn = builder.arn; this.status = builder.status; this.primaryHost = builder.primaryHost; this.sqlPort = builder.sqlPort; this.lastUpdated = builder.lastUpdated; } /** *

* The ID of the application. *

* * @return The ID of the application. */ public final String applicationId() { return applicationId; } /** *

* The ID of the component. *

* * @return The ID of the component. */ public final String componentId() { return componentId; } /** * For responses, this returns true if the service returned a value for the Credentials property. This DOES NOT * check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasCredentials() { return credentials != null && !(credentials instanceof SdkAutoConstructList); } /** *

* The credentials of the database. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasCredentials} method. *

* * @return The credentials of the database. */ public final List credentials() { return credentials; } /** *

* The ID of the SAP HANA database. *

* * @return The ID of the SAP HANA database. */ public final String databaseId() { return databaseId; } /** *

* The name of the database. *

* * @return The name of the database. */ public final String databaseName() { return databaseName; } /** *

* The type of the database. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #databaseType} will * return {@link DatabaseType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #databaseTypeAsString}. *

* * @return The type of the database. * @see DatabaseType */ public final DatabaseType databaseType() { return DatabaseType.fromValue(databaseType); } /** *

* The type of the database. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #databaseType} will * return {@link DatabaseType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #databaseTypeAsString}. *

* * @return The type of the database. * @see DatabaseType */ public final String databaseTypeAsString() { return databaseType; } /** *

* The Amazon Resource Name (ARN) of the database. *

* * @return The Amazon Resource Name (ARN) of the database. */ public final String arn() { return arn; } /** *

* The status of the database. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #status} will * return {@link DatabaseStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #statusAsString}. *

* * @return The status of the database. * @see DatabaseStatus */ public final DatabaseStatus status() { return DatabaseStatus.fromValue(status); } /** *

* The status of the database. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #status} will * return {@link DatabaseStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #statusAsString}. *

* * @return The status of the database. * @see DatabaseStatus */ public final String statusAsString() { return status; } /** *

* The primary host of the database. *

* * @return The primary host of the database. */ public final String primaryHost() { return primaryHost; } /** *

* The SQL port of the database. *

* * @return The SQL port of the database. */ public final Integer sqlPort() { return sqlPort; } /** *

* The time at which the database was last updated. *

* * @return The time at which the database was last updated. */ public final Instant lastUpdated() { return lastUpdated; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(applicationId()); hashCode = 31 * hashCode + Objects.hashCode(componentId()); hashCode = 31 * hashCode + Objects.hashCode(hasCredentials() ? credentials() : null); hashCode = 31 * hashCode + Objects.hashCode(databaseId()); hashCode = 31 * hashCode + Objects.hashCode(databaseName()); hashCode = 31 * hashCode + Objects.hashCode(databaseTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(arn()); hashCode = 31 * hashCode + Objects.hashCode(statusAsString()); hashCode = 31 * hashCode + Objects.hashCode(primaryHost()); hashCode = 31 * hashCode + Objects.hashCode(sqlPort()); hashCode = 31 * hashCode + Objects.hashCode(lastUpdated()); return hashCode; } @Override public final boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Database)) { return false; } Database other = (Database) obj; return Objects.equals(applicationId(), other.applicationId()) && Objects.equals(componentId(), other.componentId()) && hasCredentials() == other.hasCredentials() && Objects.equals(credentials(), other.credentials()) && Objects.equals(databaseId(), other.databaseId()) && Objects.equals(databaseName(), other.databaseName()) && Objects.equals(databaseTypeAsString(), other.databaseTypeAsString()) && Objects.equals(arn(), other.arn()) && Objects.equals(statusAsString(), other.statusAsString()) && Objects.equals(primaryHost(), other.primaryHost()) && Objects.equals(sqlPort(), other.sqlPort()) && Objects.equals(lastUpdated(), other.lastUpdated()); } /** * 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("Database").add("ApplicationId", applicationId()).add("ComponentId", componentId()) .add("Credentials", hasCredentials() ? credentials() : null).add("DatabaseId", databaseId()) .add("DatabaseName", databaseName()).add("DatabaseType", databaseTypeAsString()).add("Arn", arn()) .add("Status", statusAsString()).add("PrimaryHost", primaryHost()).add("SQLPort", sqlPort()) .add("LastUpdated", lastUpdated()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "ApplicationId": return Optional.ofNullable(clazz.cast(applicationId())); case "ComponentId": return Optional.ofNullable(clazz.cast(componentId())); case "Credentials": return Optional.ofNullable(clazz.cast(credentials())); case "DatabaseId": return Optional.ofNullable(clazz.cast(databaseId())); case "DatabaseName": return Optional.ofNullable(clazz.cast(databaseName())); case "DatabaseType": return Optional.ofNullable(clazz.cast(databaseTypeAsString())); case "Arn": return Optional.ofNullable(clazz.cast(arn())); case "Status": return Optional.ofNullable(clazz.cast(statusAsString())); case "PrimaryHost": return Optional.ofNullable(clazz.cast(primaryHost())); case "SQLPort": return Optional.ofNullable(clazz.cast(sqlPort())); case "LastUpdated": return Optional.ofNullable(clazz.cast(lastUpdated())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((Database) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The ID of the application. *

* * @param applicationId * The ID of the application. * @return Returns a reference to this object so that method calls can be chained together. */ Builder applicationId(String applicationId); /** *

* The ID of the component. *

* * @param componentId * The ID of the component. * @return Returns a reference to this object so that method calls can be chained together. */ Builder componentId(String componentId); /** *

* The credentials of the database. *

* * @param credentials * The credentials of the database. * @return Returns a reference to this object so that method calls can be chained together. */ Builder credentials(Collection credentials); /** *

* The credentials of the database. *

* * @param credentials * The credentials of the database. * @return Returns a reference to this object so that method calls can be chained together. */ Builder credentials(ApplicationCredential... credentials); /** *

* The credentials of the database. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.ssmsap.model.ApplicationCredential.Builder} avoiding the need to * create one manually via {@link software.amazon.awssdk.services.ssmsap.model.ApplicationCredential#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.ssmsap.model.ApplicationCredential.Builder#build()} is called * immediately and its result is passed to {@link #credentials(List)}. * * @param credentials * a consumer that will call methods on * {@link software.amazon.awssdk.services.ssmsap.model.ApplicationCredential.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #credentials(java.util.Collection) */ Builder credentials(Consumer... credentials); /** *

* The ID of the SAP HANA database. *

* * @param databaseId * The ID of the SAP HANA database. * @return Returns a reference to this object so that method calls can be chained together. */ Builder databaseId(String databaseId); /** *

* The name of the database. *

* * @param databaseName * The name of the database. * @return Returns a reference to this object so that method calls can be chained together. */ Builder databaseName(String databaseName); /** *

* The type of the database. *

* * @param databaseType * The type of the database. * @see DatabaseType * @return Returns a reference to this object so that method calls can be chained together. * @see DatabaseType */ Builder databaseType(String databaseType); /** *

* The type of the database. *

* * @param databaseType * The type of the database. * @see DatabaseType * @return Returns a reference to this object so that method calls can be chained together. * @see DatabaseType */ Builder databaseType(DatabaseType databaseType); /** *

* The Amazon Resource Name (ARN) of the database. *

* * @param arn * The Amazon Resource Name (ARN) of the database. * @return Returns a reference to this object so that method calls can be chained together. */ Builder arn(String arn); /** *

* The status of the database. *

* * @param status * The status of the database. * @see DatabaseStatus * @return Returns a reference to this object so that method calls can be chained together. * @see DatabaseStatus */ Builder status(String status); /** *

* The status of the database. *

* * @param status * The status of the database. * @see DatabaseStatus * @return Returns a reference to this object so that method calls can be chained together. * @see DatabaseStatus */ Builder status(DatabaseStatus status); /** *

* The primary host of the database. *

* * @param primaryHost * The primary host of the database. * @return Returns a reference to this object so that method calls can be chained together. */ Builder primaryHost(String primaryHost); /** *

* The SQL port of the database. *

* * @param sqlPort * The SQL port of the database. * @return Returns a reference to this object so that method calls can be chained together. */ Builder sqlPort(Integer sqlPort); /** *

* The time at which the database was last updated. *

* * @param lastUpdated * The time at which the database was last updated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastUpdated(Instant lastUpdated); } static final class BuilderImpl implements Builder { private String applicationId; private String componentId; private List credentials = DefaultSdkAutoConstructList.getInstance(); private String databaseId; private String databaseName; private String databaseType; private String arn; private String status; private String primaryHost; private Integer sqlPort; private Instant lastUpdated; private BuilderImpl() { } private BuilderImpl(Database model) { applicationId(model.applicationId); componentId(model.componentId); credentials(model.credentials); databaseId(model.databaseId); databaseName(model.databaseName); databaseType(model.databaseType); arn(model.arn); status(model.status); primaryHost(model.primaryHost); sqlPort(model.sqlPort); lastUpdated(model.lastUpdated); } public final String getApplicationId() { return applicationId; } public final void setApplicationId(String applicationId) { this.applicationId = applicationId; } @Override public final Builder applicationId(String applicationId) { this.applicationId = applicationId; return this; } public final String getComponentId() { return componentId; } public final void setComponentId(String componentId) { this.componentId = componentId; } @Override public final Builder componentId(String componentId) { this.componentId = componentId; return this; } public final List getCredentials() { List result = ApplicationCredentialListCopier.copyToBuilder(this.credentials); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setCredentials(Collection credentials) { this.credentials = ApplicationCredentialListCopier.copyFromBuilder(credentials); } @Override public final Builder credentials(Collection credentials) { this.credentials = ApplicationCredentialListCopier.copy(credentials); return this; } @Override @SafeVarargs public final Builder credentials(ApplicationCredential... credentials) { credentials(Arrays.asList(credentials)); return this; } @Override @SafeVarargs public final Builder credentials(Consumer... credentials) { credentials(Stream.of(credentials).map(c -> ApplicationCredential.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final String getDatabaseId() { return databaseId; } public final void setDatabaseId(String databaseId) { this.databaseId = databaseId; } @Override public final Builder databaseId(String databaseId) { this.databaseId = databaseId; return this; } public final String getDatabaseName() { return databaseName; } public final void setDatabaseName(String databaseName) { this.databaseName = databaseName; } @Override public final Builder databaseName(String databaseName) { this.databaseName = databaseName; return this; } public final String getDatabaseType() { return databaseType; } public final void setDatabaseType(String databaseType) { this.databaseType = databaseType; } @Override public final Builder databaseType(String databaseType) { this.databaseType = databaseType; return this; } @Override public final Builder databaseType(DatabaseType databaseType) { this.databaseType(databaseType == null ? null : databaseType.toString()); return this; } public final String getArn() { return arn; } public final void setArn(String arn) { this.arn = arn; } @Override public final Builder arn(String arn) { this.arn = arn; return this; } public final String getStatus() { return status; } public final void setStatus(String status) { this.status = status; } @Override public final Builder status(String status) { this.status = status; return this; } @Override public final Builder status(DatabaseStatus status) { this.status(status == null ? null : status.toString()); return this; } public final String getPrimaryHost() { return primaryHost; } public final void setPrimaryHost(String primaryHost) { this.primaryHost = primaryHost; } @Override public final Builder primaryHost(String primaryHost) { this.primaryHost = primaryHost; return this; } public final Integer getSqlPort() { return sqlPort; } public final void setSqlPort(Integer sqlPort) { this.sqlPort = sqlPort; } @Override public final Builder sqlPort(Integer sqlPort) { this.sqlPort = sqlPort; return this; } public final Instant getLastUpdated() { return lastUpdated; } public final void setLastUpdated(Instant lastUpdated) { this.lastUpdated = lastUpdated; } @Override public final Builder lastUpdated(Instant lastUpdated) { this.lastUpdated = lastUpdated; return this; } @Override public Database build() { return new Database(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy