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

software.amazon.awssdk.services.codegurureviewer.model.RequestMetadata Maven / Gradle / Ivy

Go to download

The AWS Java SDK for CodeGuru Reviewer module holds the client classes that are used for communicating with CodeGuru Reviewer.

There is a newer version: 2.29.15
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.codegurureviewer.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.Consumer;
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;

/**
 * 

* Metadata that is associated with a code review. This applies to both pull request and repository analysis code * reviews. *

*/ @Generated("software.amazon.awssdk:codegen") public final class RequestMetadata implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField REQUEST_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("RequestId").getter(getter(RequestMetadata::requestId)).setter(setter(Builder::requestId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RequestId").build()).build(); private static final SdkField REQUESTER_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("Requester").getter(getter(RequestMetadata::requester)).setter(setter(Builder::requester)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Requester").build()).build(); private static final SdkField EVENT_INFO_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("EventInfo").getter(getter(RequestMetadata::eventInfo)).setter(setter(Builder::eventInfo)) .constructor(EventInfo::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EventInfo").build()).build(); private static final SdkField VENDOR_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("VendorName").getter(getter(RequestMetadata::vendorNameAsString)).setter(setter(Builder::vendorName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VendorName").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(REQUEST_ID_FIELD, REQUESTER_FIELD, EVENT_INFO_FIELD, VENDOR_NAME_FIELD)); private static final long serialVersionUID = 1L; private final String requestId; private final String requester; private final EventInfo eventInfo; private final String vendorName; private RequestMetadata(BuilderImpl builder) { this.requestId = builder.requestId; this.requester = builder.requester; this.eventInfo = builder.eventInfo; this.vendorName = builder.vendorName; } /** *

* The ID of the request. This is required for a pull request code review. *

* * @return The ID of the request. This is required for a pull request code review. */ public final String requestId() { return requestId; } /** *

* An identifier, such as a name or account ID, that is associated with the requester. The Requester is * used to capture the author/actor name of the event request. *

* * @return An identifier, such as a name or account ID, that is associated with the requester. The * Requester is used to capture the author/actor name of the event request. */ public final String requester() { return requester; } /** *

* Information about the event associated with a code review. *

* * @return Information about the event associated with a code review. */ public final EventInfo eventInfo() { return eventInfo; } /** *

* The name of the repository vendor used to upload code to an S3 bucket for a CI/CD code review. For example, if * code and artifacts are uploaded to an S3 bucket for a CI/CD code review by GitHub scripts from a GitHub * repository, then the repository association's ProviderType is S3Bucket and the CI/CD * repository vendor name is GitHub. For more information, see the definition for ProviderType in RepositoryAssociation * . *

*

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

* * @return The name of the repository vendor used to upload code to an S3 bucket for a CI/CD code review. For * example, if code and artifacts are uploaded to an S3 bucket for a CI/CD code review by GitHub scripts * from a GitHub repository, then the repository association's ProviderType is * S3Bucket and the CI/CD repository vendor name is GitHub. For more information, see the * definition for ProviderType in RepositoryAssociation. * @see VendorName */ public final VendorName vendorName() { return VendorName.fromValue(vendorName); } /** *

* The name of the repository vendor used to upload code to an S3 bucket for a CI/CD code review. For example, if * code and artifacts are uploaded to an S3 bucket for a CI/CD code review by GitHub scripts from a GitHub * repository, then the repository association's ProviderType is S3Bucket and the CI/CD * repository vendor name is GitHub. For more information, see the definition for ProviderType in RepositoryAssociation * . *

*

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

* * @return The name of the repository vendor used to upload code to an S3 bucket for a CI/CD code review. For * example, if code and artifacts are uploaded to an S3 bucket for a CI/CD code review by GitHub scripts * from a GitHub repository, then the repository association's ProviderType is * S3Bucket and the CI/CD repository vendor name is GitHub. For more information, see the * definition for ProviderType in RepositoryAssociation. * @see VendorName */ public final String vendorNameAsString() { return vendorName; } @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(requestId()); hashCode = 31 * hashCode + Objects.hashCode(requester()); hashCode = 31 * hashCode + Objects.hashCode(eventInfo()); hashCode = 31 * hashCode + Objects.hashCode(vendorNameAsString()); 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 RequestMetadata)) { return false; } RequestMetadata other = (RequestMetadata) obj; return Objects.equals(requestId(), other.requestId()) && Objects.equals(requester(), other.requester()) && Objects.equals(eventInfo(), other.eventInfo()) && Objects.equals(vendorNameAsString(), other.vendorNameAsString()); } /** * 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("RequestMetadata").add("RequestId", requestId()).add("Requester", requester()) .add("EventInfo", eventInfo()).add("VendorName", vendorNameAsString()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "RequestId": return Optional.ofNullable(clazz.cast(requestId())); case "Requester": return Optional.ofNullable(clazz.cast(requester())); case "EventInfo": return Optional.ofNullable(clazz.cast(eventInfo())); case "VendorName": return Optional.ofNullable(clazz.cast(vendorNameAsString())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((RequestMetadata) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The ID of the request. This is required for a pull request code review. *

* * @param requestId * The ID of the request. This is required for a pull request code review. * @return Returns a reference to this object so that method calls can be chained together. */ Builder requestId(String requestId); /** *

* An identifier, such as a name or account ID, that is associated with the requester. The * Requester is used to capture the author/actor name of the event request. *

* * @param requester * An identifier, such as a name or account ID, that is associated with the requester. The * Requester is used to capture the author/actor name of the event request. * @return Returns a reference to this object so that method calls can be chained together. */ Builder requester(String requester); /** *

* Information about the event associated with a code review. *

* * @param eventInfo * Information about the event associated with a code review. * @return Returns a reference to this object so that method calls can be chained together. */ Builder eventInfo(EventInfo eventInfo); /** *

* Information about the event associated with a code review. *

* This is a convenience method that creates an instance of the {@link EventInfo.Builder} avoiding the need to * create one manually via {@link EventInfo#builder()}. * *

* When the {@link Consumer} completes, {@link EventInfo.Builder#build()} is called immediately and its result * is passed to {@link #eventInfo(EventInfo)}. * * @param eventInfo * a consumer that will call methods on {@link EventInfo.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #eventInfo(EventInfo) */ default Builder eventInfo(Consumer eventInfo) { return eventInfo(EventInfo.builder().applyMutation(eventInfo).build()); } /** *

* The name of the repository vendor used to upload code to an S3 bucket for a CI/CD code review. For example, * if code and artifacts are uploaded to an S3 bucket for a CI/CD code review by GitHub scripts from a GitHub * repository, then the repository association's ProviderType is S3Bucket and the * CI/CD repository vendor name is GitHub. For more information, see the definition for * ProviderType in RepositoryAssociation. *

* * @param vendorName * The name of the repository vendor used to upload code to an S3 bucket for a CI/CD code review. For * example, if code and artifacts are uploaded to an S3 bucket for a CI/CD code review by GitHub scripts * from a GitHub repository, then the repository association's ProviderType is * S3Bucket and the CI/CD repository vendor name is GitHub. For more information, see the * definition for ProviderType in RepositoryAssociation. * @see VendorName * @return Returns a reference to this object so that method calls can be chained together. * @see VendorName */ Builder vendorName(String vendorName); /** *

* The name of the repository vendor used to upload code to an S3 bucket for a CI/CD code review. For example, * if code and artifacts are uploaded to an S3 bucket for a CI/CD code review by GitHub scripts from a GitHub * repository, then the repository association's ProviderType is S3Bucket and the * CI/CD repository vendor name is GitHub. For more information, see the definition for * ProviderType in RepositoryAssociation. *

* * @param vendorName * The name of the repository vendor used to upload code to an S3 bucket for a CI/CD code review. For * example, if code and artifacts are uploaded to an S3 bucket for a CI/CD code review by GitHub scripts * from a GitHub repository, then the repository association's ProviderType is * S3Bucket and the CI/CD repository vendor name is GitHub. For more information, see the * definition for ProviderType in RepositoryAssociation. * @see VendorName * @return Returns a reference to this object so that method calls can be chained together. * @see VendorName */ Builder vendorName(VendorName vendorName); } static final class BuilderImpl implements Builder { private String requestId; private String requester; private EventInfo eventInfo; private String vendorName; private BuilderImpl() { } private BuilderImpl(RequestMetadata model) { requestId(model.requestId); requester(model.requester); eventInfo(model.eventInfo); vendorName(model.vendorName); } public final String getRequestId() { return requestId; } public final void setRequestId(String requestId) { this.requestId = requestId; } @Override public final Builder requestId(String requestId) { this.requestId = requestId; return this; } public final String getRequester() { return requester; } public final void setRequester(String requester) { this.requester = requester; } @Override public final Builder requester(String requester) { this.requester = requester; return this; } public final EventInfo.Builder getEventInfo() { return eventInfo != null ? eventInfo.toBuilder() : null; } public final void setEventInfo(EventInfo.BuilderImpl eventInfo) { this.eventInfo = eventInfo != null ? eventInfo.build() : null; } @Override public final Builder eventInfo(EventInfo eventInfo) { this.eventInfo = eventInfo; return this; } public final String getVendorName() { return vendorName; } public final void setVendorName(String vendorName) { this.vendorName = vendorName; } @Override public final Builder vendorName(String vendorName) { this.vendorName = vendorName; return this; } @Override public final Builder vendorName(VendorName vendorName) { this.vendorName(vendorName == null ? null : vendorName.toString()); return this; } @Override public RequestMetadata build() { return new RequestMetadata(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy