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

software.amazon.awssdk.services.eventbridge.model.Connection Maven / Gradle / Ivy

Go to download

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

There is a newer version: 2.29.39
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.eventbridge.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.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;

/**
 * 

* Contains information about a connection. *

*/ @Generated("software.amazon.awssdk:codegen") public final class Connection implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField CONNECTION_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ConnectionArn").getter(getter(Connection::connectionArn)).setter(setter(Builder::connectionArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ConnectionArn").build()).build(); private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name") .getter(getter(Connection::name)).setter(setter(Builder::name)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build(); private static final SdkField CONNECTION_STATE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ConnectionState").getter(getter(Connection::connectionStateAsString)) .setter(setter(Builder::connectionState)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ConnectionState").build()).build(); private static final SdkField STATE_REASON_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("StateReason").getter(getter(Connection::stateReason)).setter(setter(Builder::stateReason)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StateReason").build()).build(); private static final SdkField AUTHORIZATION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("AuthorizationType").getter(getter(Connection::authorizationTypeAsString)) .setter(setter(Builder::authorizationType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AuthorizationType").build()).build(); private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("CreationTime").getter(getter(Connection::creationTime)).setter(setter(Builder::creationTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build()).build(); private static final SdkField LAST_MODIFIED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("LastModifiedTime").getter(getter(Connection::lastModifiedTime)) .setter(setter(Builder::lastModifiedTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModifiedTime").build()).build(); private static final SdkField LAST_AUTHORIZED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("LastAuthorizedTime").getter(getter(Connection::lastAuthorizedTime)) .setter(setter(Builder::lastAuthorizedTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastAuthorizedTime").build()) .build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CONNECTION_ARN_FIELD, NAME_FIELD, CONNECTION_STATE_FIELD, STATE_REASON_FIELD, AUTHORIZATION_TYPE_FIELD, CREATION_TIME_FIELD, LAST_MODIFIED_TIME_FIELD, LAST_AUTHORIZED_TIME_FIELD)); private static final long serialVersionUID = 1L; private final String connectionArn; private final String name; private final String connectionState; private final String stateReason; private final String authorizationType; private final Instant creationTime; private final Instant lastModifiedTime; private final Instant lastAuthorizedTime; private Connection(BuilderImpl builder) { this.connectionArn = builder.connectionArn; this.name = builder.name; this.connectionState = builder.connectionState; this.stateReason = builder.stateReason; this.authorizationType = builder.authorizationType; this.creationTime = builder.creationTime; this.lastModifiedTime = builder.lastModifiedTime; this.lastAuthorizedTime = builder.lastAuthorizedTime; } /** *

* The ARN of the connection. *

* * @return The ARN of the connection. */ public final String connectionArn() { return connectionArn; } /** *

* The name of the connection. *

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

* The state of the connection. *

*

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

* * @return The state of the connection. * @see ConnectionState */ public final ConnectionState connectionState() { return ConnectionState.fromValue(connectionState); } /** *

* The state of the connection. *

*

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

* * @return The state of the connection. * @see ConnectionState */ public final String connectionStateAsString() { return connectionState; } /** *

* The reason that the connection is in the connection state. *

* * @return The reason that the connection is in the connection state. */ public final String stateReason() { return stateReason; } /** *

* The authorization type specified for the connection. *

* *

* OAUTH tokens are refreshed when a 401 or 407 response is returned. *

*
*

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

* * @return The authorization type specified for the connection.

*

* OAUTH tokens are refreshed when a 401 or 407 response is returned. *

* @see ConnectionAuthorizationType */ public final ConnectionAuthorizationType authorizationType() { return ConnectionAuthorizationType.fromValue(authorizationType); } /** *

* The authorization type specified for the connection. *

* *

* OAUTH tokens are refreshed when a 401 or 407 response is returned. *

*
*

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

* * @return The authorization type specified for the connection.

*

* OAUTH tokens are refreshed when a 401 or 407 response is returned. *

* @see ConnectionAuthorizationType */ public final String authorizationTypeAsString() { return authorizationType; } /** *

* A time stamp for the time that the connection was created. *

* * @return A time stamp for the time that the connection was created. */ public final Instant creationTime() { return creationTime; } /** *

* A time stamp for the time that the connection was last modified. *

* * @return A time stamp for the time that the connection was last modified. */ public final Instant lastModifiedTime() { return lastModifiedTime; } /** *

* A time stamp for the time that the connection was last authorized. *

* * @return A time stamp for the time that the connection was last authorized. */ public final Instant lastAuthorizedTime() { return lastAuthorizedTime; } @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(connectionArn()); hashCode = 31 * hashCode + Objects.hashCode(name()); hashCode = 31 * hashCode + Objects.hashCode(connectionStateAsString()); hashCode = 31 * hashCode + Objects.hashCode(stateReason()); hashCode = 31 * hashCode + Objects.hashCode(authorizationTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(creationTime()); hashCode = 31 * hashCode + Objects.hashCode(lastModifiedTime()); hashCode = 31 * hashCode + Objects.hashCode(lastAuthorizedTime()); 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 Connection)) { return false; } Connection other = (Connection) obj; return Objects.equals(connectionArn(), other.connectionArn()) && Objects.equals(name(), other.name()) && Objects.equals(connectionStateAsString(), other.connectionStateAsString()) && Objects.equals(stateReason(), other.stateReason()) && Objects.equals(authorizationTypeAsString(), other.authorizationTypeAsString()) && Objects.equals(creationTime(), other.creationTime()) && Objects.equals(lastModifiedTime(), other.lastModifiedTime()) && Objects.equals(lastAuthorizedTime(), other.lastAuthorizedTime()); } /** * 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("Connection").add("ConnectionArn", connectionArn()).add("Name", name()) .add("ConnectionState", connectionStateAsString()).add("StateReason", stateReason()) .add("AuthorizationType", authorizationTypeAsString()).add("CreationTime", creationTime()) .add("LastModifiedTime", lastModifiedTime()).add("LastAuthorizedTime", lastAuthorizedTime()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "ConnectionArn": return Optional.ofNullable(clazz.cast(connectionArn())); case "Name": return Optional.ofNullable(clazz.cast(name())); case "ConnectionState": return Optional.ofNullable(clazz.cast(connectionStateAsString())); case "StateReason": return Optional.ofNullable(clazz.cast(stateReason())); case "AuthorizationType": return Optional.ofNullable(clazz.cast(authorizationTypeAsString())); case "CreationTime": return Optional.ofNullable(clazz.cast(creationTime())); case "LastModifiedTime": return Optional.ofNullable(clazz.cast(lastModifiedTime())); case "LastAuthorizedTime": return Optional.ofNullable(clazz.cast(lastAuthorizedTime())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((Connection) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The ARN of the connection. *

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

* The name of the connection. *

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

* The state of the connection. *

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

* The state of the connection. *

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

* The reason that the connection is in the connection state. *

* * @param stateReason * The reason that the connection is in the connection state. * @return Returns a reference to this object so that method calls can be chained together. */ Builder stateReason(String stateReason); /** *

* The authorization type specified for the connection. *

* *

* OAUTH tokens are refreshed when a 401 or 407 response is returned. *

*
* * @param authorizationType * The authorization type specified for the connection.

*

* OAUTH tokens are refreshed when a 401 or 407 response is returned. *

* @see ConnectionAuthorizationType * @return Returns a reference to this object so that method calls can be chained together. * @see ConnectionAuthorizationType */ Builder authorizationType(String authorizationType); /** *

* The authorization type specified for the connection. *

* *

* OAUTH tokens are refreshed when a 401 or 407 response is returned. *

*
* * @param authorizationType * The authorization type specified for the connection.

*

* OAUTH tokens are refreshed when a 401 or 407 response is returned. *

* @see ConnectionAuthorizationType * @return Returns a reference to this object so that method calls can be chained together. * @see ConnectionAuthorizationType */ Builder authorizationType(ConnectionAuthorizationType authorizationType); /** *

* A time stamp for the time that the connection was created. *

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

* A time stamp for the time that the connection was last modified. *

* * @param lastModifiedTime * A time stamp for the time that the connection was last modified. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastModifiedTime(Instant lastModifiedTime); /** *

* A time stamp for the time that the connection was last authorized. *

* * @param lastAuthorizedTime * A time stamp for the time that the connection was last authorized. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastAuthorizedTime(Instant lastAuthorizedTime); } static final class BuilderImpl implements Builder { private String connectionArn; private String name; private String connectionState; private String stateReason; private String authorizationType; private Instant creationTime; private Instant lastModifiedTime; private Instant lastAuthorizedTime; private BuilderImpl() { } private BuilderImpl(Connection model) { connectionArn(model.connectionArn); name(model.name); connectionState(model.connectionState); stateReason(model.stateReason); authorizationType(model.authorizationType); creationTime(model.creationTime); lastModifiedTime(model.lastModifiedTime); lastAuthorizedTime(model.lastAuthorizedTime); } public final String getConnectionArn() { return connectionArn; } public final void setConnectionArn(String connectionArn) { this.connectionArn = connectionArn; } @Override public final Builder connectionArn(String connectionArn) { this.connectionArn = connectionArn; return this; } public final String getName() { return name; } public final void setName(String name) { this.name = name; } @Override public final Builder name(String name) { this.name = name; return this; } public final String getConnectionState() { return connectionState; } public final void setConnectionState(String connectionState) { this.connectionState = connectionState; } @Override public final Builder connectionState(String connectionState) { this.connectionState = connectionState; return this; } @Override public final Builder connectionState(ConnectionState connectionState) { this.connectionState(connectionState == null ? null : connectionState.toString()); return this; } public final String getStateReason() { return stateReason; } public final void setStateReason(String stateReason) { this.stateReason = stateReason; } @Override public final Builder stateReason(String stateReason) { this.stateReason = stateReason; return this; } public final String getAuthorizationType() { return authorizationType; } public final void setAuthorizationType(String authorizationType) { this.authorizationType = authorizationType; } @Override public final Builder authorizationType(String authorizationType) { this.authorizationType = authorizationType; return this; } @Override public final Builder authorizationType(ConnectionAuthorizationType authorizationType) { this.authorizationType(authorizationType == null ? null : authorizationType.toString()); return this; } public final Instant getCreationTime() { return creationTime; } public final void setCreationTime(Instant creationTime) { this.creationTime = creationTime; } @Override public final Builder creationTime(Instant creationTime) { this.creationTime = creationTime; return this; } public final Instant getLastModifiedTime() { return lastModifiedTime; } public final void setLastModifiedTime(Instant lastModifiedTime) { this.lastModifiedTime = lastModifiedTime; } @Override public final Builder lastModifiedTime(Instant lastModifiedTime) { this.lastModifiedTime = lastModifiedTime; return this; } public final Instant getLastAuthorizedTime() { return lastAuthorizedTime; } public final void setLastAuthorizedTime(Instant lastAuthorizedTime) { this.lastAuthorizedTime = lastAuthorizedTime; } @Override public final Builder lastAuthorizedTime(Instant lastAuthorizedTime) { this.lastAuthorizedTime = lastAuthorizedTime; return this; } @Override public Connection build() { return new Connection(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy