Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
software.amazon.awssdk.services.eks.model.CreatePodIdentityAssociationRequest 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.eks.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.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
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.DefaultValueTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
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 CreatePodIdentityAssociationRequest extends EksRequest implements
ToCopyableBuilder {
private static final SdkField CLUSTER_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("clusterName").getter(getter(CreatePodIdentityAssociationRequest::clusterName))
.setter(setter(Builder::clusterName))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("name").build()).build();
private static final SdkField NAMESPACE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("namespace").getter(getter(CreatePodIdentityAssociationRequest::namespace))
.setter(setter(Builder::namespace))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("namespace").build()).build();
private static final SdkField SERVICE_ACCOUNT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("serviceAccount").getter(getter(CreatePodIdentityAssociationRequest::serviceAccount))
.setter(setter(Builder::serviceAccount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("serviceAccount").build()).build();
private static final SdkField ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("roleArn").getter(getter(CreatePodIdentityAssociationRequest::roleArn)).setter(setter(Builder::roleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("roleArn").build()).build();
private static final SdkField CLIENT_REQUEST_TOKEN_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("clientRequestToken")
.getter(getter(CreatePodIdentityAssociationRequest::clientRequestToken))
.setter(setter(Builder::clientRequestToken))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("clientRequestToken").build(),
DefaultValueTrait.idempotencyToken()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("tags")
.getter(getter(CreatePodIdentityAssociationRequest::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tags").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CLUSTER_NAME_FIELD,
NAMESPACE_FIELD, SERVICE_ACCOUNT_FIELD, ROLE_ARN_FIELD, CLIENT_REQUEST_TOKEN_FIELD, TAGS_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private final String clusterName;
private final String namespace;
private final String serviceAccount;
private final String roleArn;
private final String clientRequestToken;
private final Map tags;
private CreatePodIdentityAssociationRequest(BuilderImpl builder) {
super(builder);
this.clusterName = builder.clusterName;
this.namespace = builder.namespace;
this.serviceAccount = builder.serviceAccount;
this.roleArn = builder.roleArn;
this.clientRequestToken = builder.clientRequestToken;
this.tags = builder.tags;
}
/**
*
* The name of the cluster to create the association in.
*
*
* @return The name of the cluster to create the association in.
*/
public final String clusterName() {
return clusterName;
}
/**
*
* The name of the Kubernetes namespace inside the cluster to create the association in. The service account and the
* pods that use the service account must be in this namespace.
*
*
* @return The name of the Kubernetes namespace inside the cluster to create the association in. The service account
* and the pods that use the service account must be in this namespace.
*/
public final String namespace() {
return namespace;
}
/**
*
* The name of the Kubernetes service account inside the cluster to associate the IAM credentials with.
*
*
* @return The name of the Kubernetes service account inside the cluster to associate the IAM credentials with.
*/
public final String serviceAccount() {
return serviceAccount;
}
/**
*
* The Amazon Resource Name (ARN) of the IAM role to associate with the service account. The EKS Pod Identity agent
* manages credentials to assume this role for applications in the containers in the pods that use this service
* account.
*
*
* @return The Amazon Resource Name (ARN) of the IAM role to associate with the service account. The EKS Pod
* Identity agent manages credentials to assume this role for applications in the containers in the pods
* that use this service account.
*/
public final String roleArn() {
return roleArn;
}
/**
*
* A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
*
*
* @return A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
*/
public final String clientRequestToken() {
return clientRequestToken;
}
/**
* For responses, this returns true if the service returned a value for the Tags 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 hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructMap);
}
/**
*
* Metadata that assists with categorization and organization. Each tag consists of a key and an optional value. You
* define both. Tags don't propagate to any other cluster or Amazon Web Services resources.
*
*
* The following basic restrictions apply to tags:
*
*
*
*
* Maximum number of tags per resource – 50
*
*
*
*
* For each resource, each tag key must be unique, and each tag key can have only one value.
*
*
*
*
* Maximum key length – 128 Unicode characters in UTF-8
*
*
*
*
* Maximum value length – 256 Unicode characters in UTF-8
*
*
*
*
* If your tagging schema is used across multiple services and resources, remember that other services may have
* restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable
* in UTF-8, and the following characters: + - = . _ : / @.
*
*
*
*
* Tag keys and values are case-sensitive.
*
*
*
*
* Do not use aws:
, AWS:
, or any upper or lowercase combination of such as a prefix for
* either keys or values as it is reserved for Amazon Web Services use. You cannot edit or delete tag keys or values
* with this prefix. Tags with this prefix do not count against your tags per resource limit.
*
*
*
*
* 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 #hasTags} method.
*
*
* @return Metadata that assists with categorization and organization. Each tag consists of a key and an optional
* value. You define both. Tags don't propagate to any other cluster or Amazon Web Services resources.
*
* The following basic restrictions apply to tags:
*
*
*
*
* Maximum number of tags per resource – 50
*
*
*
*
* For each resource, each tag key must be unique, and each tag key can have only one value.
*
*
*
*
* Maximum key length – 128 Unicode characters in UTF-8
*
*
*
*
* Maximum value length – 256 Unicode characters in UTF-8
*
*
*
*
* If your tagging schema is used across multiple services and resources, remember that other services may
* have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces
* representable in UTF-8, and the following characters: + - = . _ : / @.
*
*
*
*
* Tag keys and values are case-sensitive.
*
*
*
*
* Do not use aws:
, AWS:
, or any upper or lowercase combination of such as a
* prefix for either keys or values as it is reserved for Amazon Web Services use. You cannot edit or delete
* tag keys or values with this prefix. Tags with this prefix do not count against your tags per resource
* limit.
*
*
*/
public final Map tags() {
return tags;
}
@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(clusterName());
hashCode = 31 * hashCode + Objects.hashCode(namespace());
hashCode = 31 * hashCode + Objects.hashCode(serviceAccount());
hashCode = 31 * hashCode + Objects.hashCode(roleArn());
hashCode = 31 * hashCode + Objects.hashCode(clientRequestToken());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
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 CreatePodIdentityAssociationRequest)) {
return false;
}
CreatePodIdentityAssociationRequest other = (CreatePodIdentityAssociationRequest) obj;
return Objects.equals(clusterName(), other.clusterName()) && Objects.equals(namespace(), other.namespace())
&& Objects.equals(serviceAccount(), other.serviceAccount()) && Objects.equals(roleArn(), other.roleArn())
&& Objects.equals(clientRequestToken(), other.clientRequestToken()) && hasTags() == other.hasTags()
&& Objects.equals(tags(), other.tags());
}
/**
* 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("CreatePodIdentityAssociationRequest").add("ClusterName", clusterName())
.add("Namespace", namespace()).add("ServiceAccount", serviceAccount()).add("RoleArn", roleArn())
.add("ClientRequestToken", clientRequestToken()).add("Tags", hasTags() ? tags() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "clusterName":
return Optional.ofNullable(clazz.cast(clusterName()));
case "namespace":
return Optional.ofNullable(clazz.cast(namespace()));
case "serviceAccount":
return Optional.ofNullable(clazz.cast(serviceAccount()));
case "roleArn":
return Optional.ofNullable(clazz.cast(roleArn()));
case "clientRequestToken":
return Optional.ofNullable(clazz.cast(clientRequestToken()));
case "tags":
return Optional.ofNullable(clazz.cast(tags()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("name", CLUSTER_NAME_FIELD);
map.put("namespace", NAMESPACE_FIELD);
map.put("serviceAccount", SERVICE_ACCOUNT_FIELD);
map.put("roleArn", ROLE_ARN_FIELD);
map.put("clientRequestToken", CLIENT_REQUEST_TOKEN_FIELD);
map.put("tags", TAGS_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function getter(Function g) {
return obj -> g.apply((CreatePodIdentityAssociationRequest) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends EksRequest.Builder, SdkPojo, CopyableBuilder {
/**
*
* The name of the cluster to create the association in.
*
*
* @param clusterName
* The name of the cluster to create the association in.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder clusterName(String clusterName);
/**
*
* The name of the Kubernetes namespace inside the cluster to create the association in. The service account and
* the pods that use the service account must be in this namespace.
*
*
* @param namespace
* The name of the Kubernetes namespace inside the cluster to create the association in. The service
* account and the pods that use the service account must be in this namespace.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder namespace(String namespace);
/**
*
* The name of the Kubernetes service account inside the cluster to associate the IAM credentials with.
*
*
* @param serviceAccount
* The name of the Kubernetes service account inside the cluster to associate the IAM credentials with.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder serviceAccount(String serviceAccount);
/**
*
* The Amazon Resource Name (ARN) of the IAM role to associate with the service account. The EKS Pod Identity
* agent manages credentials to assume this role for applications in the containers in the pods that use this
* service account.
*
*
* @param roleArn
* The Amazon Resource Name (ARN) of the IAM role to associate with the service account. The EKS Pod
* Identity agent manages credentials to assume this role for applications in the containers in the pods
* that use this service account.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder roleArn(String roleArn);
/**
*
* A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
*
*
* @param clientRequestToken
* A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder clientRequestToken(String clientRequestToken);
/**
*
* Metadata that assists with categorization and organization. Each tag consists of a key and an optional value.
* You define both. Tags don't propagate to any other cluster or Amazon Web Services resources.
*
*
* The following basic restrictions apply to tags:
*
*
*
*
* Maximum number of tags per resource – 50
*
*
*
*
* For each resource, each tag key must be unique, and each tag key can have only one value.
*
*
*
*
* Maximum key length – 128 Unicode characters in UTF-8
*
*
*
*
* Maximum value length – 256 Unicode characters in UTF-8
*
*
*
*
* If your tagging schema is used across multiple services and resources, remember that other services may have
* restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces
* representable in UTF-8, and the following characters: + - = . _ : / @.
*
*
*
*
* Tag keys and values are case-sensitive.
*
*
*
*
* Do not use aws:
, AWS:
, or any upper or lowercase combination of such as a prefix
* for either keys or values as it is reserved for Amazon Web Services use. You cannot edit or delete tag keys
* or values with this prefix. Tags with this prefix do not count against your tags per resource limit.
*
*
*
*
* @param tags
* Metadata that assists with categorization and organization. Each tag consists of a key and an optional
* value. You define both. Tags don't propagate to any other cluster or Amazon Web Services
* resources.
*
* The following basic restrictions apply to tags:
*
*
*
*
* Maximum number of tags per resource – 50
*
*
*
*
* For each resource, each tag key must be unique, and each tag key can have only one value.
*
*
*
*
* Maximum key length – 128 Unicode characters in UTF-8
*
*
*
*
* Maximum value length – 256 Unicode characters in UTF-8
*
*
*
*
* If your tagging schema is used across multiple services and resources, remember that other services
* may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and
* spaces representable in UTF-8, and the following characters: + - = . _ : / @.
*
*
*
*
* Tag keys and values are case-sensitive.
*
*
*
*
* Do not use aws:
, AWS:
, or any upper or lowercase combination of such as a
* prefix for either keys or values as it is reserved for Amazon Web Services use. You cannot edit or
* delete tag keys or values with this prefix. Tags with this prefix do not count against your tags per
* resource limit.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tags(Map tags);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends EksRequest.BuilderImpl implements Builder {
private String clusterName;
private String namespace;
private String serviceAccount;
private String roleArn;
private String clientRequestToken;
private Map tags = DefaultSdkAutoConstructMap.getInstance();
private BuilderImpl() {
}
private BuilderImpl(CreatePodIdentityAssociationRequest model) {
super(model);
clusterName(model.clusterName);
namespace(model.namespace);
serviceAccount(model.serviceAccount);
roleArn(model.roleArn);
clientRequestToken(model.clientRequestToken);
tags(model.tags);
}
public final String getClusterName() {
return clusterName;
}
public final void setClusterName(String clusterName) {
this.clusterName = clusterName;
}
@Override
public final Builder clusterName(String clusterName) {
this.clusterName = clusterName;
return this;
}
public final String getNamespace() {
return namespace;
}
public final void setNamespace(String namespace) {
this.namespace = namespace;
}
@Override
public final Builder namespace(String namespace) {
this.namespace = namespace;
return this;
}
public final String getServiceAccount() {
return serviceAccount;
}
public final void setServiceAccount(String serviceAccount) {
this.serviceAccount = serviceAccount;
}
@Override
public final Builder serviceAccount(String serviceAccount) {
this.serviceAccount = serviceAccount;
return this;
}
public final String getRoleArn() {
return roleArn;
}
public final void setRoleArn(String roleArn) {
this.roleArn = roleArn;
}
@Override
public final Builder roleArn(String roleArn) {
this.roleArn = roleArn;
return this;
}
public final String getClientRequestToken() {
return clientRequestToken;
}
public final void setClientRequestToken(String clientRequestToken) {
this.clientRequestToken = clientRequestToken;
}
@Override
public final Builder clientRequestToken(String clientRequestToken) {
this.clientRequestToken = clientRequestToken;
return this;
}
public final Map getTags() {
if (tags instanceof SdkAutoConstructMap) {
return null;
}
return tags;
}
public final void setTags(Map tags) {
this.tags = TagMapCopier.copy(tags);
}
@Override
public final Builder tags(Map tags) {
this.tags = TagMapCopier.copy(tags);
return this;
}
@Override
public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
super.overrideConfiguration(overrideConfiguration);
return this;
}
@Override
public Builder overrideConfiguration(Consumer builderConsumer) {
super.overrideConfiguration(builderConsumer);
return this;
}
@Override
public CreatePodIdentityAssociationRequest build() {
return new CreatePodIdentityAssociationRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
@Override
public Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
}
}