
software.amazon.awssdk.services.ssm.model.UpdatePatchBaselineResponse Maven / Gradle / Ivy
/*
* 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.ssm.model;
import java.time.Instant;
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 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.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
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 UpdatePatchBaselineResponse extends SsmResponse implements
ToCopyableBuilder {
private static final SdkField BASELINE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("BaselineId").getter(getter(UpdatePatchBaselineResponse::baselineId)).setter(setter(Builder::baselineId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BaselineId").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(UpdatePatchBaselineResponse::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField OPERATING_SYSTEM_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OperatingSystem").getter(getter(UpdatePatchBaselineResponse::operatingSystemAsString))
.setter(setter(Builder::operatingSystem))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OperatingSystem").build()).build();
private static final SdkField GLOBAL_FILTERS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("GlobalFilters")
.getter(getter(UpdatePatchBaselineResponse::globalFilters)).setter(setter(Builder::globalFilters))
.constructor(PatchFilterGroup::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GlobalFilters").build()).build();
private static final SdkField APPROVAL_RULES_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ApprovalRules")
.getter(getter(UpdatePatchBaselineResponse::approvalRules)).setter(setter(Builder::approvalRules))
.constructor(PatchRuleGroup::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ApprovalRules").build()).build();
private static final SdkField> APPROVED_PATCHES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("ApprovedPatches")
.getter(getter(UpdatePatchBaselineResponse::approvedPatches))
.setter(setter(Builder::approvedPatches))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ApprovedPatches").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 APPROVED_PATCHES_COMPLIANCE_LEVEL_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("ApprovedPatchesComplianceLevel")
.getter(getter(UpdatePatchBaselineResponse::approvedPatchesComplianceLevelAsString))
.setter(setter(Builder::approvedPatchesComplianceLevel))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ApprovedPatchesComplianceLevel")
.build()).build();
private static final SdkField APPROVED_PATCHES_ENABLE_NON_SECURITY_FIELD = SdkField
. builder(MarshallingType.BOOLEAN)
.memberName("ApprovedPatchesEnableNonSecurity")
.getter(getter(UpdatePatchBaselineResponse::approvedPatchesEnableNonSecurity))
.setter(setter(Builder::approvedPatchesEnableNonSecurity))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ApprovedPatchesEnableNonSecurity")
.build()).build();
private static final SdkField> REJECTED_PATCHES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("RejectedPatches")
.getter(getter(UpdatePatchBaselineResponse::rejectedPatches))
.setter(setter(Builder::rejectedPatches))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RejectedPatches").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 REJECTED_PATCHES_ACTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RejectedPatchesAction").getter(getter(UpdatePatchBaselineResponse::rejectedPatchesActionAsString))
.setter(setter(Builder::rejectedPatchesAction))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RejectedPatchesAction").build())
.build();
private static final SdkField CREATED_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreatedDate").getter(getter(UpdatePatchBaselineResponse::createdDate))
.setter(setter(Builder::createdDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedDate").build()).build();
private static final SdkField MODIFIED_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("ModifiedDate").getter(getter(UpdatePatchBaselineResponse::modifiedDate))
.setter(setter(Builder::modifiedDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ModifiedDate").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Description").getter(getter(UpdatePatchBaselineResponse::description))
.setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final SdkField> SOURCES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Sources")
.getter(getter(UpdatePatchBaselineResponse::sources))
.setter(setter(Builder::sources))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Sources").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(PatchSource::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BASELINE_ID_FIELD, NAME_FIELD,
OPERATING_SYSTEM_FIELD, GLOBAL_FILTERS_FIELD, APPROVAL_RULES_FIELD, APPROVED_PATCHES_FIELD,
APPROVED_PATCHES_COMPLIANCE_LEVEL_FIELD, APPROVED_PATCHES_ENABLE_NON_SECURITY_FIELD, REJECTED_PATCHES_FIELD,
REJECTED_PATCHES_ACTION_FIELD, CREATED_DATE_FIELD, MODIFIED_DATE_FIELD, DESCRIPTION_FIELD, SOURCES_FIELD));
private final String baselineId;
private final String name;
private final String operatingSystem;
private final PatchFilterGroup globalFilters;
private final PatchRuleGroup approvalRules;
private final List approvedPatches;
private final String approvedPatchesComplianceLevel;
private final Boolean approvedPatchesEnableNonSecurity;
private final List rejectedPatches;
private final String rejectedPatchesAction;
private final Instant createdDate;
private final Instant modifiedDate;
private final String description;
private final List sources;
private UpdatePatchBaselineResponse(BuilderImpl builder) {
super(builder);
this.baselineId = builder.baselineId;
this.name = builder.name;
this.operatingSystem = builder.operatingSystem;
this.globalFilters = builder.globalFilters;
this.approvalRules = builder.approvalRules;
this.approvedPatches = builder.approvedPatches;
this.approvedPatchesComplianceLevel = builder.approvedPatchesComplianceLevel;
this.approvedPatchesEnableNonSecurity = builder.approvedPatchesEnableNonSecurity;
this.rejectedPatches = builder.rejectedPatches;
this.rejectedPatchesAction = builder.rejectedPatchesAction;
this.createdDate = builder.createdDate;
this.modifiedDate = builder.modifiedDate;
this.description = builder.description;
this.sources = builder.sources;
}
/**
*
* The ID of the deleted patch baseline.
*
*
* @return The ID of the deleted patch baseline.
*/
public String baselineId() {
return baselineId;
}
/**
*
* The name of the patch baseline.
*
*
* @return The name of the patch baseline.
*/
public String name() {
return name;
}
/**
*
* The operating system rule used by the updated patch baseline.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #operatingSystem}
* will return {@link OperatingSystem#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #operatingSystemAsString}.
*
*
* @return The operating system rule used by the updated patch baseline.
* @see OperatingSystem
*/
public OperatingSystem operatingSystem() {
return OperatingSystem.fromValue(operatingSystem);
}
/**
*
* The operating system rule used by the updated patch baseline.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #operatingSystem}
* will return {@link OperatingSystem#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #operatingSystemAsString}.
*
*
* @return The operating system rule used by the updated patch baseline.
* @see OperatingSystem
*/
public String operatingSystemAsString() {
return operatingSystem;
}
/**
*
* A set of global filters used to exclude patches from the baseline.
*
*
* @return A set of global filters used to exclude patches from the baseline.
*/
public PatchFilterGroup globalFilters() {
return globalFilters;
}
/**
*
* A set of rules used to include patches in the baseline.
*
*
* @return A set of rules used to include patches in the baseline.
*/
public PatchRuleGroup approvalRules() {
return approvalRules;
}
/**
* Returns true if the ApprovedPatches property was specified by the sender (it may be empty), or false if the
* sender did not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS
* service.
*/
public boolean hasApprovedPatches() {
return approvedPatches != null && !(approvedPatches instanceof SdkAutoConstructList);
}
/**
*
* A list of explicitly approved patches for the baseline.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasApprovedPatches()} to see if a value was sent in this field.
*
*
* @return A list of explicitly approved patches for the baseline.
*/
public List approvedPatches() {
return approvedPatches;
}
/**
*
* The compliance severity level assigned to the patch baseline after the update completed.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #approvedPatchesComplianceLevel} will return {@link PatchComplianceLevel#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #approvedPatchesComplianceLevelAsString}.
*
*
* @return The compliance severity level assigned to the patch baseline after the update completed.
* @see PatchComplianceLevel
*/
public PatchComplianceLevel approvedPatchesComplianceLevel() {
return PatchComplianceLevel.fromValue(approvedPatchesComplianceLevel);
}
/**
*
* The compliance severity level assigned to the patch baseline after the update completed.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #approvedPatchesComplianceLevel} will return {@link PatchComplianceLevel#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #approvedPatchesComplianceLevelAsString}.
*
*
* @return The compliance severity level assigned to the patch baseline after the update completed.
* @see PatchComplianceLevel
*/
public String approvedPatchesComplianceLevelAsString() {
return approvedPatchesComplianceLevel;
}
/**
*
* Indicates whether the list of approved patches includes non-security updates that should be applied to the
* instances. The default value is 'false'. Applies to Linux instances only.
*
*
* @return Indicates whether the list of approved patches includes non-security updates that should be applied to
* the instances. The default value is 'false'. Applies to Linux instances only.
*/
public Boolean approvedPatchesEnableNonSecurity() {
return approvedPatchesEnableNonSecurity;
}
/**
* Returns true if the RejectedPatches property was specified by the sender (it may be empty), or false if the
* sender did not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS
* service.
*/
public boolean hasRejectedPatches() {
return rejectedPatches != null && !(rejectedPatches instanceof SdkAutoConstructList);
}
/**
*
* A list of explicitly rejected patches for the baseline.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasRejectedPatches()} to see if a value was sent in this field.
*
*
* @return A list of explicitly rejected patches for the baseline.
*/
public List rejectedPatches() {
return rejectedPatches;
}
/**
*
* The action specified to take on patches included in the RejectedPatches list. A patch can be allowed only if it
* is a dependency of another package, or blocked entirely along with packages that include it as a dependency.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #rejectedPatchesAction} will return {@link PatchAction#UNKNOWN_TO_SDK_VERSION}. The raw value returned by
* the service is available from {@link #rejectedPatchesActionAsString}.
*
*
* @return The action specified to take on patches included in the RejectedPatches list. A patch can be allowed only
* if it is a dependency of another package, or blocked entirely along with packages that include it as a
* dependency.
* @see PatchAction
*/
public PatchAction rejectedPatchesAction() {
return PatchAction.fromValue(rejectedPatchesAction);
}
/**
*
* The action specified to take on patches included in the RejectedPatches list. A patch can be allowed only if it
* is a dependency of another package, or blocked entirely along with packages that include it as a dependency.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #rejectedPatchesAction} will return {@link PatchAction#UNKNOWN_TO_SDK_VERSION}. The raw value returned by
* the service is available from {@link #rejectedPatchesActionAsString}.
*
*
* @return The action specified to take on patches included in the RejectedPatches list. A patch can be allowed only
* if it is a dependency of another package, or blocked entirely along with packages that include it as a
* dependency.
* @see PatchAction
*/
public String rejectedPatchesActionAsString() {
return rejectedPatchesAction;
}
/**
*
* The date when the patch baseline was created.
*
*
* @return The date when the patch baseline was created.
*/
public Instant createdDate() {
return createdDate;
}
/**
*
* The date when the patch baseline was last modified.
*
*
* @return The date when the patch baseline was last modified.
*/
public Instant modifiedDate() {
return modifiedDate;
}
/**
*
* A description of the Patch Baseline.
*
*
* @return A description of the Patch Baseline.
*/
public String description() {
return description;
}
/**
* Returns true if the Sources property was specified by the sender (it may be empty), or false if the sender did
* not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public boolean hasSources() {
return sources != null && !(sources instanceof SdkAutoConstructList);
}
/**
*
* Information about the patches to use to update the instances, including target operating systems and source
* repositories. Applies to Linux instances only.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasSources()} to see if a value was sent in this field.
*
*
* @return Information about the patches to use to update the instances, including target operating systems and
* source repositories. Applies to Linux instances only.
*/
public List sources() {
return sources;
}
@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(baselineId());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(operatingSystemAsString());
hashCode = 31 * hashCode + Objects.hashCode(globalFilters());
hashCode = 31 * hashCode + Objects.hashCode(approvalRules());
hashCode = 31 * hashCode + Objects.hashCode(approvedPatches());
hashCode = 31 * hashCode + Objects.hashCode(approvedPatchesComplianceLevelAsString());
hashCode = 31 * hashCode + Objects.hashCode(approvedPatchesEnableNonSecurity());
hashCode = 31 * hashCode + Objects.hashCode(rejectedPatches());
hashCode = 31 * hashCode + Objects.hashCode(rejectedPatchesActionAsString());
hashCode = 31 * hashCode + Objects.hashCode(createdDate());
hashCode = 31 * hashCode + Objects.hashCode(modifiedDate());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(sources());
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 UpdatePatchBaselineResponse)) {
return false;
}
UpdatePatchBaselineResponse other = (UpdatePatchBaselineResponse) obj;
return Objects.equals(baselineId(), other.baselineId()) && Objects.equals(name(), other.name())
&& Objects.equals(operatingSystemAsString(), other.operatingSystemAsString())
&& Objects.equals(globalFilters(), other.globalFilters())
&& Objects.equals(approvalRules(), other.approvalRules())
&& Objects.equals(approvedPatches(), other.approvedPatches())
&& Objects.equals(approvedPatchesComplianceLevelAsString(), other.approvedPatchesComplianceLevelAsString())
&& Objects.equals(approvedPatchesEnableNonSecurity(), other.approvedPatchesEnableNonSecurity())
&& Objects.equals(rejectedPatches(), other.rejectedPatches())
&& Objects.equals(rejectedPatchesActionAsString(), other.rejectedPatchesActionAsString())
&& Objects.equals(createdDate(), other.createdDate()) && Objects.equals(modifiedDate(), other.modifiedDate())
&& Objects.equals(description(), other.description()) && Objects.equals(sources(), other.sources());
}
/**
* 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("UpdatePatchBaselineResponse").add("BaselineId", baselineId()).add("Name", name())
.add("OperatingSystem", operatingSystemAsString()).add("GlobalFilters", globalFilters())
.add("ApprovalRules", approvalRules()).add("ApprovedPatches", approvedPatches())
.add("ApprovedPatchesComplianceLevel", approvedPatchesComplianceLevelAsString())
.add("ApprovedPatchesEnableNonSecurity", approvedPatchesEnableNonSecurity())
.add("RejectedPatches", rejectedPatches()).add("RejectedPatchesAction", rejectedPatchesActionAsString())
.add("CreatedDate", createdDate()).add("ModifiedDate", modifiedDate()).add("Description", description())
.add("Sources", sources()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "BaselineId":
return Optional.ofNullable(clazz.cast(baselineId()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "OperatingSystem":
return Optional.ofNullable(clazz.cast(operatingSystemAsString()));
case "GlobalFilters":
return Optional.ofNullable(clazz.cast(globalFilters()));
case "ApprovalRules":
return Optional.ofNullable(clazz.cast(approvalRules()));
case "ApprovedPatches":
return Optional.ofNullable(clazz.cast(approvedPatches()));
case "ApprovedPatchesComplianceLevel":
return Optional.ofNullable(clazz.cast(approvedPatchesComplianceLevelAsString()));
case "ApprovedPatchesEnableNonSecurity":
return Optional.ofNullable(clazz.cast(approvedPatchesEnableNonSecurity()));
case "RejectedPatches":
return Optional.ofNullable(clazz.cast(rejectedPatches()));
case "RejectedPatchesAction":
return Optional.ofNullable(clazz.cast(rejectedPatchesActionAsString()));
case "CreatedDate":
return Optional.ofNullable(clazz.cast(createdDate()));
case "ModifiedDate":
return Optional.ofNullable(clazz.cast(modifiedDate()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "Sources":
return Optional.ofNullable(clazz.cast(sources()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function