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

com.azure.resourcemanager.datafactory.models.FactoryUpdateParameters 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.datafactory.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.datafactory.fluent.models.FactoryUpdateProperties;
import java.io.IOException;
import java.util.Map;

/**
 * Parameters for updating a factory resource.
 */
@Fluent
public final class FactoryUpdateParameters implements JsonSerializable {
    /*
     * The resource tags.
     */
    private Map tags;

    /*
     * Managed service identity of the factory.
     */
    private FactoryIdentity identity;

    /*
     * Properties of update the factory.
     */
    private FactoryUpdateProperties innerProperties;

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

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

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

    /**
     * Get the identity property: Managed service identity of the factory.
     * 
     * @return the identity value.
     */
    public FactoryIdentity identity() {
        return this.identity;
    }

    /**
     * Set the identity property: Managed service identity of the factory.
     * 
     * @param identity the identity value to set.
     * @return the FactoryUpdateParameters object itself.
     */
    public FactoryUpdateParameters withIdentity(FactoryIdentity identity) {
        this.identity = identity;
        return this;
    }

    /**
     * Get the innerProperties property: Properties of update the factory.
     * 
     * @return the innerProperties value.
     */
    private FactoryUpdateProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the publicNetworkAccess property: Whether or not public network access is allowed for the data factory.
     * 
     * @return the publicNetworkAccess value.
     */
    public PublicNetworkAccess publicNetworkAccess() {
        return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess();
    }

    /**
     * Set the publicNetworkAccess property: Whether or not public network access is allowed for the data factory.
     * 
     * @param publicNetworkAccess the publicNetworkAccess value to set.
     * @return the FactoryUpdateParameters object itself.
     */
    public FactoryUpdateParameters withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) {
        if (this.innerProperties() == null) {
            this.innerProperties = new FactoryUpdateProperties();
        }
        this.innerProperties().withPublicNetworkAccess(publicNetworkAccess);
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element));
        jsonWriter.writeJsonField("identity", this.identity);
        jsonWriter.writeJsonField("properties", this.innerProperties);
        return jsonWriter.writeEndObject();
    }

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

                if ("tags".equals(fieldName)) {
                    Map tags = reader.readMap(reader1 -> reader1.getString());
                    deserializedFactoryUpdateParameters.tags = tags;
                } else if ("identity".equals(fieldName)) {
                    deserializedFactoryUpdateParameters.identity = FactoryIdentity.fromJson(reader);
                } else if ("properties".equals(fieldName)) {
                    deserializedFactoryUpdateParameters.innerProperties = FactoryUpdateProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedFactoryUpdateParameters;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy