async function deploymentCreate()

in src/handler.ts [199:242]


async function deploymentCreate(config: DeploymentsConfig, files: ParsedFiles) {
  const name = config.name ?? defaultName;
  const scope = config.scope;
  const client = getDeploymentClient(config, scope);
  const deployment = getDeployment(config, files);

  switch (scope.type) {
    case "resourceGroup":
      return await client.deployments.beginCreateOrUpdateAndWait(
        scope.resourceGroup,
        name,
        deployment,
        getCreateOperationOptions(),
      );
    case "subscription":
      return await client.deployments.beginCreateOrUpdateAtSubscriptionScopeAndWait(
        name,
        {
          ...deployment,
          location: requireLocation(config),
        },
        getCreateOperationOptions(),
      );
    case "managementGroup":
      return await client.deployments.beginCreateOrUpdateAtManagementGroupScopeAndWait(
        scope.managementGroup,
        name,
        {
          ...deployment,
          location: requireLocation(config),
        },
        getCreateOperationOptions(),
      );
    case "tenant":
      return await client.deployments.beginCreateOrUpdateAtTenantScopeAndWait(
        name,
        {
          ...deployment,
          location: requireLocation(config),
        },
        getCreateOperationOptions(),
      );
  }
}