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

software.amazon.awssdk.services.workdocs.model.RemoveResourcePermissionRequest 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.workdocs.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 RemoveResourcePermissionRequest extends WorkDocsRequest implements
        ToCopyableBuilder {
    private static final SdkField AUTHENTICATION_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(RemoveResourcePermissionRequest::authenticationToken)).setter(setter(Builder::authenticationToken))
            .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("Authentication").build()).build();

    private static final SdkField RESOURCE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(RemoveResourcePermissionRequest::resourceId)).setter(setter(Builder::resourceId))
            .traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("ResourceId").build()).build();

    private static final SdkField PRINCIPAL_ID_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(RemoveResourcePermissionRequest::principalId)).setter(setter(Builder::principalId))
            .traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("PrincipalId").build()).build();

    private static final SdkField PRINCIPAL_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(RemoveResourcePermissionRequest::principalTypeAsString)).setter(setter(Builder::principalType))
            .traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("type").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AUTHENTICATION_TOKEN_FIELD,
            RESOURCE_ID_FIELD, PRINCIPAL_ID_FIELD, PRINCIPAL_TYPE_FIELD));

    private final String authenticationToken;

    private final String resourceId;

    private final String principalId;

    private final String principalType;

    private RemoveResourcePermissionRequest(BuilderImpl builder) {
        super(builder);
        this.authenticationToken = builder.authenticationToken;
        this.resourceId = builder.resourceId;
        this.principalId = builder.principalId;
        this.principalType = builder.principalType;
    }

    /**
     * 

* Amazon WorkDocs authentication token. Do not set this field when using administrative API actions, as in * accessing the API using AWS credentials. *

* * @return Amazon WorkDocs authentication token. Do not set this field when using administrative API actions, as in * accessing the API using AWS credentials. */ public String authenticationToken() { return authenticationToken; } /** *

* The ID of the resource. *

* * @return The ID of the resource. */ public String resourceId() { return resourceId; } /** *

* The principal ID of the resource. *

* * @return The principal ID of the resource. */ public String principalId() { return principalId; } /** *

* The principal type of the resource. *

*

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

* * @return The principal type of the resource. * @see PrincipalType */ public PrincipalType principalType() { return PrincipalType.fromValue(principalType); } /** *

* The principal type of the resource. *

*

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

* * @return The principal type of the resource. * @see PrincipalType */ public String principalTypeAsString() { return principalType; } @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 + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(authenticationToken()); hashCode = 31 * hashCode + Objects.hashCode(resourceId()); hashCode = 31 * hashCode + Objects.hashCode(principalId()); hashCode = 31 * hashCode + Objects.hashCode(principalTypeAsString()); 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 RemoveResourcePermissionRequest)) { return false; } RemoveResourcePermissionRequest other = (RemoveResourcePermissionRequest) obj; return Objects.equals(authenticationToken(), other.authenticationToken()) && Objects.equals(resourceId(), other.resourceId()) && Objects.equals(principalId(), other.principalId()) && Objects.equals(principalTypeAsString(), other.principalTypeAsString()); } /** * 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("RemoveResourcePermissionRequest") .add("AuthenticationToken", authenticationToken() == null ? null : "*** Sensitive Data Redacted ***") .add("ResourceId", resourceId()).add("PrincipalId", principalId()).add("PrincipalType", principalTypeAsString()) .build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "AuthenticationToken": return Optional.ofNullable(clazz.cast(authenticationToken())); case "ResourceId": return Optional.ofNullable(clazz.cast(resourceId())); case "PrincipalId": return Optional.ofNullable(clazz.cast(principalId())); case "PrincipalType": return Optional.ofNullable(clazz.cast(principalTypeAsString())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((RemoveResourcePermissionRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends WorkDocsRequest.Builder, SdkPojo, CopyableBuilder { /** *

* Amazon WorkDocs authentication token. Do not set this field when using administrative API actions, as in * accessing the API using AWS credentials. *

* * @param authenticationToken * Amazon WorkDocs authentication token. Do not set this field when using administrative API actions, as * in accessing the API using AWS credentials. * @return Returns a reference to this object so that method calls can be chained together. */ Builder authenticationToken(String authenticationToken); /** *

* The ID of the resource. *

* * @param resourceId * The ID of the resource. * @return Returns a reference to this object so that method calls can be chained together. */ Builder resourceId(String resourceId); /** *

* The principal ID of the resource. *

* * @param principalId * The principal ID of the resource. * @return Returns a reference to this object so that method calls can be chained together. */ Builder principalId(String principalId); /** *

* The principal type of the resource. *

* * @param principalType * The principal type of the resource. * @see PrincipalType * @return Returns a reference to this object so that method calls can be chained together. * @see PrincipalType */ Builder principalType(String principalType); /** *

* The principal type of the resource. *

* * @param principalType * The principal type of the resource. * @see PrincipalType * @return Returns a reference to this object so that method calls can be chained together. * @see PrincipalType */ Builder principalType(PrincipalType principalType); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends WorkDocsRequest.BuilderImpl implements Builder { private String authenticationToken; private String resourceId; private String principalId; private String principalType; private BuilderImpl() { } private BuilderImpl(RemoveResourcePermissionRequest model) { super(model); authenticationToken(model.authenticationToken); resourceId(model.resourceId); principalId(model.principalId); principalType(model.principalType); } public final String getAuthenticationToken() { return authenticationToken; } @Override public final Builder authenticationToken(String authenticationToken) { this.authenticationToken = authenticationToken; return this; } public final void setAuthenticationToken(String authenticationToken) { this.authenticationToken = authenticationToken; } public final String getResourceId() { return resourceId; } @Override public final Builder resourceId(String resourceId) { this.resourceId = resourceId; return this; } public final void setResourceId(String resourceId) { this.resourceId = resourceId; } public final String getPrincipalId() { return principalId; } @Override public final Builder principalId(String principalId) { this.principalId = principalId; return this; } public final void setPrincipalId(String principalId) { this.principalId = principalId; } public final String getPrincipalTypeAsString() { return principalType; } @Override public final Builder principalType(String principalType) { this.principalType = principalType; return this; } @Override public final Builder principalType(PrincipalType principalType) { this.principalType(principalType == null ? null : principalType.toString()); return this; } public final void setPrincipalType(String principalType) { this.principalType = principalType; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public RemoveResourcePermissionRequest build() { return new RemoveResourcePermissionRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy