software.amazon.awssdk.services.greengrass.model.CreateSoftwareUpdateJobRequest Maven / Gradle / Ivy
Show all versions of greengrass Show documentation
/*
* 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.greengrass.model;
import java.beans.Transient;
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 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.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 CreateSoftwareUpdateJobRequest extends GreengrassRequest implements
ToCopyableBuilder {
private static final SdkField AMZN_CLIENT_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AmznClientToken").getter(getter(CreateSoftwareUpdateJobRequest::amznClientToken))
.setter(setter(Builder::amznClientToken))
.traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("X-Amzn-Client-Token").build())
.build();
private static final SdkField S3_URL_SIGNER_ROLE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("S3UrlSignerRole").getter(getter(CreateSoftwareUpdateJobRequest::s3UrlSignerRole))
.setter(setter(Builder::s3UrlSignerRole))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("S3UrlSignerRole").build()).build();
private static final SdkField SOFTWARE_TO_UPDATE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SoftwareToUpdate").getter(getter(CreateSoftwareUpdateJobRequest::softwareToUpdateAsString))
.setter(setter(Builder::softwareToUpdate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SoftwareToUpdate").build()).build();
private static final SdkField UPDATE_AGENT_LOG_LEVEL_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("UpdateAgentLogLevel").getter(getter(CreateSoftwareUpdateJobRequest::updateAgentLogLevelAsString))
.setter(setter(Builder::updateAgentLogLevel))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UpdateAgentLogLevel").build())
.build();
private static final SdkField> UPDATE_TARGETS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("UpdateTargets")
.getter(getter(CreateSoftwareUpdateJobRequest::updateTargets))
.setter(setter(Builder::updateTargets))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UpdateTargets").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 UPDATE_TARGETS_ARCHITECTURE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("UpdateTargetsArchitecture")
.getter(getter(CreateSoftwareUpdateJobRequest::updateTargetsArchitectureAsString))
.setter(setter(Builder::updateTargetsArchitecture))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UpdateTargetsArchitecture").build())
.build();
private static final SdkField UPDATE_TARGETS_OPERATING_SYSTEM_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("UpdateTargetsOperatingSystem")
.getter(getter(CreateSoftwareUpdateJobRequest::updateTargetsOperatingSystemAsString))
.setter(setter(Builder::updateTargetsOperatingSystem))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UpdateTargetsOperatingSystem")
.build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AMZN_CLIENT_TOKEN_FIELD,
S3_URL_SIGNER_ROLE_FIELD, SOFTWARE_TO_UPDATE_FIELD, UPDATE_AGENT_LOG_LEVEL_FIELD, UPDATE_TARGETS_FIELD,
UPDATE_TARGETS_ARCHITECTURE_FIELD, UPDATE_TARGETS_OPERATING_SYSTEM_FIELD));
private final String amznClientToken;
private final String s3UrlSignerRole;
private final String softwareToUpdate;
private final String updateAgentLogLevel;
private final List updateTargets;
private final String updateTargetsArchitecture;
private final String updateTargetsOperatingSystem;
private CreateSoftwareUpdateJobRequest(BuilderImpl builder) {
super(builder);
this.amznClientToken = builder.amznClientToken;
this.s3UrlSignerRole = builder.s3UrlSignerRole;
this.softwareToUpdate = builder.softwareToUpdate;
this.updateAgentLogLevel = builder.updateAgentLogLevel;
this.updateTargets = builder.updateTargets;
this.updateTargetsArchitecture = builder.updateTargetsArchitecture;
this.updateTargetsOperatingSystem = builder.updateTargetsOperatingSystem;
}
/**
* A client token used to correlate requests and responses.
*
* @return A client token used to correlate requests and responses.
*/
public final String amznClientToken() {
return amznClientToken;
}
/**
* Returns the value of the S3UrlSignerRole property for this object.
*
* @return The value of the S3UrlSignerRole property for this object.
*/
public final String s3UrlSignerRole() {
return s3UrlSignerRole;
}
/**
* Returns the value of the SoftwareToUpdate property for this object.
*
* If the service returns an enum value that is not available in the current SDK version, {@link #softwareToUpdate}
* will return {@link SoftwareToUpdate#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #softwareToUpdateAsString}.
*
*
* @return The value of the SoftwareToUpdate property for this object.
* @see SoftwareToUpdate
*/
public final SoftwareToUpdate softwareToUpdate() {
return SoftwareToUpdate.fromValue(softwareToUpdate);
}
/**
* Returns the value of the SoftwareToUpdate property for this object.
*
* If the service returns an enum value that is not available in the current SDK version, {@link #softwareToUpdate}
* will return {@link SoftwareToUpdate#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #softwareToUpdateAsString}.
*
*
* @return The value of the SoftwareToUpdate property for this object.
* @see SoftwareToUpdate
*/
public final String softwareToUpdateAsString() {
return softwareToUpdate;
}
/**
* Returns the value of the UpdateAgentLogLevel property for this object.
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #updateAgentLogLevel} will return {@link UpdateAgentLogLevel#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #updateAgentLogLevelAsString}.
*
*
* @return The value of the UpdateAgentLogLevel property for this object.
* @see UpdateAgentLogLevel
*/
public final UpdateAgentLogLevel updateAgentLogLevel() {
return UpdateAgentLogLevel.fromValue(updateAgentLogLevel);
}
/**
* Returns the value of the UpdateAgentLogLevel property for this object.
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #updateAgentLogLevel} will return {@link UpdateAgentLogLevel#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #updateAgentLogLevelAsString}.
*
*
* @return The value of the UpdateAgentLogLevel property for this object.
* @see UpdateAgentLogLevel
*/
public final String updateAgentLogLevelAsString() {
return updateAgentLogLevel;
}
/**
* For responses, this returns true if the service returned a value for the UpdateTargets 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 hasUpdateTargets() {
return updateTargets != null && !(updateTargets instanceof SdkAutoConstructList);
}
/**
* Returns the value of the UpdateTargets property for this object.
*
* 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 #hasUpdateTargets} method.
*
*
* @return The value of the UpdateTargets property for this object.
*/
public final List updateTargets() {
return updateTargets;
}
/**
* Returns the value of the UpdateTargetsArchitecture property for this object.
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #updateTargetsArchitecture} will return {@link UpdateTargetsArchitecture#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #updateTargetsArchitectureAsString}.
*
*
* @return The value of the UpdateTargetsArchitecture property for this object.
* @see UpdateTargetsArchitecture
*/
public final UpdateTargetsArchitecture updateTargetsArchitecture() {
return UpdateTargetsArchitecture.fromValue(updateTargetsArchitecture);
}
/**
* Returns the value of the UpdateTargetsArchitecture property for this object.
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #updateTargetsArchitecture} will return {@link UpdateTargetsArchitecture#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #updateTargetsArchitectureAsString}.
*
*
* @return The value of the UpdateTargetsArchitecture property for this object.
* @see UpdateTargetsArchitecture
*/
public final String updateTargetsArchitectureAsString() {
return updateTargetsArchitecture;
}
/**
* Returns the value of the UpdateTargetsOperatingSystem property for this object.
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #updateTargetsOperatingSystem} will return {@link UpdateTargetsOperatingSystem#UNKNOWN_TO_SDK_VERSION}.
* The raw value returned by the service is available from {@link #updateTargetsOperatingSystemAsString}.
*
*
* @return The value of the UpdateTargetsOperatingSystem property for this object.
* @see UpdateTargetsOperatingSystem
*/
public final UpdateTargetsOperatingSystem updateTargetsOperatingSystem() {
return UpdateTargetsOperatingSystem.fromValue(updateTargetsOperatingSystem);
}
/**
* Returns the value of the UpdateTargetsOperatingSystem property for this object.
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #updateTargetsOperatingSystem} will return {@link UpdateTargetsOperatingSystem#UNKNOWN_TO_SDK_VERSION}.
* The raw value returned by the service is available from {@link #updateTargetsOperatingSystemAsString}.
*
*
* @return The value of the UpdateTargetsOperatingSystem property for this object.
* @see UpdateTargetsOperatingSystem
*/
public final String updateTargetsOperatingSystemAsString() {
return updateTargetsOperatingSystem;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(amznClientToken());
hashCode = 31 * hashCode + Objects.hashCode(s3UrlSignerRole());
hashCode = 31 * hashCode + Objects.hashCode(softwareToUpdateAsString());
hashCode = 31 * hashCode + Objects.hashCode(updateAgentLogLevelAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasUpdateTargets() ? updateTargets() : null);
hashCode = 31 * hashCode + Objects.hashCode(updateTargetsArchitectureAsString());
hashCode = 31 * hashCode + Objects.hashCode(updateTargetsOperatingSystemAsString());
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 CreateSoftwareUpdateJobRequest)) {
return false;
}
CreateSoftwareUpdateJobRequest other = (CreateSoftwareUpdateJobRequest) obj;
return Objects.equals(amznClientToken(), other.amznClientToken())
&& Objects.equals(s3UrlSignerRole(), other.s3UrlSignerRole())
&& Objects.equals(softwareToUpdateAsString(), other.softwareToUpdateAsString())
&& Objects.equals(updateAgentLogLevelAsString(), other.updateAgentLogLevelAsString())
&& hasUpdateTargets() == other.hasUpdateTargets() && Objects.equals(updateTargets(), other.updateTargets())
&& Objects.equals(updateTargetsArchitectureAsString(), other.updateTargetsArchitectureAsString())
&& Objects.equals(updateTargetsOperatingSystemAsString(), other.updateTargetsOperatingSystemAsString());
}
/**
* 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("CreateSoftwareUpdateJobRequest").add("AmznClientToken", amznClientToken())
.add("S3UrlSignerRole", s3UrlSignerRole()).add("SoftwareToUpdate", softwareToUpdateAsString())
.add("UpdateAgentLogLevel", updateAgentLogLevelAsString())
.add("UpdateTargets", hasUpdateTargets() ? updateTargets() : null)
.add("UpdateTargetsArchitecture", updateTargetsArchitectureAsString())
.add("UpdateTargetsOperatingSystem", updateTargetsOperatingSystemAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AmznClientToken":
return Optional.ofNullable(clazz.cast(amznClientToken()));
case "S3UrlSignerRole":
return Optional.ofNullable(clazz.cast(s3UrlSignerRole()));
case "SoftwareToUpdate":
return Optional.ofNullable(clazz.cast(softwareToUpdateAsString()));
case "UpdateAgentLogLevel":
return Optional.ofNullable(clazz.cast(updateAgentLogLevelAsString()));
case "UpdateTargets":
return Optional.ofNullable(clazz.cast(updateTargets()));
case "UpdateTargetsArchitecture":
return Optional.ofNullable(clazz.cast(updateTargetsArchitectureAsString()));
case "UpdateTargetsOperatingSystem":
return Optional.ofNullable(clazz.cast(updateTargetsOperatingSystemAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function