software.amazon.awssdk.services.applicationdiscovery.model.ListConfigurationsRequest Maven / Gradle / Ivy
/*
* Copyright 2013-2018 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.applicationdiscovery.model;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import javax.annotation.Generated;
import software.amazon.awssdk.core.AwsRequestOverrideConfig;
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 class ListConfigurationsRequest extends ApplicationDiscoveryRequest implements
ToCopyableBuilder {
private final String configurationType;
private final List filters;
private final Integer maxResults;
private final String nextToken;
private final List orderBy;
private ListConfigurationsRequest(BuilderImpl builder) {
super(builder);
this.configurationType = builder.configurationType;
this.filters = builder.filters;
this.maxResults = builder.maxResults;
this.nextToken = builder.nextToken;
this.orderBy = builder.orderBy;
}
/**
*
* A valid configuration identified by Application Discovery Service.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #configurationType}
* will return {@link ConfigurationItemType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #configurationTypeString}.
*
*
* @return A valid configuration identified by Application Discovery Service.
* @see ConfigurationItemType
*/
public ConfigurationItemType configurationType() {
return ConfigurationItemType.fromValue(configurationType);
}
/**
*
* A valid configuration identified by Application Discovery Service.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #configurationType}
* will return {@link ConfigurationItemType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #configurationTypeString}.
*
*
* @return A valid configuration identified by Application Discovery Service.
* @see ConfigurationItemType
*/
public String configurationTypeString() {
return configurationType;
}
/**
*
* You can filter the request using various logical operators and a key-value format. For example:
*
*
* {"key": "serverType", "value": "webServer"}
*
*
* For a complete list of filter options and guidance about using them with this action, see Querying Discovered Configuration Items.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return You can filter the request using various logical operators and a key-value format. For
* example:
*
* {"key": "serverType", "value": "webServer"}
*
*
* For a complete list of filter options and guidance about using them with this action, see Querying Discovered Configuration Items.
*/
public List filters() {
return filters;
}
/**
*
* The total number of items to return. The maximum value is 100.
*
*
* @return The total number of items to return. The maximum value is 100.
*/
public Integer maxResults() {
return maxResults;
}
/**
*
* Token to retrieve the next set of results. For example, if a previous call to ListConfigurations returned 100
* items, but you set ListConfigurationsRequest$maxResults
to 10, you received a set of 10 results
* along with a token. Use that token in this query to get the next set of 10.
*
*
* @return Token to retrieve the next set of results. For example, if a previous call to ListConfigurations returned
* 100 items, but you set ListConfigurationsRequest$maxResults
to 10, you received a set of 10
* results along with a token. Use that token in this query to get the next set of 10.
*/
public String nextToken() {
return nextToken;
}
/**
*
* Certain filter criteria return output that can be sorted in ascending or descending order. For a list of output
* characteristics for each filter, see Using the ListConfigurations Action.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return Certain filter criteria return output that can be sorted in ascending or descending order. For a list of
* output characteristics for each filter, see Using the ListConfigurations Action.
*/
public List orderBy() {
return orderBy;
}
@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 + Objects.hashCode(configurationTypeString());
hashCode = 31 * hashCode + Objects.hashCode(filters());
hashCode = 31 * hashCode + Objects.hashCode(maxResults());
hashCode = 31 * hashCode + Objects.hashCode(nextToken());
hashCode = 31 * hashCode + Objects.hashCode(orderBy());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ListConfigurationsRequest)) {
return false;
}
ListConfigurationsRequest other = (ListConfigurationsRequest) obj;
return Objects.equals(configurationTypeString(), other.configurationTypeString())
&& Objects.equals(filters(), other.filters()) && Objects.equals(maxResults(), other.maxResults())
&& Objects.equals(nextToken(), other.nextToken()) && Objects.equals(orderBy(), other.orderBy());
}
@Override
public String toString() {
return ToString.builder("ListConfigurationsRequest").add("ConfigurationType", configurationTypeString())
.add("Filters", filters()).add("MaxResults", maxResults()).add("NextToken", nextToken())
.add("OrderBy", orderBy()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "configurationType":
return Optional.of(clazz.cast(configurationTypeString()));
case "filters":
return Optional.of(clazz.cast(filters()));
case "maxResults":
return Optional.of(clazz.cast(maxResults()));
case "nextToken":
return Optional.of(clazz.cast(nextToken()));
case "orderBy":
return Optional.of(clazz.cast(orderBy()));
default:
return Optional.empty();
}
}
public interface Builder extends ApplicationDiscoveryRequest.Builder, CopyableBuilder {
/**
*
* A valid configuration identified by Application Discovery Service.
*
*
* @param configurationType
* A valid configuration identified by Application Discovery Service.
* @see ConfigurationItemType
* @return Returns a reference to this object so that method calls can be chained together.
* @see ConfigurationItemType
*/
Builder configurationType(String configurationType);
/**
*
* A valid configuration identified by Application Discovery Service.
*
*
* @param configurationType
* A valid configuration identified by Application Discovery Service.
* @see ConfigurationItemType
* @return Returns a reference to this object so that method calls can be chained together.
* @see ConfigurationItemType
*/
Builder configurationType(ConfigurationItemType configurationType);
/**
*
* You can filter the request using various logical operators and a key-value format. For example:
*
*
* {"key": "serverType", "value": "webServer"}
*
*
* For a complete list of filter options and guidance about using them with this action, see Querying Discovered Configuration Items.
*
*
* @param filters
* You can filter the request using various logical operators and a key-value format. For
* example:
*
* {"key": "serverType", "value": "webServer"}
*
*
* For a complete list of filter options and guidance about using them with this action, see Querying Discovered Configuration Items.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder filters(Collection filters);
/**
*
* You can filter the request using various logical operators and a key-value format. For example:
*
*
* {"key": "serverType", "value": "webServer"}
*
*
* For a complete list of filter options and guidance about using them with this action, see Querying Discovered Configuration Items.
*
*
* @param filters
* You can filter the request using various logical operators and a key-value format. For
* example:
*
* {"key": "serverType", "value": "webServer"}
*
*
* For a complete list of filter options and guidance about using them with this action, see Querying Discovered Configuration Items.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder filters(Filter... filters);
/**
*
* The total number of items to return. The maximum value is 100.
*
*
* @param maxResults
* The total number of items to return. The maximum value is 100.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder maxResults(Integer maxResults);
/**
*
* Token to retrieve the next set of results. For example, if a previous call to ListConfigurations returned 100
* items, but you set ListConfigurationsRequest$maxResults
to 10, you received a set of 10 results
* along with a token. Use that token in this query to get the next set of 10.
*
*
* @param nextToken
* Token to retrieve the next set of results. For example, if a previous call to ListConfigurations
* returned 100 items, but you set ListConfigurationsRequest$maxResults
to 10, you received
* a set of 10 results along with a token. Use that token in this query to get the next set of 10.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder nextToken(String nextToken);
/**
*
* Certain filter criteria return output that can be sorted in ascending or descending order. For a list of
* output characteristics for each filter, see Using the ListConfigurations Action.
*
*
* @param orderBy
* Certain filter criteria return output that can be sorted in ascending or descending order. For a list
* of output characteristics for each filter, see Using the ListConfigurations Action.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder orderBy(Collection orderBy);
/**
*
* Certain filter criteria return output that can be sorted in ascending or descending order. For a list of
* output characteristics for each filter, see Using the ListConfigurations Action.
*
*
* @param orderBy
* Certain filter criteria return output that can be sorted in ascending or descending order. For a list
* of output characteristics for each filter, see Using the ListConfigurations Action.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder orderBy(OrderByElement... orderBy);
@Override
Builder requestOverrideConfig(AwsRequestOverrideConfig awsRequestOverrideConfig);
}
static final class BuilderImpl extends ApplicationDiscoveryRequest.BuilderImpl implements Builder {
private String configurationType;
private List filters;
private Integer maxResults;
private String nextToken;
private List orderBy;
private BuilderImpl() {
}
private BuilderImpl(ListConfigurationsRequest model) {
configurationType(model.configurationType);
filters(model.filters);
maxResults(model.maxResults);
nextToken(model.nextToken);
orderBy(model.orderBy);
}
public final String getConfigurationType() {
return configurationType;
}
@Override
public final Builder configurationType(String configurationType) {
this.configurationType = configurationType;
return this;
}
@Override
public final Builder configurationType(ConfigurationItemType configurationType) {
this.configurationType(configurationType.toString());
return this;
}
public final void setConfigurationType(String configurationType) {
this.configurationType = configurationType;
}
public final Collection getFilters() {
return filters != null ? filters.stream().map(Filter::toBuilder).collect(Collectors.toList()) : null;
}
@Override
public final Builder filters(Collection filters) {
this.filters = FiltersCopier.copy(filters);
return this;
}
@Override
@SafeVarargs
public final Builder filters(Filter... filters) {
filters(Arrays.asList(filters));
return this;
}
public final void setFilters(Collection filters) {
this.filters = FiltersCopier.copyFromBuilder(filters);
}
public final Integer getMaxResults() {
return maxResults;
}
@Override
public final Builder maxResults(Integer maxResults) {
this.maxResults = maxResults;
return this;
}
public final void setMaxResults(Integer maxResults) {
this.maxResults = maxResults;
}
public final String getNextToken() {
return nextToken;
}
@Override
public final Builder nextToken(String nextToken) {
this.nextToken = nextToken;
return this;
}
public final void setNextToken(String nextToken) {
this.nextToken = nextToken;
}
public final Collection getOrderBy() {
return orderBy != null ? orderBy.stream().map(OrderByElement::toBuilder).collect(Collectors.toList()) : null;
}
@Override
public final Builder orderBy(Collection orderBy) {
this.orderBy = OrderByListCopier.copy(orderBy);
return this;
}
@Override
@SafeVarargs
public final Builder orderBy(OrderByElement... orderBy) {
orderBy(Arrays.asList(orderBy));
return this;
}
public final void setOrderBy(Collection orderBy) {
this.orderBy = OrderByListCopier.copyFromBuilder(orderBy);
}
@Override
public Builder requestOverrideConfig(AwsRequestOverrideConfig awsRequestOverrideConfig) {
super.requestOverrideConfig(awsRequestOverrideConfig);
return this;
}
@Override
public Builder requestOverrideConfig(Consumer builderConsumer) {
super.requestOverrideConfig(builderConsumer);
return this;
}
@Override
public ListConfigurationsRequest build() {
return new ListConfigurationsRequest(this);
}
}
}