All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.fms.model.PolicySummary Maven / Gradle / Ivy

/*
 * 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.util.Arrays;
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.Function;
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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Details of the AWS Firewall Manager policy. *

*/ @Generated("software.amazon.awssdk:codegen") public final class PolicySummary implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField POLICY_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(PolicySummary::policyArn)).setter(setter(Builder::policyArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PolicyArn").build()).build(); private static final SdkField POLICY_ID_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(PolicySummary::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(PolicySummary::policyName)).setter(setter(Builder::policyName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PolicyName").build()).build(); private static final SdkField RESOURCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(PolicySummary::resourceType)).setter(setter(Builder::resourceType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceType").build()).build(); private static final SdkField SECURITY_SERVICE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(PolicySummary::securityServiceTypeAsString)).setter(setter(Builder::securityServiceType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SecurityServiceType").build()) .build(); private static final SdkField REMEDIATION_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .getter(getter(PolicySummary::remediationEnabled)).setter(setter(Builder::remediationEnabled)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RemediationEnabled").build()) .build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(POLICY_ARN_FIELD, POLICY_ID_FIELD, POLICY_NAME_FIELD, RESOURCE_TYPE_FIELD, SECURITY_SERVICE_TYPE_FIELD, REMEDIATION_ENABLED_FIELD)); private static final long serialVersionUID = 1L; private final String policyArn; private final String policyId; private final String policyName; private final String resourceType; private final String securityServiceType; private final Boolean remediationEnabled; private PolicySummary(BuilderImpl builder) { this.policyArn = builder.policyArn; this.policyId = builder.policyId; this.policyName = builder.policyName; this.resourceType = builder.resourceType; this.securityServiceType = builder.securityServiceType; this.remediationEnabled = builder.remediationEnabled; } /** *

* The Amazon Resource Name (ARN) of the specified policy. *

* * @return The Amazon Resource Name (ARN) of the specified policy. */ public String policyArn() { return policyArn; } /** *

* The ID of the specified policy. *

* * @return The ID of the specified policy. */ public String policyId() { return policyId; } /** *

* The friendly name of the specified policy. *

* * @return The friendly name of the specified policy. */ public String policyName() { return policyName; } /** *

* The type of resource to protect with the policy, either an Application Load Balancer or a CloudFront * distribution. This is in the format shown in AWS * Resource Types Reference. Valid values are AWS::ElasticLoadBalancingV2::LoadBalancer or * AWS::CloudFront::Distribution. *

* * @return The type of resource to protect with the policy, either an Application Load Balancer or a CloudFront * distribution. This is in the format shown in AWS * Resource Types Reference. Valid values are AWS::ElasticLoadBalancingV2::LoadBalancer or * AWS::CloudFront::Distribution. */ public String resourceType() { return resourceType; } /** *

* The service that the policy is using to protect the resources. This value is WAF. *

*

* If the service returns an enum value that is not available in the current SDK version, * {@link #securityServiceType} will return {@link SecurityServiceType#UNKNOWN_TO_SDK_VERSION}. The raw value * returned by the service is available from {@link #securityServiceTypeAsString}. *

* * @return The service that the policy is using to protect the resources. This value is WAF. * @see SecurityServiceType */ public SecurityServiceType securityServiceType() { return SecurityServiceType.fromValue(securityServiceType); } /** *

* The service that the policy is using to protect the resources. This value is WAF. *

*

* If the service returns an enum value that is not available in the current SDK version, * {@link #securityServiceType} will return {@link SecurityServiceType#UNKNOWN_TO_SDK_VERSION}. The raw value * returned by the service is available from {@link #securityServiceTypeAsString}. *

* * @return The service that the policy is using to protect the resources. This value is WAF. * @see SecurityServiceType */ public String securityServiceTypeAsString() { return securityServiceType; } /** *

* Indicates if the policy should be automatically applied to new resources. *

* * @return Indicates if the policy should be automatically applied to new resources. */ public Boolean remediationEnabled() { return remediationEnabled; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(policyArn()); hashCode = 31 * hashCode + Objects.hashCode(policyId()); hashCode = 31 * hashCode + Objects.hashCode(policyName()); hashCode = 31 * hashCode + Objects.hashCode(resourceType()); hashCode = 31 * hashCode + Objects.hashCode(securityServiceTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(remediationEnabled()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof PolicySummary)) { return false; } PolicySummary other = (PolicySummary) obj; return Objects.equals(policyArn(), other.policyArn()) && Objects.equals(policyId(), other.policyId()) && Objects.equals(policyName(), other.policyName()) && Objects.equals(resourceType(), other.resourceType()) && Objects.equals(securityServiceTypeAsString(), other.securityServiceTypeAsString()) && Objects.equals(remediationEnabled(), other.remediationEnabled()); } /** * 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("PolicySummary").add("PolicyArn", policyArn()).add("PolicyId", policyId()) .add("PolicyName", policyName()).add("ResourceType", resourceType()) .add("SecurityServiceType", securityServiceTypeAsString()).add("RemediationEnabled", remediationEnabled()) .build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "PolicyArn": return Optional.ofNullable(clazz.cast(policyArn())); case "PolicyId": return Optional.ofNullable(clazz.cast(policyId())); case "PolicyName": return Optional.ofNullable(clazz.cast(policyName())); case "ResourceType": return Optional.ofNullable(clazz.cast(resourceType())); case "SecurityServiceType": return Optional.ofNullable(clazz.cast(securityServiceTypeAsString())); case "RemediationEnabled": return Optional.ofNullable(clazz.cast(remediationEnabled())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((PolicySummary) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The Amazon Resource Name (ARN) of the specified policy. *

* * @param policyArn * The Amazon Resource Name (ARN) of the specified policy. * @return Returns a reference to this object so that method calls can be chained together. */ Builder policyArn(String policyArn); /** *

* The ID of the specified policy. *

* * @param policyId * The ID of the specified 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 specified policy. *

* * @param policyName * The friendly name of the specified policy. * @return Returns a reference to this object so that method calls can be chained together. */ Builder policyName(String policyName); /** *

* The type of resource to protect with the policy, either an Application Load Balancer or a CloudFront * distribution. This is in the format shown in AWS * Resource Types Reference. Valid values are AWS::ElasticLoadBalancingV2::LoadBalancer or * AWS::CloudFront::Distribution. *

* * @param resourceType * The type of resource to protect with the policy, either an Application Load Balancer or a CloudFront * distribution. This is in the format shown in AWS Resource Types Reference. Valid values are * AWS::ElasticLoadBalancingV2::LoadBalancer or AWS::CloudFront::Distribution. * @return Returns a reference to this object so that method calls can be chained together. */ Builder resourceType(String resourceType); /** *

* The service that the policy is using to protect the resources. This value is WAF. *

* * @param securityServiceType * The service that the policy is using to protect the resources. This value is WAF. * @see SecurityServiceType * @return Returns a reference to this object so that method calls can be chained together. * @see SecurityServiceType */ Builder securityServiceType(String securityServiceType); /** *

* The service that the policy is using to protect the resources. This value is WAF. *

* * @param securityServiceType * The service that the policy is using to protect the resources. This value is WAF. * @see SecurityServiceType * @return Returns a reference to this object so that method calls can be chained together. * @see SecurityServiceType */ Builder securityServiceType(SecurityServiceType securityServiceType); /** *

* Indicates if the policy should be automatically applied to new resources. *

* * @param remediationEnabled * Indicates if the policy should be automatically applied to new resources. * @return Returns a reference to this object so that method calls can be chained together. */ Builder remediationEnabled(Boolean remediationEnabled); } static final class BuilderImpl implements Builder { private String policyArn; private String policyId; private String policyName; private String resourceType; private String securityServiceType; private Boolean remediationEnabled; private BuilderImpl() { } private BuilderImpl(PolicySummary model) { policyArn(model.policyArn); policyId(model.policyId); policyName(model.policyName); resourceType(model.resourceType); securityServiceType(model.securityServiceType); remediationEnabled(model.remediationEnabled); } public final String getPolicyArn() { return policyArn; } @Override public final Builder policyArn(String policyArn) { this.policyArn = policyArn; return this; } public final void setPolicyArn(String policyArn) { this.policyArn = policyArn; } 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 getResourceType() { return resourceType; } @Override public final Builder resourceType(String resourceType) { this.resourceType = resourceType; return this; } public final void setResourceType(String resourceType) { this.resourceType = resourceType; } public final String getSecurityServiceTypeAsString() { return securityServiceType; } @Override public final Builder securityServiceType(String securityServiceType) { this.securityServiceType = securityServiceType; return this; } @Override public final Builder securityServiceType(SecurityServiceType securityServiceType) { this.securityServiceType(securityServiceType.toString()); return this; } public final void setSecurityServiceType(String securityServiceType) { this.securityServiceType = securityServiceType; } public final Boolean getRemediationEnabled() { return remediationEnabled; } @Override public final Builder remediationEnabled(Boolean remediationEnabled) { this.remediationEnabled = remediationEnabled; return this; } public final void setRemediationEnabled(Boolean remediationEnabled) { this.remediationEnabled = remediationEnabled; } @Override public PolicySummary build() { return new PolicySummary(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy