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

software.amazon.awssdk.services.cloudfront.model.FunctionMetadata Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon CloudFront module holds the client classes that are used for communicating with Amazon CloudFront Service

There is a newer version: 2.28.3
Show newest version
/*
 * 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.cloudfront.model;

import java.io.Serializable;
import java.time.Instant;
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;

/**
 * 

* Contains metadata about a CloudFront function. *

*/ @Generated("software.amazon.awssdk:codegen") public final class FunctionMetadata implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField FUNCTION_ARN_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("FunctionARN") .getter(getter(FunctionMetadata::functionARN)) .setter(setter(Builder::functionARN)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FunctionARN") .unmarshallLocationName("FunctionARN").build()).build(); private static final SdkField STAGE_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("Stage") .getter(getter(FunctionMetadata::stageAsString)) .setter(setter(Builder::stage)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Stage") .unmarshallLocationName("Stage").build()).build(); private static final SdkField CREATED_TIME_FIELD = SdkField . builder(MarshallingType.INSTANT) .memberName("CreatedTime") .getter(getter(FunctionMetadata::createdTime)) .setter(setter(Builder::createdTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedTime") .unmarshallLocationName("CreatedTime").build()).build(); private static final SdkField LAST_MODIFIED_TIME_FIELD = SdkField . builder(MarshallingType.INSTANT) .memberName("LastModifiedTime") .getter(getter(FunctionMetadata::lastModifiedTime)) .setter(setter(Builder::lastModifiedTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModifiedTime") .unmarshallLocationName("LastModifiedTime").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(FUNCTION_ARN_FIELD, STAGE_FIELD, CREATED_TIME_FIELD, LAST_MODIFIED_TIME_FIELD)); private static final long serialVersionUID = 1L; private final String functionARN; private final String stage; private final Instant createdTime; private final Instant lastModifiedTime; private FunctionMetadata(BuilderImpl builder) { this.functionARN = builder.functionARN; this.stage = builder.stage; this.createdTime = builder.createdTime; this.lastModifiedTime = builder.lastModifiedTime; } /** *

* The Amazon Resource Name (ARN) of the function. The ARN uniquely identifies the function. *

* * @return The Amazon Resource Name (ARN) of the function. The ARN uniquely identifies the function. */ public final String functionARN() { return functionARN; } /** *

* The stage that the function is in, either DEVELOPMENT or LIVE. *

*

* When a function is in the DEVELOPMENT stage, you can test the function with * TestFunction, and update it with UpdateFunction. *

*

* When a function is in the LIVE stage, you can attach the function to a distribution's cache * behavior, using the function's ARN. *

*

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

* * @return The stage that the function is in, either DEVELOPMENT or LIVE.

*

* When a function is in the DEVELOPMENT stage, you can test the function with * TestFunction, and update it with UpdateFunction. *

*

* When a function is in the LIVE stage, you can attach the function to a distribution's cache * behavior, using the function's ARN. * @see FunctionStage */ public final FunctionStage stage() { return FunctionStage.fromValue(stage); } /** *

* The stage that the function is in, either DEVELOPMENT or LIVE. *

*

* When a function is in the DEVELOPMENT stage, you can test the function with * TestFunction, and update it with UpdateFunction. *

*

* When a function is in the LIVE stage, you can attach the function to a distribution's cache * behavior, using the function's ARN. *

*

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

* * @return The stage that the function is in, either DEVELOPMENT or LIVE.

*

* When a function is in the DEVELOPMENT stage, you can test the function with * TestFunction, and update it with UpdateFunction. *

*

* When a function is in the LIVE stage, you can attach the function to a distribution's cache * behavior, using the function's ARN. * @see FunctionStage */ public final String stageAsString() { return stage; } /** *

* The date and time when the function was created. *

* * @return The date and time when the function was created. */ public final Instant createdTime() { return createdTime; } /** *

* The date and time when the function was most recently updated. *

* * @return The date and time when the function was most recently updated. */ public final Instant lastModifiedTime() { return lastModifiedTime; } @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(functionARN()); hashCode = 31 * hashCode + Objects.hashCode(stageAsString()); hashCode = 31 * hashCode + Objects.hashCode(createdTime()); hashCode = 31 * hashCode + Objects.hashCode(lastModifiedTime()); 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 FunctionMetadata)) { return false; } FunctionMetadata other = (FunctionMetadata) obj; return Objects.equals(functionARN(), other.functionARN()) && Objects.equals(stageAsString(), other.stageAsString()) && Objects.equals(createdTime(), other.createdTime()) && Objects.equals(lastModifiedTime(), other.lastModifiedTime()); } /** * 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("FunctionMetadata").add("FunctionARN", functionARN()).add("Stage", stageAsString()) .add("CreatedTime", createdTime()).add("LastModifiedTime", lastModifiedTime()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "FunctionARN": return Optional.ofNullable(clazz.cast(functionARN())); case "Stage": return Optional.ofNullable(clazz.cast(stageAsString())); case "CreatedTime": return Optional.ofNullable(clazz.cast(createdTime())); case "LastModifiedTime": return Optional.ofNullable(clazz.cast(lastModifiedTime())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((FunctionMetadata) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The Amazon Resource Name (ARN) of the function. The ARN uniquely identifies the function. *

* * @param functionARN * The Amazon Resource Name (ARN) of the function. The ARN uniquely identifies the function. * @return Returns a reference to this object so that method calls can be chained together. */ Builder functionARN(String functionARN); /** *

* The stage that the function is in, either DEVELOPMENT or LIVE. *

*

* When a function is in the DEVELOPMENT stage, you can test the function with * TestFunction, and update it with UpdateFunction. *

*

* When a function is in the LIVE stage, you can attach the function to a distribution's cache * behavior, using the function's ARN. *

* * @param stage * The stage that the function is in, either DEVELOPMENT or LIVE.

*

* When a function is in the DEVELOPMENT stage, you can test the function with * TestFunction, and update it with UpdateFunction. *

*

* When a function is in the LIVE stage, you can attach the function to a distribution's * cache behavior, using the function's ARN. * @see FunctionStage * @return Returns a reference to this object so that method calls can be chained together. * @see FunctionStage */ Builder stage(String stage); /** *

* The stage that the function is in, either DEVELOPMENT or LIVE. *

*

* When a function is in the DEVELOPMENT stage, you can test the function with * TestFunction, and update it with UpdateFunction. *

*

* When a function is in the LIVE stage, you can attach the function to a distribution's cache * behavior, using the function's ARN. *

* * @param stage * The stage that the function is in, either DEVELOPMENT or LIVE.

*

* When a function is in the DEVELOPMENT stage, you can test the function with * TestFunction, and update it with UpdateFunction. *

*

* When a function is in the LIVE stage, you can attach the function to a distribution's * cache behavior, using the function's ARN. * @see FunctionStage * @return Returns a reference to this object so that method calls can be chained together. * @see FunctionStage */ Builder stage(FunctionStage stage); /** *

* The date and time when the function was created. *

* * @param createdTime * The date and time when the function was created. * @return Returns a reference to this object so that method calls can be chained together. */ Builder createdTime(Instant createdTime); /** *

* The date and time when the function was most recently updated. *

* * @param lastModifiedTime * The date and time when the function was most recently updated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastModifiedTime(Instant lastModifiedTime); } static final class BuilderImpl implements Builder { private String functionARN; private String stage; private Instant createdTime; private Instant lastModifiedTime; private BuilderImpl() { } private BuilderImpl(FunctionMetadata model) { functionARN(model.functionARN); stage(model.stage); createdTime(model.createdTime); lastModifiedTime(model.lastModifiedTime); } public final String getFunctionARN() { return functionARN; } public final void setFunctionARN(String functionARN) { this.functionARN = functionARN; } @Override public final Builder functionARN(String functionARN) { this.functionARN = functionARN; return this; } public final String getStage() { return stage; } public final void setStage(String stage) { this.stage = stage; } @Override public final Builder stage(String stage) { this.stage = stage; return this; } @Override public final Builder stage(FunctionStage stage) { this.stage(stage == null ? null : stage.toString()); return this; } public final Instant getCreatedTime() { return createdTime; } public final void setCreatedTime(Instant createdTime) { this.createdTime = createdTime; } @Override public final Builder createdTime(Instant createdTime) { this.createdTime = createdTime; return this; } public final Instant getLastModifiedTime() { return lastModifiedTime; } public final void setLastModifiedTime(Instant lastModifiedTime) { this.lastModifiedTime = lastModifiedTime; } @Override public final Builder lastModifiedTime(Instant lastModifiedTime) { this.lastModifiedTime = lastModifiedTime; return this; } @Override public FunctionMetadata build() { return new FunctionMetadata(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy