
software.amazon.awssdk.services.secretsmanager.model.ListSecretVersionIdsRequest 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.secretsmanager.model;
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.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.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 ListSecretVersionIdsRequest extends SecretsManagerRequest implements
ToCopyableBuilder {
private static final SdkField SECRET_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ListSecretVersionIdsRequest::secretId)).setter(setter(Builder::secretId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SecretId").build()).build();
private static final SdkField MAX_RESULTS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(ListSecretVersionIdsRequest::maxResults)).setter(setter(Builder::maxResults))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxResults").build()).build();
private static final SdkField NEXT_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ListSecretVersionIdsRequest::nextToken)).setter(setter(Builder::nextToken))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NextToken").build()).build();
private static final SdkField INCLUDE_DEPRECATED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.getter(getter(ListSecretVersionIdsRequest::includeDeprecated)).setter(setter(Builder::includeDeprecated))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IncludeDeprecated").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SECRET_ID_FIELD,
MAX_RESULTS_FIELD, NEXT_TOKEN_FIELD, INCLUDE_DEPRECATED_FIELD));
private final String secretId;
private final Integer maxResults;
private final String nextToken;
private final Boolean includeDeprecated;
private ListSecretVersionIdsRequest(BuilderImpl builder) {
super(builder);
this.secretId = builder.secretId;
this.maxResults = builder.maxResults;
this.nextToken = builder.nextToken;
this.includeDeprecated = builder.includeDeprecated;
}
/**
*
* The identifier for the secret containing the versions you want to list. You can specify either the Amazon
* Resource Name (ARN) or the friendly name of the secret.
*
*
*
* If you specify an ARN, we generally recommend that you specify a complete ARN. You can specify a partial ARN
* too—for example, if you don’t include the final hyphen and six random characters that Secrets Manager adds at the
* end of the ARN when you created the secret. A partial ARN match can work as long as it uniquely matches only one
* secret. However, if your secret has a name that ends in a hyphen followed by six characters (before Secrets
* Manager adds the hyphen and six characters to the ARN) and you try to use that as a partial ARN, then those
* characters cause Secrets Manager to assume that you’re specifying a complete ARN. This confusion can cause
* unexpected results. To avoid this situation, we recommend that you don’t create secret names ending with a hyphen
* followed by six characters.
*
*
* If you specify an incomplete ARN without the random suffix, and instead provide the 'friendly name', you
* must not include the random suffix. If you do include the random suffix added by Secrets Manager, you
* receive either a ResourceNotFoundException or an AccessDeniedException error, depending on your
* permissions.
*
*
*
* @return The identifier for the secret containing the versions you want to list. You can specify either the Amazon
* Resource Name (ARN) or the friendly name of the secret.
*
* If you specify an ARN, we generally recommend that you specify a complete ARN. You can specify a partial
* ARN too—for example, if you don’t include the final hyphen and six random characters that Secrets Manager
* adds at the end of the ARN when you created the secret. A partial ARN match can work as long as it
* uniquely matches only one secret. However, if your secret has a name that ends in a hyphen followed by
* six characters (before Secrets Manager adds the hyphen and six characters to the ARN) and you try to use
* that as a partial ARN, then those characters cause Secrets Manager to assume that you’re specifying a
* complete ARN. This confusion can cause unexpected results. To avoid this situation, we recommend that you
* don’t create secret names ending with a hyphen followed by six characters.
*
*
* If you specify an incomplete ARN without the random suffix, and instead provide the 'friendly name', you
* must not include the random suffix. If you do include the random suffix added by Secrets Manager,
* you receive either a ResourceNotFoundException or an AccessDeniedException error, depending
* on your permissions.
*
*/
public String secretId() {
return secretId;
}
/**
*
* (Optional) Limits the number of results you want to include in the response. If you don't include this parameter,
* it defaults to a value that's specific to the operation. If additional items exist beyond the maximum you
* specify, the NextToken
response element is present and has a value (isn't null). Include that value
* as the NextToken
request parameter in the next call to the operation to get the next part of the
* results. Note that Secrets Manager might return fewer results than the maximum even when there are more results
* available. You should check NextToken
after every operation to ensure that you receive all of the
* results.
*
*
* @return (Optional) Limits the number of results you want to include in the response. If you don't include this
* parameter, it defaults to a value that's specific to the operation. If additional items exist beyond the
* maximum you specify, the NextToken
response element is present and has a value (isn't null).
* Include that value as the NextToken
request parameter in the next call to the operation to
* get the next part of the results. Note that Secrets Manager might return fewer results than the maximum
* even when there are more results available. You should check NextToken
after every operation
* to ensure that you receive all of the results.
*/
public Integer maxResults() {
return maxResults;
}
/**
*
* (Optional) Use this parameter in a request if you receive a NextToken
response in a previous request
* indicating there's more output available. In a subsequent call, set it to the value of the previous call
* NextToken
response to indicate where the output should continue from.
*
*
* @return (Optional) Use this parameter in a request if you receive a NextToken
response in a previous
* request indicating there's more output available. In a subsequent call, set it to the value of the
* previous call NextToken
response to indicate where the output should continue from.
*/
public String nextToken() {
return nextToken;
}
/**
*
* (Optional) Specifies that you want the results to include versions that do not have any staging labels attached
* to them. Such versions are considered deprecated and are subject to deletion by Secrets Manager as needed.
*
*
* @return (Optional) Specifies that you want the results to include versions that do not have any staging labels
* attached to them. Such versions are considered deprecated and are subject to deletion by Secrets Manager
* as needed.
*/
public Boolean includeDeprecated() {
return includeDeprecated;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(secretId());
hashCode = 31 * hashCode + Objects.hashCode(maxResults());
hashCode = 31 * hashCode + Objects.hashCode(nextToken());
hashCode = 31 * hashCode + Objects.hashCode(includeDeprecated());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ListSecretVersionIdsRequest)) {
return false;
}
ListSecretVersionIdsRequest other = (ListSecretVersionIdsRequest) obj;
return Objects.equals(secretId(), other.secretId()) && Objects.equals(maxResults(), other.maxResults())
&& Objects.equals(nextToken(), other.nextToken())
&& Objects.equals(includeDeprecated(), other.includeDeprecated());
}
/**
* 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 String toString() {
return ToString.builder("ListSecretVersionIdsRequest").add("SecretId", secretId()).add("MaxResults", maxResults())
.add("NextToken", nextToken()).add("IncludeDeprecated", includeDeprecated()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "SecretId":
return Optional.ofNullable(clazz.cast(secretId()));
case "MaxResults":
return Optional.ofNullable(clazz.cast(maxResults()));
case "NextToken":
return Optional.ofNullable(clazz.cast(nextToken()));
case "IncludeDeprecated":
return Optional.ofNullable(clazz.cast(includeDeprecated()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function