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

com.azure.resourcemanager.automation.models.ActivityParameter Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Automation Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Automation Client. Package tag package-2022-02-22.

The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.automation.models;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.List;

/**
 * Definition of the activity parameter.
 */
@Fluent
public final class ActivityParameter implements JsonSerializable {
    /*
     * Gets or sets the name of the activity parameter.
     */
    private String name;

    /*
     * Gets or sets the type of the activity parameter.
     */
    private String type;

    /*
     * Gets or sets a Boolean value that indicates true if the parameter is required. If the value is false, the
     * parameter is optional.
     */
    private Boolean isMandatory;

    /*
     * Gets or sets a Boolean value that indicates true if the parameter is dynamic.
     */
    private Boolean isDynamic;

    /*
     * Gets or sets the position of the activity parameter.
     */
    private Long position;

    /*
     * Gets or sets a Boolean value that indicates true if the parameter can take values from the incoming pipeline
     * objects. This setting is used if the cmdlet must access the complete input object. false indicates that the
     * parameter cannot take values from the complete input object.
     */
    private Boolean valueFromPipeline;

    /*
     * Gets or sets a Boolean value that indicates true if the parameter can be filled from a property of the incoming
     * pipeline object that has the same name as this parameter. false indicates that the parameter cannot be filled
     * from the incoming pipeline object property with the same name.
     */
    private Boolean valueFromPipelineByPropertyName;

    /*
     * Gets or sets a Boolean value that indicates true if the cmdlet parameter accepts all the remaining command-line
     * arguments that are associated with this parameter in the form of an array. false if the cmdlet parameter does not
     * accept all the remaining argument values.
     */
    private Boolean valueFromRemainingArguments;

    /*
     * Gets or sets the description of the activity parameter.
     */
    private String description;

    /*
     * Gets or sets the validation set of activity parameter.
     */
    private List validationSet;

    /**
     * Creates an instance of ActivityParameter class.
     */
    public ActivityParameter() {
    }

    /**
     * Get the name property: Gets or sets the name of the activity parameter.
     * 
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: Gets or sets the name of the activity parameter.
     * 
     * @param name the name value to set.
     * @return the ActivityParameter object itself.
     */
    public ActivityParameter withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the type property: Gets or sets the type of the activity parameter.
     * 
     * @return the type value.
     */
    public String type() {
        return this.type;
    }

    /**
     * Set the type property: Gets or sets the type of the activity parameter.
     * 
     * @param type the type value to set.
     * @return the ActivityParameter object itself.
     */
    public ActivityParameter withType(String type) {
        this.type = type;
        return this;
    }

    /**
     * Get the isMandatory property: Gets or sets a Boolean value that indicates true if the parameter is required. If
     * the value is false, the parameter is optional.
     * 
     * @return the isMandatory value.
     */
    public Boolean isMandatory() {
        return this.isMandatory;
    }

    /**
     * Set the isMandatory property: Gets or sets a Boolean value that indicates true if the parameter is required. If
     * the value is false, the parameter is optional.
     * 
     * @param isMandatory the isMandatory value to set.
     * @return the ActivityParameter object itself.
     */
    public ActivityParameter withIsMandatory(Boolean isMandatory) {
        this.isMandatory = isMandatory;
        return this;
    }

    /**
     * Get the isDynamic property: Gets or sets a Boolean value that indicates true if the parameter is dynamic.
     * 
     * @return the isDynamic value.
     */
    public Boolean isDynamic() {
        return this.isDynamic;
    }

    /**
     * Set the isDynamic property: Gets or sets a Boolean value that indicates true if the parameter is dynamic.
     * 
     * @param isDynamic the isDynamic value to set.
     * @return the ActivityParameter object itself.
     */
    public ActivityParameter withIsDynamic(Boolean isDynamic) {
        this.isDynamic = isDynamic;
        return this;
    }

    /**
     * Get the position property: Gets or sets the position of the activity parameter.
     * 
     * @return the position value.
     */
    public Long position() {
        return this.position;
    }

    /**
     * Set the position property: Gets or sets the position of the activity parameter.
     * 
     * @param position the position value to set.
     * @return the ActivityParameter object itself.
     */
    public ActivityParameter withPosition(Long position) {
        this.position = position;
        return this;
    }

    /**
     * Get the valueFromPipeline property: Gets or sets a Boolean value that indicates true if the parameter can take
     * values from the incoming pipeline objects. This setting is used if the cmdlet must access the complete input
     * object. false indicates that the parameter cannot take values from the complete input object.
     * 
     * @return the valueFromPipeline value.
     */
    public Boolean valueFromPipeline() {
        return this.valueFromPipeline;
    }

    /**
     * Set the valueFromPipeline property: Gets or sets a Boolean value that indicates true if the parameter can take
     * values from the incoming pipeline objects. This setting is used if the cmdlet must access the complete input
     * object. false indicates that the parameter cannot take values from the complete input object.
     * 
     * @param valueFromPipeline the valueFromPipeline value to set.
     * @return the ActivityParameter object itself.
     */
    public ActivityParameter withValueFromPipeline(Boolean valueFromPipeline) {
        this.valueFromPipeline = valueFromPipeline;
        return this;
    }

    /**
     * Get the valueFromPipelineByPropertyName property: Gets or sets a Boolean value that indicates true if the
     * parameter can be filled from a property of the incoming pipeline object that has the same name as this parameter.
     * false indicates that the parameter cannot be filled from the incoming pipeline object property with the same
     * name.
     * 
     * @return the valueFromPipelineByPropertyName value.
     */
    public Boolean valueFromPipelineByPropertyName() {
        return this.valueFromPipelineByPropertyName;
    }

    /**
     * Set the valueFromPipelineByPropertyName property: Gets or sets a Boolean value that indicates true if the
     * parameter can be filled from a property of the incoming pipeline object that has the same name as this parameter.
     * false indicates that the parameter cannot be filled from the incoming pipeline object property with the same
     * name.
     * 
     * @param valueFromPipelineByPropertyName the valueFromPipelineByPropertyName value to set.
     * @return the ActivityParameter object itself.
     */
    public ActivityParameter withValueFromPipelineByPropertyName(Boolean valueFromPipelineByPropertyName) {
        this.valueFromPipelineByPropertyName = valueFromPipelineByPropertyName;
        return this;
    }

    /**
     * Get the valueFromRemainingArguments property: Gets or sets a Boolean value that indicates true if the cmdlet
     * parameter accepts all the remaining command-line arguments that are associated with this parameter in the form of
     * an array. false if the cmdlet parameter does not accept all the remaining argument values.
     * 
     * @return the valueFromRemainingArguments value.
     */
    public Boolean valueFromRemainingArguments() {
        return this.valueFromRemainingArguments;
    }

    /**
     * Set the valueFromRemainingArguments property: Gets or sets a Boolean value that indicates true if the cmdlet
     * parameter accepts all the remaining command-line arguments that are associated with this parameter in the form of
     * an array. false if the cmdlet parameter does not accept all the remaining argument values.
     * 
     * @param valueFromRemainingArguments the valueFromRemainingArguments value to set.
     * @return the ActivityParameter object itself.
     */
    public ActivityParameter withValueFromRemainingArguments(Boolean valueFromRemainingArguments) {
        this.valueFromRemainingArguments = valueFromRemainingArguments;
        return this;
    }

    /**
     * Get the description property: Gets or sets the description of the activity parameter.
     * 
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Set the description property: Gets or sets the description of the activity parameter.
     * 
     * @param description the description value to set.
     * @return the ActivityParameter object itself.
     */
    public ActivityParameter withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Get the validationSet property: Gets or sets the validation set of activity parameter.
     * 
     * @return the validationSet value.
     */
    public List validationSet() {
        return this.validationSet;
    }

    /**
     * Set the validationSet property: Gets or sets the validation set of activity parameter.
     * 
     * @param validationSet the validationSet value to set.
     * @return the ActivityParameter object itself.
     */
    public ActivityParameter withValidationSet(List validationSet) {
        this.validationSet = validationSet;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (validationSet() != null) {
            validationSet().forEach(e -> e.validate());
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("name", this.name);
        jsonWriter.writeStringField("type", this.type);
        jsonWriter.writeBooleanField("isMandatory", this.isMandatory);
        jsonWriter.writeBooleanField("isDynamic", this.isDynamic);
        jsonWriter.writeNumberField("position", this.position);
        jsonWriter.writeBooleanField("valueFromPipeline", this.valueFromPipeline);
        jsonWriter.writeBooleanField("valueFromPipelineByPropertyName", this.valueFromPipelineByPropertyName);
        jsonWriter.writeBooleanField("valueFromRemainingArguments", this.valueFromRemainingArguments);
        jsonWriter.writeStringField("description", this.description);
        jsonWriter.writeArrayField("validationSet", this.validationSet, (writer, element) -> writer.writeJson(element));
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of ActivityParameter from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of ActivityParameter if the JsonReader was pointing to an instance of it, or null if it was
     * pointing to JSON null.
     * @throws IOException If an error occurs while reading the ActivityParameter.
     */
    public static ActivityParameter fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            ActivityParameter deserializedActivityParameter = new ActivityParameter();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("name".equals(fieldName)) {
                    deserializedActivityParameter.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedActivityParameter.type = reader.getString();
                } else if ("isMandatory".equals(fieldName)) {
                    deserializedActivityParameter.isMandatory = reader.getNullable(JsonReader::getBoolean);
                } else if ("isDynamic".equals(fieldName)) {
                    deserializedActivityParameter.isDynamic = reader.getNullable(JsonReader::getBoolean);
                } else if ("position".equals(fieldName)) {
                    deserializedActivityParameter.position = reader.getNullable(JsonReader::getLong);
                } else if ("valueFromPipeline".equals(fieldName)) {
                    deserializedActivityParameter.valueFromPipeline = reader.getNullable(JsonReader::getBoolean);
                } else if ("valueFromPipelineByPropertyName".equals(fieldName)) {
                    deserializedActivityParameter.valueFromPipelineByPropertyName
                        = reader.getNullable(JsonReader::getBoolean);
                } else if ("valueFromRemainingArguments".equals(fieldName)) {
                    deserializedActivityParameter.valueFromRemainingArguments
                        = reader.getNullable(JsonReader::getBoolean);
                } else if ("description".equals(fieldName)) {
                    deserializedActivityParameter.description = reader.getString();
                } else if ("validationSet".equals(fieldName)) {
                    List validationSet
                        = reader.readArray(reader1 -> ActivityParameterValidationSet.fromJson(reader1));
                    deserializedActivityParameter.validationSet = validationSet;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedActivityParameter;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy