
software.amazon.awssdk.services.inspector.model.CreateAssessmentTemplateRequest Maven / Gradle / Ivy
/*
* Copyright 2012-2017 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.inspector.model;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.annotation.Generated;
import software.amazon.awssdk.AmazonWebServiceRequest;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public class CreateAssessmentTemplateRequest extends AmazonWebServiceRequest implements
ToCopyableBuilder {
private final String assessmentTargetArn;
private final String assessmentTemplateName;
private final Integer durationInSeconds;
private final List rulesPackageArns;
private final List userAttributesForFindings;
private CreateAssessmentTemplateRequest(BuilderImpl builder) {
this.assessmentTargetArn = builder.assessmentTargetArn;
this.assessmentTemplateName = builder.assessmentTemplateName;
this.durationInSeconds = builder.durationInSeconds;
this.rulesPackageArns = builder.rulesPackageArns;
this.userAttributesForFindings = builder.userAttributesForFindings;
}
/**
*
* The ARN that specifies the assessment target for which you want to create the assessment template.
*
*
* @return The ARN that specifies the assessment target for which you want to create the assessment template.
*/
public String assessmentTargetArn() {
return assessmentTargetArn;
}
/**
*
* The user-defined name that identifies the assessment template that you want to create. You can create several
* assessment templates for an assessment target. The names of the assessment templates that correspond to a
* particular assessment target must be unique.
*
*
* @return The user-defined name that identifies the assessment template that you want to create. You can create
* several assessment templates for an assessment target. The names of the assessment templates that
* correspond to a particular assessment target must be unique.
*/
public String assessmentTemplateName() {
return assessmentTemplateName;
}
/**
*
* The duration of the assessment run in seconds. The default value is 3600 seconds (one hour).
*
*
* @return The duration of the assessment run in seconds. The default value is 3600 seconds (one hour).
*/
public Integer durationInSeconds() {
return durationInSeconds;
}
/**
*
* The ARNs that specify the rules packages that you want to attach to the assessment template.
*
*
* @return The ARNs that specify the rules packages that you want to attach to the assessment template.
*/
public List rulesPackageArns() {
return rulesPackageArns;
}
/**
*
* The user-defined attributes that are assigned to every finding that is generated by the assessment run that uses
* this assessment template.
*
*
* @return The user-defined attributes that are assigned to every finding that is generated by the assessment run
* that uses this assessment template.
*/
public List userAttributesForFindings() {
return userAttributesForFindings;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + ((assessmentTargetArn() == null) ? 0 : assessmentTargetArn().hashCode());
hashCode = 31 * hashCode + ((assessmentTemplateName() == null) ? 0 : assessmentTemplateName().hashCode());
hashCode = 31 * hashCode + ((durationInSeconds() == null) ? 0 : durationInSeconds().hashCode());
hashCode = 31 * hashCode + ((rulesPackageArns() == null) ? 0 : rulesPackageArns().hashCode());
hashCode = 31 * hashCode + ((userAttributesForFindings() == null) ? 0 : userAttributesForFindings().hashCode());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateAssessmentTemplateRequest)) {
return false;
}
CreateAssessmentTemplateRequest other = (CreateAssessmentTemplateRequest) obj;
if (other.assessmentTargetArn() == null ^ this.assessmentTargetArn() == null) {
return false;
}
if (other.assessmentTargetArn() != null && !other.assessmentTargetArn().equals(this.assessmentTargetArn())) {
return false;
}
if (other.assessmentTemplateName() == null ^ this.assessmentTemplateName() == null) {
return false;
}
if (other.assessmentTemplateName() != null && !other.assessmentTemplateName().equals(this.assessmentTemplateName())) {
return false;
}
if (other.durationInSeconds() == null ^ this.durationInSeconds() == null) {
return false;
}
if (other.durationInSeconds() != null && !other.durationInSeconds().equals(this.durationInSeconds())) {
return false;
}
if (other.rulesPackageArns() == null ^ this.rulesPackageArns() == null) {
return false;
}
if (other.rulesPackageArns() != null && !other.rulesPackageArns().equals(this.rulesPackageArns())) {
return false;
}
if (other.userAttributesForFindings() == null ^ this.userAttributesForFindings() == null) {
return false;
}
if (other.userAttributesForFindings() != null
&& !other.userAttributesForFindings().equals(this.userAttributesForFindings())) {
return false;
}
return true;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (assessmentTargetArn() != null) {
sb.append("AssessmentTargetArn: ").append(assessmentTargetArn()).append(",");
}
if (assessmentTemplateName() != null) {
sb.append("AssessmentTemplateName: ").append(assessmentTemplateName()).append(",");
}
if (durationInSeconds() != null) {
sb.append("DurationInSeconds: ").append(durationInSeconds()).append(",");
}
if (rulesPackageArns() != null) {
sb.append("RulesPackageArns: ").append(rulesPackageArns()).append(",");
}
if (userAttributesForFindings() != null) {
sb.append("UserAttributesForFindings: ").append(userAttributesForFindings()).append(",");
}
sb.append("}");
return sb.toString();
}
public interface Builder extends CopyableBuilder {
/**
*
* The ARN that specifies the assessment target for which you want to create the assessment template.
*
*
* @param assessmentTargetArn
* The ARN that specifies the assessment target for which you want to create the assessment template.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder assessmentTargetArn(String assessmentTargetArn);
/**
*
* The user-defined name that identifies the assessment template that you want to create. You can create several
* assessment templates for an assessment target. The names of the assessment templates that correspond to a
* particular assessment target must be unique.
*
*
* @param assessmentTemplateName
* The user-defined name that identifies the assessment template that you want to create. You can create
* several assessment templates for an assessment target. The names of the assessment templates that
* correspond to a particular assessment target must be unique.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder assessmentTemplateName(String assessmentTemplateName);
/**
*
* The duration of the assessment run in seconds. The default value is 3600 seconds (one hour).
*
*
* @param durationInSeconds
* The duration of the assessment run in seconds. The default value is 3600 seconds (one hour).
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder durationInSeconds(Integer durationInSeconds);
/**
*
* The ARNs that specify the rules packages that you want to attach to the assessment template.
*
*
* @param rulesPackageArns
* The ARNs that specify the rules packages that you want to attach to the assessment template.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder rulesPackageArns(Collection rulesPackageArns);
/**
*
* The ARNs that specify the rules packages that you want to attach to the assessment template.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setRulesPackageArns(java.util.Collection)} or {@link #withRulesPackageArns(java.util.Collection)} if
* you want to override the existing values.
*
*
* @param rulesPackageArns
* The ARNs that specify the rules packages that you want to attach to the assessment template.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder rulesPackageArns(String... rulesPackageArns);
/**
*
* The user-defined attributes that are assigned to every finding that is generated by the assessment run that
* uses this assessment template.
*
*
* @param userAttributesForFindings
* The user-defined attributes that are assigned to every finding that is generated by the assessment run
* that uses this assessment template.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder userAttributesForFindings(Collection userAttributesForFindings);
/**
*
* The user-defined attributes that are assigned to every finding that is generated by the assessment run that
* uses this assessment template.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setUserAttributesForFindings(java.util.Collection)} or
* {@link #withUserAttributesForFindings(java.util.Collection)} if you want to override the existing values.
*
*
* @param userAttributesForFindings
* The user-defined attributes that are assigned to every finding that is generated by the assessment run
* that uses this assessment template.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder userAttributesForFindings(Attribute... userAttributesForFindings);
}
private static final class BuilderImpl implements Builder {
private String assessmentTargetArn;
private String assessmentTemplateName;
private Integer durationInSeconds;
private List rulesPackageArns;
private List userAttributesForFindings;
private BuilderImpl() {
}
private BuilderImpl(CreateAssessmentTemplateRequest model) {
setAssessmentTargetArn(model.assessmentTargetArn);
setAssessmentTemplateName(model.assessmentTemplateName);
setDurationInSeconds(model.durationInSeconds);
setRulesPackageArns(model.rulesPackageArns);
setUserAttributesForFindings(model.userAttributesForFindings);
}
public final String getAssessmentTargetArn() {
return assessmentTargetArn;
}
@Override
public final Builder assessmentTargetArn(String assessmentTargetArn) {
this.assessmentTargetArn = assessmentTargetArn;
return this;
}
public final void setAssessmentTargetArn(String assessmentTargetArn) {
this.assessmentTargetArn = assessmentTargetArn;
}
public final String getAssessmentTemplateName() {
return assessmentTemplateName;
}
@Override
public final Builder assessmentTemplateName(String assessmentTemplateName) {
this.assessmentTemplateName = assessmentTemplateName;
return this;
}
public final void setAssessmentTemplateName(String assessmentTemplateName) {
this.assessmentTemplateName = assessmentTemplateName;
}
public final Integer getDurationInSeconds() {
return durationInSeconds;
}
@Override
public final Builder durationInSeconds(Integer durationInSeconds) {
this.durationInSeconds = durationInSeconds;
return this;
}
public final void setDurationInSeconds(Integer durationInSeconds) {
this.durationInSeconds = durationInSeconds;
}
public final Collection getRulesPackageArns() {
return rulesPackageArns;
}
@Override
public final Builder rulesPackageArns(Collection rulesPackageArns) {
this.rulesPackageArns = AssessmentTemplateRulesPackageArnListCopier.copy(rulesPackageArns);
return this;
}
@Override
@SafeVarargs
public final Builder rulesPackageArns(String... rulesPackageArns) {
if (this.rulesPackageArns == null) {
this.rulesPackageArns = new ArrayList<>(rulesPackageArns.length);
}
for (String e : rulesPackageArns) {
this.rulesPackageArns.add(e);
}
return this;
}
public final void setRulesPackageArns(Collection rulesPackageArns) {
this.rulesPackageArns = AssessmentTemplateRulesPackageArnListCopier.copy(rulesPackageArns);
}
@SafeVarargs
public final void setRulesPackageArns(String... rulesPackageArns) {
if (this.rulesPackageArns == null) {
this.rulesPackageArns = new ArrayList<>(rulesPackageArns.length);
}
for (String e : rulesPackageArns) {
this.rulesPackageArns.add(e);
}
}
public final Collection getUserAttributesForFindings() {
return userAttributesForFindings;
}
@Override
public final Builder userAttributesForFindings(Collection userAttributesForFindings) {
this.userAttributesForFindings = UserAttributeListCopier.copy(userAttributesForFindings);
return this;
}
@Override
@SafeVarargs
public final Builder userAttributesForFindings(Attribute... userAttributesForFindings) {
if (this.userAttributesForFindings == null) {
this.userAttributesForFindings = new ArrayList<>(userAttributesForFindings.length);
}
for (Attribute e : userAttributesForFindings) {
this.userAttributesForFindings.add(e);
}
return this;
}
public final void setUserAttributesForFindings(Collection userAttributesForFindings) {
this.userAttributesForFindings = UserAttributeListCopier.copy(userAttributesForFindings);
}
@SafeVarargs
public final void setUserAttributesForFindings(Attribute... userAttributesForFindings) {
if (this.userAttributesForFindings == null) {
this.userAttributesForFindings = new ArrayList<>(userAttributesForFindings.length);
}
for (Attribute e : userAttributesForFindings) {
this.userAttributesForFindings.add(e);
}
}
@Override
public CreateAssessmentTemplateRequest build() {
return new CreateAssessmentTemplateRequest(this);
}
}
}