software.amazon.awssdk.services.codegurureviewer.model.RequestMetadata Maven / Gradle / Ivy
Show all versions of codegurureviewer 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.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 extends Builder> 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