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

com.azure.resourcemanager.dataprotection.models.ResourceGuardProxyBase Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for DataProtection Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Open API 2.0 Specs for Azure Data Protection service. Package tag package-2024-04.

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.dataprotection.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;

/**
 * ResourceGuardProxyBase object, used in ResourceGuardProxyBaseResource.
 */
@Fluent
public final class ResourceGuardProxyBase implements JsonSerializable {
    /*
     * The resourceGuardResourceId property.
     */
    private String resourceGuardResourceId;

    /*
     * The resourceGuardOperationDetails property.
     */
    private List resourceGuardOperationDetails;

    /*
     * The lastUpdatedTime property.
     */
    private String lastUpdatedTime;

    /*
     * The description property.
     */
    private String description;

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

    /**
     * Get the resourceGuardResourceId property: The resourceGuardResourceId property.
     * 
     * @return the resourceGuardResourceId value.
     */
    public String resourceGuardResourceId() {
        return this.resourceGuardResourceId;
    }

    /**
     * Set the resourceGuardResourceId property: The resourceGuardResourceId property.
     * 
     * @param resourceGuardResourceId the resourceGuardResourceId value to set.
     * @return the ResourceGuardProxyBase object itself.
     */
    public ResourceGuardProxyBase withResourceGuardResourceId(String resourceGuardResourceId) {
        this.resourceGuardResourceId = resourceGuardResourceId;
        return this;
    }

    /**
     * Get the resourceGuardOperationDetails property: The resourceGuardOperationDetails property.
     * 
     * @return the resourceGuardOperationDetails value.
     */
    public List resourceGuardOperationDetails() {
        return this.resourceGuardOperationDetails;
    }

    /**
     * Set the resourceGuardOperationDetails property: The resourceGuardOperationDetails property.
     * 
     * @param resourceGuardOperationDetails the resourceGuardOperationDetails value to set.
     * @return the ResourceGuardProxyBase object itself.
     */
    public ResourceGuardProxyBase
        withResourceGuardOperationDetails(List resourceGuardOperationDetails) {
        this.resourceGuardOperationDetails = resourceGuardOperationDetails;
        return this;
    }

    /**
     * Get the lastUpdatedTime property: The lastUpdatedTime property.
     * 
     * @return the lastUpdatedTime value.
     */
    public String lastUpdatedTime() {
        return this.lastUpdatedTime;
    }

    /**
     * Set the lastUpdatedTime property: The lastUpdatedTime property.
     * 
     * @param lastUpdatedTime the lastUpdatedTime value to set.
     * @return the ResourceGuardProxyBase object itself.
     */
    public ResourceGuardProxyBase withLastUpdatedTime(String lastUpdatedTime) {
        this.lastUpdatedTime = lastUpdatedTime;
        return this;
    }

    /**
     * Get the description property: The description property.
     * 
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Set the description property: The description property.
     * 
     * @param description the description value to set.
     * @return the ResourceGuardProxyBase object itself.
     */
    public ResourceGuardProxyBase withDescription(String description) {
        this.description = description;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("resourceGuardResourceId", this.resourceGuardResourceId);
        jsonWriter.writeArrayField("resourceGuardOperationDetails", this.resourceGuardOperationDetails,
            (writer, element) -> writer.writeJson(element));
        jsonWriter.writeStringField("lastUpdatedTime", this.lastUpdatedTime);
        jsonWriter.writeStringField("description", this.description);
        return jsonWriter.writeEndObject();
    }

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

                if ("resourceGuardResourceId".equals(fieldName)) {
                    deserializedResourceGuardProxyBase.resourceGuardResourceId = reader.getString();
                } else if ("resourceGuardOperationDetails".equals(fieldName)) {
                    List resourceGuardOperationDetails
                        = reader.readArray(reader1 -> ResourceGuardOperationDetail.fromJson(reader1));
                    deserializedResourceGuardProxyBase.resourceGuardOperationDetails = resourceGuardOperationDetails;
                } else if ("lastUpdatedTime".equals(fieldName)) {
                    deserializedResourceGuardProxyBase.lastUpdatedTime = reader.getString();
                } else if ("description".equals(fieldName)) {
                    deserializedResourceGuardProxyBase.description = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedResourceGuardProxyBase;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy