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

software.amazon.awssdk.services.iot.model.StartAuditMitigationActionsTaskRequest 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.iot.model;

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 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.DefaultValueTrait;
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.DefaultSdkAutoConstructMap;
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;

/**
 */
@Generated("software.amazon.awssdk:codegen")
public final class StartAuditMitigationActionsTaskRequest extends IotRequest implements
        ToCopyableBuilder {
    private static final SdkField TASK_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("taskId")
            .getter(getter(StartAuditMitigationActionsTaskRequest::taskId)).setter(setter(Builder::taskId))
            .traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("taskId").build()).build();

    private static final SdkField TARGET_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).memberName("target")
            .getter(getter(StartAuditMitigationActionsTaskRequest::target)).setter(setter(Builder::target))
            .constructor(AuditMitigationActionsTaskTarget::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("target").build()).build();

    private static final SdkField>> AUDIT_CHECK_TO_ACTIONS_MAPPING_FIELD = SdkField
            .>> builder(MarshallingType.MAP)
            .memberName("auditCheckToActionsMapping")
            .getter(getter(StartAuditMitigationActionsTaskRequest::auditCheckToActionsMapping))
            .setter(setter(Builder::auditCheckToActionsMapping))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("auditCheckToActionsMapping").build(),
                    MapTrait.builder()
                            .keyLocationName("key")
                            .valueLocationName("value")
                            .valueFieldInfo(
                                    SdkField.> builder(MarshallingType.LIST)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("value").build(),
                                                    ListTrait
                                                            .builder()
                                                            .memberLocationName(null)
                                                            .memberFieldInfo(
                                                                    SdkField. builder(MarshallingType.STRING)
                                                                            .traits(LocationTrait.builder()
                                                                                    .location(MarshallLocation.PAYLOAD)
                                                                                    .locationName("member").build()).build())
                                                            .build()).build()).build()).build();

    private static final SdkField CLIENT_REQUEST_TOKEN_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .memberName("clientRequestToken")
            .getter(getter(StartAuditMitigationActionsTaskRequest::clientRequestToken))
            .setter(setter(Builder::clientRequestToken))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("clientRequestToken").build(),
                    DefaultValueTrait.idempotencyToken()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TASK_ID_FIELD, TARGET_FIELD,
            AUDIT_CHECK_TO_ACTIONS_MAPPING_FIELD, CLIENT_REQUEST_TOKEN_FIELD));

    private final String taskId;

    private final AuditMitigationActionsTaskTarget target;

    private final Map> auditCheckToActionsMapping;

    private final String clientRequestToken;

    private StartAuditMitigationActionsTaskRequest(BuilderImpl builder) {
        super(builder);
        this.taskId = builder.taskId;
        this.target = builder.target;
        this.auditCheckToActionsMapping = builder.auditCheckToActionsMapping;
        this.clientRequestToken = builder.clientRequestToken;
    }

    /**
     * 

* A unique identifier for the task. You can use this identifier to check the status of the task or to cancel it. *

* * @return A unique identifier for the task. You can use this identifier to check the status of the task or to * cancel it. */ public final String taskId() { return taskId; } /** *

* Specifies the audit findings to which the mitigation actions are applied. You can apply them to a type of audit * check, to all findings from an audit, or to a specific set of findings. *

* * @return Specifies the audit findings to which the mitigation actions are applied. You can apply them to a type of * audit check, to all findings from an audit, or to a specific set of findings. */ public final AuditMitigationActionsTaskTarget target() { return target; } /** * For responses, this returns true if the service returned a value for the AuditCheckToActionsMapping 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 hasAuditCheckToActionsMapping() { return auditCheckToActionsMapping != null && !(auditCheckToActionsMapping instanceof SdkAutoConstructMap); } /** *

* For an audit check, specifies which mitigation actions to apply. Those actions must be defined in your Amazon Web * Services accounts. *

*

* 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 #hasAuditCheckToActionsMapping} method. *

* * @return For an audit check, specifies which mitigation actions to apply. Those actions must be defined in your * Amazon Web Services accounts. */ public final Map> auditCheckToActionsMapping() { return auditCheckToActionsMapping; } /** *

* Each audit mitigation task must have a unique client request token. If you try to start a new task with the same * token as a task that already exists, an exception occurs. If you omit this value, a unique client request token * is generated automatically. *

* * @return Each audit mitigation task must have a unique client request token. If you try to start a new task with * the same token as a task that already exists, an exception occurs. If you omit this value, a unique * client request token is generated automatically. */ public final String clientRequestToken() { return clientRequestToken; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(taskId()); hashCode = 31 * hashCode + Objects.hashCode(target()); hashCode = 31 * hashCode + Objects.hashCode(hasAuditCheckToActionsMapping() ? auditCheckToActionsMapping() : null); hashCode = 31 * hashCode + Objects.hashCode(clientRequestToken()); return hashCode; } @Override public final boolean equals(Object obj) { return super.equals(obj) && equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof StartAuditMitigationActionsTaskRequest)) { return false; } StartAuditMitigationActionsTaskRequest other = (StartAuditMitigationActionsTaskRequest) obj; return Objects.equals(taskId(), other.taskId()) && Objects.equals(target(), other.target()) && hasAuditCheckToActionsMapping() == other.hasAuditCheckToActionsMapping() && Objects.equals(auditCheckToActionsMapping(), other.auditCheckToActionsMapping()) && Objects.equals(clientRequestToken(), other.clientRequestToken()); } /** * 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("StartAuditMitigationActionsTaskRequest").add("TaskId", taskId()).add("Target", target()) .add("AuditCheckToActionsMapping", hasAuditCheckToActionsMapping() ? auditCheckToActionsMapping() : null) .add("ClientRequestToken", clientRequestToken()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "taskId": return Optional.ofNullable(clazz.cast(taskId())); case "target": return Optional.ofNullable(clazz.cast(target())); case "auditCheckToActionsMapping": return Optional.ofNullable(clazz.cast(auditCheckToActionsMapping())); case "clientRequestToken": return Optional.ofNullable(clazz.cast(clientRequestToken())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((StartAuditMitigationActionsTaskRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends IotRequest.Builder, SdkPojo, CopyableBuilder { /** *

* A unique identifier for the task. You can use this identifier to check the status of the task or to cancel * it. *

* * @param taskId * A unique identifier for the task. You can use this identifier to check the status of the task or to * cancel it. * @return Returns a reference to this object so that method calls can be chained together. */ Builder taskId(String taskId); /** *

* Specifies the audit findings to which the mitigation actions are applied. You can apply them to a type of * audit check, to all findings from an audit, or to a specific set of findings. *

* * @param target * Specifies the audit findings to which the mitigation actions are applied. You can apply them to a type * of audit check, to all findings from an audit, or to a specific set of findings. * @return Returns a reference to this object so that method calls can be chained together. */ Builder target(AuditMitigationActionsTaskTarget target); /** *

* Specifies the audit findings to which the mitigation actions are applied. You can apply them to a type of * audit check, to all findings from an audit, or to a specific set of findings. *

* This is a convenience method that creates an instance of the {@link AuditMitigationActionsTaskTarget.Builder} * avoiding the need to create one manually via {@link AuditMitigationActionsTaskTarget#builder()}. * *

* When the {@link Consumer} completes, {@link AuditMitigationActionsTaskTarget.Builder#build()} is called * immediately and its result is passed to {@link #target(AuditMitigationActionsTaskTarget)}. * * @param target * a consumer that will call methods on {@link AuditMitigationActionsTaskTarget.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #target(AuditMitigationActionsTaskTarget) */ default Builder target(Consumer target) { return target(AuditMitigationActionsTaskTarget.builder().applyMutation(target).build()); } /** *

* For an audit check, specifies which mitigation actions to apply. Those actions must be defined in your Amazon * Web Services accounts. *

* * @param auditCheckToActionsMapping * For an audit check, specifies which mitigation actions to apply. Those actions must be defined in your * Amazon Web Services accounts. * @return Returns a reference to this object so that method calls can be chained together. */ Builder auditCheckToActionsMapping(Map> auditCheckToActionsMapping); /** *

* Each audit mitigation task must have a unique client request token. If you try to start a new task with the * same token as a task that already exists, an exception occurs. If you omit this value, a unique client * request token is generated automatically. *

* * @param clientRequestToken * Each audit mitigation task must have a unique client request token. If you try to start a new task * with the same token as a task that already exists, an exception occurs. If you omit this value, a * unique client request token is generated automatically. * @return Returns a reference to this object so that method calls can be chained together. */ Builder clientRequestToken(String clientRequestToken); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends IotRequest.BuilderImpl implements Builder { private String taskId; private AuditMitigationActionsTaskTarget target; private Map> auditCheckToActionsMapping = DefaultSdkAutoConstructMap.getInstance(); private String clientRequestToken; private BuilderImpl() { } private BuilderImpl(StartAuditMitigationActionsTaskRequest model) { super(model); taskId(model.taskId); target(model.target); auditCheckToActionsMapping(model.auditCheckToActionsMapping); clientRequestToken(model.clientRequestToken); } public final String getTaskId() { return taskId; } public final void setTaskId(String taskId) { this.taskId = taskId; } @Override public final Builder taskId(String taskId) { this.taskId = taskId; return this; } public final AuditMitigationActionsTaskTarget.Builder getTarget() { return target != null ? target.toBuilder() : null; } public final void setTarget(AuditMitigationActionsTaskTarget.BuilderImpl target) { this.target = target != null ? target.build() : null; } @Override public final Builder target(AuditMitigationActionsTaskTarget target) { this.target = target; return this; } public final Map> getAuditCheckToActionsMapping() { if (auditCheckToActionsMapping instanceof SdkAutoConstructMap) { return null; } return auditCheckToActionsMapping; } public final void setAuditCheckToActionsMapping(Map> auditCheckToActionsMapping) { this.auditCheckToActionsMapping = AuditCheckToActionsMappingCopier.copy(auditCheckToActionsMapping); } @Override public final Builder auditCheckToActionsMapping(Map> auditCheckToActionsMapping) { this.auditCheckToActionsMapping = AuditCheckToActionsMappingCopier.copy(auditCheckToActionsMapping); return this; } public final String getClientRequestToken() { return clientRequestToken; } public final void setClientRequestToken(String clientRequestToken) { this.clientRequestToken = clientRequestToken; } @Override public final Builder clientRequestToken(String clientRequestToken) { this.clientRequestToken = clientRequestToken; return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public StartAuditMitigationActionsTaskRequest build() { return new StartAuditMitigationActionsTaskRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy