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

com.azure.resourcemanager.automation.fluent.models.ActivityInner Maven / Gradle / Ivy

// 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.fluent.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 com.azure.resourcemanager.automation.models.ActivityOutputType;
import com.azure.resourcemanager.automation.models.ActivityParameterSet;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.List;

/**
 * Definition of the activity.
 */
@Fluent
public final class ActivityInner implements JsonSerializable {
    /*
     * Gets or sets the id of the resource.
     */
    private String id;

    /*
     * Gets the name of the activity.
     */
    private String name;

    /*
     * Gets or sets the properties of the activity.
     */
    private ActivityProperties innerProperties;

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

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

    /**
     * Set the id property: Gets or sets the id of the resource.
     * 
     * @param id the id value to set.
     * @return the ActivityInner object itself.
     */
    public ActivityInner withId(String id) {
        this.id = id;
        return this;
    }

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

    /**
     * Get the innerProperties property: Gets or sets the properties of the activity.
     * 
     * @return the innerProperties value.
     */
    private ActivityProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the definition property: Gets or sets the user name of the activity.
     * 
     * @return the definition value.
     */
    public String definition() {
        return this.innerProperties() == null ? null : this.innerProperties().definition();
    }

    /**
     * Set the definition property: Gets or sets the user name of the activity.
     * 
     * @param definition the definition value to set.
     * @return the ActivityInner object itself.
     */
    public ActivityInner withDefinition(String definition) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ActivityProperties();
        }
        this.innerProperties().withDefinition(definition);
        return this;
    }

    /**
     * Get the parameterSets property: Gets or sets the parameter sets of the activity.
     * 
     * @return the parameterSets value.
     */
    public List parameterSets() {
        return this.innerProperties() == null ? null : this.innerProperties().parameterSets();
    }

    /**
     * Set the parameterSets property: Gets or sets the parameter sets of the activity.
     * 
     * @param parameterSets the parameterSets value to set.
     * @return the ActivityInner object itself.
     */
    public ActivityInner withParameterSets(List parameterSets) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ActivityProperties();
        }
        this.innerProperties().withParameterSets(parameterSets);
        return this;
    }

    /**
     * Get the outputTypes property: Gets or sets the output types of the activity.
     * 
     * @return the outputTypes value.
     */
    public List outputTypes() {
        return this.innerProperties() == null ? null : this.innerProperties().outputTypes();
    }

    /**
     * Set the outputTypes property: Gets or sets the output types of the activity.
     * 
     * @param outputTypes the outputTypes value to set.
     * @return the ActivityInner object itself.
     */
    public ActivityInner withOutputTypes(List outputTypes) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ActivityProperties();
        }
        this.innerProperties().withOutputTypes(outputTypes);
        return this;
    }

    /**
     * Get the creationTime property: Gets or sets the creation time.
     * 
     * @return the creationTime value.
     */
    public OffsetDateTime creationTime() {
        return this.innerProperties() == null ? null : this.innerProperties().creationTime();
    }

    /**
     * Set the creationTime property: Gets or sets the creation time.
     * 
     * @param creationTime the creationTime value to set.
     * @return the ActivityInner object itself.
     */
    public ActivityInner withCreationTime(OffsetDateTime creationTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ActivityProperties();
        }
        this.innerProperties().withCreationTime(creationTime);
        return this;
    }

    /**
     * Get the lastModifiedTime property: Gets or sets the last modified time.
     * 
     * @return the lastModifiedTime value.
     */
    public OffsetDateTime lastModifiedTime() {
        return this.innerProperties() == null ? null : this.innerProperties().lastModifiedTime();
    }

    /**
     * Set the lastModifiedTime property: Gets or sets the last modified time.
     * 
     * @param lastModifiedTime the lastModifiedTime value to set.
     * @return the ActivityInner object itself.
     */
    public ActivityInner withLastModifiedTime(OffsetDateTime lastModifiedTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ActivityProperties();
        }
        this.innerProperties().withLastModifiedTime(lastModifiedTime);
        return this;
    }

    /**
     * Get the description property: Gets or sets the description.
     * 
     * @return the description value.
     */
    public String description() {
        return this.innerProperties() == null ? null : this.innerProperties().description();
    }

    /**
     * Set the description property: Gets or sets the description.
     * 
     * @param description the description value to set.
     * @return the ActivityInner object itself.
     */
    public ActivityInner withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ActivityProperties();
        }
        this.innerProperties().withDescription(description);
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("id", this.id);
        jsonWriter.writeJsonField("properties", this.innerProperties);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of ActivityInner from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of ActivityInner 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 ActivityInner.
     */
    public static ActivityInner fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            ActivityInner deserializedActivityInner = new ActivityInner();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("id".equals(fieldName)) {
                    deserializedActivityInner.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedActivityInner.name = reader.getString();
                } else if ("properties".equals(fieldName)) {
                    deserializedActivityInner.innerProperties = ActivityProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedActivityInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy