/*
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for
 * license information.
 *
 * Code generated by Microsoft (R) AutoRest Code Generator.
 * Changes may cause incorrect behavior and will be lost if the code is
 * regenerated.
 */

'use strict';

/**
 * Cluster creation operation.
 *
 */
class ClusterCreateParameters {
  /**
   * Create a ClusterCreateParameters.
   * @member {string} vmSize VM size. The size of the virtual machines in the
   * cluster. All nodes in a cluster have the same VM size. For information
   * about available VM sizes for clusters using images from the Virtual
   * Machines Marketplace see Sizes for Virtual Machines (Linux). Batch AI
   * service supports all Azure VM sizes except STANDARD_A0 and those with
   * premium storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series).
   * @member {string} [vmPriority] VM priority. VM priority. Allowed values
   * are: dedicated (default) and lowpriority. Possible values include:
   * 'dedicated', 'lowpriority'. Default value: 'dedicated' .
   * @member {object} [scaleSettings] Scale settings. Scale settings for the
   * cluster. Batch AI service supports manual and auto scale clusters.
   * @member {object} [scaleSettings.manual] Manual scale settings for the
   * cluster.
   * @member {number} [scaleSettings.manual.targetNodeCount] The desired number
   * of compute nodes in the Cluster. Default is 0.
   * @member {string} [scaleSettings.manual.nodeDeallocationOption] An action
   * to be performed when the cluster size is decreasing. The default value is
   * requeue. Possible values include: 'requeue', 'terminate',
   * 'waitforjobcompletion'
   * @member {object} [scaleSettings.autoScale] Auto-scale settings for the
   * cluster.
   * @member {number} [scaleSettings.autoScale.minimumNodeCount] The minimum
   * number of compute nodes the Batch AI service will try to allocate for the
   * cluster. Note, the actual number of nodes can be less than the specified
   * value if the subscription has not enough quota to fulfill the request.
   * @member {number} [scaleSettings.autoScale.maximumNodeCount] The maximum
   * number of compute nodes the cluster can have.
   * @member {number} [scaleSettings.autoScale.initialNodeCount] The number of
   * compute nodes to allocate on cluster creation. Note that this value is
   * used only during cluster creation. Default: 0.
   * @member {object} [virtualMachineConfiguration] VM configuration. OS image
   * configuration for cluster nodes. All nodes in a cluster have the same OS
   * image.
   * @member {object} [virtualMachineConfiguration.imageReference] OS image
   * reference for cluster nodes.
   * @member {string} [virtualMachineConfiguration.imageReference.publisher]
   * Publisher of the image.
   * @member {string} [virtualMachineConfiguration.imageReference.offer] Offer
   * of the image.
   * @member {string} [virtualMachineConfiguration.imageReference.sku] SKU of
   * the image.
   * @member {string} [virtualMachineConfiguration.imageReference.version]
   * Version of the image.
   * @member {string}
   * [virtualMachineConfiguration.imageReference.virtualMachineImageId] The ARM
   * resource identifier of the virtual machine image for the compute nodes.
   * This is of the form
   * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}.
   * The virtual machine image must be in the same region and subscription as
   * the cluster. For information about the firewall settings for the Batch
   * node agent to communicate with the Batch service see
   * https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration.
   * Note, you need to provide publisher, offer and sku of the base OS image of
   * which the custom image has been derived from.
   * @member {object} [nodeSetup] Node setup. Setup to be performed on each
   * compute node in the cluster.
   * @member {object} [nodeSetup.setupTask] Setup task to run on cluster nodes
   * when nodes got created or rebooted. The setup task code needs to be
   * idempotent. Generally the setup task is used to download static data that
   * is required for all jobs that run on the cluster VMs and/or to
   * download/install software.
   * @member {string} [nodeSetup.setupTask.commandLine] The command line to be
   * executed on each cluster's node after it being allocated or rebooted. The
   * command is executed in a bash subshell as a root.
   * @member {array} [nodeSetup.setupTask.environmentVariables] A collection of
   * user defined environment variables to be set for setup task.
   * @member {array} [nodeSetup.setupTask.secrets] A collection of user defined
   * environment variables with secret values to be set for the setup task.
   * Server will never report values of these variables back.
   * @member {string} [nodeSetup.setupTask.stdOutErrPathPrefix] The prefix of a
   * path where the Batch AI service will upload the stdout, stderr and
   * execution log of the setup task.
   * @member {string} [nodeSetup.setupTask.stdOutErrPathSuffix] A path segment
   * appended by Batch AI to stdOutErrPathPrefix to form a path where stdout,
   * stderr and execution log of the setup task will be uploaded. Batch AI
   * creates the setup task output directories under an unique path to avoid
   * conflicts between different clusters. The full path can be obtained by
   * concatenation of stdOutErrPathPrefix and stdOutErrPathSuffix.
   * @member {object} [nodeSetup.mountVolumes] Mount volumes to be available to
   * setup task and all jobs executing on the cluster. The volumes will be
   * mounted at location specified by $AZ_BATCHAI_MOUNT_ROOT environment
   * variable.
   * @member {array} [nodeSetup.mountVolumes.azureFileShares] A collection of
   * Azure File Shares that are to be mounted to the cluster nodes.
   * @member {array} [nodeSetup.mountVolumes.azureBlobFileSystems] A collection
   * of Azure Blob Containers that are to be mounted to the cluster nodes.
   * @member {array} [nodeSetup.mountVolumes.fileServers] A collection of Batch
   * AI File Servers that are to be mounted to the cluster nodes.
   * @member {array} [nodeSetup.mountVolumes.unmanagedFileSystems] A collection
   * of unmanaged file systems that are to be mounted to the cluster nodes.
   * @member {object} [nodeSetup.performanceCountersSettings] Settings for
   * performance counters collecting and uploading.
   * @member {object}
   * [nodeSetup.performanceCountersSettings.appInsightsReference] Azure
   * Application Insights information for performance counters reporting. If
   * provided, Batch AI will upload node performance counters to the
   * corresponding Azure Application Insights account.
   * @member {object}
   * [nodeSetup.performanceCountersSettings.appInsightsReference.component]
   * Azure Application Insights component resource ID.
   * @member {string}
   * [nodeSetup.performanceCountersSettings.appInsightsReference.component.id]
   * The ID of the resource
   * @member {string}
   * [nodeSetup.performanceCountersSettings.appInsightsReference.instrumentationKey]
   * Value of the Azure Application Insights instrumentation key.
   * @member {object}
   * [nodeSetup.performanceCountersSettings.appInsightsReference.instrumentationKeySecretReference]
   * KeyVault Store and Secret which contains Azure Application Insights
   * instrumentation key. One of instrumentationKey or
   * instrumentationKeySecretReference must be specified.
   * @member {object}
   * [nodeSetup.performanceCountersSettings.appInsightsReference.instrumentationKeySecretReference.sourceVault]
   * Fully qualified resource indentifier of the Key Vault.
   * @member {string}
   * [nodeSetup.performanceCountersSettings.appInsightsReference.instrumentationKeySecretReference.sourceVault.id]
   * The ID of the resource
   * @member {string}
   * [nodeSetup.performanceCountersSettings.appInsightsReference.instrumentationKeySecretReference.secretUrl]
   * The URL referencing a secret in the Key Vault.
   * @member {object} userAccountSettings User account settings. Settings for
   * an administrator user account that will be created on each compute node in
   * the cluster.
   * @member {string} [userAccountSettings.adminUserName] Name of the
   * administrator user account which can be used to SSH to nodes.
   * @member {string} [userAccountSettings.adminUserSshPublicKey] SSH public
   * key of the administrator user account.
   * @member {string} [userAccountSettings.adminUserPassword] Password of the
   * administrator user account.
   * @member {object} [subnet] Subnet. Existing virtual network subnet to put
   * the cluster nodes in. Note, if a File Server mount configured in node
   * setup, the File Server's subnet will be used automatically.
   * @member {string} [subnet.id] The ID of the resource
   */
  constructor() {
  }

  /**
   * Defines the metadata of ClusterCreateParameters
   *
   * @returns {object} metadata of ClusterCreateParameters
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'ClusterCreateParameters',
      type: {
        name: 'Composite',
        className: 'ClusterCreateParameters',
        modelProperties: {
          vmSize: {
            required: true,
            serializedName: 'properties.vmSize',
            type: {
              name: 'String'
            }
          },
          vmPriority: {
            required: false,
            serializedName: 'properties.vmPriority',
            defaultValue: 'dedicated',
            type: {
              name: 'Enum',
              allowedValues: [ 'dedicated', 'lowpriority' ]
            }
          },
          scaleSettings: {
            required: false,
            serializedName: 'properties.scaleSettings',
            type: {
              name: 'Composite',
              className: 'ScaleSettings'
            }
          },
          virtualMachineConfiguration: {
            required: false,
            serializedName: 'properties.virtualMachineConfiguration',
            type: {
              name: 'Composite',
              className: 'VirtualMachineConfiguration'
            }
          },
          nodeSetup: {
            required: false,
            serializedName: 'properties.nodeSetup',
            type: {
              name: 'Composite',
              className: 'NodeSetup'
            }
          },
          userAccountSettings: {
            required: true,
            serializedName: 'properties.userAccountSettings',
            type: {
              name: 'Composite',
              className: 'UserAccountSettings'
            }
          },
          subnet: {
            required: false,
            serializedName: 'properties.subnet',
            type: {
              name: 'Composite',
              className: 'ResourceId'
            }
          }
        }
      }
    };
  }
}

module.exports = ClusterCreateParameters;
