software.amazon.awssdk.services.ecs.model.ListServiceDeploymentsRequest 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.ecs.model;
import java.util.Arrays;
import java.util.Collection;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
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 ListServiceDeploymentsRequest extends EcsRequest implements
ToCopyableBuilder {
private static final SdkField SERVICE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("service")
.getter(getter(ListServiceDeploymentsRequest::service)).setter(setter(Builder::service))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("service").build()).build();
private static final SdkField CLUSTER_FIELD = SdkField. builder(MarshallingType.STRING).memberName("cluster")
.getter(getter(ListServiceDeploymentsRequest::cluster)).setter(setter(Builder::cluster))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("cluster").build()).build();
private static final SdkField> STATUS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("status")
.getter(getter(ListServiceDeploymentsRequest::statusAsStrings))
.setter(setter(Builder::statusWithStrings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField CREATED_AT_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("createdAt").getter(getter(ListServiceDeploymentsRequest::createdAt)).setter(setter(Builder::createdAt))
.constructor(CreatedAt::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("createdAt").build()).build();
private static final SdkField NEXT_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("nextToken").getter(getter(ListServiceDeploymentsRequest::nextToken)).setter(setter(Builder::nextToken))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("nextToken").build()).build();
private static final SdkField MAX_RESULTS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("maxResults").getter(getter(ListServiceDeploymentsRequest::maxResults))
.setter(setter(Builder::maxResults))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("maxResults").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SERVICE_FIELD, CLUSTER_FIELD,
STATUS_FIELD, CREATED_AT_FIELD, NEXT_TOKEN_FIELD, MAX_RESULTS_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private final String service;
private final String cluster;
private final List status;
private final CreatedAt createdAt;
private final String nextToken;
private final Integer maxResults;
private ListServiceDeploymentsRequest(BuilderImpl builder) {
super(builder);
this.service = builder.service;
this.cluster = builder.cluster;
this.status = builder.status;
this.createdAt = builder.createdAt;
this.nextToken = builder.nextToken;
this.maxResults = builder.maxResults;
}
/**
*
* The ARN or name of the service
*
*
* @return The ARN or name of the service
*/
public final String service() {
return service;
}
/**
*
* The cluster that hosts the service. This can either be the cluster name or ARN. Starting April 15, 2023, Amazon
* Web Services will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers
* migrate their workloads to options that offer better price and performance. If you don't specify a cluster,
* default
is used.
*
*
* @return The cluster that hosts the service. This can either be the cluster name or ARN. Starting April 15, 2023,
* Amazon Web Services will not onboard new customers to Amazon Elastic Inference (EI), and will help
* current customers migrate their workloads to options that offer better price and performance. If you
* don't specify a cluster, default
is used.
*/
public final String cluster() {
return cluster;
}
/**
*
* An optional filter you can use to narrow the results. If you do not specify a status, then all status values are
* included in the result.
*
*
* 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 #hasStatus} method.
*
*
* @return An optional filter you can use to narrow the results. If you do not specify a status, then all status
* values are included in the result.
*/
public final List status() {
return ServiceDeploymentStatusListCopier.copyStringToEnum(status);
}
/**
* For responses, this returns true if the service returned a value for the Status 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 hasStatus() {
return status != null && !(status instanceof SdkAutoConstructList);
}
/**
*
* An optional filter you can use to narrow the results. If you do not specify a status, then all status values are
* included in the result.
*
*
* 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 #hasStatus} method.
*
*
* @return An optional filter you can use to narrow the results. If you do not specify a status, then all status
* values are included in the result.
*/
public final List statusAsStrings() {
return status;
}
/**
*
* An optional filter you can use to narrow the results by the service creation date. If you do not specify a value,
* the result includes all services created before the current time. The format is yyyy-MM-dd HH:mm:ss.SSSSSS.
*
*
* @return An optional filter you can use to narrow the results by the service creation date. If you do not specify
* a value, the result includes all services created before the current time. The format is yyyy-MM-dd
* HH:mm:ss.SSSSSS.
*/
public final CreatedAt createdAt() {
return createdAt;
}
/**
*
* The nextToken
value returned from a ListServiceDeployments
request indicating that more
* results are available to fulfill the request and further calls are needed. If you provided
* maxResults
, it's possible the number of results is fewer than maxResults
.
*
*
* @return The nextToken
value returned from a ListServiceDeployments
request indicating
* that more results are available to fulfill the request and further calls are needed. If you provided
* maxResults
, it's possible the number of results is fewer than maxResults
.
*/
public final String nextToken() {
return nextToken;
}
/**
*
* The maximum number of service deployment results that ListServiceDeployments
returned in paginated
* output. When this parameter is used, ListServiceDeployments
only returns maxResults
* results in a single page along with a nextToken
response element. The remaining results of the
* initial request can be seen by sending another ListServiceDeployments
request with the returned
* nextToken
value. This value can be between 1 and 100. If this parameter isn't used, then
* ListServiceDeployments
returns up to 20 results and a nextToken
value if applicable.
*
*
* @return The maximum number of service deployment results that ListServiceDeployments
returned in
* paginated output. When this parameter is used, ListServiceDeployments
only returns
* maxResults
results in a single page along with a nextToken
response element.
* The remaining results of the initial request can be seen by sending another
* ListServiceDeployments
request with the returned nextToken
value. This value
* can be between 1 and 100. If this parameter isn't used, then ListServiceDeployments
returns
* up to 20 results and a nextToken
value if applicable.
*/
public final Integer maxResults() {
return maxResults;
}
@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(service());
hashCode = 31 * hashCode + Objects.hashCode(cluster());
hashCode = 31 * hashCode + Objects.hashCode(hasStatus() ? statusAsStrings() : null);
hashCode = 31 * hashCode + Objects.hashCode(createdAt());
hashCode = 31 * hashCode + Objects.hashCode(nextToken());
hashCode = 31 * hashCode + Objects.hashCode(maxResults());
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 ListServiceDeploymentsRequest)) {
return false;
}
ListServiceDeploymentsRequest other = (ListServiceDeploymentsRequest) obj;
return Objects.equals(service(), other.service()) && Objects.equals(cluster(), other.cluster())
&& hasStatus() == other.hasStatus() && Objects.equals(statusAsStrings(), other.statusAsStrings())
&& Objects.equals(createdAt(), other.createdAt()) && Objects.equals(nextToken(), other.nextToken())
&& Objects.equals(maxResults(), other.maxResults());
}
/**
* 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("ListServiceDeploymentsRequest").add("Service", service()).add("Cluster", cluster())
.add("Status", hasStatus() ? statusAsStrings() : null).add("CreatedAt", createdAt())
.add("NextToken", nextToken()).add("MaxResults", maxResults()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "service":
return Optional.ofNullable(clazz.cast(service()));
case "cluster":
return Optional.ofNullable(clazz.cast(cluster()));
case "status":
return Optional.ofNullable(clazz.cast(statusAsStrings()));
case "createdAt":
return Optional.ofNullable(clazz.cast(createdAt()));
case "nextToken":
return Optional.ofNullable(clazz.cast(nextToken()));
case "maxResults":
return Optional.ofNullable(clazz.cast(maxResults()));
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("service", SERVICE_FIELD);
map.put("cluster", CLUSTER_FIELD);
map.put("status", STATUS_FIELD);
map.put("createdAt", CREATED_AT_FIELD);
map.put("nextToken", NEXT_TOKEN_FIELD);
map.put("maxResults", MAX_RESULTS_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function