software.amazon.awssdk.services.lambda.model.AddLayerVersionPermissionRequest Maven / Gradle / Ivy
Show all versions of lambda 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.lambda.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 AddLayerVersionPermissionRequest extends LambdaRequest implements
ToCopyableBuilder {
private static final SdkField LAYER_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LayerName").getter(getter(AddLayerVersionPermissionRequest::layerName))
.setter(setter(Builder::layerName))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("LayerName").build()).build();
private static final SdkField VERSION_NUMBER_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("VersionNumber").getter(getter(AddLayerVersionPermissionRequest::versionNumber))
.setter(setter(Builder::versionNumber))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("VersionNumber").build()).build();
private static final SdkField STATEMENT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StatementId").getter(getter(AddLayerVersionPermissionRequest::statementId))
.setter(setter(Builder::statementId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StatementId").build()).build();
private static final SdkField ACTION_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Action")
.getter(getter(AddLayerVersionPermissionRequest::action)).setter(setter(Builder::action))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Action").build()).build();
private static final SdkField PRINCIPAL_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Principal").getter(getter(AddLayerVersionPermissionRequest::principal))
.setter(setter(Builder::principal))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Principal").build()).build();
private static final SdkField ORGANIZATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OrganizationId").getter(getter(AddLayerVersionPermissionRequest::organizationId))
.setter(setter(Builder::organizationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OrganizationId").build()).build();
private static final SdkField REVISION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RevisionId").getter(getter(AddLayerVersionPermissionRequest::revisionId))
.setter(setter(Builder::revisionId))
.traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("RevisionId").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(LAYER_NAME_FIELD,
VERSION_NUMBER_FIELD, STATEMENT_ID_FIELD, ACTION_FIELD, PRINCIPAL_FIELD, ORGANIZATION_ID_FIELD, REVISION_ID_FIELD));
private final String layerName;
private final Long versionNumber;
private final String statementId;
private final String action;
private final String principal;
private final String organizationId;
private final String revisionId;
private AddLayerVersionPermissionRequest(BuilderImpl builder) {
super(builder);
this.layerName = builder.layerName;
this.versionNumber = builder.versionNumber;
this.statementId = builder.statementId;
this.action = builder.action;
this.principal = builder.principal;
this.organizationId = builder.organizationId;
this.revisionId = builder.revisionId;
}
/**
*
* The name or Amazon Resource Name (ARN) of the layer.
*
*
* @return The name or Amazon Resource Name (ARN) of the layer.
*/
public final String layerName() {
return layerName;
}
/**
*
* The version number.
*
*
* @return The version number.
*/
public final Long versionNumber() {
return versionNumber;
}
/**
*
* An identifier that distinguishes the policy from others on the same layer version.
*
*
* @return An identifier that distinguishes the policy from others on the same layer version.
*/
public final String statementId() {
return statementId;
}
/**
*
* The API action that grants access to the layer. For example, lambda:GetLayerVersion
.
*
*
* @return The API action that grants access to the layer. For example, lambda:GetLayerVersion
.
*/
public final String action() {
return action;
}
/**
*
* An account ID, or *
to grant layer usage permission to all accounts in an organization, or all
* Amazon Web Services accounts (if organizationId
is not specified). For the last case, make sure that
* you really do want all Amazon Web Services accounts to have usage permission to this layer.
*
*
* @return An account ID, or *
to grant layer usage permission to all accounts in an organization, or
* all Amazon Web Services accounts (if organizationId
is not specified). For the last case,
* make sure that you really do want all Amazon Web Services accounts to have usage permission to this
* layer.
*/
public final String principal() {
return principal;
}
/**
*
* With the principal set to *
, grant permission to all accounts in the specified organization.
*
*
* @return With the principal set to *
, grant permission to all accounts in the specified organization.
*/
public final String organizationId() {
return organizationId;
}
/**
*
* Only update the policy if the revision ID matches the ID specified. Use this option to avoid modifying a policy
* that has changed since you last read it.
*
*
* @return Only update the policy if the revision ID matches the ID specified. Use this option to avoid modifying a
* policy that has changed since you last read it.
*/
public final String revisionId() {
return revisionId;
}
@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(layerName());
hashCode = 31 * hashCode + Objects.hashCode(versionNumber());
hashCode = 31 * hashCode + Objects.hashCode(statementId());
hashCode = 31 * hashCode + Objects.hashCode(action());
hashCode = 31 * hashCode + Objects.hashCode(principal());
hashCode = 31 * hashCode + Objects.hashCode(organizationId());
hashCode = 31 * hashCode + Objects.hashCode(revisionId());
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 AddLayerVersionPermissionRequest)) {
return false;
}
AddLayerVersionPermissionRequest other = (AddLayerVersionPermissionRequest) obj;
return Objects.equals(layerName(), other.layerName()) && Objects.equals(versionNumber(), other.versionNumber())
&& Objects.equals(statementId(), other.statementId()) && Objects.equals(action(), other.action())
&& Objects.equals(principal(), other.principal()) && Objects.equals(organizationId(), other.organizationId())
&& Objects.equals(revisionId(), other.revisionId());
}
/**
* 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("AddLayerVersionPermissionRequest").add("LayerName", layerName())
.add("VersionNumber", versionNumber()).add("StatementId", statementId()).add("Action", action())
.add("Principal", principal()).add("OrganizationId", organizationId()).add("RevisionId", revisionId()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "LayerName":
return Optional.ofNullable(clazz.cast(layerName()));
case "VersionNumber":
return Optional.ofNullable(clazz.cast(versionNumber()));
case "StatementId":
return Optional.ofNullable(clazz.cast(statementId()));
case "Action":
return Optional.ofNullable(clazz.cast(action()));
case "Principal":
return Optional.ofNullable(clazz.cast(principal()));
case "OrganizationId":
return Optional.ofNullable(clazz.cast(organizationId()));
case "RevisionId":
return Optional.ofNullable(clazz.cast(revisionId()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function