/*
 * 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';

const models = require('./index');

/**
 * Information about a Cluster.
 *
 * @extends models['ProxyResource']
 */
class Cluster extends models['ProxyResource'] {
  /**
   * Create a Cluster.
   * @member {string} [vmSize] VM size. The size of the virtual machines in the
   * cluster. All nodes in a cluster have the same VM size.
   * @member {string} [vmPriority] VM priority. VM priority of cluster nodes.
   * Possible values include: 'dedicated', 'lowpriority'. Default value:
   * 'dedicated' .
   * @member {object} [scaleSettings] Scale settings. Scale settings of the
   * cluster.
   * @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. Virtual
   * machine configuration (OS image) of the compute nodes. All nodes in a
   * cluster have the same OS image configuration.
   * @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 (mount file systems,
   * performance counters settings and custom setup task) 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.
   * Administrator user account settings which can be used to SSH to compute
   * nodes.
   * @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. Virtual network subnet resource ID the
   * cluster nodes belong to.
   * @member {string} [subnet.id] The ID of the resource
   * @member {date} [creationTime] Creation time. The time when the cluster was
   * created.
   * @member {string} [provisioningState] Provisioning state. Provisioning
   * state of the cluster. Possible value are: creating - Specifies that the
   * cluster is being created. succeeded - Specifies that the cluster has been
   * created successfully. failed - Specifies that the cluster creation has
   * failed. deleting - Specifies that the cluster is being deleted. Possible
   * values include: 'creating', 'succeeded', 'failed', 'deleting'
   * @member {date} [provisioningStateTransitionTime] Provisioning State
   * Transition time. Time when the provisioning state was changed.
   * @member {string} [allocationState] Allocation state. Allocation state of
   * the cluster. Possible values are: steady - Indicates that the cluster is
   * not resizing. There are no changes to the number of compute nodes in the
   * cluster in progress. A cluster enters this state when it is created and
   * when no operations are being performed on the cluster to change the number
   * of compute nodes. resizing - Indicates that the cluster is resizing; that
   * is, compute nodes are being added to or removed from the cluster. Possible
   * values include: 'steady', 'resizing'
   * @member {date} [allocationStateTransitionTime] Allocation state transition
   * time. The time at which the cluster entered its current allocation state.
   * @member {array} [errors] Errors. Collection of errors encountered by
   * various compute nodes during node setup.
   * @member {number} [currentNodeCount] Current node count. The number of
   * compute nodes currently assigned to the cluster.
   * @member {object} [nodeStateCounts] Node state counts. Counts of various
   * node states on the cluster.
   * @member {number} [nodeStateCounts.idleNodeCount] Number of compute nodes
   * in idle state.
   * @member {number} [nodeStateCounts.runningNodeCount] Number of compute
   * nodes which are running jobs.
   * @member {number} [nodeStateCounts.preparingNodeCount] Number of compute
   * nodes which are being prepared.
   * @member {number} [nodeStateCounts.unusableNodeCount] Number of compute
   * nodes which are in unusable state.
   * @member {number} [nodeStateCounts.leavingNodeCount] Number of compute
   * nodes which are leaving the cluster.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of Cluster
   *
   * @returns {object} metadata of Cluster
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'Cluster',
      type: {
        name: 'Composite',
        className: 'Cluster',
        modelProperties: {
          id: {
            required: false,
            readOnly: true,
            serializedName: 'id',
            type: {
              name: 'String'
            }
          },
          name: {
            required: false,
            readOnly: true,
            serializedName: 'name',
            type: {
              name: 'String'
            }
          },
          type: {
            required: false,
            readOnly: true,
            serializedName: 'type',
            type: {
              name: 'String'
            }
          },
          vmSize: {
            required: false,
            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: false,
            serializedName: 'properties.userAccountSettings',
            type: {
              name: 'Composite',
              className: 'UserAccountSettings'
            }
          },
          subnet: {
            required: false,
            serializedName: 'properties.subnet',
            type: {
              name: 'Composite',
              className: 'ResourceId'
            }
          },
          creationTime: {
            required: false,
            readOnly: true,
            serializedName: 'properties.creationTime',
            type: {
              name: 'DateTime'
            }
          },
          provisioningState: {
            required: false,
            nullable: false,
            readOnly: true,
            serializedName: 'properties.provisioningState',
            type: {
              name: 'String'
            }
          },
          provisioningStateTransitionTime: {
            required: false,
            readOnly: true,
            serializedName: 'properties.provisioningStateTransitionTime',
            type: {
              name: 'DateTime'
            }
          },
          allocationState: {
            required: false,
            readOnly: true,
            serializedName: 'properties.allocationState',
            type: {
              name: 'String'
            }
          },
          allocationStateTransitionTime: {
            required: false,
            readOnly: true,
            serializedName: 'properties.allocationStateTransitionTime',
            type: {
              name: 'DateTime'
            }
          },
          errors: {
            required: false,
            readOnly: true,
            serializedName: 'properties.errors',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'BatchAIErrorElementType',
                  type: {
                    name: 'Composite',
                    className: 'BatchAIError'
                  }
              }
            }
          },
          currentNodeCount: {
            required: false,
            readOnly: true,
            serializedName: 'properties.currentNodeCount',
            type: {
              name: 'Number'
            }
          },
          nodeStateCounts: {
            required: false,
            readOnly: true,
            serializedName: 'properties.nodeStateCounts',
            type: {
              name: 'Composite',
              className: 'NodeStateCounts'
            }
          }
        }
      }
    };
  }
}

module.exports = Cluster;
