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

com.azure.resourcemanager.automation.fluent.models.WatcherInner 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.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.Map;

/**
 * Definition of the watcher type.
 */
@Fluent
public final class WatcherInner extends ProxyResource {
    /*
     * Gets or sets the watcher properties.
     */
    private WatcherProperties innerProperties;

    /*
     * Gets or sets the etag of the resource.
     */
    private String etag;

    /*
     * Resource tags.
     */
    private Map tags;

    /*
     * The geo-location where the resource lives
     */
    private String location;

    /*
     * The type of the resource.
     */
    private String type;

    /*
     * The name of the resource.
     */
    private String name;

    /*
     * Fully qualified resource Id for the resource.
     */
    private String id;

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

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

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

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

    /**
     * Get the tags property: Resource tags.
     * 
     * @return the tags value.
     */
    public Map tags() {
        return this.tags;
    }

    /**
     * Set the tags property: Resource tags.
     * 
     * @param tags the tags value to set.
     * @return the WatcherInner object itself.
     */
    public WatcherInner withTags(Map tags) {
        this.tags = tags;
        return this;
    }

    /**
     * Get the location property: The geo-location where the resource lives.
     * 
     * @return the location value.
     */
    public String location() {
        return this.location;
    }

    /**
     * Set the location property: The geo-location where the resource lives.
     * 
     * @param location the location value to set.
     * @return the WatcherInner object itself.
     */
    public WatcherInner withLocation(String location) {
        this.location = location;
        return this;
    }

    /**
     * Get the type property: The type of the resource.
     * 
     * @return the type value.
     */
    @Override
    public String type() {
        return this.type;
    }

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

    /**
     * Get the id property: Fully qualified resource Id for the resource.
     * 
     * @return the id value.
     */
    @Override
    public String id() {
        return this.id;
    }

    /**
     * Get the executionFrequencyInSeconds property: Gets or sets the frequency at which the watcher is invoked.
     * 
     * @return the executionFrequencyInSeconds value.
     */
    public Long executionFrequencyInSeconds() {
        return this.innerProperties() == null ? null : this.innerProperties().executionFrequencyInSeconds();
    }

    /**
     * Set the executionFrequencyInSeconds property: Gets or sets the frequency at which the watcher is invoked.
     * 
     * @param executionFrequencyInSeconds the executionFrequencyInSeconds value to set.
     * @return the WatcherInner object itself.
     */
    public WatcherInner withExecutionFrequencyInSeconds(Long executionFrequencyInSeconds) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WatcherProperties();
        }
        this.innerProperties().withExecutionFrequencyInSeconds(executionFrequencyInSeconds);
        return this;
    }

    /**
     * Get the scriptName property: Gets or sets the name of the script the watcher is attached to, i.e. the name of an
     * existing runbook.
     * 
     * @return the scriptName value.
     */
    public String scriptName() {
        return this.innerProperties() == null ? null : this.innerProperties().scriptName();
    }

    /**
     * Set the scriptName property: Gets or sets the name of the script the watcher is attached to, i.e. the name of an
     * existing runbook.
     * 
     * @param scriptName the scriptName value to set.
     * @return the WatcherInner object itself.
     */
    public WatcherInner withScriptName(String scriptName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WatcherProperties();
        }
        this.innerProperties().withScriptName(scriptName);
        return this;
    }

    /**
     * Get the scriptParameters property: Gets or sets the parameters of the script.
     * 
     * @return the scriptParameters value.
     */
    public Map scriptParameters() {
        return this.innerProperties() == null ? null : this.innerProperties().scriptParameters();
    }

    /**
     * Set the scriptParameters property: Gets or sets the parameters of the script.
     * 
     * @param scriptParameters the scriptParameters value to set.
     * @return the WatcherInner object itself.
     */
    public WatcherInner withScriptParameters(Map scriptParameters) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WatcherProperties();
        }
        this.innerProperties().withScriptParameters(scriptParameters);
        return this;
    }

    /**
     * Get the scriptRunOn property: Gets or sets the name of the hybrid worker group the watcher will run on.
     * 
     * @return the scriptRunOn value.
     */
    public String scriptRunOn() {
        return this.innerProperties() == null ? null : this.innerProperties().scriptRunOn();
    }

    /**
     * Set the scriptRunOn property: Gets or sets the name of the hybrid worker group the watcher will run on.
     * 
     * @param scriptRunOn the scriptRunOn value to set.
     * @return the WatcherInner object itself.
     */
    public WatcherInner withScriptRunOn(String scriptRunOn) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WatcherProperties();
        }
        this.innerProperties().withScriptRunOn(scriptRunOn);
        return this;
    }

    /**
     * Get the status property: Gets the current status of the watcher.
     * 
     * @return the status value.
     */
    public String status() {
        return this.innerProperties() == null ? null : this.innerProperties().status();
    }

    /**
     * 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();
    }

    /**
     * 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();
    }

    /**
     * Get the lastModifiedBy property: Details of the user who last modified the watcher.
     * 
     * @return the lastModifiedBy value.
     */
    public String lastModifiedBy() {
        return this.innerProperties() == null ? null : this.innerProperties().lastModifiedBy();
    }

    /**
     * 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 WatcherInner object itself.
     */
    public WatcherInner withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WatcherProperties();
        }
        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.writeJsonField("properties", this.innerProperties);
        jsonWriter.writeStringField("etag", this.etag);
        jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element));
        jsonWriter.writeStringField("location", this.location);
        return jsonWriter.writeEndObject();
    }

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

                if ("id".equals(fieldName)) {
                    deserializedWatcherInner.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedWatcherInner.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedWatcherInner.type = reader.getString();
                } else if ("properties".equals(fieldName)) {
                    deserializedWatcherInner.innerProperties = WatcherProperties.fromJson(reader);
                } else if ("etag".equals(fieldName)) {
                    deserializedWatcherInner.etag = reader.getString();
                } else if ("tags".equals(fieldName)) {
                    Map tags = reader.readMap(reader1 -> reader1.getString());
                    deserializedWatcherInner.tags = tags;
                } else if ("location".equals(fieldName)) {
                    deserializedWatcherInner.location = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedWatcherInner;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy