software.amazon.awssdk.services.iam.model.ListPoliciesGrantingServiceAccessRequest Maven / Gradle / Ivy
Show all versions of iam Show documentation
/*
* Copyright 2014-2019 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.iam.model;
import java.util.Arrays;
import java.util.Collection;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
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 ListPoliciesGrantingServiceAccessRequest extends IamRequest implements
ToCopyableBuilder {
private static final SdkField MARKER_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ListPoliciesGrantingServiceAccessRequest::marker)).setter(setter(Builder::marker))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Marker").build()).build();
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ListPoliciesGrantingServiceAccessRequest::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Arn").build()).build();
private static final SdkField> SERVICE_NAMESPACES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.getter(getter(ListPoliciesGrantingServiceAccessRequest::serviceNamespaces))
.setter(setter(Builder::serviceNamespaces))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ServiceNamespaces").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 List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(MARKER_FIELD, ARN_FIELD,
SERVICE_NAMESPACES_FIELD));
private final String marker;
private final String arn;
private final List serviceNamespaces;
private ListPoliciesGrantingServiceAccessRequest(BuilderImpl builder) {
super(builder);
this.marker = builder.marker;
this.arn = builder.arn;
this.serviceNamespaces = builder.serviceNamespaces;
}
/**
*
* Use this parameter only when paginating results and only after you receive a response indicating that the results
* are truncated. Set it to the value of the Marker
element in the response that you received to
* indicate where the next call should start.
*
*
* @return Use this parameter only when paginating results and only after you receive a response indicating that the
* results are truncated. Set it to the value of the Marker
element in the response that you
* received to indicate where the next call should start.
*/
public String marker() {
return marker;
}
/**
*
* The ARN of the IAM identity (user, group, or role) whose policies you want to list.
*
*
* @return The ARN of the IAM identity (user, group, or role) whose policies you want to list.
*/
public String arn() {
return arn;
}
/**
*
* The service namespace for the AWS services whose policies you want to list.
*
*
* To learn the service namespace for a service, go to Actions, Resources, and Condition Keys for AWS Services in the IAM User Guide. Choose the name of the
* service to view details for that service. In the first paragraph, find the service prefix. For example,
* (service prefix: a4b)
. For more information about service namespaces, see AWS Service Namespaces in the AWS General Reference.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return The service namespace for the AWS services whose policies you want to list.
*
* To learn the service namespace for a service, go to Actions, Resources, and Condition Keys for AWS Services in the IAM User Guide. Choose the
* name of the service to view details for that service. In the first paragraph, find the service prefix.
* For example, (service prefix: a4b)
. For more information about service namespaces, see AWS Service Namespaces in the AWS General Reference.
*/
public List serviceNamespaces() {
return serviceNamespaces;
}
@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(marker());
hashCode = 31 * hashCode + Objects.hashCode(arn());
hashCode = 31 * hashCode + Objects.hashCode(serviceNamespaces());
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 ListPoliciesGrantingServiceAccessRequest)) {
return false;
}
ListPoliciesGrantingServiceAccessRequest other = (ListPoliciesGrantingServiceAccessRequest) obj;
return Objects.equals(marker(), other.marker()) && Objects.equals(arn(), other.arn())
&& Objects.equals(serviceNamespaces(), other.serviceNamespaces());
}
/**
* 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("ListPoliciesGrantingServiceAccessRequest").add("Marker", marker()).add("Arn", arn())
.add("ServiceNamespaces", serviceNamespaces()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Marker":
return Optional.ofNullable(clazz.cast(marker()));
case "Arn":
return Optional.ofNullable(clazz.cast(arn()));
case "ServiceNamespaces":
return Optional.ofNullable(clazz.cast(serviceNamespaces()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function
*
* To learn the service namespace for a service, go to Actions, Resources, and Condition Keys for AWS Services in the IAM User Guide. Choose the
* name of the service to view details for that service. In the first paragraph, find the service prefix.
* For example, (service prefix: a4b)
. For more information about service namespaces, see AWS Service Namespaces in the AWS General Reference.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder serviceNamespaces(Collection serviceNamespaces);
/**
*
* The service namespace for the AWS services whose policies you want to list.
*
*
* To learn the service namespace for a service, go to Actions, Resources, and Condition Keys for AWS Services in the IAM User Guide. Choose the name of
* the service to view details for that service. In the first paragraph, find the service prefix. For example,
* (service prefix: a4b)
. For more information about service namespaces, see AWS Service Namespaces in the AWS General Reference.
*
*
* @param serviceNamespaces
* The service namespace for the AWS services whose policies you want to list.
*
* To learn the service namespace for a service, go to Actions, Resources, and Condition Keys for AWS Services in the IAM User Guide. Choose the
* name of the service to view details for that service. In the first paragraph, find the service prefix.
* For example, (service prefix: a4b)
. For more information about service namespaces, see AWS Service Namespaces in the AWS General Reference.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder serviceNamespaces(String... serviceNamespaces);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends IamRequest.BuilderImpl implements Builder {
private String marker;
private String arn;
private List serviceNamespaces = DefaultSdkAutoConstructList.getInstance();
private BuilderImpl() {
}
private BuilderImpl(ListPoliciesGrantingServiceAccessRequest model) {
super(model);
marker(model.marker);
arn(model.arn);
serviceNamespaces(model.serviceNamespaces);
}
public final String getMarker() {
return marker;
}
@Override
public final Builder marker(String marker) {
this.marker = marker;
return this;
}
public final void setMarker(String marker) {
this.marker = marker;
}
public final String getArn() {
return arn;
}
@Override
public final Builder arn(String arn) {
this.arn = arn;
return this;
}
public final void setArn(String arn) {
this.arn = arn;
}
public final Collection getServiceNamespaces() {
return serviceNamespaces;
}
@Override
public final Builder serviceNamespaces(Collection serviceNamespaces) {
this.serviceNamespaces = _serviceNamespaceListTypeCopier.copy(serviceNamespaces);
return this;
}
@Override
@SafeVarargs
public final Builder serviceNamespaces(String... serviceNamespaces) {
serviceNamespaces(Arrays.asList(serviceNamespaces));
return this;
}
public final void setServiceNamespaces(Collection serviceNamespaces) {
this.serviceNamespaces = _serviceNamespaceListTypeCopier.copy(serviceNamespaces);
}
@Override
public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
super.overrideConfiguration(overrideConfiguration);
return this;
}
@Override
public Builder overrideConfiguration(Consumer builderConsumer) {
super.overrideConfiguration(builderConsumer);
return this;
}
@Override
public ListPoliciesGrantingServiceAccessRequest build() {
return new ListPoliciesGrantingServiceAccessRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}