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

software.amazon.awssdk.services.workspaces.model.ApplicationResourceAssociation Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon WorkSpaces module holds the client classes that are used for communicating with Amazon WorkSpaces Service

There is a newer version: 2.29.15
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.workspaces.model;

import java.io.Serializable;
import java.time.Instant;
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.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;

/**
 * 

* Describes the association between an application and an application resource. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ApplicationResourceAssociation implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField APPLICATION_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ApplicationId").getter(getter(ApplicationResourceAssociation::applicationId)) .setter(setter(Builder::applicationId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ApplicationId").build()).build(); private static final SdkField ASSOCIATED_RESOURCE_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("AssociatedResourceId").getter(getter(ApplicationResourceAssociation::associatedResourceId)) .setter(setter(Builder::associatedResourceId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AssociatedResourceId").build()) .build(); private static final SdkField ASSOCIATED_RESOURCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("AssociatedResourceType").getter(getter(ApplicationResourceAssociation::associatedResourceTypeAsString)) .setter(setter(Builder::associatedResourceType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AssociatedResourceType").build()) .build(); private static final SdkField CREATED_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("Created").getter(getter(ApplicationResourceAssociation::created)).setter(setter(Builder::created)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Created").build()).build(); private static final SdkField LAST_UPDATED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("LastUpdatedTime").getter(getter(ApplicationResourceAssociation::lastUpdatedTime)) .setter(setter(Builder::lastUpdatedTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastUpdatedTime").build()).build(); private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State") .getter(getter(ApplicationResourceAssociation::stateAsString)).setter(setter(Builder::state)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build(); private static final SdkField STATE_REASON_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("StateReason") .getter(getter(ApplicationResourceAssociation::stateReason)).setter(setter(Builder::stateReason)) .constructor(AssociationStateReason::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StateReason").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(APPLICATION_ID_FIELD, ASSOCIATED_RESOURCE_ID_FIELD, ASSOCIATED_RESOURCE_TYPE_FIELD, CREATED_FIELD, LAST_UPDATED_TIME_FIELD, STATE_FIELD, STATE_REASON_FIELD)); private static final long serialVersionUID = 1L; private final String applicationId; private final String associatedResourceId; private final String associatedResourceType; private final Instant created; private final Instant lastUpdatedTime; private final String state; private final AssociationStateReason stateReason; private ApplicationResourceAssociation(BuilderImpl builder) { this.applicationId = builder.applicationId; this.associatedResourceId = builder.associatedResourceId; this.associatedResourceType = builder.associatedResourceType; this.created = builder.created; this.lastUpdatedTime = builder.lastUpdatedTime; this.state = builder.state; this.stateReason = builder.stateReason; } /** *

* The identifier of the application. *

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

* The identifier of the associated resource. *

* * @return The identifier of the associated resource. */ public final String associatedResourceId() { return associatedResourceId; } /** *

* The resource type of the associated resource. *

*

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

* * @return The resource type of the associated resource. * @see ApplicationAssociatedResourceType */ public final ApplicationAssociatedResourceType associatedResourceType() { return ApplicationAssociatedResourceType.fromValue(associatedResourceType); } /** *

* The resource type of the associated resource. *

*

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

* * @return The resource type of the associated resource. * @see ApplicationAssociatedResourceType */ public final String associatedResourceTypeAsString() { return associatedResourceType; } /** *

* The time the association was created. *

* * @return The time the association was created. */ public final Instant created() { return created; } /** *

* The time the association status was last updated. *

* * @return The time the association status was last updated. */ public final Instant lastUpdatedTime() { return lastUpdatedTime; } /** *

* The status of the application resource association. *

*

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

* * @return The status of the application resource association. * @see AssociationState */ public final AssociationState state() { return AssociationState.fromValue(state); } /** *

* The status of the application resource association. *

*

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

* * @return The status of the application resource association. * @see AssociationState */ public final String stateAsString() { return state; } /** *

* The reason the association deployment failed. *

* * @return The reason the association deployment failed. */ public final AssociationStateReason stateReason() { return stateReason; } @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(associatedResourceId()); hashCode = 31 * hashCode + Objects.hashCode(associatedResourceTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(created()); hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedTime()); hashCode = 31 * hashCode + Objects.hashCode(stateAsString()); hashCode = 31 * hashCode + Objects.hashCode(stateReason()); 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 ApplicationResourceAssociation)) { return false; } ApplicationResourceAssociation other = (ApplicationResourceAssociation) obj; return Objects.equals(applicationId(), other.applicationId()) && Objects.equals(associatedResourceId(), other.associatedResourceId()) && Objects.equals(associatedResourceTypeAsString(), other.associatedResourceTypeAsString()) && Objects.equals(created(), other.created()) && Objects.equals(lastUpdatedTime(), other.lastUpdatedTime()) && Objects.equals(stateAsString(), other.stateAsString()) && Objects.equals(stateReason(), other.stateReason()); } /** * 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("ApplicationResourceAssociation").add("ApplicationId", applicationId()) .add("AssociatedResourceId", associatedResourceId()) .add("AssociatedResourceType", associatedResourceTypeAsString()).add("Created", created()) .add("LastUpdatedTime", lastUpdatedTime()).add("State", stateAsString()).add("StateReason", stateReason()) .build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "ApplicationId": return Optional.ofNullable(clazz.cast(applicationId())); case "AssociatedResourceId": return Optional.ofNullable(clazz.cast(associatedResourceId())); case "AssociatedResourceType": return Optional.ofNullable(clazz.cast(associatedResourceTypeAsString())); case "Created": return Optional.ofNullable(clazz.cast(created())); case "LastUpdatedTime": return Optional.ofNullable(clazz.cast(lastUpdatedTime())); case "State": return Optional.ofNullable(clazz.cast(stateAsString())); case "StateReason": return Optional.ofNullable(clazz.cast(stateReason())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((ApplicationResourceAssociation) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The identifier of the application. *

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

* The identifier of the associated resource. *

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

* The resource type of the associated resource. *

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

* The resource type of the associated resource. *

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

* The time the association was created. *

* * @param created * The time the association was created. * @return Returns a reference to this object so that method calls can be chained together. */ Builder created(Instant created); /** *

* The time the association status was last updated. *

* * @param lastUpdatedTime * The time the association status was last updated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastUpdatedTime(Instant lastUpdatedTime); /** *

* The status of the application resource association. *

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

* The status of the application resource association. *

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

* The reason the association deployment failed. *

* * @param stateReason * The reason the association deployment failed. * @return Returns a reference to this object so that method calls can be chained together. */ Builder stateReason(AssociationStateReason stateReason); /** *

* The reason the association deployment failed. *

* This is a convenience method that creates an instance of the {@link AssociationStateReason.Builder} avoiding * the need to create one manually via {@link AssociationStateReason#builder()}. * *

* When the {@link Consumer} completes, {@link AssociationStateReason.Builder#build()} is called immediately and * its result is passed to {@link #stateReason(AssociationStateReason)}. * * @param stateReason * a consumer that will call methods on {@link AssociationStateReason.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #stateReason(AssociationStateReason) */ default Builder stateReason(Consumer stateReason) { return stateReason(AssociationStateReason.builder().applyMutation(stateReason).build()); } } static final class BuilderImpl implements Builder { private String applicationId; private String associatedResourceId; private String associatedResourceType; private Instant created; private Instant lastUpdatedTime; private String state; private AssociationStateReason stateReason; private BuilderImpl() { } private BuilderImpl(ApplicationResourceAssociation model) { applicationId(model.applicationId); associatedResourceId(model.associatedResourceId); associatedResourceType(model.associatedResourceType); created(model.created); lastUpdatedTime(model.lastUpdatedTime); state(model.state); stateReason(model.stateReason); } 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 getAssociatedResourceId() { return associatedResourceId; } public final void setAssociatedResourceId(String associatedResourceId) { this.associatedResourceId = associatedResourceId; } @Override public final Builder associatedResourceId(String associatedResourceId) { this.associatedResourceId = associatedResourceId; return this; } public final String getAssociatedResourceType() { return associatedResourceType; } public final void setAssociatedResourceType(String associatedResourceType) { this.associatedResourceType = associatedResourceType; } @Override public final Builder associatedResourceType(String associatedResourceType) { this.associatedResourceType = associatedResourceType; return this; } @Override public final Builder associatedResourceType(ApplicationAssociatedResourceType associatedResourceType) { this.associatedResourceType(associatedResourceType == null ? null : associatedResourceType.toString()); return this; } public final Instant getCreated() { return created; } public final void setCreated(Instant created) { this.created = created; } @Override public final Builder created(Instant created) { this.created = created; return this; } public final Instant getLastUpdatedTime() { return lastUpdatedTime; } public final void setLastUpdatedTime(Instant lastUpdatedTime) { this.lastUpdatedTime = lastUpdatedTime; } @Override public final Builder lastUpdatedTime(Instant lastUpdatedTime) { this.lastUpdatedTime = lastUpdatedTime; return this; } public final String getState() { return state; } public final void setState(String state) { this.state = state; } @Override public final Builder state(String state) { this.state = state; return this; } @Override public final Builder state(AssociationState state) { this.state(state == null ? null : state.toString()); return this; } public final AssociationStateReason.Builder getStateReason() { return stateReason != null ? stateReason.toBuilder() : null; } public final void setStateReason(AssociationStateReason.BuilderImpl stateReason) { this.stateReason = stateReason != null ? stateReason.build() : null; } @Override public final Builder stateReason(AssociationStateReason stateReason) { this.stateReason = stateReason; return this; } @Override public ApplicationResourceAssociation build() { return new ApplicationResourceAssociation(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy