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.iam.model.ResourceSpecificResult Maven / Gradle / Ivy
Go to download
The AWS Java SDK for AWS IAM module holds the client classes that are used for communicating with AWS
Identity and Access Management Service
/*
* 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.iam.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
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 java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
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.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
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;
/**
*
* Contains the result of the simulation of a single API operation call on a single resource.
*
*
* This data type is used by a member of the EvaluationResult data type.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ResourceSpecificResult implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField EVAL_RESOURCE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EvalResourceName").getter(getter(ResourceSpecificResult::evalResourceName))
.setter(setter(Builder::evalResourceName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EvalResourceName").build()).build();
private static final SdkField EVAL_RESOURCE_DECISION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EvalResourceDecision").getter(getter(ResourceSpecificResult::evalResourceDecisionAsString))
.setter(setter(Builder::evalResourceDecision))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EvalResourceDecision").build())
.build();
private static final SdkField> MATCHED_STATEMENTS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("MatchedStatements")
.getter(getter(ResourceSpecificResult::matchedStatements))
.setter(setter(Builder::matchedStatements))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MatchedStatements").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Statement::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> MISSING_CONTEXT_VALUES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("MissingContextValues")
.getter(getter(ResourceSpecificResult::missingContextValues))
.setter(setter(Builder::missingContextValues))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MissingContextValues").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> EVAL_DECISION_DETAILS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("EvalDecisionDetails")
.getter(getter(ResourceSpecificResult::evalDecisionDetailsAsStrings))
.setter(setter(Builder::evalDecisionDetailsWithStrings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EvalDecisionDetails").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 SdkField PERMISSIONS_BOUNDARY_DECISION_DETAIL_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("PermissionsBoundaryDecisionDetail")
.getter(getter(ResourceSpecificResult::permissionsBoundaryDecisionDetail))
.setter(setter(Builder::permissionsBoundaryDecisionDetail))
.constructor(PermissionsBoundaryDecisionDetail::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PermissionsBoundaryDecisionDetail")
.build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(EVAL_RESOURCE_NAME_FIELD,
EVAL_RESOURCE_DECISION_FIELD, MATCHED_STATEMENTS_FIELD, MISSING_CONTEXT_VALUES_FIELD, EVAL_DECISION_DETAILS_FIELD,
PERMISSIONS_BOUNDARY_DECISION_DETAIL_FIELD));
private static final long serialVersionUID = 1L;
private final String evalResourceName;
private final String evalResourceDecision;
private final List matchedStatements;
private final List missingContextValues;
private final Map evalDecisionDetails;
private final PermissionsBoundaryDecisionDetail permissionsBoundaryDecisionDetail;
private ResourceSpecificResult(BuilderImpl builder) {
this.evalResourceName = builder.evalResourceName;
this.evalResourceDecision = builder.evalResourceDecision;
this.matchedStatements = builder.matchedStatements;
this.missingContextValues = builder.missingContextValues;
this.evalDecisionDetails = builder.evalDecisionDetails;
this.permissionsBoundaryDecisionDetail = builder.permissionsBoundaryDecisionDetail;
}
/**
*
* The name of the simulated resource, in Amazon Resource Name (ARN) format.
*
*
* @return The name of the simulated resource, in Amazon Resource Name (ARN) format.
*/
public final String evalResourceName() {
return evalResourceName;
}
/**
*
* The result of the simulation of the simulated API operation on the resource specified in
* EvalResourceName
.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #evalResourceDecision} will return {@link PolicyEvaluationDecisionType#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #evalResourceDecisionAsString}.
*
*
* @return The result of the simulation of the simulated API operation on the resource specified in
* EvalResourceName
.
* @see PolicyEvaluationDecisionType
*/
public final PolicyEvaluationDecisionType evalResourceDecision() {
return PolicyEvaluationDecisionType.fromValue(evalResourceDecision);
}
/**
*
* The result of the simulation of the simulated API operation on the resource specified in
* EvalResourceName
.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #evalResourceDecision} will return {@link PolicyEvaluationDecisionType#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #evalResourceDecisionAsString}.
*
*
* @return The result of the simulation of the simulated API operation on the resource specified in
* EvalResourceName
.
* @see PolicyEvaluationDecisionType
*/
public final String evalResourceDecisionAsString() {
return evalResourceDecision;
}
/**
* For responses, this returns true if the service returned a value for the MatchedStatements 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 hasMatchedStatements() {
return matchedStatements != null && !(matchedStatements instanceof SdkAutoConstructList);
}
/**
*
* A list of the statements in the input policies that determine the result for this part of the simulation.
* Remember that even if multiple statements allow the operation on the resource, if any statement denies
* that operation, then the explicit deny overrides any allow. In addition, the deny statement is the only entry
* 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 #hasMatchedStatements} method.
*
*
* @return A list of the statements in the input policies that determine the result for this part of the simulation.
* Remember that even if multiple statements allow the operation on the resource, if any statement
* denies that operation, then the explicit deny overrides any allow. In addition, the deny statement is the
* only entry included in the result.
*/
public final List matchedStatements() {
return matchedStatements;
}
/**
* For responses, this returns true if the service returned a value for the MissingContextValues 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 hasMissingContextValues() {
return missingContextValues != null && !(missingContextValues instanceof SdkAutoConstructList);
}
/**
*
* A list of context keys that are required by the included input policies but that were not provided by one of the
* input parameters. This list is used when a list of ARNs is included in the ResourceArns
parameter
* instead of "*". If you do not specify individual resources, by setting ResourceArns
to "*" or by not
* including the ResourceArns
parameter, then any missing context values are instead included under the
* EvaluationResults
section. To discover the context keys used by a set of policies, you can call
* GetContextKeysForCustomPolicy or GetContextKeysForPrincipalPolicy .
*
*
* 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 #hasMissingContextValues} method.
*
*
* @return A list of context keys that are required by the included input policies but that were not provided by one
* of the input parameters. This list is used when a list of ARNs is included in the
* ResourceArns
parameter instead of "*". If you do not specify individual resources, by
* setting ResourceArns
to "*" or by not including the ResourceArns
parameter,
* then any missing context values are instead included under the EvaluationResults
section. To
* discover the context keys used by a set of policies, you can call GetContextKeysForCustomPolicy or
* GetContextKeysForPrincipalPolicy .
*/
public final List missingContextValues() {
return missingContextValues;
}
/**
*
* Additional details about the results of the evaluation decision on a single resource. This parameter is returned
* only for cross-account simulations. This parameter explains how each policy type contributes to the
* resource-specific evaluation decision.
*
*
* 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 #hasEvalDecisionDetails} method.
*
*
* @return Additional details about the results of the evaluation decision on a single resource. This parameter is
* returned only for cross-account simulations. This parameter explains how each policy type contributes to
* the resource-specific evaluation decision.
*/
public final Map evalDecisionDetails() {
return EvalDecisionDetailsTypeCopier.copyStringToEnum(evalDecisionDetails);
}
/**
* For responses, this returns true if the service returned a value for the EvalDecisionDetails 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 hasEvalDecisionDetails() {
return evalDecisionDetails != null && !(evalDecisionDetails instanceof SdkAutoConstructMap);
}
/**
*
* Additional details about the results of the evaluation decision on a single resource. This parameter is returned
* only for cross-account simulations. This parameter explains how each policy type contributes to the
* resource-specific evaluation decision.
*
*
* 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 #hasEvalDecisionDetails} method.
*
*
* @return Additional details about the results of the evaluation decision on a single resource. This parameter is
* returned only for cross-account simulations. This parameter explains how each policy type contributes to
* the resource-specific evaluation decision.
*/
public final Map evalDecisionDetailsAsStrings() {
return evalDecisionDetails;
}
/**
*
* Contains information about the effect that a permissions boundary has on a policy simulation when that boundary
* is applied to an IAM entity.
*
*
* @return Contains information about the effect that a permissions boundary has on a policy simulation when that
* boundary is applied to an IAM entity.
*/
public final PermissionsBoundaryDecisionDetail permissionsBoundaryDecisionDetail() {
return permissionsBoundaryDecisionDetail;
}
@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 + Objects.hashCode(evalResourceName());
hashCode = 31 * hashCode + Objects.hashCode(evalResourceDecisionAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasMatchedStatements() ? matchedStatements() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasMissingContextValues() ? missingContextValues() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasEvalDecisionDetails() ? evalDecisionDetailsAsStrings() : null);
hashCode = 31 * hashCode + Objects.hashCode(permissionsBoundaryDecisionDetail());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ResourceSpecificResult)) {
return false;
}
ResourceSpecificResult other = (ResourceSpecificResult) obj;
return Objects.equals(evalResourceName(), other.evalResourceName())
&& Objects.equals(evalResourceDecisionAsString(), other.evalResourceDecisionAsString())
&& hasMatchedStatements() == other.hasMatchedStatements()
&& Objects.equals(matchedStatements(), other.matchedStatements())
&& hasMissingContextValues() == other.hasMissingContextValues()
&& Objects.equals(missingContextValues(), other.missingContextValues())
&& hasEvalDecisionDetails() == other.hasEvalDecisionDetails()
&& Objects.equals(evalDecisionDetailsAsStrings(), other.evalDecisionDetailsAsStrings())
&& Objects.equals(permissionsBoundaryDecisionDetail(), other.permissionsBoundaryDecisionDetail());
}
/**
* 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("ResourceSpecificResult").add("EvalResourceName", evalResourceName())
.add("EvalResourceDecision", evalResourceDecisionAsString())
.add("MatchedStatements", hasMatchedStatements() ? matchedStatements() : null)
.add("MissingContextValues", hasMissingContextValues() ? missingContextValues() : null)
.add("EvalDecisionDetails", hasEvalDecisionDetails() ? evalDecisionDetailsAsStrings() : null)
.add("PermissionsBoundaryDecisionDetail", permissionsBoundaryDecisionDetail()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "EvalResourceName":
return Optional.ofNullable(clazz.cast(evalResourceName()));
case "EvalResourceDecision":
return Optional.ofNullable(clazz.cast(evalResourceDecisionAsString()));
case "MatchedStatements":
return Optional.ofNullable(clazz.cast(matchedStatements()));
case "MissingContextValues":
return Optional.ofNullable(clazz.cast(missingContextValues()));
case "EvalDecisionDetails":
return Optional.ofNullable(clazz.cast(evalDecisionDetailsAsStrings()));
case "PermissionsBoundaryDecisionDetail":
return Optional.ofNullable(clazz.cast(permissionsBoundaryDecisionDetail()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((ResourceSpecificResult) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends SdkPojo, CopyableBuilder {
/**
*
* The name of the simulated resource, in Amazon Resource Name (ARN) format.
*
*
* @param evalResourceName
* The name of the simulated resource, in Amazon Resource Name (ARN) format.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder evalResourceName(String evalResourceName);
/**
*
* The result of the simulation of the simulated API operation on the resource specified in
* EvalResourceName
.
*
*
* @param evalResourceDecision
* The result of the simulation of the simulated API operation on the resource specified in
* EvalResourceName
.
* @see PolicyEvaluationDecisionType
* @return Returns a reference to this object so that method calls can be chained together.
* @see PolicyEvaluationDecisionType
*/
Builder evalResourceDecision(String evalResourceDecision);
/**
*
* The result of the simulation of the simulated API operation on the resource specified in
* EvalResourceName
.
*
*
* @param evalResourceDecision
* The result of the simulation of the simulated API operation on the resource specified in
* EvalResourceName
.
* @see PolicyEvaluationDecisionType
* @return Returns a reference to this object so that method calls can be chained together.
* @see PolicyEvaluationDecisionType
*/
Builder evalResourceDecision(PolicyEvaluationDecisionType evalResourceDecision);
/**
*
* A list of the statements in the input policies that determine the result for this part of the simulation.
* Remember that even if multiple statements allow the operation on the resource, if any statement denies
* that operation, then the explicit deny overrides any allow. In addition, the deny statement is the only entry
* included in the result.
*
*
* @param matchedStatements
* A list of the statements in the input policies that determine the result for this part of the
* simulation. Remember that even if multiple statements allow the operation on the resource, if
* any statement denies that operation, then the explicit deny overrides any allow. In addition,
* the deny statement is the only entry included in the result.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder matchedStatements(Collection matchedStatements);
/**
*
* A list of the statements in the input policies that determine the result for this part of the simulation.
* Remember that even if multiple statements allow the operation on the resource, if any statement denies
* that operation, then the explicit deny overrides any allow. In addition, the deny statement is the only entry
* included in the result.
*
*
* @param matchedStatements
* A list of the statements in the input policies that determine the result for this part of the
* simulation. Remember that even if multiple statements allow the operation on the resource, if
* any statement denies that operation, then the explicit deny overrides any allow. In addition,
* the deny statement is the only entry included in the result.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder matchedStatements(Statement... matchedStatements);
/**
*
* A list of the statements in the input policies that determine the result for this part of the simulation.
* Remember that even if multiple statements allow the operation on the resource, if any statement denies
* that operation, then the explicit deny overrides any allow. In addition, the deny statement is the only entry
* included in the result.
*
* This is a convenience method that creates an instance of the
* {@link software.amazon.awssdk.services.iam.model.Statement.Builder} avoiding the need to create one manually
* via {@link software.amazon.awssdk.services.iam.model.Statement#builder()}.
*
*
* When the {@link Consumer} completes,
* {@link software.amazon.awssdk.services.iam.model.Statement.Builder#build()} is called immediately and its
* result is passed to {@link #matchedStatements(List)}.
*
* @param matchedStatements
* a consumer that will call methods on
* {@link software.amazon.awssdk.services.iam.model.Statement.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #matchedStatements(java.util.Collection)
*/
Builder matchedStatements(Consumer... matchedStatements);
/**
*
* A list of context keys that are required by the included input policies but that were not provided by one of
* the input parameters. This list is used when a list of ARNs is included in the ResourceArns
* parameter instead of "*". If you do not specify individual resources, by setting ResourceArns
to
* "*" or by not including the ResourceArns
parameter, then any missing context values are instead
* included under the EvaluationResults
section. To discover the context keys used by a set of
* policies, you can call GetContextKeysForCustomPolicy or GetContextKeysForPrincipalPolicy .
*
*
* @param missingContextValues
* A list of context keys that are required by the included input policies but that were not provided by
* one of the input parameters. This list is used when a list of ARNs is included in the
* ResourceArns
parameter instead of "*". If you do not specify individual resources, by
* setting ResourceArns
to "*" or by not including the ResourceArns
parameter,
* then any missing context values are instead included under the EvaluationResults
section.
* To discover the context keys used by a set of policies, you can call
* GetContextKeysForCustomPolicy or GetContextKeysForPrincipalPolicy .
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder missingContextValues(Collection missingContextValues);
/**
*
* A list of context keys that are required by the included input policies but that were not provided by one of
* the input parameters. This list is used when a list of ARNs is included in the ResourceArns
* parameter instead of "*". If you do not specify individual resources, by setting ResourceArns
to
* "*" or by not including the ResourceArns
parameter, then any missing context values are instead
* included under the EvaluationResults
section. To discover the context keys used by a set of
* policies, you can call GetContextKeysForCustomPolicy or GetContextKeysForPrincipalPolicy .
*
*
* @param missingContextValues
* A list of context keys that are required by the included input policies but that were not provided by
* one of the input parameters. This list is used when a list of ARNs is included in the
* ResourceArns
parameter instead of "*". If you do not specify individual resources, by
* setting ResourceArns
to "*" or by not including the ResourceArns
parameter,
* then any missing context values are instead included under the EvaluationResults
section.
* To discover the context keys used by a set of policies, you can call
* GetContextKeysForCustomPolicy or GetContextKeysForPrincipalPolicy .
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder missingContextValues(String... missingContextValues);
/**
*
* Additional details about the results of the evaluation decision on a single resource. This parameter is
* returned only for cross-account simulations. This parameter explains how each policy type contributes to the
* resource-specific evaluation decision.
*
*
* @param evalDecisionDetails
* Additional details about the results of the evaluation decision on a single resource. This parameter
* is returned only for cross-account simulations. This parameter explains how each policy type
* contributes to the resource-specific evaluation decision.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder evalDecisionDetailsWithStrings(Map evalDecisionDetails);
/**
*
* Additional details about the results of the evaluation decision on a single resource. This parameter is
* returned only for cross-account simulations. This parameter explains how each policy type contributes to the
* resource-specific evaluation decision.
*
*
* @param evalDecisionDetails
* Additional details about the results of the evaluation decision on a single resource. This parameter
* is returned only for cross-account simulations. This parameter explains how each policy type
* contributes to the resource-specific evaluation decision.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder evalDecisionDetails(Map evalDecisionDetails);
/**
*
* Contains information about the effect that a permissions boundary has on a policy simulation when that
* boundary is applied to an IAM entity.
*
*
* @param permissionsBoundaryDecisionDetail
* Contains information about the effect that a permissions boundary has on a policy simulation when that
* boundary is applied to an IAM entity.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder permissionsBoundaryDecisionDetail(PermissionsBoundaryDecisionDetail permissionsBoundaryDecisionDetail);
/**
*
* Contains information about the effect that a permissions boundary has on a policy simulation when that
* boundary is applied to an IAM entity.
*
* This is a convenience method that creates an instance of the
* {@link PermissionsBoundaryDecisionDetail.Builder} avoiding the need to create one manually via
* {@link PermissionsBoundaryDecisionDetail#builder()}.
*
*
* When the {@link Consumer} completes, {@link PermissionsBoundaryDecisionDetail.Builder#build()} is called
* immediately and its result is passed to
* {@link #permissionsBoundaryDecisionDetail(PermissionsBoundaryDecisionDetail)}.
*
* @param permissionsBoundaryDecisionDetail
* a consumer that will call methods on {@link PermissionsBoundaryDecisionDetail.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #permissionsBoundaryDecisionDetail(PermissionsBoundaryDecisionDetail)
*/
default Builder permissionsBoundaryDecisionDetail(
Consumer permissionsBoundaryDecisionDetail) {
return permissionsBoundaryDecisionDetail(PermissionsBoundaryDecisionDetail.builder()
.applyMutation(permissionsBoundaryDecisionDetail).build());
}
}
static final class BuilderImpl implements Builder {
private String evalResourceName;
private String evalResourceDecision;
private List matchedStatements = DefaultSdkAutoConstructList.getInstance();
private List missingContextValues = DefaultSdkAutoConstructList.getInstance();
private Map evalDecisionDetails = DefaultSdkAutoConstructMap.getInstance();
private PermissionsBoundaryDecisionDetail permissionsBoundaryDecisionDetail;
private BuilderImpl() {
}
private BuilderImpl(ResourceSpecificResult model) {
evalResourceName(model.evalResourceName);
evalResourceDecision(model.evalResourceDecision);
matchedStatements(model.matchedStatements);
missingContextValues(model.missingContextValues);
evalDecisionDetailsWithStrings(model.evalDecisionDetails);
permissionsBoundaryDecisionDetail(model.permissionsBoundaryDecisionDetail);
}
public final String getEvalResourceName() {
return evalResourceName;
}
public final void setEvalResourceName(String evalResourceName) {
this.evalResourceName = evalResourceName;
}
@Override
public final Builder evalResourceName(String evalResourceName) {
this.evalResourceName = evalResourceName;
return this;
}
public final String getEvalResourceDecision() {
return evalResourceDecision;
}
public final void setEvalResourceDecision(String evalResourceDecision) {
this.evalResourceDecision = evalResourceDecision;
}
@Override
public final Builder evalResourceDecision(String evalResourceDecision) {
this.evalResourceDecision = evalResourceDecision;
return this;
}
@Override
public final Builder evalResourceDecision(PolicyEvaluationDecisionType evalResourceDecision) {
this.evalResourceDecision(evalResourceDecision == null ? null : evalResourceDecision.toString());
return this;
}
public final List getMatchedStatements() {
List result = StatementListTypeCopier.copyToBuilder(this.matchedStatements);
if (result instanceof SdkAutoConstructList) {
return null;
}
return result;
}
public final void setMatchedStatements(Collection matchedStatements) {
this.matchedStatements = StatementListTypeCopier.copyFromBuilder(matchedStatements);
}
@Override
public final Builder matchedStatements(Collection matchedStatements) {
this.matchedStatements = StatementListTypeCopier.copy(matchedStatements);
return this;
}
@Override
@SafeVarargs
public final Builder matchedStatements(Statement... matchedStatements) {
matchedStatements(Arrays.asList(matchedStatements));
return this;
}
@Override
@SafeVarargs
public final Builder matchedStatements(Consumer... matchedStatements) {
matchedStatements(Stream.of(matchedStatements).map(c -> Statement.builder().applyMutation(c).build())
.collect(Collectors.toList()));
return this;
}
public final Collection getMissingContextValues() {
if (missingContextValues instanceof SdkAutoConstructList) {
return null;
}
return missingContextValues;
}
public final void setMissingContextValues(Collection missingContextValues) {
this.missingContextValues = ContextKeyNamesResultListTypeCopier.copy(missingContextValues);
}
@Override
public final Builder missingContextValues(Collection missingContextValues) {
this.missingContextValues = ContextKeyNamesResultListTypeCopier.copy(missingContextValues);
return this;
}
@Override
@SafeVarargs
public final Builder missingContextValues(String... missingContextValues) {
missingContextValues(Arrays.asList(missingContextValues));
return this;
}
public final Map getEvalDecisionDetails() {
if (evalDecisionDetails instanceof SdkAutoConstructMap) {
return null;
}
return evalDecisionDetails;
}
public final void setEvalDecisionDetails(Map evalDecisionDetails) {
this.evalDecisionDetails = EvalDecisionDetailsTypeCopier.copy(evalDecisionDetails);
}
@Override
public final Builder evalDecisionDetailsWithStrings(Map evalDecisionDetails) {
this.evalDecisionDetails = EvalDecisionDetailsTypeCopier.copy(evalDecisionDetails);
return this;
}
@Override
public final Builder evalDecisionDetails(Map evalDecisionDetails) {
this.evalDecisionDetails = EvalDecisionDetailsTypeCopier.copyEnumToString(evalDecisionDetails);
return this;
}
public final PermissionsBoundaryDecisionDetail.Builder getPermissionsBoundaryDecisionDetail() {
return permissionsBoundaryDecisionDetail != null ? permissionsBoundaryDecisionDetail.toBuilder() : null;
}
public final void setPermissionsBoundaryDecisionDetail(
PermissionsBoundaryDecisionDetail.BuilderImpl permissionsBoundaryDecisionDetail) {
this.permissionsBoundaryDecisionDetail = permissionsBoundaryDecisionDetail != null ? permissionsBoundaryDecisionDetail
.build() : null;
}
@Override
public final Builder permissionsBoundaryDecisionDetail(PermissionsBoundaryDecisionDetail permissionsBoundaryDecisionDetail) {
this.permissionsBoundaryDecisionDetail = permissionsBoundaryDecisionDetail;
return this;
}
@Override
public ResourceSpecificResult build() {
return new ResourceSpecificResult(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}