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

com.azure.resourcemanager.hybridcompute.models.AgentConfiguration Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for HybridCompute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Hybrid Compute Management Client. Package tag package-preview-2024-05.

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.hybridcompute.models;

import com.azure.core.annotation.Immutable;
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;

/**
 * Configurable properties that the user can set locally via the azcmagent config command, or remotely via ARM.
 */
@Immutable
public final class AgentConfiguration implements JsonSerializable {
    /*
     * Specifies the URL of the proxy to be used.
     */
    private String proxyUrl;

    /*
     * Specifies the list of ports that the agent will be able to listen on.
     */
    private List incomingConnectionsPorts;

    /*
     * Array of extensions that are allowed to be installed or updated.
     */
    private List extensionsAllowList;

    /*
     * Array of extensions that are blocked (cannot be installed or updated)
     */
    private List extensionsBlockList;

    /*
     * List of service names which should not use the specified proxy server.
     */
    private List proxyBypass;

    /*
     * Specifies whether the extension service is enabled or disabled.
     */
    private String extensionsEnabled;

    /*
     * Specified whether the guest configuration service is enabled or disabled.
     */
    private String guestConfigurationEnabled;

    /*
     * Name of configuration mode to use. Modes are pre-defined configurations of security controls, extension
     * allowlists and guest configuration, maintained by Microsoft.
     */
    private AgentConfigurationMode configMode;

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

    /**
     * Get the proxyUrl property: Specifies the URL of the proxy to be used.
     * 
     * @return the proxyUrl value.
     */
    public String proxyUrl() {
        return this.proxyUrl;
    }

    /**
     * Get the incomingConnectionsPorts property: Specifies the list of ports that the agent will be able to listen on.
     * 
     * @return the incomingConnectionsPorts value.
     */
    public List incomingConnectionsPorts() {
        return this.incomingConnectionsPorts;
    }

    /**
     * Get the extensionsAllowList property: Array of extensions that are allowed to be installed or updated.
     * 
     * @return the extensionsAllowList value.
     */
    public List extensionsAllowList() {
        return this.extensionsAllowList;
    }

    /**
     * Get the extensionsBlockList property: Array of extensions that are blocked (cannot be installed or updated).
     * 
     * @return the extensionsBlockList value.
     */
    public List extensionsBlockList() {
        return this.extensionsBlockList;
    }

    /**
     * Get the proxyBypass property: List of service names which should not use the specified proxy server.
     * 
     * @return the proxyBypass value.
     */
    public List proxyBypass() {
        return this.proxyBypass;
    }

    /**
     * Get the extensionsEnabled property: Specifies whether the extension service is enabled or disabled.
     * 
     * @return the extensionsEnabled value.
     */
    public String extensionsEnabled() {
        return this.extensionsEnabled;
    }

    /**
     * Get the guestConfigurationEnabled property: Specified whether the guest configuration service is enabled or
     * disabled.
     * 
     * @return the guestConfigurationEnabled value.
     */
    public String guestConfigurationEnabled() {
        return this.guestConfigurationEnabled;
    }

    /**
     * Get the configMode property: Name of configuration mode to use. Modes are pre-defined configurations of security
     * controls, extension allowlists and guest configuration, maintained by Microsoft.
     * 
     * @return the configMode value.
     */
    public AgentConfigurationMode configMode() {
        return this.configMode;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        return jsonWriter.writeEndObject();
    }

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

                if ("proxyUrl".equals(fieldName)) {
                    deserializedAgentConfiguration.proxyUrl = reader.getString();
                } else if ("incomingConnectionsPorts".equals(fieldName)) {
                    List incomingConnectionsPorts = reader.readArray(reader1 -> reader1.getString());
                    deserializedAgentConfiguration.incomingConnectionsPorts = incomingConnectionsPorts;
                } else if ("extensionsAllowList".equals(fieldName)) {
                    List extensionsAllowList
                        = reader.readArray(reader1 -> ConfigurationExtension.fromJson(reader1));
                    deserializedAgentConfiguration.extensionsAllowList = extensionsAllowList;
                } else if ("extensionsBlockList".equals(fieldName)) {
                    List extensionsBlockList
                        = reader.readArray(reader1 -> ConfigurationExtension.fromJson(reader1));
                    deserializedAgentConfiguration.extensionsBlockList = extensionsBlockList;
                } else if ("proxyBypass".equals(fieldName)) {
                    List proxyBypass = reader.readArray(reader1 -> reader1.getString());
                    deserializedAgentConfiguration.proxyBypass = proxyBypass;
                } else if ("extensionsEnabled".equals(fieldName)) {
                    deserializedAgentConfiguration.extensionsEnabled = reader.getString();
                } else if ("guestConfigurationEnabled".equals(fieldName)) {
                    deserializedAgentConfiguration.guestConfigurationEnabled = reader.getString();
                } else if ("configMode".equals(fieldName)) {
                    deserializedAgentConfiguration.configMode = AgentConfigurationMode.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAgentConfiguration;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy