software.amazon.awssdk.services.sagemaker.model.SharingSettings Maven / Gradle / Ivy
Show all versions of sagemaker 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.sagemaker.model;
import java.io.Serializable;
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.Function;
import software.amazon.awssdk.annotations.Generated;
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;
/**
*
* Specifies options for sharing Amazon SageMaker Studio notebooks. These settings are specified as part of
* DefaultUserSettings
when the CreateDomain
API is called, and as part of
* UserSettings
when the CreateUserProfile
API is called. When SharingSettings
is
* not specified, notebook sharing isn't allowed.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class SharingSettings implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField NOTEBOOK_OUTPUT_OPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("NotebookOutputOption").getter(getter(SharingSettings::notebookOutputOptionAsString))
.setter(setter(Builder::notebookOutputOption))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NotebookOutputOption").build())
.build();
private static final SdkField S3_OUTPUT_PATH_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("S3OutputPath").getter(getter(SharingSettings::s3OutputPath)).setter(setter(Builder::s3OutputPath))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("S3OutputPath").build()).build();
private static final SdkField S3_KMS_KEY_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("S3KmsKeyId").getter(getter(SharingSettings::s3KmsKeyId)).setter(setter(Builder::s3KmsKeyId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("S3KmsKeyId").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NOTEBOOK_OUTPUT_OPTION_FIELD,
S3_OUTPUT_PATH_FIELD, S3_KMS_KEY_ID_FIELD));
private static final long serialVersionUID = 1L;
private final String notebookOutputOption;
private final String s3OutputPath;
private final String s3KmsKeyId;
private SharingSettings(BuilderImpl builder) {
this.notebookOutputOption = builder.notebookOutputOption;
this.s3OutputPath = builder.s3OutputPath;
this.s3KmsKeyId = builder.s3KmsKeyId;
}
/**
*
* Whether to include the notebook cell output when sharing the notebook. The default is Disabled
.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #notebookOutputOption} will return {@link NotebookOutputOption#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #notebookOutputOptionAsString}.
*
*
* @return Whether to include the notebook cell output when sharing the notebook. The default is
* Disabled
.
* @see NotebookOutputOption
*/
public final NotebookOutputOption notebookOutputOption() {
return NotebookOutputOption.fromValue(notebookOutputOption);
}
/**
*
* Whether to include the notebook cell output when sharing the notebook. The default is Disabled
.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #notebookOutputOption} will return {@link NotebookOutputOption#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #notebookOutputOptionAsString}.
*
*
* @return Whether to include the notebook cell output when sharing the notebook. The default is
* Disabled
.
* @see NotebookOutputOption
*/
public final String notebookOutputOptionAsString() {
return notebookOutputOption;
}
/**
*
* When NotebookOutputOption
is Allowed
, the Amazon S3 bucket used to store the shared
* notebook snapshots.
*
*
* @return When NotebookOutputOption
is Allowed
, the Amazon S3 bucket used to store the
* shared notebook snapshots.
*/
public final String s3OutputPath() {
return s3OutputPath;
}
/**
*
* When NotebookOutputOption
is Allowed
, the Amazon Web Services Key Management Service
* (KMS) encryption key ID used to encrypt the notebook cell output in the Amazon S3 bucket.
*
*
* @return When NotebookOutputOption
is Allowed
, the Amazon Web Services Key Management
* Service (KMS) encryption key ID used to encrypt the notebook cell output in the Amazon S3 bucket.
*/
public final String s3KmsKeyId() {
return s3KmsKeyId;
}
@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 + Objects.hashCode(notebookOutputOptionAsString());
hashCode = 31 * hashCode + Objects.hashCode(s3OutputPath());
hashCode = 31 * hashCode + Objects.hashCode(s3KmsKeyId());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof SharingSettings)) {
return false;
}
SharingSettings other = (SharingSettings) obj;
return Objects.equals(notebookOutputOptionAsString(), other.notebookOutputOptionAsString())
&& Objects.equals(s3OutputPath(), other.s3OutputPath()) && Objects.equals(s3KmsKeyId(), other.s3KmsKeyId());
}
/**
* 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("SharingSettings").add("NotebookOutputOption", notebookOutputOptionAsString())
.add("S3OutputPath", s3OutputPath()).add("S3KmsKeyId", s3KmsKeyId()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "NotebookOutputOption":
return Optional.ofNullable(clazz.cast(notebookOutputOptionAsString()));
case "S3OutputPath":
return Optional.ofNullable(clazz.cast(s3OutputPath()));
case "S3KmsKeyId":
return Optional.ofNullable(clazz.cast(s3KmsKeyId()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function