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

com.azure.resourcemanager.deviceupdate.fluent.models.AccountProperties 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.deviceupdate.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.deviceupdate.models.Encryption;
import com.azure.resourcemanager.deviceupdate.models.Location;
import com.azure.resourcemanager.deviceupdate.models.ProvisioningState;
import com.azure.resourcemanager.deviceupdate.models.PublicNetworkAccess;
import com.azure.resourcemanager.deviceupdate.models.Sku;
import java.io.IOException;
import java.util.List;

/**
 * Device Update account properties.
 */
@Fluent
public final class AccountProperties implements JsonSerializable {
    /*
     * Provisioning state.
     */
    private ProvisioningState provisioningState;

    /*
     * API host name.
     */
    private String hostname;

    /*
     * Whether or not public network access is allowed for the account.
     */
    private PublicNetworkAccess publicNetworkAccess;

    /*
     * List of private endpoint connections associated with the account.
     */
    private List privateEndpointConnections;

    /*
     * Device Update Sku
     */
    private Sku sku;

    /*
     * CMK encryption at rest properties
     */
    private Encryption encryption;

    /*
     * Device Update account primary and failover location details
     */
    private List locations;

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

    /**
     * Get the provisioningState property: Provisioning state.
     * 
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the hostname property: API host name.
     * 
     * @return the hostname value.
     */
    public String hostname() {
        return this.hostname;
    }

    /**
     * Get the publicNetworkAccess property: Whether or not public network access is allowed for the account.
     * 
     * @return the publicNetworkAccess value.
     */
    public PublicNetworkAccess publicNetworkAccess() {
        return this.publicNetworkAccess;
    }

    /**
     * Set the publicNetworkAccess property: Whether or not public network access is allowed for the account.
     * 
     * @param publicNetworkAccess the publicNetworkAccess value to set.
     * @return the AccountProperties object itself.
     */
    public AccountProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) {
        this.publicNetworkAccess = publicNetworkAccess;
        return this;
    }

    /**
     * Get the privateEndpointConnections property: List of private endpoint connections associated with the account.
     * 
     * @return the privateEndpointConnections value.
     */
    public List privateEndpointConnections() {
        return this.privateEndpointConnections;
    }

    /**
     * Set the privateEndpointConnections property: List of private endpoint connections associated with the account.
     * 
     * @param privateEndpointConnections the privateEndpointConnections value to set.
     * @return the AccountProperties object itself.
     */
    public AccountProperties
        withPrivateEndpointConnections(List privateEndpointConnections) {
        this.privateEndpointConnections = privateEndpointConnections;
        return this;
    }

    /**
     * Get the sku property: Device Update Sku.
     * 
     * @return the sku value.
     */
    public Sku sku() {
        return this.sku;
    }

    /**
     * Set the sku property: Device Update Sku.
     * 
     * @param sku the sku value to set.
     * @return the AccountProperties object itself.
     */
    public AccountProperties withSku(Sku sku) {
        this.sku = sku;
        return this;
    }

    /**
     * Get the encryption property: CMK encryption at rest properties.
     * 
     * @return the encryption value.
     */
    public Encryption encryption() {
        return this.encryption;
    }

    /**
     * Set the encryption property: CMK encryption at rest properties.
     * 
     * @param encryption the encryption value to set.
     * @return the AccountProperties object itself.
     */
    public AccountProperties withEncryption(Encryption encryption) {
        this.encryption = encryption;
        return this;
    }

    /**
     * Get the locations property: Device Update account primary and failover location details.
     * 
     * @return the locations value.
     */
    public List locations() {
        return this.locations;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("publicNetworkAccess",
            this.publicNetworkAccess == null ? null : this.publicNetworkAccess.toString());
        jsonWriter.writeArrayField("privateEndpointConnections", this.privateEndpointConnections,
            (writer, element) -> writer.writeJson(element));
        jsonWriter.writeStringField("sku", this.sku == null ? null : this.sku.toString());
        jsonWriter.writeJsonField("encryption", this.encryption);
        return jsonWriter.writeEndObject();
    }

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

                if ("provisioningState".equals(fieldName)) {
                    deserializedAccountProperties.provisioningState = ProvisioningState.fromString(reader.getString());
                } else if ("hostName".equals(fieldName)) {
                    deserializedAccountProperties.hostname = reader.getString();
                } else if ("publicNetworkAccess".equals(fieldName)) {
                    deserializedAccountProperties.publicNetworkAccess
                        = PublicNetworkAccess.fromString(reader.getString());
                } else if ("privateEndpointConnections".equals(fieldName)) {
                    List privateEndpointConnections
                        = reader.readArray(reader1 -> PrivateEndpointConnectionInner.fromJson(reader1));
                    deserializedAccountProperties.privateEndpointConnections = privateEndpointConnections;
                } else if ("sku".equals(fieldName)) {
                    deserializedAccountProperties.sku = Sku.fromString(reader.getString());
                } else if ("encryption".equals(fieldName)) {
                    deserializedAccountProperties.encryption = Encryption.fromJson(reader);
                } else if ("locations".equals(fieldName)) {
                    List locations = reader.readArray(reader1 -> Location.fromJson(reader1));
                    deserializedAccountProperties.locations = locations;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAccountProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy