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

software.amazon.awssdk.services.clouddirectory.model.DetachObjectRequest 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.clouddirectory.model;

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.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.LocationTrait;
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 DetachObjectRequest extends CloudDirectoryRequest implements
        ToCopyableBuilder {
    private static final SdkField DIRECTORY_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(DetachObjectRequest::directoryArn)).setter(setter(Builder::directoryArn))
            .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("x-amz-data-partition").build())
            .build();

    private static final SdkField PARENT_REFERENCE_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).getter(getter(DetachObjectRequest::parentReference))
            .setter(setter(Builder::parentReference)).constructor(ObjectReference::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ParentReference").build()).build();

    private static final SdkField LINK_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(DetachObjectRequest::linkName)).setter(setter(Builder::linkName))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LinkName").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DIRECTORY_ARN_FIELD,
            PARENT_REFERENCE_FIELD, LINK_NAME_FIELD));

    private final String directoryArn;

    private final ObjectReference parentReference;

    private final String linkName;

    private DetachObjectRequest(BuilderImpl builder) {
        super(builder);
        this.directoryArn = builder.directoryArn;
        this.parentReference = builder.parentReference;
        this.linkName = builder.linkName;
    }

    /**
     * 

* The Amazon Resource Name (ARN) that is associated with the Directory where objects reside. For more * information, see arns. *

* * @return The Amazon Resource Name (ARN) that is associated with the Directory where objects reside. For * more information, see arns. */ public String directoryArn() { return directoryArn; } /** *

* The parent reference from which the object with the specified link name is detached. *

* * @return The parent reference from which the object with the specified link name is detached. */ public ObjectReference parentReference() { return parentReference; } /** *

* The link name associated with the object that needs to be detached. *

* * @return The link name associated with the object that needs to be detached. */ public String linkName() { return linkName; } @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(directoryArn()); hashCode = 31 * hashCode + Objects.hashCode(parentReference()); hashCode = 31 * hashCode + Objects.hashCode(linkName()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof DetachObjectRequest)) { return false; } DetachObjectRequest other = (DetachObjectRequest) obj; return Objects.equals(directoryArn(), other.directoryArn()) && Objects.equals(parentReference(), other.parentReference()) && Objects.equals(linkName(), other.linkName()); } /** * 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("DetachObjectRequest").add("DirectoryArn", directoryArn()) .add("ParentReference", parentReference()).add("LinkName", linkName()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "DirectoryArn": return Optional.ofNullable(clazz.cast(directoryArn())); case "ParentReference": return Optional.ofNullable(clazz.cast(parentReference())); case "LinkName": return Optional.ofNullable(clazz.cast(linkName())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((DetachObjectRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends CloudDirectoryRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The Amazon Resource Name (ARN) that is associated with the Directory where objects reside. For more * information, see arns. *

* * @param directoryArn * The Amazon Resource Name (ARN) that is associated with the Directory where objects reside. For * more information, see arns. * @return Returns a reference to this object so that method calls can be chained together. */ Builder directoryArn(String directoryArn); /** *

* The parent reference from which the object with the specified link name is detached. *

* * @param parentReference * The parent reference from which the object with the specified link name is detached. * @return Returns a reference to this object so that method calls can be chained together. */ Builder parentReference(ObjectReference parentReference); /** *

* The parent reference from which the object with the specified link name is detached. *

* This is a convenience that creates an instance of the {@link ObjectReference.Builder} avoiding the need to * create one manually via {@link ObjectReference#builder()}. * * When the {@link Consumer} completes, {@link ObjectReference.Builder#build()} is called immediately and its * result is passed to {@link #parentReference(ObjectReference)}. * * @param parentReference * a consumer that will call methods on {@link ObjectReference.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #parentReference(ObjectReference) */ default Builder parentReference(Consumer parentReference) { return parentReference(ObjectReference.builder().applyMutation(parentReference).build()); } /** *

* The link name associated with the object that needs to be detached. *

* * @param linkName * The link name associated with the object that needs to be detached. * @return Returns a reference to this object so that method calls can be chained together. */ Builder linkName(String linkName); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends CloudDirectoryRequest.BuilderImpl implements Builder { private String directoryArn; private ObjectReference parentReference; private String linkName; private BuilderImpl() { } private BuilderImpl(DetachObjectRequest model) { super(model); directoryArn(model.directoryArn); parentReference(model.parentReference); linkName(model.linkName); } public final String getDirectoryArn() { return directoryArn; } @Override public final Builder directoryArn(String directoryArn) { this.directoryArn = directoryArn; return this; } public final void setDirectoryArn(String directoryArn) { this.directoryArn = directoryArn; } public final ObjectReference.Builder getParentReference() { return parentReference != null ? parentReference.toBuilder() : null; } @Override public final Builder parentReference(ObjectReference parentReference) { this.parentReference = parentReference; return this; } public final void setParentReference(ObjectReference.BuilderImpl parentReference) { this.parentReference = parentReference != null ? parentReference.build() : null; } public final String getLinkName() { return linkName; } @Override public final Builder linkName(String linkName) { this.linkName = linkName; return this; } public final void setLinkName(String linkName) { this.linkName = linkName; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public DetachObjectRequest build() { return new DetachObjectRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy