software.amazon.awssdk.services.ssooidc.model.StartDeviceAuthorizationResponse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ssooidc Show documentation
Show all versions of ssooidc Show documentation
The AWS Java SDK for SSO OIDC module holds the client classes that are used for
communicating with SSO OIDC.
The 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.ssooidc.model;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class StartDeviceAuthorizationResponse extends SsoOidcResponse implements
ToCopyableBuilder {
private static final SdkField DEVICE_CODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("deviceCode").getter(getter(StartDeviceAuthorizationResponse::deviceCode))
.setter(setter(Builder::deviceCode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("deviceCode").build()).build();
private static final SdkField USER_CODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("userCode").getter(getter(StartDeviceAuthorizationResponse::userCode)).setter(setter(Builder::userCode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("userCode").build()).build();
private static final SdkField VERIFICATION_URI_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("verificationUri").getter(getter(StartDeviceAuthorizationResponse::verificationUri))
.setter(setter(Builder::verificationUri))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("verificationUri").build()).build();
private static final SdkField VERIFICATION_URI_COMPLETE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("verificationUriComplete").getter(getter(StartDeviceAuthorizationResponse::verificationUriComplete))
.setter(setter(Builder::verificationUriComplete))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("verificationUriComplete").build())
.build();
private static final SdkField EXPIRES_IN_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("expiresIn").getter(getter(StartDeviceAuthorizationResponse::expiresIn))
.setter(setter(Builder::expiresIn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("expiresIn").build()).build();
private static final SdkField INTERVAL_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("interval").getter(getter(StartDeviceAuthorizationResponse::interval)).setter(setter(Builder::interval))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("interval").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DEVICE_CODE_FIELD,
USER_CODE_FIELD, VERIFICATION_URI_FIELD, VERIFICATION_URI_COMPLETE_FIELD, EXPIRES_IN_FIELD, INTERVAL_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("deviceCode", DEVICE_CODE_FIELD);
put("userCode", USER_CODE_FIELD);
put("verificationUri", VERIFICATION_URI_FIELD);
put("verificationUriComplete", VERIFICATION_URI_COMPLETE_FIELD);
put("expiresIn", EXPIRES_IN_FIELD);
put("interval", INTERVAL_FIELD);
}
});
private final String deviceCode;
private final String userCode;
private final String verificationUri;
private final String verificationUriComplete;
private final Integer expiresIn;
private final Integer interval;
private StartDeviceAuthorizationResponse(BuilderImpl builder) {
super(builder);
this.deviceCode = builder.deviceCode;
this.userCode = builder.userCode;
this.verificationUri = builder.verificationUri;
this.verificationUriComplete = builder.verificationUriComplete;
this.expiresIn = builder.expiresIn;
this.interval = builder.interval;
}
/**
*
* The short-lived code that is used by the device when polling for a session token.
*
*
* @return The short-lived code that is used by the device when polling for a session token.
*/
public final String deviceCode() {
return deviceCode;
}
/**
*
* A one-time user verification code. This is needed to authorize an in-use device.
*
*
* @return A one-time user verification code. This is needed to authorize an in-use device.
*/
public final String userCode() {
return userCode;
}
/**
*
* The URI of the verification page that takes the userCode
to authorize the device.
*
*
* @return The URI of the verification page that takes the userCode
to authorize the device.
*/
public final String verificationUri() {
return verificationUri;
}
/**
*
* An alternate URL that the client can use to automatically launch a browser. This process skips the manual step in
* which the user visits the verification page and enters their code.
*
*
* @return An alternate URL that the client can use to automatically launch a browser. This process skips the manual
* step in which the user visits the verification page and enters their code.
*/
public final String verificationUriComplete() {
return verificationUriComplete;
}
/**
*
* Indicates the number of seconds in which the verification code will become invalid.
*
*
* @return Indicates the number of seconds in which the verification code will become invalid.
*/
public final Integer expiresIn() {
return expiresIn;
}
/**
*
* Indicates the number of seconds the client must wait between attempts when polling for a session.
*
*
* @return Indicates the number of seconds the client must wait between attempts when polling for a session.
*/
public final Integer interval() {
return interval;
}
@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(deviceCode());
hashCode = 31 * hashCode + Objects.hashCode(userCode());
hashCode = 31 * hashCode + Objects.hashCode(verificationUri());
hashCode = 31 * hashCode + Objects.hashCode(verificationUriComplete());
hashCode = 31 * hashCode + Objects.hashCode(expiresIn());
hashCode = 31 * hashCode + Objects.hashCode(interval());
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 StartDeviceAuthorizationResponse)) {
return false;
}
StartDeviceAuthorizationResponse other = (StartDeviceAuthorizationResponse) obj;
return Objects.equals(deviceCode(), other.deviceCode()) && Objects.equals(userCode(), other.userCode())
&& Objects.equals(verificationUri(), other.verificationUri())
&& Objects.equals(verificationUriComplete(), other.verificationUriComplete())
&& Objects.equals(expiresIn(), other.expiresIn()) && Objects.equals(interval(), other.interval());
}
/**
* 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("StartDeviceAuthorizationResponse").add("DeviceCode", deviceCode()).add("UserCode", userCode())
.add("VerificationUri", verificationUri()).add("VerificationUriComplete", verificationUriComplete())
.add("ExpiresIn", expiresIn()).add("Interval", interval()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "deviceCode":
return Optional.ofNullable(clazz.cast(deviceCode()));
case "userCode":
return Optional.ofNullable(clazz.cast(userCode()));
case "verificationUri":
return Optional.ofNullable(clazz.cast(verificationUri()));
case "verificationUriComplete":
return Optional.ofNullable(clazz.cast(verificationUriComplete()));
case "expiresIn":
return Optional.ofNullable(clazz.cast(expiresIn()));
case "interval":
return Optional.ofNullable(clazz.cast(interval()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function