
software.amazon.awssdk.services.sagemaker.model.Workforce Maven / Gradle / Ivy
/*
* 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.sagemaker.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;
/**
*
* A single private workforce, which is automatically created when you create your first private work team. You can
* create one private work force in each AWS Region. By default, any workforce-related API operation used in a specific
* region will apply to the workforce created in that region. To learn how to create a private workforce, see Create a Private
* Workforce.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Workforce implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField WORKFORCE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("WorkforceName").getter(getter(Workforce::workforceName)).setter(setter(Builder::workforceName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("WorkforceName").build()).build();
private static final SdkField WORKFORCE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("WorkforceArn").getter(getter(Workforce::workforceArn)).setter(setter(Builder::workforceArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("WorkforceArn").build()).build();
private static final SdkField LAST_UPDATED_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastUpdatedDate").getter(getter(Workforce::lastUpdatedDate)).setter(setter(Builder::lastUpdatedDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastUpdatedDate").build()).build();
private static final SdkField SOURCE_IP_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("SourceIpConfig")
.getter(getter(Workforce::sourceIpConfig)).setter(setter(Builder::sourceIpConfig))
.constructor(SourceIpConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceIpConfig").build()).build();
private static final SdkField SUB_DOMAIN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SubDomain").getter(getter(Workforce::subDomain)).setter(setter(Builder::subDomain))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SubDomain").build()).build();
private static final SdkField COGNITO_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("CognitoConfig")
.getter(getter(Workforce::cognitoConfig)).setter(setter(Builder::cognitoConfig)).constructor(CognitoConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CognitoConfig").build()).build();
private static final SdkField OIDC_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("OidcConfig")
.getter(getter(Workforce::oidcConfig)).setter(setter(Builder::oidcConfig))
.constructor(OidcConfigForResponse::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OidcConfig").build()).build();
private static final SdkField CREATE_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreateDate").getter(getter(Workforce::createDate)).setter(setter(Builder::createDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreateDate").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(WORKFORCE_NAME_FIELD,
WORKFORCE_ARN_FIELD, LAST_UPDATED_DATE_FIELD, SOURCE_IP_CONFIG_FIELD, SUB_DOMAIN_FIELD, COGNITO_CONFIG_FIELD,
OIDC_CONFIG_FIELD, CREATE_DATE_FIELD));
private static final long serialVersionUID = 1L;
private final String workforceName;
private final String workforceArn;
private final Instant lastUpdatedDate;
private final SourceIpConfig sourceIpConfig;
private final String subDomain;
private final CognitoConfig cognitoConfig;
private final OidcConfigForResponse oidcConfig;
private final Instant createDate;
private Workforce(BuilderImpl builder) {
this.workforceName = builder.workforceName;
this.workforceArn = builder.workforceArn;
this.lastUpdatedDate = builder.lastUpdatedDate;
this.sourceIpConfig = builder.sourceIpConfig;
this.subDomain = builder.subDomain;
this.cognitoConfig = builder.cognitoConfig;
this.oidcConfig = builder.oidcConfig;
this.createDate = builder.createDate;
}
/**
*
* The name of the private workforce.
*
*
* @return The name of the private workforce.
*/
public final String workforceName() {
return workforceName;
}
/**
*
* The Amazon Resource Name (ARN) of the private workforce.
*
*
* @return The Amazon Resource Name (ARN) of the private workforce.
*/
public final String workforceArn() {
return workforceArn;
}
/**
*
* The most recent date that was used to successfully add one or more IP address ranges (CIDRs) to a private workforce's
* allow list.
*
*
* @return The most recent date that was used to successfully add one or more IP address ranges (CIDRs) to a private
* workforce's allow list.
*/
public final Instant lastUpdatedDate() {
return lastUpdatedDate;
}
/**
*
* A list of one to ten IP address ranges (CIDRs) to be added to the workforce
* allow list. By default, a workforce isn't restricted to specific IP addresses.
*
*
* @return A list of one to ten IP address ranges (CIDRs) to be added to the
* workforce allow list. By default, a workforce isn't restricted to specific IP addresses.
*/
public final SourceIpConfig sourceIpConfig() {
return sourceIpConfig;
}
/**
*
* The subdomain for your OIDC Identity Provider.
*
*
* @return The subdomain for your OIDC Identity Provider.
*/
public final String subDomain() {
return subDomain;
}
/**
*
* The configuration of an Amazon Cognito workforce. A single Cognito workforce is created using and corresponds to
* a single
* Amazon Cognito user pool.
*
*
* @return The configuration of an Amazon Cognito workforce. A single Cognito workforce is created using and
* corresponds to a single Amazon
* Cognito user pool.
*/
public final CognitoConfig cognitoConfig() {
return cognitoConfig;
}
/**
*
* The configuration of an OIDC Identity Provider (IdP) private workforce.
*
*
* @return The configuration of an OIDC Identity Provider (IdP) private workforce.
*/
public final OidcConfigForResponse oidcConfig() {
return oidcConfig;
}
/**
*
* The date that the workforce is created.
*
*
* @return The date that the workforce is created.
*/
public final Instant createDate() {
return createDate;
}
@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 + Objects.hashCode(workforceName());
hashCode = 31 * hashCode + Objects.hashCode(workforceArn());
hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedDate());
hashCode = 31 * hashCode + Objects.hashCode(sourceIpConfig());
hashCode = 31 * hashCode + Objects.hashCode(subDomain());
hashCode = 31 * hashCode + Objects.hashCode(cognitoConfig());
hashCode = 31 * hashCode + Objects.hashCode(oidcConfig());
hashCode = 31 * hashCode + Objects.hashCode(createDate());
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 Workforce)) {
return false;
}
Workforce other = (Workforce) obj;
return Objects.equals(workforceName(), other.workforceName()) && Objects.equals(workforceArn(), other.workforceArn())
&& Objects.equals(lastUpdatedDate(), other.lastUpdatedDate())
&& Objects.equals(sourceIpConfig(), other.sourceIpConfig()) && Objects.equals(subDomain(), other.subDomain())
&& Objects.equals(cognitoConfig(), other.cognitoConfig()) && Objects.equals(oidcConfig(), other.oidcConfig())
&& Objects.equals(createDate(), other.createDate());
}
/**
* 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("Workforce").add("WorkforceName", workforceName()).add("WorkforceArn", workforceArn())
.add("LastUpdatedDate", lastUpdatedDate()).add("SourceIpConfig", sourceIpConfig()).add("SubDomain", subDomain())
.add("CognitoConfig", cognitoConfig()).add("OidcConfig", oidcConfig()).add("CreateDate", createDate()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "WorkforceName":
return Optional.ofNullable(clazz.cast(workforceName()));
case "WorkforceArn":
return Optional.ofNullable(clazz.cast(workforceArn()));
case "LastUpdatedDate":
return Optional.ofNullable(clazz.cast(lastUpdatedDate()));
case "SourceIpConfig":
return Optional.ofNullable(clazz.cast(sourceIpConfig()));
case "SubDomain":
return Optional.ofNullable(clazz.cast(subDomain()));
case "CognitoConfig":
return Optional.ofNullable(clazz.cast(cognitoConfig()));
case "OidcConfig":
return Optional.ofNullable(clazz.cast(oidcConfig()));
case "CreateDate":
return Optional.ofNullable(clazz.cast(createDate()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function