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.fms.model.PolicyComplianceStatus Maven / Gradle / Ivy
Go to download
The AWS Java SDK for FMS module holds the client classes that are used for
communicating with FMS.
/*
* 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.fms.model;
import java.io.Serializable;
import java.time.Instant;
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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Indicates whether the account is compliant with the specified policy. An account is considered non-compliant if it
* includes resources that are not protected by the policy.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class PolicyComplianceStatus implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField POLICY_OWNER_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(PolicyComplianceStatus::policyOwner)).setter(setter(Builder::policyOwner))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PolicyOwner").build()).build();
private static final SdkField POLICY_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(PolicyComplianceStatus::policyId)).setter(setter(Builder::policyId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PolicyId").build()).build();
private static final SdkField POLICY_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(PolicyComplianceStatus::policyName)).setter(setter(Builder::policyName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PolicyName").build()).build();
private static final SdkField MEMBER_ACCOUNT_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(PolicyComplianceStatus::memberAccount)).setter(setter(Builder::memberAccount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MemberAccount").build()).build();
private static final SdkField> EVALUATION_RESULTS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.getter(getter(PolicyComplianceStatus::evaluationResults))
.setter(setter(Builder::evaluationResults))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EvaluationResults").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(EvaluationResult::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField LAST_UPDATED_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(PolicyComplianceStatus::lastUpdated)).setter(setter(Builder::lastUpdated))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastUpdated").build()).build();
private static final SdkField> ISSUE_INFO_MAP_FIELD = SdkField
.> builder(MarshallingType.MAP)
.getter(getter(PolicyComplianceStatus::issueInfoMapAsStrings))
.setter(setter(Builder::issueInfoMapWithStrings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IssueInfoMap").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 List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(POLICY_OWNER_FIELD,
POLICY_ID_FIELD, POLICY_NAME_FIELD, MEMBER_ACCOUNT_FIELD, EVALUATION_RESULTS_FIELD, LAST_UPDATED_FIELD,
ISSUE_INFO_MAP_FIELD));
private static final long serialVersionUID = 1L;
private final String policyOwner;
private final String policyId;
private final String policyName;
private final String memberAccount;
private final List evaluationResults;
private final Instant lastUpdated;
private final Map issueInfoMap;
private PolicyComplianceStatus(BuilderImpl builder) {
this.policyOwner = builder.policyOwner;
this.policyId = builder.policyId;
this.policyName = builder.policyName;
this.memberAccount = builder.memberAccount;
this.evaluationResults = builder.evaluationResults;
this.lastUpdated = builder.lastUpdated;
this.issueInfoMap = builder.issueInfoMap;
}
/**
*
* The AWS account that created the AWS Firewall Manager policy.
*
*
* @return The AWS account that created the AWS Firewall Manager policy.
*/
public String policyOwner() {
return policyOwner;
}
/**
*
* The ID of the AWS Firewall Manager policy.
*
*
* @return The ID of the AWS Firewall Manager policy.
*/
public String policyId() {
return policyId;
}
/**
*
* The friendly name of the AWS Firewall Manager policy.
*
*
* @return The friendly name of the AWS Firewall Manager policy.
*/
public String policyName() {
return policyName;
}
/**
*
* The member account ID.
*
*
* @return The member account ID.
*/
public String memberAccount() {
return memberAccount;
}
/**
*
* An array of EvaluationResult
objects.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return An array of EvaluationResult
objects.
*/
public List evaluationResults() {
return evaluationResults;
}
/**
*
* Time stamp of the last update to the EvaluationResult
objects.
*
*
* @return Time stamp of the last update to the EvaluationResult
objects.
*/
public Instant lastUpdated() {
return lastUpdated;
}
/**
*
* Details about problems with dependent services, such as AWS WAF or AWS Config, that are causing a resource to be
* non-compliant. The details include the name of the dependent service and the error message received that
* indicates the problem with the service.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return Details about problems with dependent services, such as AWS WAF or AWS Config, that are causing a
* resource to be non-compliant. The details include the name of the dependent service and the error message
* received that indicates the problem with the service.
*/
public Map issueInfoMap() {
return IssueInfoMapCopier.copyStringToEnum(issueInfoMap);
}
/**
*
* Details about problems with dependent services, such as AWS WAF or AWS Config, that are causing a resource to be
* non-compliant. The details include the name of the dependent service and the error message received that
* indicates the problem with the service.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return Details about problems with dependent services, such as AWS WAF or AWS Config, that are causing a
* resource to be non-compliant. The details include the name of the dependent service and the error message
* received that indicates the problem with the service.
*/
public Map issueInfoMapAsStrings() {
return issueInfoMap;
}
@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(policyOwner());
hashCode = 31 * hashCode + Objects.hashCode(policyId());
hashCode = 31 * hashCode + Objects.hashCode(policyName());
hashCode = 31 * hashCode + Objects.hashCode(memberAccount());
hashCode = 31 * hashCode + Objects.hashCode(evaluationResults());
hashCode = 31 * hashCode + Objects.hashCode(lastUpdated());
hashCode = 31 * hashCode + Objects.hashCode(issueInfoMapAsStrings());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof PolicyComplianceStatus)) {
return false;
}
PolicyComplianceStatus other = (PolicyComplianceStatus) obj;
return Objects.equals(policyOwner(), other.policyOwner()) && Objects.equals(policyId(), other.policyId())
&& Objects.equals(policyName(), other.policyName()) && Objects.equals(memberAccount(), other.memberAccount())
&& Objects.equals(evaluationResults(), other.evaluationResults())
&& Objects.equals(lastUpdated(), other.lastUpdated())
&& Objects.equals(issueInfoMapAsStrings(), other.issueInfoMapAsStrings());
}
/**
* 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("PolicyComplianceStatus").add("PolicyOwner", policyOwner()).add("PolicyId", policyId())
.add("PolicyName", policyName()).add("MemberAccount", memberAccount())
.add("EvaluationResults", evaluationResults()).add("LastUpdated", lastUpdated())
.add("IssueInfoMap", issueInfoMapAsStrings()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "PolicyOwner":
return Optional.ofNullable(clazz.cast(policyOwner()));
case "PolicyId":
return Optional.ofNullable(clazz.cast(policyId()));
case "PolicyName":
return Optional.ofNullable(clazz.cast(policyName()));
case "MemberAccount":
return Optional.ofNullable(clazz.cast(memberAccount()));
case "EvaluationResults":
return Optional.ofNullable(clazz.cast(evaluationResults()));
case "LastUpdated":
return Optional.ofNullable(clazz.cast(lastUpdated()));
case "IssueInfoMap":
return Optional.ofNullable(clazz.cast(issueInfoMapAsStrings()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((PolicyComplianceStatus) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends SdkPojo, CopyableBuilder {
/**
*
* The AWS account that created the AWS Firewall Manager policy.
*
*
* @param policyOwner
* The AWS account that created the AWS Firewall Manager policy.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder policyOwner(String policyOwner);
/**
*
* The ID of the AWS Firewall Manager policy.
*
*
* @param policyId
* The ID of the AWS Firewall Manager policy.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder policyId(String policyId);
/**
*
* The friendly name of the AWS Firewall Manager policy.
*
*
* @param policyName
* The friendly name of the AWS Firewall Manager policy.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder policyName(String policyName);
/**
*
* The member account ID.
*
*
* @param memberAccount
* The member account ID.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder memberAccount(String memberAccount);
/**
*
* An array of EvaluationResult
objects.
*
*
* @param evaluationResults
* An array of EvaluationResult
objects.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder evaluationResults(Collection evaluationResults);
/**
*
* An array of EvaluationResult
objects.
*
*
* @param evaluationResults
* An array of EvaluationResult
objects.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder evaluationResults(EvaluationResult... evaluationResults);
/**
*
* An array of EvaluationResult
objects.
*
* This is a convenience that creates an instance of the {@link List.Builder} avoiding the
* need to create one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and
* its result is passed to {@link #evaluationResults(List)}.
*
* @param evaluationResults
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #evaluationResults(List)
*/
Builder evaluationResults(Consumer... evaluationResults);
/**
*
* Time stamp of the last update to the EvaluationResult
objects.
*
*
* @param lastUpdated
* Time stamp of the last update to the EvaluationResult
objects.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder lastUpdated(Instant lastUpdated);
/**
*
* Details about problems with dependent services, such as AWS WAF or AWS Config, that are causing a resource to
* be non-compliant. The details include the name of the dependent service and the error message received that
* indicates the problem with the service.
*
*
* @param issueInfoMap
* Details about problems with dependent services, such as AWS WAF or AWS Config, that are causing a
* resource to be non-compliant. The details include the name of the dependent service and the error
* message received that indicates the problem with the service.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder issueInfoMapWithStrings(Map issueInfoMap);
/**
*
* Details about problems with dependent services, such as AWS WAF or AWS Config, that are causing a resource to
* be non-compliant. The details include the name of the dependent service and the error message received that
* indicates the problem with the service.
*
*
* @param issueInfoMap
* Details about problems with dependent services, such as AWS WAF or AWS Config, that are causing a
* resource to be non-compliant. The details include the name of the dependent service and the error
* message received that indicates the problem with the service.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder issueInfoMap(Map issueInfoMap);
}
static final class BuilderImpl implements Builder {
private String policyOwner;
private String policyId;
private String policyName;
private String memberAccount;
private List evaluationResults = DefaultSdkAutoConstructList.getInstance();
private Instant lastUpdated;
private Map issueInfoMap = DefaultSdkAutoConstructMap.getInstance();
private BuilderImpl() {
}
private BuilderImpl(PolicyComplianceStatus model) {
policyOwner(model.policyOwner);
policyId(model.policyId);
policyName(model.policyName);
memberAccount(model.memberAccount);
evaluationResults(model.evaluationResults);
lastUpdated(model.lastUpdated);
issueInfoMapWithStrings(model.issueInfoMap);
}
public final String getPolicyOwner() {
return policyOwner;
}
@Override
public final Builder policyOwner(String policyOwner) {
this.policyOwner = policyOwner;
return this;
}
public final void setPolicyOwner(String policyOwner) {
this.policyOwner = policyOwner;
}
public final String getPolicyId() {
return policyId;
}
@Override
public final Builder policyId(String policyId) {
this.policyId = policyId;
return this;
}
public final void setPolicyId(String policyId) {
this.policyId = policyId;
}
public final String getPolicyName() {
return policyName;
}
@Override
public final Builder policyName(String policyName) {
this.policyName = policyName;
return this;
}
public final void setPolicyName(String policyName) {
this.policyName = policyName;
}
public final String getMemberAccount() {
return memberAccount;
}
@Override
public final Builder memberAccount(String memberAccount) {
this.memberAccount = memberAccount;
return this;
}
public final void setMemberAccount(String memberAccount) {
this.memberAccount = memberAccount;
}
public final Collection getEvaluationResults() {
return evaluationResults != null ? evaluationResults.stream().map(EvaluationResult::toBuilder)
.collect(Collectors.toList()) : null;
}
@Override
public final Builder evaluationResults(Collection evaluationResults) {
this.evaluationResults = EvaluationResultsCopier.copy(evaluationResults);
return this;
}
@Override
@SafeVarargs
public final Builder evaluationResults(EvaluationResult... evaluationResults) {
evaluationResults(Arrays.asList(evaluationResults));
return this;
}
@Override
@SafeVarargs
public final Builder evaluationResults(Consumer... evaluationResults) {
evaluationResults(Stream.of(evaluationResults).map(c -> EvaluationResult.builder().applyMutation(c).build())
.collect(Collectors.toList()));
return this;
}
public final void setEvaluationResults(Collection evaluationResults) {
this.evaluationResults = EvaluationResultsCopier.copyFromBuilder(evaluationResults);
}
public final Instant getLastUpdated() {
return lastUpdated;
}
@Override
public final Builder lastUpdated(Instant lastUpdated) {
this.lastUpdated = lastUpdated;
return this;
}
public final void setLastUpdated(Instant lastUpdated) {
this.lastUpdated = lastUpdated;
}
public final Map getIssueInfoMapAsStrings() {
return issueInfoMap;
}
@Override
public final Builder issueInfoMapWithStrings(Map issueInfoMap) {
this.issueInfoMap = IssueInfoMapCopier.copy(issueInfoMap);
return this;
}
@Override
public final Builder issueInfoMap(Map issueInfoMap) {
this.issueInfoMap = IssueInfoMapCopier.copyEnumToString(issueInfoMap);
return this;
}
public final void setIssueInfoMapWithStrings(Map issueInfoMap) {
this.issueInfoMap = IssueInfoMapCopier.copy(issueInfoMap);
}
@Override
public PolicyComplianceStatus build() {
return new PolicyComplianceStatus(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}