diff --git a/services/batch/2017-05-01.5.0/batch/CHANGELOG.md b/services/batch/2017-05-01.5.0/batch/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/batch/2017-05-01.5.0/batch/CHANGELOG.md +++ b/services/batch/2017-05-01.5.0/batch/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/batch/2017-05-01.5.0/batch/_meta.json b/services/batch/2017-05-01.5.0/batch/_meta.json index 6872bed7707d..214bf523c2f5 100644 --- a/services/batch/2017-05-01.5.0/batch/_meta.json +++ b/services/batch/2017-05-01.5.0/batch/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "18b54ea5e241eddd47527a166c38ed75958b3227", "readme": "/_/azure-rest-api-specs/specification/batch/data-plane/readme.md", "tag": "package-2017-05.5.0", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/batch/2018-03-01.6.1/batch/CHANGELOG.md b/services/batch/2018-03-01.6.1/batch/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/batch/2018-03-01.6.1/batch/CHANGELOG.md +++ b/services/batch/2018-03-01.6.1/batch/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/batch/2018-03-01.6.1/batch/_meta.json b/services/batch/2018-03-01.6.1/batch/_meta.json index 69803c37cfda..61394fa4e09c 100644 --- a/services/batch/2018-03-01.6.1/batch/_meta.json +++ b/services/batch/2018-03-01.6.1/batch/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "18b54ea5e241eddd47527a166c38ed75958b3227", "readme": "/_/azure-rest-api-specs/specification/batch/data-plane/readme.md", "tag": "package-2018-03.6.1", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/batch/2018-08-01.7.0/batch/CHANGELOG.md b/services/batch/2018-08-01.7.0/batch/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/batch/2018-08-01.7.0/batch/CHANGELOG.md +++ b/services/batch/2018-08-01.7.0/batch/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/batch/2018-08-01.7.0/batch/_meta.json b/services/batch/2018-08-01.7.0/batch/_meta.json index 65e062d3793d..906ce78c51eb 100644 --- a/services/batch/2018-08-01.7.0/batch/_meta.json +++ b/services/batch/2018-08-01.7.0/batch/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "18b54ea5e241eddd47527a166c38ed75958b3227", "readme": "/_/azure-rest-api-specs/specification/batch/data-plane/readme.md", "tag": "package-2018-08.7.0", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/batch/2018-12-01.8.0/batch/CHANGELOG.md b/services/batch/2018-12-01.8.0/batch/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/batch/2018-12-01.8.0/batch/CHANGELOG.md +++ b/services/batch/2018-12-01.8.0/batch/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/batch/2018-12-01.8.0/batch/_meta.json b/services/batch/2018-12-01.8.0/batch/_meta.json index 0a04579d748a..4b212c14d011 100644 --- a/services/batch/2018-12-01.8.0/batch/_meta.json +++ b/services/batch/2018-12-01.8.0/batch/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "18b54ea5e241eddd47527a166c38ed75958b3227", "readme": "/_/azure-rest-api-specs/specification/batch/data-plane/readme.md", "tag": "package-2018-12.8.0", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/batch/2019-06-01.9.0/batch/CHANGELOG.md b/services/batch/2019-06-01.9.0/batch/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/batch/2019-06-01.9.0/batch/CHANGELOG.md +++ b/services/batch/2019-06-01.9.0/batch/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/batch/2019-06-01.9.0/batch/_meta.json b/services/batch/2019-06-01.9.0/batch/_meta.json index 85db89f9f4b1..041ff1fab410 100644 --- a/services/batch/2019-06-01.9.0/batch/_meta.json +++ b/services/batch/2019-06-01.9.0/batch/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "18b54ea5e241eddd47527a166c38ed75958b3227", "readme": "/_/azure-rest-api-specs/specification/batch/data-plane/readme.md", "tag": "package-2019-06.9.0", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/batch/2019-08-01.10.0/batch/CHANGELOG.md b/services/batch/2019-08-01.10.0/batch/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/batch/2019-08-01.10.0/batch/CHANGELOG.md +++ b/services/batch/2019-08-01.10.0/batch/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/batch/2019-08-01.10.0/batch/_meta.json b/services/batch/2019-08-01.10.0/batch/_meta.json index 13646b35e8a5..4dcb43c606d3 100644 --- a/services/batch/2019-08-01.10.0/batch/_meta.json +++ b/services/batch/2019-08-01.10.0/batch/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "18b54ea5e241eddd47527a166c38ed75958b3227", "readme": "/_/azure-rest-api-specs/specification/batch/data-plane/readme.md", "tag": "package-2019-08.10.0", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/batch/2020-03-01.11.0/batch/CHANGELOG.md b/services/batch/2020-03-01.11.0/batch/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/batch/2020-03-01.11.0/batch/CHANGELOG.md +++ b/services/batch/2020-03-01.11.0/batch/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/batch/2020-03-01.11.0/batch/_meta.json b/services/batch/2020-03-01.11.0/batch/_meta.json index 9135b459c812..de065c9fe656 100644 --- a/services/batch/2020-03-01.11.0/batch/_meta.json +++ b/services/batch/2020-03-01.11.0/batch/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "18b54ea5e241eddd47527a166c38ed75958b3227", "readme": "/_/azure-rest-api-specs/specification/batch/data-plane/readme.md", "tag": "package-2020-03.11.0", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/batch/2020-09-01.12.0/batch/CHANGELOG.md b/services/batch/2020-09-01.12.0/batch/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/batch/2020-09-01.12.0/batch/CHANGELOG.md +++ b/services/batch/2020-09-01.12.0/batch/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/batch/2020-09-01.12.0/batch/_meta.json b/services/batch/2020-09-01.12.0/batch/_meta.json index 55b5d1dcaec1..686c6f3aea86 100644 --- a/services/batch/2020-09-01.12.0/batch/_meta.json +++ b/services/batch/2020-09-01.12.0/batch/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "18b54ea5e241eddd47527a166c38ed75958b3227", "readme": "/_/azure-rest-api-specs/specification/batch/data-plane/readme.md", "tag": "package-2020-09.12.0", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/batch/2020-09-01.12.0/batch/models.go b/services/batch/2020-09-01.12.0/batch/models.go index 81b2b0cc834d..1ca7bb07643a 100644 --- a/services/batch/2020-09-01.12.0/batch/models.go +++ b/services/batch/2020-09-01.12.0/batch/models.go @@ -2703,6 +2703,7 @@ type NodeReimageParameter struct { // NodeRemoveParameter ... type NodeRemoveParameter struct { + // NodeList - A maximum of 100 nodes may be removed per request. NodeList *[]string `json:"nodeList,omitempty"` // ResizeTimeout - The default value is 15 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). ResizeTimeout *string `json:"resizeTimeout,omitempty"` diff --git a/services/batch/2020-09-01.12.0/batch/pool.go b/services/batch/2020-09-01.12.0/batch/pool.go index 464baf2470ea..acdeb09963a6 100644 --- a/services/batch/2020-09-01.12.0/batch/pool.go +++ b/services/batch/2020-09-01.12.0/batch/pool.go @@ -1498,7 +1498,7 @@ func (client PoolClient) PatchResponder(resp *http.Response) (result autorest.Re } // RemoveNodes this operation can only run when the allocation state of the Pool is steady. When this operation runs, -// the allocation state changes from steady to resizing. +// the allocation state changes from steady to resizing. Each request may remove up to 100 nodes. // Parameters: // poolID - the ID of the Pool from which you want to remove Compute Nodes. // nodeRemoveParameter - the parameters for the request. diff --git a/services/batch/2021-06-01.14.0/batch/CHANGELOG.md b/services/batch/2021-06-01.14.0/batch/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/batch/2021-06-01.14.0/batch/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/batch/2021-06-01.14.0/batch/_meta.json b/services/batch/2021-06-01.14.0/batch/_meta.json new file mode 100644 index 000000000000..7fe09ca86b48 --- /dev/null +++ b/services/batch/2021-06-01.14.0/batch/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "18b54ea5e241eddd47527a166c38ed75958b3227", + "readme": "/_/azure-rest-api-specs/specification/batch/data-plane/readme.md", + "tag": "package-2021-06.14.0", + "use": "@microsoft.azure/autorest.go@2.1.183", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2021-06.14.0 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/batch/data-plane/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/batch/2021-06-01.14.0/batch/account.go b/services/batch/2021-06-01.14.0/batch/account.go new file mode 100644 index 000000000000..8793bfa09c9c --- /dev/null +++ b/services/batch/2021-06-01.14.0/batch/account.go @@ -0,0 +1,352 @@ +package batch + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "github.com/gofrs/uuid" + "net/http" +) + +// AccountClient is the a client for issuing REST requests to the Azure Batch service. +type AccountClient struct { + BaseClient +} + +// NewAccountClient creates an instance of the AccountClient client. +func NewAccountClient(batchURL string) AccountClient { + return AccountClient{New(batchURL)} +} + +// ListPoolNodeCounts gets the number of Compute Nodes in each state, grouped by Pool. Note that the numbers returned +// may not always be up to date. If you need exact node counts, use a list query. +// Parameters: +// filter - an OData $filter clause. For more information on constructing this filter, see +// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch. +// maxResults - the maximum number of items to return in the response. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client AccountClient) ListPoolNodeCounts(ctx context.Context, filter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result PoolNodeCountsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.ListPoolNodeCounts") + defer func() { + sc := -1 + if result.pnclr.Response.Response != nil { + sc = result.pnclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxResults, + Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMaximum, Rule: int64(10), Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("batch.AccountClient", "ListPoolNodeCounts", err.Error()) + } + + result.fn = client.listPoolNodeCountsNextResults + req, err := client.ListPoolNodeCountsPreparer(ctx, filter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListPoolNodeCounts", nil, "Failure preparing request") + return + } + + resp, err := client.ListPoolNodeCountsSender(req) + if err != nil { + result.pnclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListPoolNodeCounts", resp, "Failure sending request") + return + } + + result.pnclr, err = client.ListPoolNodeCountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListPoolNodeCounts", resp, "Failure responding to request") + return + } + if result.pnclr.hasNextLink() && result.pnclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPoolNodeCountsPreparer prepares the ListPoolNodeCounts request. +func (client AccountClient) ListPoolNodeCountsPreparer(ctx context.Context, filter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if maxResults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxResults) + } else { + queryParameters["maxresults"] = autorest.Encode("query", 10) + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPath("/nodecounts"), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListPoolNodeCountsSender sends the ListPoolNodeCounts request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) ListPoolNodeCountsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListPoolNodeCountsResponder handles the response to the ListPoolNodeCounts request. The method always +// closes the http.Response Body. +func (client AccountClient) ListPoolNodeCountsResponder(resp *http.Response) (result PoolNodeCountsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listPoolNodeCountsNextResults retrieves the next set of results, if any. +func (client AccountClient) listPoolNodeCountsNextResults(ctx context.Context, lastResults PoolNodeCountsListResult) (result PoolNodeCountsListResult, err error) { + req, err := lastResults.poolNodeCountsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listPoolNodeCountsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListPoolNodeCountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listPoolNodeCountsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListPoolNodeCountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "listPoolNodeCountsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListPoolNodeCountsComplete enumerates all values, automatically crossing page boundaries as required. +func (client AccountClient) ListPoolNodeCountsComplete(ctx context.Context, filter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result PoolNodeCountsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.ListPoolNodeCounts") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListPoolNodeCounts(ctx, filter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + return +} + +// ListSupportedImages sends the list supported images request. +// Parameters: +// filter - an OData $filter clause. For more information on constructing this filter, see +// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-support-images. +// maxResults - the maximum number of items to return in the response. A maximum of 1000 results will be +// returned. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client AccountClient) ListSupportedImages(ctx context.Context, filter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result AccountListSupportedImagesResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.ListSupportedImages") + defer func() { + sc := -1 + if result.alsir.Response.Response != nil { + sc = result.alsir.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxResults, + Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("batch.AccountClient", "ListSupportedImages", err.Error()) + } + + result.fn = client.listSupportedImagesNextResults + req, err := client.ListSupportedImagesPreparer(ctx, filter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListSupportedImages", nil, "Failure preparing request") + return + } + + resp, err := client.ListSupportedImagesSender(req) + if err != nil { + result.alsir.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListSupportedImages", resp, "Failure sending request") + return + } + + result.alsir, err = client.ListSupportedImagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListSupportedImages", resp, "Failure responding to request") + return + } + if result.alsir.hasNextLink() && result.alsir.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSupportedImagesPreparer prepares the ListSupportedImages request. +func (client AccountClient) ListSupportedImagesPreparer(ctx context.Context, filter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if maxResults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxResults) + } else { + queryParameters["maxresults"] = autorest.Encode("query", 1000) + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPath("/supportedimages"), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSupportedImagesSender sends the ListSupportedImages request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) ListSupportedImagesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListSupportedImagesResponder handles the response to the ListSupportedImages request. The method always +// closes the http.Response Body. +func (client AccountClient) ListSupportedImagesResponder(resp *http.Response) (result AccountListSupportedImagesResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSupportedImagesNextResults retrieves the next set of results, if any. +func (client AccountClient) listSupportedImagesNextResults(ctx context.Context, lastResults AccountListSupportedImagesResult) (result AccountListSupportedImagesResult, err error) { + req, err := lastResults.accountListSupportedImagesResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listSupportedImagesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSupportedImagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listSupportedImagesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSupportedImagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "listSupportedImagesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSupportedImagesComplete enumerates all values, automatically crossing page boundaries as required. +func (client AccountClient) ListSupportedImagesComplete(ctx context.Context, filter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result AccountListSupportedImagesResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.ListSupportedImages") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListSupportedImages(ctx, filter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + return +} diff --git a/services/batch/2021-06-01.14.0/batch/application.go b/services/batch/2021-06-01.14.0/batch/application.go new file mode 100644 index 000000000000..a88924c612a8 --- /dev/null +++ b/services/batch/2021-06-01.14.0/batch/application.go @@ -0,0 +1,293 @@ +package batch + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "github.com/gofrs/uuid" + "net/http" +) + +// ApplicationClient is the a client for issuing REST requests to the Azure Batch service. +type ApplicationClient struct { + BaseClient +} + +// NewApplicationClient creates an instance of the ApplicationClient client. +func NewApplicationClient(batchURL string) ApplicationClient { + return ApplicationClient{New(batchURL)} +} + +// Get this operation returns only Applications and versions that are available for use on Compute Nodes; that is, that +// can be used in an Package reference. For administrator information about Applications and versions that are not yet +// available to Compute Nodes, use the Azure portal or the Azure Resource Manager API. +// Parameters: +// applicationID - the ID of the Application. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client ApplicationClient) Get(ctx context.Context, applicationID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result ApplicationSummary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, applicationID, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ApplicationClient) GetPreparer(ctx context.Context, applicationID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "applicationId": autorest.Encode("path", applicationID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/applications/{applicationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ApplicationClient) GetResponder(resp *http.Response) (result ApplicationSummary, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List this operation returns only Applications and versions that are available for use on Compute Nodes; that is, +// that can be used in an Package reference. For administrator information about applications and versions that are not +// yet available to Compute Nodes, use the Azure portal or the Azure Resource Manager API. +// Parameters: +// maxResults - the maximum number of items to return in the response. A maximum of 1000 applications can be +// returned. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client ApplicationClient) List(ctx context.Context, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result ApplicationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.List") + defer func() { + sc := -1 + if result.alr.Response.Response != nil { + sc = result.alr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxResults, + Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("batch.ApplicationClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.alr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", resp, "Failure sending request") + return + } + + result.alr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", resp, "Failure responding to request") + return + } + if result.alr.hasNextLink() && result.alr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ApplicationClient) ListPreparer(ctx context.Context, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxResults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxResults) + } else { + queryParameters["maxresults"] = autorest.Encode("query", 1000) + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPath("/applications"), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ApplicationClient) ListResponder(resp *http.Response) (result ApplicationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ApplicationClient) listNextResults(ctx context.Context, lastResults ApplicationListResult) (result ApplicationListResult, err error) { + req, err := lastResults.applicationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ApplicationClient) ListComplete(ctx context.Context, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result ApplicationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + return +} diff --git a/services/batch/2021-06-01.14.0/batch/batchapi/interfaces.go b/services/batch/2021-06-01.14.0/batch/batchapi/interfaces.go new file mode 100644 index 000000000000..13a4b7ed1a7c --- /dev/null +++ b/services/batch/2021-06-01.14.0/batch/batchapi/interfaces.go @@ -0,0 +1,174 @@ +package batchapi + +// 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. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/batch/2021-06-01.14.0/batch" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/gofrs/uuid" +) + +// ApplicationClientAPI contains the set of methods on the ApplicationClient type. +type ApplicationClientAPI interface { + Get(ctx context.Context, applicationID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.ApplicationSummary, err error) + List(ctx context.Context, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.ApplicationListResultPage, err error) + ListComplete(ctx context.Context, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.ApplicationListResultIterator, err error) +} + +var _ ApplicationClientAPI = (*batch.ApplicationClient)(nil) + +// PoolClientAPI contains the set of methods on the PoolClient type. +type PoolClientAPI interface { + Add(ctx context.Context, pool batch.PoolAddParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) + Delete(ctx context.Context, poolID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) + DisableAutoScale(ctx context.Context, poolID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) + EnableAutoScale(ctx context.Context, poolID string, poolEnableAutoScaleParameter batch.PoolEnableAutoScaleParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) + EvaluateAutoScale(ctx context.Context, poolID string, poolEvaluateAutoScaleParameter batch.PoolEvaluateAutoScaleParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.AutoScaleRun, err error) + Exists(ctx context.Context, poolID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) + Get(ctx context.Context, poolID string, selectParameter string, expand string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result batch.CloudPool, err error) + GetAllLifetimeStatistics(ctx context.Context, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.PoolStatistics, err error) + List(ctx context.Context, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.CloudPoolListResultPage, err error) + ListComplete(ctx context.Context, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.CloudPoolListResultIterator, err error) + ListUsageMetrics(ctx context.Context, startTime *date.Time, endTime *date.Time, filter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.PoolListUsageMetricsResultPage, err error) + ListUsageMetricsComplete(ctx context.Context, startTime *date.Time, endTime *date.Time, filter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.PoolListUsageMetricsResultIterator, err error) + Patch(ctx context.Context, poolID string, poolPatchParameter batch.PoolPatchParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) + RemoveNodes(ctx context.Context, poolID string, nodeRemoveParameter batch.NodeRemoveParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) + Resize(ctx context.Context, poolID string, poolResizeParameter batch.PoolResizeParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) + StopResize(ctx context.Context, poolID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) + UpdateProperties(ctx context.Context, poolID string, poolUpdatePropertiesParameter batch.PoolUpdatePropertiesParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) +} + +var _ PoolClientAPI = (*batch.PoolClient)(nil) + +// AccountClientAPI contains the set of methods on the AccountClient type. +type AccountClientAPI interface { + ListPoolNodeCounts(ctx context.Context, filter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.PoolNodeCountsListResultPage, err error) + ListPoolNodeCountsComplete(ctx context.Context, filter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.PoolNodeCountsListResultIterator, err error) + ListSupportedImages(ctx context.Context, filter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.AccountListSupportedImagesResultPage, err error) + ListSupportedImagesComplete(ctx context.Context, filter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.AccountListSupportedImagesResultIterator, err error) +} + +var _ AccountClientAPI = (*batch.AccountClient)(nil) + +// JobClientAPI contains the set of methods on the JobClient type. +type JobClientAPI interface { + Add(ctx context.Context, job batch.JobAddParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) + Delete(ctx context.Context, jobID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) + Disable(ctx context.Context, jobID string, jobDisableParameter batch.JobDisableParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) + Enable(ctx context.Context, jobID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) + Get(ctx context.Context, jobID string, selectParameter string, expand string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result batch.CloudJob, err error) + GetAllLifetimeStatistics(ctx context.Context, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.JobStatistics, err error) + GetTaskCounts(ctx context.Context, jobID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.TaskCountsResult, err error) + List(ctx context.Context, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.CloudJobListResultPage, err error) + ListComplete(ctx context.Context, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.CloudJobListResultIterator, err error) + ListFromJobSchedule(ctx context.Context, jobScheduleID string, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.CloudJobListResultPage, err error) + ListFromJobScheduleComplete(ctx context.Context, jobScheduleID string, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.CloudJobListResultIterator, err error) + ListPreparationAndReleaseTaskStatus(ctx context.Context, jobID string, filter string, selectParameter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.CloudJobListPreparationAndReleaseTaskStatusResultPage, err error) + ListPreparationAndReleaseTaskStatusComplete(ctx context.Context, jobID string, filter string, selectParameter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.CloudJobListPreparationAndReleaseTaskStatusResultIterator, err error) + Patch(ctx context.Context, jobID string, jobPatchParameter batch.JobPatchParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) + Terminate(ctx context.Context, jobID string, jobTerminateParameter *batch.JobTerminateParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) + Update(ctx context.Context, jobID string, jobUpdateParameter batch.JobUpdateParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) +} + +var _ JobClientAPI = (*batch.JobClient)(nil) + +// CertificateClientAPI contains the set of methods on the CertificateClient type. +type CertificateClientAPI interface { + Add(ctx context.Context, certificate batch.CertificateAddParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) + CancelDeletion(ctx context.Context, thumbprintAlgorithm string, thumbprint string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) + Delete(ctx context.Context, thumbprintAlgorithm string, thumbprint string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) + Get(ctx context.Context, thumbprintAlgorithm string, thumbprint string, selectParameter string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.Certificate, err error) + List(ctx context.Context, filter string, selectParameter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.CertificateListResultPage, err error) + ListComplete(ctx context.Context, filter string, selectParameter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.CertificateListResultIterator, err error) +} + +var _ CertificateClientAPI = (*batch.CertificateClient)(nil) + +// FileClientAPI contains the set of methods on the FileClient type. +type FileClientAPI interface { + DeleteFromComputeNode(ctx context.Context, poolID string, nodeID string, filePath string, recursive *bool, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) + DeleteFromTask(ctx context.Context, jobID string, taskID string, filePath string, recursive *bool, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) + GetFromComputeNode(ctx context.Context, poolID string, nodeID string, filePath string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ocpRange string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result batch.ReadCloser, err error) + GetFromTask(ctx context.Context, jobID string, taskID string, filePath string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ocpRange string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result batch.ReadCloser, err error) + GetPropertiesFromComputeNode(ctx context.Context, poolID string, nodeID string, filePath string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) + GetPropertiesFromTask(ctx context.Context, jobID string, taskID string, filePath string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) + ListFromComputeNode(ctx context.Context, poolID string, nodeID string, filter string, recursive *bool, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.NodeFileListResultPage, err error) + ListFromComputeNodeComplete(ctx context.Context, poolID string, nodeID string, filter string, recursive *bool, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.NodeFileListResultIterator, err error) + ListFromTask(ctx context.Context, jobID string, taskID string, filter string, recursive *bool, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.NodeFileListResultPage, err error) + ListFromTaskComplete(ctx context.Context, jobID string, taskID string, filter string, recursive *bool, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.NodeFileListResultIterator, err error) +} + +var _ FileClientAPI = (*batch.FileClient)(nil) + +// JobScheduleClientAPI contains the set of methods on the JobScheduleClient type. +type JobScheduleClientAPI interface { + Add(ctx context.Context, cloudJobSchedule batch.JobScheduleAddParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) + Delete(ctx context.Context, jobScheduleID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) + Disable(ctx context.Context, jobScheduleID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) + Enable(ctx context.Context, jobScheduleID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) + Exists(ctx context.Context, jobScheduleID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) + Get(ctx context.Context, jobScheduleID string, selectParameter string, expand string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result batch.CloudJobSchedule, err error) + List(ctx context.Context, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.CloudJobScheduleListResultPage, err error) + ListComplete(ctx context.Context, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.CloudJobScheduleListResultIterator, err error) + Patch(ctx context.Context, jobScheduleID string, jobSchedulePatchParameter batch.JobSchedulePatchParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) + Terminate(ctx context.Context, jobScheduleID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) + Update(ctx context.Context, jobScheduleID string, jobScheduleUpdateParameter batch.JobScheduleUpdateParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) +} + +var _ JobScheduleClientAPI = (*batch.JobScheduleClient)(nil) + +// TaskClientAPI contains the set of methods on the TaskClient type. +type TaskClientAPI interface { + Add(ctx context.Context, jobID string, task batch.TaskAddParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) + AddCollection(ctx context.Context, jobID string, taskCollection batch.TaskAddCollectionParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.TaskAddCollectionResult, err error) + Delete(ctx context.Context, jobID string, taskID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) + Get(ctx context.Context, jobID string, taskID string, selectParameter string, expand string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result batch.CloudTask, err error) + List(ctx context.Context, jobID string, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.CloudTaskListResultPage, err error) + ListComplete(ctx context.Context, jobID string, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.CloudTaskListResultIterator, err error) + ListSubtasks(ctx context.Context, jobID string, taskID string, selectParameter string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.CloudTaskListSubtasksResult, err error) + Reactivate(ctx context.Context, jobID string, taskID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) + Terminate(ctx context.Context, jobID string, taskID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) + Update(ctx context.Context, jobID string, taskID string, taskUpdateParameter batch.TaskUpdateParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) +} + +var _ TaskClientAPI = (*batch.TaskClient)(nil) + +// ComputeNodeClientAPI contains the set of methods on the ComputeNodeClient type. +type ComputeNodeClientAPI interface { + AddUser(ctx context.Context, poolID string, nodeID string, userParameter batch.ComputeNodeUser, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) + DeleteUser(ctx context.Context, poolID string, nodeID string, userName string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) + DisableScheduling(ctx context.Context, poolID string, nodeID string, nodeDisableSchedulingParameter *batch.NodeDisableSchedulingParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) + EnableScheduling(ctx context.Context, poolID string, nodeID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) + Get(ctx context.Context, poolID string, nodeID string, selectParameter string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.ComputeNode, err error) + GetRemoteDesktop(ctx context.Context, poolID string, nodeID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.ReadCloser, err error) + GetRemoteLoginSettings(ctx context.Context, poolID string, nodeID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.ComputeNodeGetRemoteLoginSettingsResult, err error) + List(ctx context.Context, poolID string, filter string, selectParameter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.ComputeNodeListResultPage, err error) + ListComplete(ctx context.Context, poolID string, filter string, selectParameter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.ComputeNodeListResultIterator, err error) + Reboot(ctx context.Context, poolID string, nodeID string, nodeRebootParameter *batch.NodeRebootParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) + Reimage(ctx context.Context, poolID string, nodeID string, nodeReimageParameter *batch.NodeReimageParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) + UpdateUser(ctx context.Context, poolID string, nodeID string, userName string, nodeUpdateUserParameter batch.NodeUpdateUserParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) + UploadBatchServiceLogs(ctx context.Context, poolID string, nodeID string, uploadBatchServiceLogsConfiguration batch.UploadBatchServiceLogsConfiguration, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.UploadBatchServiceLogsResult, err error) +} + +var _ ComputeNodeClientAPI = (*batch.ComputeNodeClient)(nil) + +// ComputeNodeExtensionClientAPI contains the set of methods on the ComputeNodeExtensionClient type. +type ComputeNodeExtensionClientAPI interface { + Get(ctx context.Context, poolID string, nodeID string, extensionName string, selectParameter string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.NodeVMExtension, err error) +} + +var _ ComputeNodeExtensionClientAPI = (*batch.ComputeNodeExtensionClient)(nil) + +// ComputeNodeExtensionsClientAPI contains the set of methods on the ComputeNodeExtensionsClient type. +type ComputeNodeExtensionsClientAPI interface { + List(ctx context.Context, poolID string, nodeID string, selectParameter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.NodeVMExtensionListPage, err error) + ListComplete(ctx context.Context, poolID string, nodeID string, selectParameter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result batch.NodeVMExtensionListIterator, err error) +} + +var _ ComputeNodeExtensionsClientAPI = (*batch.ComputeNodeExtensionsClient)(nil) diff --git a/services/batch/2021-06-01.14.0/batch/certificate.go b/services/batch/2021-06-01.14.0/batch/certificate.go new file mode 100644 index 000000000000..202700657380 --- /dev/null +++ b/services/batch/2021-06-01.14.0/batch/certificate.go @@ -0,0 +1,633 @@ +package batch + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "github.com/gofrs/uuid" + "net/http" +) + +// CertificateClient is the a client for issuing REST requests to the Azure Batch service. +type CertificateClient struct { + BaseClient +} + +// NewCertificateClient creates an instance of the CertificateClient client. +func NewCertificateClient(batchURL string) CertificateClient { + return CertificateClient{New(batchURL)} +} + +// Add sends the add request. +// Parameters: +// certificate - the Certificate to be added. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client CertificateClient) Add(ctx context.Context, certificate CertificateAddParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.Add") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: certificate, + Constraints: []validation.Constraint{{Target: "certificate.Thumbprint", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "certificate.ThumbprintAlgorithm", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "certificate.Data", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.CertificateClient", "Add", err.Error()) + } + + req, err := client.AddPreparer(ctx, certificate, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Add", nil, "Failure preparing request") + return + } + + resp, err := client.AddSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Add", resp, "Failure sending request") + return + } + + result, err = client.AddResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Add", resp, "Failure responding to request") + return + } + + return +} + +// AddPreparer prepares the Add request. +func (client CertificateClient) AddPreparer(ctx context.Context, certificate CertificateAddParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPath("/certificates"), + autorest.WithJSON(certificate), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddSender sends the Add request. The method will close the +// http.Response Body if it receives an error. +func (client CertificateClient) AddSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// AddResponder handles the response to the Add request. The method always +// closes the http.Response Body. +func (client CertificateClient) AddResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByClosing()) + result.Response = resp + return +} + +// CancelDeletion if you try to delete a Certificate that is being used by a Pool or Compute Node, the status of the +// Certificate changes to deleteFailed. If you decide that you want to continue using the Certificate, you can use this +// operation to set the status of the Certificate back to active. If you intend to delete the Certificate, you do not +// need to run this operation after the deletion failed. You must make sure that the Certificate is not being used by +// any resources, and then you can try again to delete the Certificate. +// Parameters: +// thumbprintAlgorithm - the algorithm used to derive the thumbprint parameter. This must be sha1. +// thumbprint - the thumbprint of the Certificate being deleted. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client CertificateClient) CancelDeletion(ctx context.Context, thumbprintAlgorithm string, thumbprint string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.CancelDeletion") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CancelDeletionPreparer(ctx, thumbprintAlgorithm, thumbprint, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "CancelDeletion", nil, "Failure preparing request") + return + } + + resp, err := client.CancelDeletionSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "CancelDeletion", resp, "Failure sending request") + return + } + + result, err = client.CancelDeletionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "CancelDeletion", resp, "Failure responding to request") + return + } + + return +} + +// CancelDeletionPreparer prepares the CancelDeletion request. +func (client CertificateClient) CancelDeletionPreparer(ctx context.Context, thumbprintAlgorithm string, thumbprint string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "thumbprint": autorest.Encode("path", thumbprint), + "thumbprintAlgorithm": autorest.Encode("path", thumbprintAlgorithm), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/certificates(thumbprintAlgorithm={thumbprintAlgorithm},thumbprint={thumbprint})/canceldelete", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CancelDeletionSender sends the CancelDeletion request. The method will close the +// http.Response Body if it receives an error. +func (client CertificateClient) CancelDeletionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CancelDeletionResponder handles the response to the CancelDeletion request. The method always +// closes the http.Response Body. +func (client CertificateClient) CancelDeletionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete you cannot delete a Certificate if a resource (Pool or Compute Node) is using it. Before you can delete a +// Certificate, you must therefore make sure that the Certificate is not associated with any existing Pools, the +// Certificate is not installed on any Nodes (even if you remove a Certificate from a Pool, it is not removed from +// existing Compute Nodes in that Pool until they restart), and no running Tasks depend on the Certificate. If you try +// to delete a Certificate that is in use, the deletion fails. The Certificate status changes to deleteFailed. You can +// use Cancel Delete Certificate to set the status back to active if you decide that you want to continue using the +// Certificate. +// Parameters: +// thumbprintAlgorithm - the algorithm used to derive the thumbprint parameter. This must be sha1. +// thumbprint - the thumbprint of the Certificate to be deleted. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client CertificateClient) Delete(ctx context.Context, thumbprintAlgorithm string, thumbprint string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, thumbprintAlgorithm, thumbprint, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CertificateClient) DeletePreparer(ctx context.Context, thumbprintAlgorithm string, thumbprint string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "thumbprint": autorest.Encode("path", thumbprint), + "thumbprintAlgorithm": autorest.Encode("path", thumbprintAlgorithm), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/certificates(thumbprintAlgorithm={thumbprintAlgorithm},thumbprint={thumbprint})", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client CertificateClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client CertificateClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified Certificate. +// Parameters: +// thumbprintAlgorithm - the algorithm used to derive the thumbprint parameter. This must be sha1. +// thumbprint - the thumbprint of the Certificate to get. +// selectParameter - an OData $select clause. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client CertificateClient) Get(ctx context.Context, thumbprintAlgorithm string, thumbprint string, selectParameter string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result Certificate, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, thumbprintAlgorithm, thumbprint, selectParameter, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client CertificateClient) GetPreparer(ctx context.Context, thumbprintAlgorithm string, thumbprint string, selectParameter string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "thumbprint": autorest.Encode("path", thumbprint), + "thumbprintAlgorithm": autorest.Encode("path", thumbprintAlgorithm), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/certificates(thumbprintAlgorithm={thumbprintAlgorithm},thumbprint={thumbprint})", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CertificateClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client CertificateClient) GetResponder(resp *http.Response) (result Certificate, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// filter - an OData $filter clause. For more information on constructing this filter, see +// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-certificates. +// selectParameter - an OData $select clause. +// maxResults - the maximum number of items to return in the response. A maximum of 1000 Certificates can be +// returned. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client CertificateClient) List(ctx context.Context, filter string, selectParameter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result CertificateListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.List") + defer func() { + sc := -1 + if result.clr.Response.Response != nil { + sc = result.clr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxResults, + Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("batch.CertificateClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, filter, selectParameter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.clr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "List", resp, "Failure sending request") + return + } + + result.clr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "List", resp, "Failure responding to request") + return + } + if result.clr.hasNextLink() && result.clr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client CertificateClient) ListPreparer(ctx context.Context, filter string, selectParameter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if maxResults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxResults) + } else { + queryParameters["maxresults"] = autorest.Encode("query", 1000) + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPath("/certificates"), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client CertificateClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client CertificateClient) ListResponder(resp *http.Response) (result CertificateListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client CertificateClient) listNextResults(ctx context.Context, lastResults CertificateListResult) (result CertificateListResult, err error) { + req, err := lastResults.certificateListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.CertificateClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.CertificateClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client CertificateClient) ListComplete(ctx context.Context, filter string, selectParameter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result CertificateListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, filter, selectParameter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + return +} diff --git a/services/batch/2021-06-01.14.0/batch/client.go b/services/batch/2021-06-01.14.0/batch/client.go new file mode 100644 index 000000000000..a53bf69ec34f --- /dev/null +++ b/services/batch/2021-06-01.14.0/batch/client.go @@ -0,0 +1,33 @@ +// Package batch implements the Azure ARM Batch service API version 2021-06-01.14.0. +// +// A client for issuing REST requests to the Azure Batch service. +package batch + +// 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. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +// BaseClient is the base client for Batch. +type BaseClient struct { + autorest.Client + BatchURL string +} + +// New creates an instance of the BaseClient client. +func New(batchURL string) BaseClient { + return NewWithoutDefaults(batchURL) +} + +// NewWithoutDefaults creates an instance of the BaseClient client. +func NewWithoutDefaults(batchURL string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BatchURL: batchURL, + } +} diff --git a/services/batch/2021-06-01.14.0/batch/computenode.go b/services/batch/2021-06-01.14.0/batch/computenode.go new file mode 100644 index 000000000000..e400978876aa --- /dev/null +++ b/services/batch/2021-06-01.14.0/batch/computenode.go @@ -0,0 +1,1414 @@ +package batch + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "github.com/gofrs/uuid" + "net/http" +) + +// ComputeNodeClient is the a client for issuing REST requests to the Azure Batch service. +type ComputeNodeClient struct { + BaseClient +} + +// NewComputeNodeClient creates an instance of the ComputeNodeClient client. +func NewComputeNodeClient(batchURL string) ComputeNodeClient { + return ComputeNodeClient{New(batchURL)} +} + +// AddUser you can add a user Account to a Compute Node only when it is in the idle or running state. +// Parameters: +// poolID - the ID of the Pool that contains the Compute Node. +// nodeID - the ID of the machine on which you want to create a user Account. +// userParameter - the user Account to be created. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client ComputeNodeClient) AddUser(ctx context.Context, poolID string, nodeID string, userParameter ComputeNodeUser, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.AddUser") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: userParameter, + Constraints: []validation.Constraint{{Target: "userParameter.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.ComputeNodeClient", "AddUser", err.Error()) + } + + req, err := client.AddUserPreparer(ctx, poolID, nodeID, userParameter, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "AddUser", nil, "Failure preparing request") + return + } + + resp, err := client.AddUserSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "AddUser", resp, "Failure sending request") + return + } + + result, err = client.AddUserResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "AddUser", resp, "Failure responding to request") + return + } + + return +} + +// AddUserPreparer prepares the AddUser request. +func (client ComputeNodeClient) AddUserPreparer(ctx context.Context, poolID string, nodeID string, userParameter ComputeNodeUser, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/users", pathParameters), + autorest.WithJSON(userParameter), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddUserSender sends the AddUser request. The method will close the +// http.Response Body if it receives an error. +func (client ComputeNodeClient) AddUserSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// AddUserResponder handles the response to the AddUser request. The method always +// closes the http.Response Body. +func (client ComputeNodeClient) AddUserResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteUser you can delete a user Account to a Compute Node only when it is in the idle or running state. +// Parameters: +// poolID - the ID of the Pool that contains the Compute Node. +// nodeID - the ID of the machine on which you want to delete a user Account. +// userName - the name of the user Account to delete. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client ComputeNodeClient) DeleteUser(ctx context.Context, poolID string, nodeID string, userName string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.DeleteUser") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteUserPreparer(ctx, poolID, nodeID, userName, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "DeleteUser", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteUserSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "DeleteUser", resp, "Failure sending request") + return + } + + result, err = client.DeleteUserResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "DeleteUser", resp, "Failure responding to request") + return + } + + return +} + +// DeleteUserPreparer prepares the DeleteUser request. +func (client ComputeNodeClient) DeleteUserPreparer(ctx context.Context, poolID string, nodeID string, userName string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/users/{userName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteUserSender sends the DeleteUser request. The method will close the +// http.Response Body if it receives an error. +func (client ComputeNodeClient) DeleteUserSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteUserResponder handles the response to the DeleteUser request. The method always +// closes the http.Response Body. +func (client ComputeNodeClient) DeleteUserResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DisableScheduling you can disable Task scheduling on a Compute Node only if its current scheduling state is enabled. +// Parameters: +// poolID - the ID of the Pool that contains the Compute Node. +// nodeID - the ID of the Compute Node on which you want to disable Task scheduling. +// nodeDisableSchedulingParameter - the parameters for the request. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client ComputeNodeClient) DisableScheduling(ctx context.Context, poolID string, nodeID string, nodeDisableSchedulingParameter *NodeDisableSchedulingParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.DisableScheduling") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DisableSchedulingPreparer(ctx, poolID, nodeID, nodeDisableSchedulingParameter, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "DisableScheduling", nil, "Failure preparing request") + return + } + + resp, err := client.DisableSchedulingSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "DisableScheduling", resp, "Failure sending request") + return + } + + result, err = client.DisableSchedulingResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "DisableScheduling", resp, "Failure responding to request") + return + } + + return +} + +// DisableSchedulingPreparer prepares the DisableScheduling request. +func (client ComputeNodeClient) DisableSchedulingPreparer(ctx context.Context, poolID string, nodeID string, nodeDisableSchedulingParameter *NodeDisableSchedulingParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/disablescheduling", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if nodeDisableSchedulingParameter != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(nodeDisableSchedulingParameter)) + } + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DisableSchedulingSender sends the DisableScheduling request. The method will close the +// http.Response Body if it receives an error. +func (client ComputeNodeClient) DisableSchedulingSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DisableSchedulingResponder handles the response to the DisableScheduling request. The method always +// closes the http.Response Body. +func (client ComputeNodeClient) DisableSchedulingResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// EnableScheduling you can enable Task scheduling on a Compute Node only if its current scheduling state is disabled +// Parameters: +// poolID - the ID of the Pool that contains the Compute Node. +// nodeID - the ID of the Compute Node on which you want to enable Task scheduling. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client ComputeNodeClient) EnableScheduling(ctx context.Context, poolID string, nodeID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.EnableScheduling") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.EnableSchedulingPreparer(ctx, poolID, nodeID, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "EnableScheduling", nil, "Failure preparing request") + return + } + + resp, err := client.EnableSchedulingSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "EnableScheduling", resp, "Failure sending request") + return + } + + result, err = client.EnableSchedulingResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "EnableScheduling", resp, "Failure responding to request") + return + } + + return +} + +// EnableSchedulingPreparer prepares the EnableScheduling request. +func (client ComputeNodeClient) EnableSchedulingPreparer(ctx context.Context, poolID string, nodeID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/enablescheduling", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// EnableSchedulingSender sends the EnableScheduling request. The method will close the +// http.Response Body if it receives an error. +func (client ComputeNodeClient) EnableSchedulingSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// EnableSchedulingResponder handles the response to the EnableScheduling request. The method always +// closes the http.Response Body. +func (client ComputeNodeClient) EnableSchedulingResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// poolID - the ID of the Pool that contains the Compute Node. +// nodeID - the ID of the Compute Node that you want to get information about. +// selectParameter - an OData $select clause. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client ComputeNodeClient) Get(ctx context.Context, poolID string, nodeID string, selectParameter string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result ComputeNode, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, poolID, nodeID, selectParameter, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ComputeNodeClient) GetPreparer(ctx context.Context, poolID string, nodeID string, selectParameter string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ComputeNodeClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ComputeNodeClient) GetResponder(resp *http.Response) (result ComputeNode, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetRemoteDesktop before you can access a Compute Node by using the RDP file, you must create a user Account on the +// Compute Node. This API can only be invoked on Pools created with a cloud service configuration. For Pools created +// with a virtual machine configuration, see the GetRemoteLoginSettings API. +// Parameters: +// poolID - the ID of the Pool that contains the Compute Node. +// nodeID - the ID of the Compute Node for which you want to get the Remote Desktop Protocol file. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client ComputeNodeClient) GetRemoteDesktop(ctx context.Context, poolID string, nodeID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result ReadCloser, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.GetRemoteDesktop") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetRemoteDesktopPreparer(ctx, poolID, nodeID, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "GetRemoteDesktop", nil, "Failure preparing request") + return + } + + resp, err := client.GetRemoteDesktopSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "GetRemoteDesktop", resp, "Failure sending request") + return + } + + result, err = client.GetRemoteDesktopResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "GetRemoteDesktop", resp, "Failure responding to request") + return + } + + return +} + +// GetRemoteDesktopPreparer prepares the GetRemoteDesktop request. +func (client ComputeNodeClient) GetRemoteDesktopPreparer(ctx context.Context, poolID string, nodeID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/rdp", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetRemoteDesktopSender sends the GetRemoteDesktop request. The method will close the +// http.Response Body if it receives an error. +func (client ComputeNodeClient) GetRemoteDesktopSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetRemoteDesktopResponder handles the response to the GetRemoteDesktop request. The method always +// closes the http.Response Body. +func (client ComputeNodeClient) GetRemoteDesktopResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} + +// GetRemoteLoginSettings before you can remotely login to a Compute Node using the remote login settings, you must +// create a user Account on the Compute Node. This API can be invoked only on Pools created with the virtual machine +// configuration property. For Pools created with a cloud service configuration, see the GetRemoteDesktop API. +// Parameters: +// poolID - the ID of the Pool that contains the Compute Node. +// nodeID - the ID of the Compute Node for which to obtain the remote login settings. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client ComputeNodeClient) GetRemoteLoginSettings(ctx context.Context, poolID string, nodeID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result ComputeNodeGetRemoteLoginSettingsResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.GetRemoteLoginSettings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetRemoteLoginSettingsPreparer(ctx, poolID, nodeID, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "GetRemoteLoginSettings", nil, "Failure preparing request") + return + } + + resp, err := client.GetRemoteLoginSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "GetRemoteLoginSettings", resp, "Failure sending request") + return + } + + result, err = client.GetRemoteLoginSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "GetRemoteLoginSettings", resp, "Failure responding to request") + return + } + + return +} + +// GetRemoteLoginSettingsPreparer prepares the GetRemoteLoginSettings request. +func (client ComputeNodeClient) GetRemoteLoginSettingsPreparer(ctx context.Context, poolID string, nodeID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/remoteloginsettings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetRemoteLoginSettingsSender sends the GetRemoteLoginSettings request. The method will close the +// http.Response Body if it receives an error. +func (client ComputeNodeClient) GetRemoteLoginSettingsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetRemoteLoginSettingsResponder handles the response to the GetRemoteLoginSettings request. The method always +// closes the http.Response Body. +func (client ComputeNodeClient) GetRemoteLoginSettingsResponder(resp *http.Response) (result ComputeNodeGetRemoteLoginSettingsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// poolID - the ID of the Pool from which you want to list Compute Nodes. +// filter - an OData $filter clause. For more information on constructing this filter, see +// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-nodes-in-a-pool. +// selectParameter - an OData $select clause. +// maxResults - the maximum number of items to return in the response. A maximum of 1000 Compute Nodes can be +// returned. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client ComputeNodeClient) List(ctx context.Context, poolID string, filter string, selectParameter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result ComputeNodeListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.List") + defer func() { + sc := -1 + if result.cnlr.Response.Response != nil { + sc = result.cnlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxResults, + Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("batch.ComputeNodeClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, poolID, filter, selectParameter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.cnlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "List", resp, "Failure sending request") + return + } + + result.cnlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "List", resp, "Failure responding to request") + return + } + if result.cnlr.hasNextLink() && result.cnlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ComputeNodeClient) ListPreparer(ctx context.Context, poolID string, filter string, selectParameter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if maxResults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxResults) + } else { + queryParameters["maxresults"] = autorest.Encode("query", 1000) + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}/nodes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ComputeNodeClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ComputeNodeClient) ListResponder(resp *http.Response) (result ComputeNodeListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ComputeNodeClient) listNextResults(ctx context.Context, lastResults ComputeNodeListResult) (result ComputeNodeListResult, err error) { + req, err := lastResults.computeNodeListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ComputeNodeClient) ListComplete(ctx context.Context, poolID string, filter string, selectParameter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result ComputeNodeListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, poolID, filter, selectParameter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + return +} + +// Reboot you can restart a Compute Node only if it is in an idle or running state. +// Parameters: +// poolID - the ID of the Pool that contains the Compute Node. +// nodeID - the ID of the Compute Node that you want to restart. +// nodeRebootParameter - the parameters for the request. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client ComputeNodeClient) Reboot(ctx context.Context, poolID string, nodeID string, nodeRebootParameter *NodeRebootParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.Reboot") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RebootPreparer(ctx, poolID, nodeID, nodeRebootParameter, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Reboot", nil, "Failure preparing request") + return + } + + resp, err := client.RebootSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Reboot", resp, "Failure sending request") + return + } + + result, err = client.RebootResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Reboot", resp, "Failure responding to request") + return + } + + return +} + +// RebootPreparer prepares the Reboot request. +func (client ComputeNodeClient) RebootPreparer(ctx context.Context, poolID string, nodeID string, nodeRebootParameter *NodeRebootParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/reboot", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if nodeRebootParameter != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(nodeRebootParameter)) + } + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RebootSender sends the Reboot request. The method will close the +// http.Response Body if it receives an error. +func (client ComputeNodeClient) RebootSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// RebootResponder handles the response to the Reboot request. The method always +// closes the http.Response Body. +func (client ComputeNodeClient) RebootResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Reimage you can reinstall the operating system on a Compute Node only if it is in an idle or running state. This API +// can be invoked only on Pools created with the cloud service configuration property. +// Parameters: +// poolID - the ID of the Pool that contains the Compute Node. +// nodeID - the ID of the Compute Node that you want to restart. +// nodeReimageParameter - the parameters for the request. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client ComputeNodeClient) Reimage(ctx context.Context, poolID string, nodeID string, nodeReimageParameter *NodeReimageParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.Reimage") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ReimagePreparer(ctx, poolID, nodeID, nodeReimageParameter, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Reimage", nil, "Failure preparing request") + return + } + + resp, err := client.ReimageSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Reimage", resp, "Failure sending request") + return + } + + result, err = client.ReimageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "Reimage", resp, "Failure responding to request") + return + } + + return +} + +// ReimagePreparer prepares the Reimage request. +func (client ComputeNodeClient) ReimagePreparer(ctx context.Context, poolID string, nodeID string, nodeReimageParameter *NodeReimageParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/reimage", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if nodeReimageParameter != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(nodeReimageParameter)) + } + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ReimageSender sends the Reimage request. The method will close the +// http.Response Body if it receives an error. +func (client ComputeNodeClient) ReimageSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ReimageResponder handles the response to the Reimage request. The method always +// closes the http.Response Body. +func (client ComputeNodeClient) ReimageResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// UpdateUser this operation replaces of all the updatable properties of the Account. For example, if the expiryTime +// element is not specified, the current value is replaced with the default value, not left unmodified. You can update +// a user Account on a Compute Node only when it is in the idle or running state. +// Parameters: +// poolID - the ID of the Pool that contains the Compute Node. +// nodeID - the ID of the machine on which you want to update a user Account. +// userName - the name of the user Account to update. +// nodeUpdateUserParameter - the parameters for the request. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client ComputeNodeClient) UpdateUser(ctx context.Context, poolID string, nodeID string, userName string, nodeUpdateUserParameter NodeUpdateUserParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.UpdateUser") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateUserPreparer(ctx, poolID, nodeID, userName, nodeUpdateUserParameter, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "UpdateUser", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateUserSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "UpdateUser", resp, "Failure sending request") + return + } + + result, err = client.UpdateUserResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "UpdateUser", resp, "Failure responding to request") + return + } + + return +} + +// UpdateUserPreparer prepares the UpdateUser request. +func (client ComputeNodeClient) UpdateUserPreparer(ctx context.Context, poolID string, nodeID string, userName string, nodeUpdateUserParameter NodeUpdateUserParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/users/{userName}", pathParameters), + autorest.WithJSON(nodeUpdateUserParameter), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateUserSender sends the UpdateUser request. The method will close the +// http.Response Body if it receives an error. +func (client ComputeNodeClient) UpdateUserSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// UpdateUserResponder handles the response to the UpdateUser request. The method always +// closes the http.Response Body. +func (client ComputeNodeClient) UpdateUserResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// UploadBatchServiceLogs this is for gathering Azure Batch service log files in an automated fashion from Compute +// Nodes if you are experiencing an error and wish to escalate to Azure support. The Azure Batch service log files +// should be shared with Azure support to aid in debugging issues with the Batch service. +// Parameters: +// poolID - the ID of the Pool that contains the Compute Node. +// nodeID - the ID of the Compute Node from which you want to upload the Azure Batch service log files. +// uploadBatchServiceLogsConfiguration - the Azure Batch service log files upload configuration. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client ComputeNodeClient) UploadBatchServiceLogs(ctx context.Context, poolID string, nodeID string, uploadBatchServiceLogsConfiguration UploadBatchServiceLogsConfiguration, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result UploadBatchServiceLogsResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeClient.UploadBatchServiceLogs") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: uploadBatchServiceLogsConfiguration, + Constraints: []validation.Constraint{{Target: "uploadBatchServiceLogsConfiguration.ContainerURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "uploadBatchServiceLogsConfiguration.StartTime", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.ComputeNodeClient", "UploadBatchServiceLogs", err.Error()) + } + + req, err := client.UploadBatchServiceLogsPreparer(ctx, poolID, nodeID, uploadBatchServiceLogsConfiguration, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "UploadBatchServiceLogs", nil, "Failure preparing request") + return + } + + resp, err := client.UploadBatchServiceLogsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "UploadBatchServiceLogs", resp, "Failure sending request") + return + } + + result, err = client.UploadBatchServiceLogsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeClient", "UploadBatchServiceLogs", resp, "Failure responding to request") + return + } + + return +} + +// UploadBatchServiceLogsPreparer prepares the UploadBatchServiceLogs request. +func (client ComputeNodeClient) UploadBatchServiceLogsPreparer(ctx context.Context, poolID string, nodeID string, uploadBatchServiceLogsConfiguration UploadBatchServiceLogsConfiguration, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/uploadbatchservicelogs", pathParameters), + autorest.WithJSON(uploadBatchServiceLogsConfiguration), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UploadBatchServiceLogsSender sends the UploadBatchServiceLogs request. The method will close the +// http.Response Body if it receives an error. +func (client ComputeNodeClient) UploadBatchServiceLogsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// UploadBatchServiceLogsResponder handles the response to the UploadBatchServiceLogs request. The method always +// closes the http.Response Body. +func (client ComputeNodeClient) UploadBatchServiceLogsResponder(resp *http.Response) (result UploadBatchServiceLogsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/batch/2021-06-01.14.0/batch/computenodeextension.go b/services/batch/2021-06-01.14.0/batch/computenodeextension.go new file mode 100644 index 000000000000..cbb25eac2faa --- /dev/null +++ b/services/batch/2021-06-01.14.0/batch/computenodeextension.go @@ -0,0 +1,139 @@ +package batch + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/tracing" + "github.com/gofrs/uuid" + "net/http" +) + +// ComputeNodeExtensionClient is the a client for issuing REST requests to the Azure Batch service. +type ComputeNodeExtensionClient struct { + BaseClient +} + +// NewComputeNodeExtensionClient creates an instance of the ComputeNodeExtensionClient client. +func NewComputeNodeExtensionClient(batchURL string) ComputeNodeExtensionClient { + return ComputeNodeExtensionClient{New(batchURL)} +} + +// Get sends the get request. +// Parameters: +// poolID - the ID of the Pool that contains the Compute Node. +// nodeID - the ID of the Compute Node that contains the extensions. +// extensionName - the name of the of the Compute Node Extension that you want to get information about. +// selectParameter - an OData $select clause. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client ComputeNodeExtensionClient) Get(ctx context.Context, poolID string, nodeID string, extensionName string, selectParameter string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result NodeVMExtension, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeExtensionClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, poolID, nodeID, extensionName, selectParameter, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeExtensionClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ComputeNodeExtensionClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeExtensionClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ComputeNodeExtensionClient) GetPreparer(ctx context.Context, poolID string, nodeID string, extensionName string, selectParameter string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "extensionName": autorest.Encode("path", extensionName), + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/extensions/{extensionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ComputeNodeExtensionClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ComputeNodeExtensionClient) GetResponder(resp *http.Response) (result NodeVMExtension, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/batch/2021-06-01.14.0/batch/computenodeextensions.go b/services/batch/2021-06-01.14.0/batch/computenodeextensions.go new file mode 100644 index 000000000000..e89b18a9b9ac --- /dev/null +++ b/services/batch/2021-06-01.14.0/batch/computenodeextensions.go @@ -0,0 +1,196 @@ +package batch + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "github.com/gofrs/uuid" + "net/http" +) + +// ComputeNodeExtensionsClient is the a client for issuing REST requests to the Azure Batch service. +type ComputeNodeExtensionsClient struct { + BaseClient +} + +// NewComputeNodeExtensionsClient creates an instance of the ComputeNodeExtensionsClient client. +func NewComputeNodeExtensionsClient(batchURL string) ComputeNodeExtensionsClient { + return ComputeNodeExtensionsClient{New(batchURL)} +} + +// List sends the list request. +// Parameters: +// poolID - the ID of the Pool that contains Compute Node. +// nodeID - the ID of the Compute Node that you want to list extensions. +// selectParameter - an OData $select clause. +// maxResults - the maximum number of items to return in the response. A maximum of 1000 Compute Nodes can be +// returned. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client ComputeNodeExtensionsClient) List(ctx context.Context, poolID string, nodeID string, selectParameter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result NodeVMExtensionListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeExtensionsClient.List") + defer func() { + sc := -1 + if result.nvel.Response.Response != nil { + sc = result.nvel.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxResults, + Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("batch.ComputeNodeExtensionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, poolID, nodeID, selectParameter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeExtensionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.nvel.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ComputeNodeExtensionsClient", "List", resp, "Failure sending request") + return + } + + result.nvel, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeExtensionsClient", "List", resp, "Failure responding to request") + return + } + if result.nvel.hasNextLink() && result.nvel.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ComputeNodeExtensionsClient) ListPreparer(ctx context.Context, poolID string, nodeID string, selectParameter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if maxResults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxResults) + } else { + queryParameters["maxresults"] = autorest.Encode("query", 1000) + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/extensions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ComputeNodeExtensionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ComputeNodeExtensionsClient) ListResponder(resp *http.Response) (result NodeVMExtensionList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ComputeNodeExtensionsClient) listNextResults(ctx context.Context, lastResults NodeVMExtensionList) (result NodeVMExtensionList, err error) { + req, err := lastResults.nodeVMExtensionListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.ComputeNodeExtensionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.ComputeNodeExtensionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ComputeNodeExtensionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ComputeNodeExtensionsClient) ListComplete(ctx context.Context, poolID string, nodeID string, selectParameter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result NodeVMExtensionListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeExtensionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, poolID, nodeID, selectParameter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + return +} diff --git a/services/batch/2021-06-01.14.0/batch/enums.go b/services/batch/2021-06-01.14.0/batch/enums.go new file mode 100644 index 000000000000..92c87696c343 --- /dev/null +++ b/services/batch/2021-06-01.14.0/batch/enums.go @@ -0,0 +1,912 @@ +package batch + +// 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. + +// AccessScope enumerates the values for access scope. +type AccessScope string + +const ( + // Job Grants access to perform all operations on the Job containing the Task. + Job AccessScope = "job" +) + +// PossibleAccessScopeValues returns an array of possible values for the AccessScope const type. +func PossibleAccessScopeValues() []AccessScope { + return []AccessScope{Job} +} + +// AllocationState enumerates the values for allocation state. +type AllocationState string + +const ( + // Resizing The Pool is resizing; that is, Compute Nodes are being added to or removed from the Pool. + Resizing AllocationState = "resizing" + // Steady The Pool is not resizing. There are no changes to the number of Compute Nodes in the Pool in + // progress. A Pool enters this state when it is created and when no operations are being performed on the + // Pool to change the number of Compute Nodes. + Steady AllocationState = "steady" + // Stopping The Pool was resizing, but the user has requested that the resize be stopped, but the stop + // request has not yet been completed. + Stopping AllocationState = "stopping" +) + +// PossibleAllocationStateValues returns an array of possible values for the AllocationState const type. +func PossibleAllocationStateValues() []AllocationState { + return []AllocationState{Resizing, Steady, Stopping} +} + +// AutoUserScope enumerates the values for auto user scope. +type AutoUserScope string + +const ( + // Pool Specifies that the Task runs as the common auto user Account which is created on every Compute Node + // in a Pool. + Pool AutoUserScope = "pool" + // Task Specifies that the service should create a new user for the Task. + Task AutoUserScope = "task" +) + +// PossibleAutoUserScopeValues returns an array of possible values for the AutoUserScope const type. +func PossibleAutoUserScopeValues() []AutoUserScope { + return []AutoUserScope{Pool, Task} +} + +// CachingType enumerates the values for caching type. +type CachingType string + +const ( + // None The caching mode for the disk is not enabled. + None CachingType = "none" + // ReadOnly The caching mode for the disk is read only. + ReadOnly CachingType = "readonly" + // ReadWrite The caching mode for the disk is read and write. + ReadWrite CachingType = "readwrite" +) + +// PossibleCachingTypeValues returns an array of possible values for the CachingType const type. +func PossibleCachingTypeValues() []CachingType { + return []CachingType{None, ReadOnly, ReadWrite} +} + +// CertificateFormat enumerates the values for certificate format. +type CertificateFormat string + +const ( + // Cer The Certificate is a base64-encoded X.509 Certificate. + Cer CertificateFormat = "cer" + // Pfx The Certificate is a PFX (PKCS#12) formatted Certificate or Certificate chain. + Pfx CertificateFormat = "pfx" +) + +// PossibleCertificateFormatValues returns an array of possible values for the CertificateFormat const type. +func PossibleCertificateFormatValues() []CertificateFormat { + return []CertificateFormat{Cer, Pfx} +} + +// CertificateState enumerates the values for certificate state. +type CertificateState string + +const ( + // Active The Certificate is available for use in Pools. + Active CertificateState = "active" + // DeleteFailed The user requested that the Certificate be deleted, but there are Pools that still have + // references to the Certificate, or it is still installed on one or more Nodes. (The latter can occur if + // the Certificate has been removed from the Pool, but the Compute Node has not yet restarted. Compute + // Nodes refresh their Certificates only when they restart.) You may use the cancel Certificate delete + // operation to cancel the delete, or the delete Certificate operation to retry the delete. + DeleteFailed CertificateState = "deletefailed" + // Deleting The user has requested that the Certificate be deleted, but the delete operation has not yet + // completed. You may not reference the Certificate when creating or updating Pools. + Deleting CertificateState = "deleting" +) + +// PossibleCertificateStateValues returns an array of possible values for the CertificateState const type. +func PossibleCertificateStateValues() []CertificateState { + return []CertificateState{Active, DeleteFailed, Deleting} +} + +// CertificateStoreLocation enumerates the values for certificate store location. +type CertificateStoreLocation string + +const ( + // CurrentUser Certificates should be installed to the CurrentUser Certificate store. + CurrentUser CertificateStoreLocation = "currentuser" + // LocalMachine Certificates should be installed to the LocalMachine Certificate store. + LocalMachine CertificateStoreLocation = "localmachine" +) + +// PossibleCertificateStoreLocationValues returns an array of possible values for the CertificateStoreLocation const type. +func PossibleCertificateStoreLocationValues() []CertificateStoreLocation { + return []CertificateStoreLocation{CurrentUser, LocalMachine} +} + +// CertificateVisibility enumerates the values for certificate visibility. +type CertificateVisibility string + +const ( + // CertificateVisibilityRemoteUser The Certificate should be visible to the user accounts under which users + // remotely access the Compute Node. + CertificateVisibilityRemoteUser CertificateVisibility = "remoteuser" + // CertificateVisibilityStartTask The Certificate should be visible to the user account under which the + // StartTask is run. Note that if AutoUser Scope is Pool for both the StartTask and a Task, this + // certificate will be visible to the Task as well. + CertificateVisibilityStartTask CertificateVisibility = "starttask" + // CertificateVisibilityTask The Certificate should be visible to the user accounts under which Job Tasks + // are run. + CertificateVisibilityTask CertificateVisibility = "task" +) + +// PossibleCertificateVisibilityValues returns an array of possible values for the CertificateVisibility const type. +func PossibleCertificateVisibilityValues() []CertificateVisibility { + return []CertificateVisibility{CertificateVisibilityRemoteUser, CertificateVisibilityStartTask, CertificateVisibilityTask} +} + +// ComputeNodeDeallocationOption enumerates the values for compute node deallocation option. +type ComputeNodeDeallocationOption string + +const ( + // Requeue Terminate running Task processes and requeue the Tasks. The Tasks will run again when a Compute + // Node is available. Remove Compute Nodes as soon as Tasks have been terminated. + Requeue ComputeNodeDeallocationOption = "requeue" + // RetainedData Allow currently running Tasks to complete, then wait for all Task data retention periods to + // expire. Schedule no new Tasks while waiting. Remove Compute Nodes when all Task retention periods have + // expired. + RetainedData ComputeNodeDeallocationOption = "retaineddata" + // TaskCompletion Allow currently running Tasks to complete. Schedule no new Tasks while waiting. Remove + // Compute Nodes when all Tasks have completed. + TaskCompletion ComputeNodeDeallocationOption = "taskcompletion" + // Terminate Terminate running Tasks. The Tasks will be completed with failureInfo indicating that they + // were terminated, and will not run again. Remove Compute Nodes as soon as Tasks have been terminated. + Terminate ComputeNodeDeallocationOption = "terminate" +) + +// PossibleComputeNodeDeallocationOptionValues returns an array of possible values for the ComputeNodeDeallocationOption const type. +func PossibleComputeNodeDeallocationOptionValues() []ComputeNodeDeallocationOption { + return []ComputeNodeDeallocationOption{Requeue, RetainedData, TaskCompletion, Terminate} +} + +// ComputeNodeFillType enumerates the values for compute node fill type. +type ComputeNodeFillType string + +const ( + // Pack As many Tasks as possible (taskSlotsPerNode) should be assigned to each Compute Node in the Pool + // before any Tasks are assigned to the next Compute Node in the Pool. + Pack ComputeNodeFillType = "pack" + // Spread Tasks should be assigned evenly across all Compute Nodes in the Pool. + Spread ComputeNodeFillType = "spread" +) + +// PossibleComputeNodeFillTypeValues returns an array of possible values for the ComputeNodeFillType const type. +func PossibleComputeNodeFillTypeValues() []ComputeNodeFillType { + return []ComputeNodeFillType{Pack, Spread} +} + +// ComputeNodeRebootOption enumerates the values for compute node reboot option. +type ComputeNodeRebootOption string + +const ( + // ComputeNodeRebootOptionRequeue Terminate running Task processes and requeue the Tasks. The Tasks will + // run again when a Compute Node is available. Restart the Compute Node as soon as Tasks have been + // terminated. + ComputeNodeRebootOptionRequeue ComputeNodeRebootOption = "requeue" + // ComputeNodeRebootOptionRetainedData Allow currently running Tasks to complete, then wait for all Task + // data retention periods to expire. Schedule no new Tasks while waiting. Restart the Compute Node when all + // Task retention periods have expired. + ComputeNodeRebootOptionRetainedData ComputeNodeRebootOption = "retaineddata" + // ComputeNodeRebootOptionTaskCompletion Allow currently running Tasks to complete. Schedule no new Tasks + // while waiting. Restart the Compute Node when all Tasks have completed. + ComputeNodeRebootOptionTaskCompletion ComputeNodeRebootOption = "taskcompletion" + // ComputeNodeRebootOptionTerminate Terminate running Tasks. The Tasks will be completed with failureInfo + // indicating that they were terminated, and will not run again. Restart the Compute Node as soon as Tasks + // have been terminated. + ComputeNodeRebootOptionTerminate ComputeNodeRebootOption = "terminate" +) + +// PossibleComputeNodeRebootOptionValues returns an array of possible values for the ComputeNodeRebootOption const type. +func PossibleComputeNodeRebootOptionValues() []ComputeNodeRebootOption { + return []ComputeNodeRebootOption{ComputeNodeRebootOptionRequeue, ComputeNodeRebootOptionRetainedData, ComputeNodeRebootOptionTaskCompletion, ComputeNodeRebootOptionTerminate} +} + +// ComputeNodeReimageOption enumerates the values for compute node reimage option. +type ComputeNodeReimageOption string + +const ( + // ComputeNodeReimageOptionRequeue Terminate running Task processes and requeue the Tasks. The Tasks will + // run again when a Compute Node is available. Reimage the Compute Node as soon as Tasks have been + // terminated. + ComputeNodeReimageOptionRequeue ComputeNodeReimageOption = "requeue" + // ComputeNodeReimageOptionRetainedData Allow currently running Tasks to complete, then wait for all Task + // data retention periods to expire. Schedule no new Tasks while waiting. Reimage the Compute Node when all + // Task retention periods have expired. + ComputeNodeReimageOptionRetainedData ComputeNodeReimageOption = "retaineddata" + // ComputeNodeReimageOptionTaskCompletion Allow currently running Tasks to complete. Schedule no new Tasks + // while waiting. Reimage the Compute Node when all Tasks have completed. + ComputeNodeReimageOptionTaskCompletion ComputeNodeReimageOption = "taskcompletion" + // ComputeNodeReimageOptionTerminate Terminate running Tasks. The Tasks will be completed with failureInfo + // indicating that they were terminated, and will not run again. Reimage the Compute Node as soon as Tasks + // have been terminated. + ComputeNodeReimageOptionTerminate ComputeNodeReimageOption = "terminate" +) + +// PossibleComputeNodeReimageOptionValues returns an array of possible values for the ComputeNodeReimageOption const type. +func PossibleComputeNodeReimageOptionValues() []ComputeNodeReimageOption { + return []ComputeNodeReimageOption{ComputeNodeReimageOptionRequeue, ComputeNodeReimageOptionRetainedData, ComputeNodeReimageOptionTaskCompletion, ComputeNodeReimageOptionTerminate} +} + +// ComputeNodeState enumerates the values for compute node state. +type ComputeNodeState string + +const ( + // Creating The Batch service has obtained the underlying virtual machine from Azure Compute, but it has + // not yet started to join the Pool. + Creating ComputeNodeState = "creating" + // Idle The Compute Node is not currently running a Task. + Idle ComputeNodeState = "idle" + // LeavingPool The Compute Node is leaving the Pool, either because the user explicitly removed it or + // because the Pool is resizing or autoscaling down. + LeavingPool ComputeNodeState = "leavingpool" + // Offline The Compute Node is not currently running a Task, and scheduling of new Tasks to the Compute + // Node is disabled. + Offline ComputeNodeState = "offline" + // Preempted The low-priority Compute Node has been preempted. Tasks which were running on the Compute Node + // when it was preempted will be rescheduled when another Compute Node becomes available. + Preempted ComputeNodeState = "preempted" + // Rebooting The Compute Node is rebooting. + Rebooting ComputeNodeState = "rebooting" + // Reimaging The Compute Node is reimaging. + Reimaging ComputeNodeState = "reimaging" + // Running The Compute Node is running one or more Tasks (other than a StartTask). + Running ComputeNodeState = "running" + // Starting The Batch service is starting on the underlying virtual machine. + Starting ComputeNodeState = "starting" + // StartTaskFailed The StartTask has failed on the Compute Node (and exhausted all retries), and + // waitForSuccess is set. The Compute Node is not usable for running Tasks. + StartTaskFailed ComputeNodeState = "starttaskfailed" + // Unknown The Batch service has lost contact with the Compute Node, and does not know its true state. + Unknown ComputeNodeState = "unknown" + // Unusable The Compute Node cannot be used for Task execution due to errors. + Unusable ComputeNodeState = "unusable" + // WaitingForStartTask The StartTask has started running on the Compute Node, but waitForSuccess is set and + // the StartTask has not yet completed. + WaitingForStartTask ComputeNodeState = "waitingforstarttask" +) + +// PossibleComputeNodeStateValues returns an array of possible values for the ComputeNodeState const type. +func PossibleComputeNodeStateValues() []ComputeNodeState { + return []ComputeNodeState{Creating, Idle, LeavingPool, Offline, Preempted, Rebooting, Reimaging, Running, Starting, StartTaskFailed, Unknown, Unusable, WaitingForStartTask} +} + +// ContainerWorkingDirectory enumerates the values for container working directory. +type ContainerWorkingDirectory string + +const ( + // ContainerImageDefault Use the working directory defined in the container Image. Beware that this + // directory will not contain the Resource Files downloaded by Batch. + ContainerImageDefault ContainerWorkingDirectory = "containerImageDefault" + // TaskWorkingDirectory Use the standard Batch service Task working directory, which will contain the Task + // Resource Files populated by Batch. + TaskWorkingDirectory ContainerWorkingDirectory = "taskWorkingDirectory" +) + +// PossibleContainerWorkingDirectoryValues returns an array of possible values for the ContainerWorkingDirectory const type. +func PossibleContainerWorkingDirectoryValues() []ContainerWorkingDirectory { + return []ContainerWorkingDirectory{ContainerImageDefault, TaskWorkingDirectory} +} + +// DependencyAction enumerates the values for dependency action. +type DependencyAction string + +const ( + // Block Blocks tasks waiting on this task, preventing them from being scheduled. + Block DependencyAction = "block" + // Satisfy Satisfy tasks waiting on this task; once all dependencies are satisfied, the task will be + // scheduled to run. + Satisfy DependencyAction = "satisfy" +) + +// PossibleDependencyActionValues returns an array of possible values for the DependencyAction const type. +func PossibleDependencyActionValues() []DependencyAction { + return []DependencyAction{Block, Satisfy} +} + +// DiffDiskPlacement enumerates the values for diff disk placement. +type DiffDiskPlacement string + +const ( + // CacheDisk The Ephemeral OS Disk is stored on the VM cache. + CacheDisk DiffDiskPlacement = "CacheDisk" +) + +// PossibleDiffDiskPlacementValues returns an array of possible values for the DiffDiskPlacement const type. +func PossibleDiffDiskPlacementValues() []DiffDiskPlacement { + return []DiffDiskPlacement{CacheDisk} +} + +// DisableComputeNodeSchedulingOption enumerates the values for disable compute node scheduling option. +type DisableComputeNodeSchedulingOption string + +const ( + // DisableComputeNodeSchedulingOptionRequeue Terminate running Task processes and requeue the Tasks. The + // Tasks may run again on other Compute Nodes, or when Task scheduling is re-enabled on this Compute Node. + // Enter offline state as soon as Tasks have been terminated. + DisableComputeNodeSchedulingOptionRequeue DisableComputeNodeSchedulingOption = "requeue" + // DisableComputeNodeSchedulingOptionTaskCompletion Allow currently running Tasks to complete. Schedule no + // new Tasks while waiting. Enter offline state when all Tasks have completed. + DisableComputeNodeSchedulingOptionTaskCompletion DisableComputeNodeSchedulingOption = "taskcompletion" + // DisableComputeNodeSchedulingOptionTerminate Terminate running Tasks. The Tasks will be completed with + // failureInfo indicating that they were terminated, and will not run again. Enter offline state as soon as + // Tasks have been terminated. + DisableComputeNodeSchedulingOptionTerminate DisableComputeNodeSchedulingOption = "terminate" +) + +// PossibleDisableComputeNodeSchedulingOptionValues returns an array of possible values for the DisableComputeNodeSchedulingOption const type. +func PossibleDisableComputeNodeSchedulingOptionValues() []DisableComputeNodeSchedulingOption { + return []DisableComputeNodeSchedulingOption{DisableComputeNodeSchedulingOptionRequeue, DisableComputeNodeSchedulingOptionTaskCompletion, DisableComputeNodeSchedulingOptionTerminate} +} + +// DisableJobOption enumerates the values for disable job option. +type DisableJobOption string + +const ( + // DisableJobOptionRequeue Terminate running Tasks and requeue them. The Tasks will run again when the Job + // is enabled. + DisableJobOptionRequeue DisableJobOption = "requeue" + // DisableJobOptionTerminate Terminate running Tasks. The Tasks will be completed with failureInfo + // indicating that they were terminated, and will not run again. + DisableJobOptionTerminate DisableJobOption = "terminate" + // DisableJobOptionWait Allow currently running Tasks to complete. + DisableJobOptionWait DisableJobOption = "wait" +) + +// PossibleDisableJobOptionValues returns an array of possible values for the DisableJobOption const type. +func PossibleDisableJobOptionValues() []DisableJobOption { + return []DisableJobOption{DisableJobOptionRequeue, DisableJobOptionTerminate, DisableJobOptionWait} +} + +// DiskEncryptionTarget enumerates the values for disk encryption target. +type DiskEncryptionTarget string + +const ( + // OsDisk The OS Disk on the compute node is encrypted. + OsDisk DiskEncryptionTarget = "osdisk" + // TemporaryDisk The temporary disk on the compute node is encrypted. On Linux this encryption applies to + // other partitions (such as those on mounted data disks) when encryption occurs at boot time. + TemporaryDisk DiskEncryptionTarget = "temporarydisk" +) + +// PossibleDiskEncryptionTargetValues returns an array of possible values for the DiskEncryptionTarget const type. +func PossibleDiskEncryptionTargetValues() []DiskEncryptionTarget { + return []DiskEncryptionTarget{OsDisk, TemporaryDisk} +} + +// DynamicVNetAssignmentScope enumerates the values for dynamic v net assignment scope. +type DynamicVNetAssignmentScope string + +const ( + // DynamicVNetAssignmentScopeJob Dynamic VNet assignment is done per-job. + DynamicVNetAssignmentScopeJob DynamicVNetAssignmentScope = "job" + // DynamicVNetAssignmentScopeNone No dynamic VNet assignment is enabled. + DynamicVNetAssignmentScopeNone DynamicVNetAssignmentScope = "none" +) + +// PossibleDynamicVNetAssignmentScopeValues returns an array of possible values for the DynamicVNetAssignmentScope const type. +func PossibleDynamicVNetAssignmentScopeValues() []DynamicVNetAssignmentScope { + return []DynamicVNetAssignmentScope{DynamicVNetAssignmentScopeJob, DynamicVNetAssignmentScopeNone} +} + +// ElevationLevel enumerates the values for elevation level. +type ElevationLevel string + +const ( + // Admin The user is a user with elevated access and operates with full Administrator permissions. + Admin ElevationLevel = "admin" + // NonAdmin The user is a standard user without elevated access. + NonAdmin ElevationLevel = "nonadmin" +) + +// PossibleElevationLevelValues returns an array of possible values for the ElevationLevel const type. +func PossibleElevationLevelValues() []ElevationLevel { + return []ElevationLevel{Admin, NonAdmin} +} + +// ErrorCategory enumerates the values for error category. +type ErrorCategory string + +const ( + // ServerError The error is due to an internal server issue. + ServerError ErrorCategory = "servererror" + // UserError The error is due to a user issue, such as misconfiguration. + UserError ErrorCategory = "usererror" +) + +// PossibleErrorCategoryValues returns an array of possible values for the ErrorCategory const type. +func PossibleErrorCategoryValues() []ErrorCategory { + return []ErrorCategory{ServerError, UserError} +} + +// InboundEndpointProtocol enumerates the values for inbound endpoint protocol. +type InboundEndpointProtocol string + +const ( + // TCP Use TCP for the endpoint. + TCP InboundEndpointProtocol = "tcp" + // UDP Use UDP for the endpoint. + UDP InboundEndpointProtocol = "udp" +) + +// PossibleInboundEndpointProtocolValues returns an array of possible values for the InboundEndpointProtocol const type. +func PossibleInboundEndpointProtocolValues() []InboundEndpointProtocol { + return []InboundEndpointProtocol{TCP, UDP} +} + +// IPAddressProvisioningType enumerates the values for ip address provisioning type. +type IPAddressProvisioningType string + +const ( + // BatchManaged A public IP will be created and managed by Batch. There may be multiple public IPs + // depending on the size of the Pool. + BatchManaged IPAddressProvisioningType = "batchmanaged" + // NoPublicIPAddresses No public IP Address will be created. + NoPublicIPAddresses IPAddressProvisioningType = "nopublicipaddresses" + // UserManaged Public IPs are provided by the user and will be used to provision the Compute Nodes. + UserManaged IPAddressProvisioningType = "usermanaged" +) + +// PossibleIPAddressProvisioningTypeValues returns an array of possible values for the IPAddressProvisioningType const type. +func PossibleIPAddressProvisioningTypeValues() []IPAddressProvisioningType { + return []IPAddressProvisioningType{BatchManaged, NoPublicIPAddresses, UserManaged} +} + +// JobAction enumerates the values for job action. +type JobAction string + +const ( + // JobActionDisable Disable the Job. This is equivalent to calling the disable Job API, with a disableTasks + // value of requeue. + JobActionDisable JobAction = "disable" + // JobActionNone Take no action. + JobActionNone JobAction = "none" + // JobActionTerminate Terminate the Job. The terminateReason in the Job's executionInfo is set to + // "TaskFailed". + JobActionTerminate JobAction = "terminate" +) + +// PossibleJobActionValues returns an array of possible values for the JobAction const type. +func PossibleJobActionValues() []JobAction { + return []JobAction{JobActionDisable, JobActionNone, JobActionTerminate} +} + +// JobPreparationTaskState enumerates the values for job preparation task state. +type JobPreparationTaskState string + +const ( + // JobPreparationTaskStateCompleted The Task has exited with exit code 0, or the Task has exhausted its + // retry limit, or the Batch service was unable to start the Task due to Task preparation errors (such as + // resource file download failures). + JobPreparationTaskStateCompleted JobPreparationTaskState = "completed" + // JobPreparationTaskStateRunning The Task is currently running (including retrying). + JobPreparationTaskStateRunning JobPreparationTaskState = "running" +) + +// PossibleJobPreparationTaskStateValues returns an array of possible values for the JobPreparationTaskState const type. +func PossibleJobPreparationTaskStateValues() []JobPreparationTaskState { + return []JobPreparationTaskState{JobPreparationTaskStateCompleted, JobPreparationTaskStateRunning} +} + +// JobReleaseTaskState enumerates the values for job release task state. +type JobReleaseTaskState string + +const ( + // JobReleaseTaskStateCompleted The Task has exited with exit code 0, or the Task has exhausted its retry + // limit, or the Batch service was unable to start the Task due to Task preparation errors (such as + // resource file download failures). + JobReleaseTaskStateCompleted JobReleaseTaskState = "completed" + // JobReleaseTaskStateRunning The Task is currently running (including retrying). + JobReleaseTaskStateRunning JobReleaseTaskState = "running" +) + +// PossibleJobReleaseTaskStateValues returns an array of possible values for the JobReleaseTaskState const type. +func PossibleJobReleaseTaskStateValues() []JobReleaseTaskState { + return []JobReleaseTaskState{JobReleaseTaskStateCompleted, JobReleaseTaskStateRunning} +} + +// JobScheduleState enumerates the values for job schedule state. +type JobScheduleState string + +const ( + // JobScheduleStateActive The Job Schedule is active and will create Jobs as per its schedule. + JobScheduleStateActive JobScheduleState = "active" + // JobScheduleStateCompleted The Job Schedule has terminated, either by reaching its end time or by the + // user terminating it explicitly. + JobScheduleStateCompleted JobScheduleState = "completed" + // JobScheduleStateDeleting The user has requested that the Job Schedule be deleted, but the delete + // operation is still in progress. The scheduler will not initiate any new Jobs for this Job Schedule, and + // will delete any existing Jobs and Tasks under the Job Schedule, including any active Job. The Job + // Schedule will be deleted when all Jobs and Tasks under the Job Schedule have been deleted. + JobScheduleStateDeleting JobScheduleState = "deleting" + // JobScheduleStateDisabled The user has disabled the Job Schedule. The scheduler will not initiate any new + // Jobs will on this schedule, but any existing active Job will continue to run. + JobScheduleStateDisabled JobScheduleState = "disabled" + // JobScheduleStateTerminating The Job Schedule has no more work to do, or has been explicitly terminated + // by the user, but the termination operation is still in progress. The scheduler will not initiate any new + // Jobs for this Job Schedule, nor is any existing Job active. + JobScheduleStateTerminating JobScheduleState = "terminating" +) + +// PossibleJobScheduleStateValues returns an array of possible values for the JobScheduleState const type. +func PossibleJobScheduleStateValues() []JobScheduleState { + return []JobScheduleState{JobScheduleStateActive, JobScheduleStateCompleted, JobScheduleStateDeleting, JobScheduleStateDisabled, JobScheduleStateTerminating} +} + +// JobState enumerates the values for job state. +type JobState string + +const ( + // JobStateActive The Job is available to have Tasks scheduled. + JobStateActive JobState = "active" + // JobStateCompleted All Tasks have terminated, and the system will not accept any more Tasks or any + // further changes to the Job. + JobStateCompleted JobState = "completed" + // JobStateDeleting A user has requested that the Job be deleted, but the delete operation is still in + // progress (for example, because the system is still terminating running Tasks). + JobStateDeleting JobState = "deleting" + // JobStateDisabled A user has disabled the Job. No Tasks are running, and no new Tasks will be scheduled. + JobStateDisabled JobState = "disabled" + // JobStateDisabling A user has requested that the Job be disabled, but the disable operation is still in + // progress (for example, waiting for Tasks to terminate). + JobStateDisabling JobState = "disabling" + // JobStateEnabling A user has requested that the Job be enabled, but the enable operation is still in + // progress. + JobStateEnabling JobState = "enabling" + // JobStateTerminating The Job is about to complete, either because a Job Manager Task has completed or + // because the user has terminated the Job, but the terminate operation is still in progress (for example, + // because Job Release Tasks are running). + JobStateTerminating JobState = "terminating" +) + +// PossibleJobStateValues returns an array of possible values for the JobState const type. +func PossibleJobStateValues() []JobState { + return []JobState{JobStateActive, JobStateCompleted, JobStateDeleting, JobStateDisabled, JobStateDisabling, JobStateEnabling, JobStateTerminating} +} + +// LoginMode enumerates the values for login mode. +type LoginMode string + +const ( + // Batch The LOGON32_LOGON_BATCH Win32 login mode. The batch login mode is recommended for long running + // parallel processes. + Batch LoginMode = "batch" + // Interactive The LOGON32_LOGON_INTERACTIVE Win32 login mode. UAC is enabled on Windows + // VirtualMachineConfiguration Pools. If this option is used with an elevated user identity in a Windows + // VirtualMachineConfiguration Pool, the user session will not be elevated unless the application executed + // by the Task command line is configured to always require administrative privilege or to always require + // maximum privilege. + Interactive LoginMode = "interactive" +) + +// PossibleLoginModeValues returns an array of possible values for the LoginMode const type. +func PossibleLoginModeValues() []LoginMode { + return []LoginMode{Batch, Interactive} +} + +// NetworkSecurityGroupRuleAccess enumerates the values for network security group rule access. +type NetworkSecurityGroupRuleAccess string + +const ( + // Allow Allow access. + Allow NetworkSecurityGroupRuleAccess = "allow" + // Deny Deny access. + Deny NetworkSecurityGroupRuleAccess = "deny" +) + +// PossibleNetworkSecurityGroupRuleAccessValues returns an array of possible values for the NetworkSecurityGroupRuleAccess const type. +func PossibleNetworkSecurityGroupRuleAccessValues() []NetworkSecurityGroupRuleAccess { + return []NetworkSecurityGroupRuleAccess{Allow, Deny} +} + +// NodePlacementPolicyType enumerates the values for node placement policy type. +type NodePlacementPolicyType string + +const ( + // Regional All nodes in the pool will be allocated in the same region. + Regional NodePlacementPolicyType = "regional" + // Zonal Nodes in the pool will be spread across different availability zones with best effort balancing. + Zonal NodePlacementPolicyType = "zonal" +) + +// PossibleNodePlacementPolicyTypeValues returns an array of possible values for the NodePlacementPolicyType const type. +func PossibleNodePlacementPolicyTypeValues() []NodePlacementPolicyType { + return []NodePlacementPolicyType{Regional, Zonal} +} + +// OnAllTasksComplete enumerates the values for on all tasks complete. +type OnAllTasksComplete string + +const ( + // NoAction Do nothing. The Job remains active unless terminated or disabled by some other means. + NoAction OnAllTasksComplete = "noaction" + // TerminateJob Terminate the Job. The Job's terminateReason is set to 'AllTasksComplete'. + TerminateJob OnAllTasksComplete = "terminatejob" +) + +// PossibleOnAllTasksCompleteValues returns an array of possible values for the OnAllTasksComplete const type. +func PossibleOnAllTasksCompleteValues() []OnAllTasksComplete { + return []OnAllTasksComplete{NoAction, TerminateJob} +} + +// OnTaskFailure enumerates the values for on task failure. +type OnTaskFailure string + +const ( + // OnTaskFailureNoAction Do nothing. The Job remains active unless terminated or disabled by some other + // means. + OnTaskFailureNoAction OnTaskFailure = "noaction" + // OnTaskFailurePerformExitOptionsJobAction Take the action associated with the Task exit condition in the + // Task's exitConditions collection. (This may still result in no action being taken, if that is what the + // Task specifies.) + OnTaskFailurePerformExitOptionsJobAction OnTaskFailure = "performexitoptionsjobaction" +) + +// PossibleOnTaskFailureValues returns an array of possible values for the OnTaskFailure const type. +func PossibleOnTaskFailureValues() []OnTaskFailure { + return []OnTaskFailure{OnTaskFailureNoAction, OnTaskFailurePerformExitOptionsJobAction} +} + +// OSType enumerates the values for os type. +type OSType string + +const ( + // Linux The Linux operating system. + Linux OSType = "linux" + // Windows The Windows operating system. + Windows OSType = "windows" +) + +// PossibleOSTypeValues returns an array of possible values for the OSType const type. +func PossibleOSTypeValues() []OSType { + return []OSType{Linux, Windows} +} + +// OutputFileUploadCondition enumerates the values for output file upload condition. +type OutputFileUploadCondition string + +const ( + // OutputFileUploadConditionTaskCompletion Upload the file(s) after the Task process exits, no matter what + // the exit code was. + OutputFileUploadConditionTaskCompletion OutputFileUploadCondition = "taskcompletion" + // OutputFileUploadConditionTaskFailure Upload the file(s) only after the Task process exits with a nonzero + // exit code. + OutputFileUploadConditionTaskFailure OutputFileUploadCondition = "taskfailure" + // OutputFileUploadConditionTaskSuccess Upload the file(s) only after the Task process exits with an exit + // code of 0. + OutputFileUploadConditionTaskSuccess OutputFileUploadCondition = "tasksuccess" +) + +// PossibleOutputFileUploadConditionValues returns an array of possible values for the OutputFileUploadCondition const type. +func PossibleOutputFileUploadConditionValues() []OutputFileUploadCondition { + return []OutputFileUploadCondition{OutputFileUploadConditionTaskCompletion, OutputFileUploadConditionTaskFailure, OutputFileUploadConditionTaskSuccess} +} + +// PoolIdentityType enumerates the values for pool identity type. +type PoolIdentityType string + +const ( + // PoolIdentityTypeNone Batch pool has no identity associated with it. Setting `None` in update pool will + // remove existing identities. + PoolIdentityTypeNone PoolIdentityType = "None" + // PoolIdentityTypeUserAssigned Batch pool has user assigned identities with it. + PoolIdentityTypeUserAssigned PoolIdentityType = "UserAssigned" +) + +// PossiblePoolIdentityTypeValues returns an array of possible values for the PoolIdentityType const type. +func PossiblePoolIdentityTypeValues() []PoolIdentityType { + return []PoolIdentityType{PoolIdentityTypeNone, PoolIdentityTypeUserAssigned} +} + +// PoolLifetimeOption enumerates the values for pool lifetime option. +type PoolLifetimeOption string + +const ( + // PoolLifetimeOptionJob The Pool exists for the lifetime of the Job to which it is dedicated. The Batch + // service creates the Pool when it creates the Job. If the 'job' option is applied to a Job Schedule, the + // Batch service creates a new auto Pool for every Job created on the schedule. + PoolLifetimeOptionJob PoolLifetimeOption = "job" + // PoolLifetimeOptionJobSchedule The Pool exists for the lifetime of the Job Schedule. The Batch Service + // creates the Pool when it creates the first Job on the schedule. You may apply this option only to Job + // Schedules, not to Jobs. + PoolLifetimeOptionJobSchedule PoolLifetimeOption = "jobschedule" +) + +// PossiblePoolLifetimeOptionValues returns an array of possible values for the PoolLifetimeOption const type. +func PossiblePoolLifetimeOptionValues() []PoolLifetimeOption { + return []PoolLifetimeOption{PoolLifetimeOptionJob, PoolLifetimeOptionJobSchedule} +} + +// PoolState enumerates the values for pool state. +type PoolState string + +const ( + // PoolStateActive The Pool is available to run Tasks subject to the availability of Compute Nodes. + PoolStateActive PoolState = "active" + // PoolStateDeleting The user has requested that the Pool be deleted, but the delete operation has not yet + // completed. + PoolStateDeleting PoolState = "deleting" +) + +// PossiblePoolStateValues returns an array of possible values for the PoolState const type. +func PossiblePoolStateValues() []PoolState { + return []PoolState{PoolStateActive, PoolStateDeleting} +} + +// SchedulingState enumerates the values for scheduling state. +type SchedulingState string + +const ( + // Disabled No new Tasks will be scheduled on the Compute Node. Tasks already running on the Compute Node + // may still run to completion. All Compute Nodes start with scheduling enabled. + Disabled SchedulingState = "disabled" + // Enabled Tasks can be scheduled on the Compute Node. + Enabled SchedulingState = "enabled" +) + +// PossibleSchedulingStateValues returns an array of possible values for the SchedulingState const type. +func PossibleSchedulingStateValues() []SchedulingState { + return []SchedulingState{Disabled, Enabled} +} + +// StartTaskState enumerates the values for start task state. +type StartTaskState string + +const ( + // StartTaskStateCompleted The StartTask has exited with exit code 0, or the StartTask has failed and the + // retry limit has reached, or the StartTask process did not run due to Task preparation errors (such as + // resource file download failures). + StartTaskStateCompleted StartTaskState = "completed" + // StartTaskStateRunning The StartTask is currently running. + StartTaskStateRunning StartTaskState = "running" +) + +// PossibleStartTaskStateValues returns an array of possible values for the StartTaskState const type. +func PossibleStartTaskStateValues() []StartTaskState { + return []StartTaskState{StartTaskStateCompleted, StartTaskStateRunning} +} + +// StatusLevelTypes enumerates the values for status level types. +type StatusLevelTypes string + +const ( + // StatusLevelTypesError ... + StatusLevelTypesError StatusLevelTypes = "Error" + // StatusLevelTypesInfo ... + StatusLevelTypesInfo StatusLevelTypes = "Info" + // StatusLevelTypesWarning ... + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +// PossibleStatusLevelTypesValues returns an array of possible values for the StatusLevelTypes const type. +func PossibleStatusLevelTypesValues() []StatusLevelTypes { + return []StatusLevelTypes{StatusLevelTypesError, StatusLevelTypesInfo, StatusLevelTypesWarning} +} + +// StorageAccountType enumerates the values for storage account type. +type StorageAccountType string + +const ( + // PremiumLRS The data disk should use premium locally redundant storage. + PremiumLRS StorageAccountType = "premium_lrs" + // StandardLRS The data disk should use standard locally redundant storage. + StandardLRS StorageAccountType = "standard_lrs" +) + +// PossibleStorageAccountTypeValues returns an array of possible values for the StorageAccountType const type. +func PossibleStorageAccountTypeValues() []StorageAccountType { + return []StorageAccountType{PremiumLRS, StandardLRS} +} + +// SubtaskState enumerates the values for subtask state. +type SubtaskState string + +const ( + // SubtaskStateCompleted The Task is no longer eligible to run, usually because the Task has finished + // successfully, or the Task has finished unsuccessfully and has exhausted its retry limit. A Task is also + // marked as completed if an error occurred launching the Task, or when the Task has been terminated. + SubtaskStateCompleted SubtaskState = "completed" + // SubtaskStatePreparing The Task has been assigned to a Compute Node, but is waiting for a required Job + // Preparation Task to complete on the Compute Node. If the Job Preparation Task succeeds, the Task will + // move to running. If the Job Preparation Task fails, the Task will return to active and will be eligible + // to be assigned to a different Compute Node. + SubtaskStatePreparing SubtaskState = "preparing" + // SubtaskStateRunning The Task is running on a Compute Node. This includes task-level preparation such as + // downloading resource files or deploying Packages specified on the Task - it does not necessarily mean + // that the Task command line has started executing. + SubtaskStateRunning SubtaskState = "running" +) + +// PossibleSubtaskStateValues returns an array of possible values for the SubtaskState const type. +func PossibleSubtaskStateValues() []SubtaskState { + return []SubtaskState{SubtaskStateCompleted, SubtaskStatePreparing, SubtaskStateRunning} +} + +// TaskAddStatus enumerates the values for task add status. +type TaskAddStatus string + +const ( + // TaskAddStatusClientError The Task failed to add due to a client error and should not be retried without + // modifying the request as appropriate. + TaskAddStatusClientError TaskAddStatus = "clienterror" + // TaskAddStatusServerError Task failed to add due to a server error and can be retried without + // modification. + TaskAddStatusServerError TaskAddStatus = "servererror" + // TaskAddStatusSuccess The Task was added successfully. + TaskAddStatusSuccess TaskAddStatus = "success" +) + +// PossibleTaskAddStatusValues returns an array of possible values for the TaskAddStatus const type. +func PossibleTaskAddStatusValues() []TaskAddStatus { + return []TaskAddStatus{TaskAddStatusClientError, TaskAddStatusServerError, TaskAddStatusSuccess} +} + +// TaskExecutionResult enumerates the values for task execution result. +type TaskExecutionResult string + +const ( + // Failure There was an error during processing of the Task. The failure may have occurred before the Task + // process was launched, while the Task process was executing, or after the Task process exited. + Failure TaskExecutionResult = "failure" + // Success The Task ran successfully. + Success TaskExecutionResult = "success" +) + +// PossibleTaskExecutionResultValues returns an array of possible values for the TaskExecutionResult const type. +func PossibleTaskExecutionResultValues() []TaskExecutionResult { + return []TaskExecutionResult{Failure, Success} +} + +// TaskState enumerates the values for task state. +type TaskState string + +const ( + // TaskStateActive The Task is queued and able to run, but is not currently assigned to a Compute Node. A + // Task enters this state when it is created, when it is enabled after being disabled, or when it is + // awaiting a retry after a failed run. + TaskStateActive TaskState = "active" + // TaskStateCompleted The Task is no longer eligible to run, usually because the Task has finished + // successfully, or the Task has finished unsuccessfully and has exhausted its retry limit. A Task is also + // marked as completed if an error occurred launching the Task, or when the Task has been terminated. + TaskStateCompleted TaskState = "completed" + // TaskStatePreparing The Task has been assigned to a Compute Node, but is waiting for a required Job + // Preparation Task to complete on the Compute Node. If the Job Preparation Task succeeds, the Task will + // move to running. If the Job Preparation Task fails, the Task will return to active and will be eligible + // to be assigned to a different Compute Node. + TaskStatePreparing TaskState = "preparing" + // TaskStateRunning The Task is running on a Compute Node. This includes task-level preparation such as + // downloading resource files or deploying Packages specified on the Task - it does not necessarily mean + // that the Task command line has started executing. + TaskStateRunning TaskState = "running" +) + +// PossibleTaskStateValues returns an array of possible values for the TaskState const type. +func PossibleTaskStateValues() []TaskState { + return []TaskState{TaskStateActive, TaskStateCompleted, TaskStatePreparing, TaskStateRunning} +} + +// VerificationType enumerates the values for verification type. +type VerificationType string + +const ( + // Unverified The associated Compute Node agent SKU should have binary compatibility with the Image, but + // specific functionality has not been verified. + Unverified VerificationType = "unverified" + // Verified The Image is guaranteed to be compatible with the associated Compute Node agent SKU and all + // Batch features have been confirmed to work as expected. + Verified VerificationType = "verified" +) + +// PossibleVerificationTypeValues returns an array of possible values for the VerificationType const type. +func PossibleVerificationTypeValues() []VerificationType { + return []VerificationType{Unverified, Verified} +} diff --git a/services/batch/2021-06-01.14.0/batch/file.go b/services/batch/2021-06-01.14.0/batch/file.go new file mode 100644 index 000000000000..2d74ce0c4621 --- /dev/null +++ b/services/batch/2021-06-01.14.0/batch/file.go @@ -0,0 +1,1091 @@ +package batch + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "github.com/gofrs/uuid" + "net/http" +) + +// FileClient is the a client for issuing REST requests to the Azure Batch service. +type FileClient struct { + BaseClient +} + +// NewFileClient creates an instance of the FileClient client. +func NewFileClient(batchURL string) FileClient { + return FileClient{New(batchURL)} +} + +// DeleteFromComputeNode sends the delete from compute node request. +// Parameters: +// poolID - the ID of the Pool that contains the Compute Node. +// nodeID - the ID of the Compute Node from which you want to delete the file. +// filePath - the path to the file or directory that you want to delete. +// recursive - whether to delete children of a directory. If the filePath parameter represents a directory +// instead of a file, you can set recursive to true to delete the directory and all of the files and +// subdirectories in it. If recursive is false then the directory must be empty or deletion will fail. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client FileClient) DeleteFromComputeNode(ctx context.Context, poolID string, nodeID string, filePath string, recursive *bool, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FileClient.DeleteFromComputeNode") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteFromComputeNodePreparer(ctx, poolID, nodeID, filePath, recursive, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.FileClient", "DeleteFromComputeNode", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteFromComputeNodeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.FileClient", "DeleteFromComputeNode", resp, "Failure sending request") + return + } + + result, err = client.DeleteFromComputeNodeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.FileClient", "DeleteFromComputeNode", resp, "Failure responding to request") + return + } + + return +} + +// DeleteFromComputeNodePreparer prepares the DeleteFromComputeNode request. +func (client FileClient) DeleteFromComputeNodePreparer(ctx context.Context, poolID string, nodeID string, filePath string, recursive *bool, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "filePath": autorest.Encode("path", filePath), + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if recursive != nil { + queryParameters["recursive"] = autorest.Encode("query", *recursive) + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/files/{filePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteFromComputeNodeSender sends the DeleteFromComputeNode request. The method will close the +// http.Response Body if it receives an error. +func (client FileClient) DeleteFromComputeNodeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteFromComputeNodeResponder handles the response to the DeleteFromComputeNode request. The method always +// closes the http.Response Body. +func (client FileClient) DeleteFromComputeNodeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteFromTask sends the delete from task request. +// Parameters: +// jobID - the ID of the Job that contains the Task. +// taskID - the ID of the Task whose file you want to delete. +// filePath - the path to the Task file or directory that you want to delete. +// recursive - whether to delete children of a directory. If the filePath parameter represents a directory +// instead of a file, you can set recursive to true to delete the directory and all of the files and +// subdirectories in it. If recursive is false then the directory must be empty or deletion will fail. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client FileClient) DeleteFromTask(ctx context.Context, jobID string, taskID string, filePath string, recursive *bool, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FileClient.DeleteFromTask") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteFromTaskPreparer(ctx, jobID, taskID, filePath, recursive, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.FileClient", "DeleteFromTask", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteFromTaskSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.FileClient", "DeleteFromTask", resp, "Failure sending request") + return + } + + result, err = client.DeleteFromTaskResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.FileClient", "DeleteFromTask", resp, "Failure responding to request") + return + } + + return +} + +// DeleteFromTaskPreparer prepares the DeleteFromTask request. +func (client FileClient) DeleteFromTaskPreparer(ctx context.Context, jobID string, taskID string, filePath string, recursive *bool, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "filePath": autorest.Encode("path", filePath), + "jobId": autorest.Encode("path", jobID), + "taskId": autorest.Encode("path", taskID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if recursive != nil { + queryParameters["recursive"] = autorest.Encode("query", *recursive) + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobs/{jobId}/tasks/{taskId}/files/{filePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteFromTaskSender sends the DeleteFromTask request. The method will close the +// http.Response Body if it receives an error. +func (client FileClient) DeleteFromTaskSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteFromTaskResponder handles the response to the DeleteFromTask request. The method always +// closes the http.Response Body. +func (client FileClient) DeleteFromTaskResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetFromComputeNode returns the content of the specified Compute Node file. +// Parameters: +// poolID - the ID of the Pool that contains the Compute Node. +// nodeID - the ID of the Compute Node that contains the file. +// filePath - the path to the Compute Node file that you want to get the content of. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ocpRange - the byte range to be retrieved. The default is to retrieve the entire file. The format is +// bytes=startRange-endRange. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client FileClient) GetFromComputeNode(ctx context.Context, poolID string, nodeID string, filePath string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ocpRange string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result ReadCloser, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FileClient.GetFromComputeNode") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetFromComputeNodePreparer(ctx, poolID, nodeID, filePath, timeout, clientRequestID, returnClientRequestID, ocpDate, ocpRange, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.FileClient", "GetFromComputeNode", nil, "Failure preparing request") + return + } + + resp, err := client.GetFromComputeNodeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.FileClient", "GetFromComputeNode", resp, "Failure sending request") + return + } + + result, err = client.GetFromComputeNodeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.FileClient", "GetFromComputeNode", resp, "Failure responding to request") + return + } + + return +} + +// GetFromComputeNodePreparer prepares the GetFromComputeNode request. +func (client FileClient) GetFromComputeNodePreparer(ctx context.Context, poolID string, nodeID string, filePath string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ocpRange string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "filePath": autorest.Encode("path", filePath), + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/files/{filePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ocpRange) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-range", autorest.String(ocpRange))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetFromComputeNodeSender sends the GetFromComputeNode request. The method will close the +// http.Response Body if it receives an error. +func (client FileClient) GetFromComputeNodeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetFromComputeNodeResponder handles the response to the GetFromComputeNode request. The method always +// closes the http.Response Body. +func (client FileClient) GetFromComputeNodeResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} + +// GetFromTask returns the content of the specified Task file. +// Parameters: +// jobID - the ID of the Job that contains the Task. +// taskID - the ID of the Task whose file you want to retrieve. +// filePath - the path to the Task file that you want to get the content of. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ocpRange - the byte range to be retrieved. The default is to retrieve the entire file. The format is +// bytes=startRange-endRange. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client FileClient) GetFromTask(ctx context.Context, jobID string, taskID string, filePath string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ocpRange string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result ReadCloser, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FileClient.GetFromTask") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetFromTaskPreparer(ctx, jobID, taskID, filePath, timeout, clientRequestID, returnClientRequestID, ocpDate, ocpRange, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.FileClient", "GetFromTask", nil, "Failure preparing request") + return + } + + resp, err := client.GetFromTaskSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.FileClient", "GetFromTask", resp, "Failure sending request") + return + } + + result, err = client.GetFromTaskResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.FileClient", "GetFromTask", resp, "Failure responding to request") + return + } + + return +} + +// GetFromTaskPreparer prepares the GetFromTask request. +func (client FileClient) GetFromTaskPreparer(ctx context.Context, jobID string, taskID string, filePath string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ocpRange string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "filePath": autorest.Encode("path", filePath), + "jobId": autorest.Encode("path", jobID), + "taskId": autorest.Encode("path", taskID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobs/{jobId}/tasks/{taskId}/files/{filePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ocpRange) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-range", autorest.String(ocpRange))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetFromTaskSender sends the GetFromTask request. The method will close the +// http.Response Body if it receives an error. +func (client FileClient) GetFromTaskSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetFromTaskResponder handles the response to the GetFromTask request. The method always +// closes the http.Response Body. +func (client FileClient) GetFromTaskResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPropertiesFromComputeNode gets the properties of the specified Compute Node file. +// Parameters: +// poolID - the ID of the Pool that contains the Compute Node. +// nodeID - the ID of the Compute Node that contains the file. +// filePath - the path to the Compute Node file that you want to get the properties of. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client FileClient) GetPropertiesFromComputeNode(ctx context.Context, poolID string, nodeID string, filePath string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FileClient.GetPropertiesFromComputeNode") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPropertiesFromComputeNodePreparer(ctx, poolID, nodeID, filePath, timeout, clientRequestID, returnClientRequestID, ocpDate, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.FileClient", "GetPropertiesFromComputeNode", nil, "Failure preparing request") + return + } + + resp, err := client.GetPropertiesFromComputeNodeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.FileClient", "GetPropertiesFromComputeNode", resp, "Failure sending request") + return + } + + result, err = client.GetPropertiesFromComputeNodeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.FileClient", "GetPropertiesFromComputeNode", resp, "Failure responding to request") + return + } + + return +} + +// GetPropertiesFromComputeNodePreparer prepares the GetPropertiesFromComputeNode request. +func (client FileClient) GetPropertiesFromComputeNodePreparer(ctx context.Context, poolID string, nodeID string, filePath string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "filePath": autorest.Encode("path", filePath), + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsHead(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/files/{filePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPropertiesFromComputeNodeSender sends the GetPropertiesFromComputeNode request. The method will close the +// http.Response Body if it receives an error. +func (client FileClient) GetPropertiesFromComputeNodeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetPropertiesFromComputeNodeResponder handles the response to the GetPropertiesFromComputeNode request. The method always +// closes the http.Response Body. +func (client FileClient) GetPropertiesFromComputeNodeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetPropertiesFromTask gets the properties of the specified Task file. +// Parameters: +// jobID - the ID of the Job that contains the Task. +// taskID - the ID of the Task whose file you want to get the properties of. +// filePath - the path to the Task file that you want to get the properties of. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client FileClient) GetPropertiesFromTask(ctx context.Context, jobID string, taskID string, filePath string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FileClient.GetPropertiesFromTask") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPropertiesFromTaskPreparer(ctx, jobID, taskID, filePath, timeout, clientRequestID, returnClientRequestID, ocpDate, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.FileClient", "GetPropertiesFromTask", nil, "Failure preparing request") + return + } + + resp, err := client.GetPropertiesFromTaskSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.FileClient", "GetPropertiesFromTask", resp, "Failure sending request") + return + } + + result, err = client.GetPropertiesFromTaskResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.FileClient", "GetPropertiesFromTask", resp, "Failure responding to request") + return + } + + return +} + +// GetPropertiesFromTaskPreparer prepares the GetPropertiesFromTask request. +func (client FileClient) GetPropertiesFromTaskPreparer(ctx context.Context, jobID string, taskID string, filePath string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "filePath": autorest.Encode("path", filePath), + "jobId": autorest.Encode("path", jobID), + "taskId": autorest.Encode("path", taskID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsHead(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobs/{jobId}/tasks/{taskId}/files/{filePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPropertiesFromTaskSender sends the GetPropertiesFromTask request. The method will close the +// http.Response Body if it receives an error. +func (client FileClient) GetPropertiesFromTaskSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetPropertiesFromTaskResponder handles the response to the GetPropertiesFromTask request. The method always +// closes the http.Response Body. +func (client FileClient) GetPropertiesFromTaskResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// ListFromComputeNode sends the list from compute node request. +// Parameters: +// poolID - the ID of the Pool that contains the Compute Node. +// nodeID - the ID of the Compute Node whose files you want to list. +// filter - an OData $filter clause. For more information on constructing this filter, see +// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-compute-node-files. +// recursive - whether to list children of a directory. +// maxResults - the maximum number of items to return in the response. A maximum of 1000 files can be returned. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client FileClient) ListFromComputeNode(ctx context.Context, poolID string, nodeID string, filter string, recursive *bool, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result NodeFileListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FileClient.ListFromComputeNode") + defer func() { + sc := -1 + if result.nflr.Response.Response != nil { + sc = result.nflr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxResults, + Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("batch.FileClient", "ListFromComputeNode", err.Error()) + } + + result.fn = client.listFromComputeNodeNextResults + req, err := client.ListFromComputeNodePreparer(ctx, poolID, nodeID, filter, recursive, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.FileClient", "ListFromComputeNode", nil, "Failure preparing request") + return + } + + resp, err := client.ListFromComputeNodeSender(req) + if err != nil { + result.nflr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.FileClient", "ListFromComputeNode", resp, "Failure sending request") + return + } + + result.nflr, err = client.ListFromComputeNodeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.FileClient", "ListFromComputeNode", resp, "Failure responding to request") + return + } + if result.nflr.hasNextLink() && result.nflr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListFromComputeNodePreparer prepares the ListFromComputeNode request. +func (client FileClient) ListFromComputeNodePreparer(ctx context.Context, poolID string, nodeID string, filter string, recursive *bool, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if recursive != nil { + queryParameters["recursive"] = autorest.Encode("query", *recursive) + } + if maxResults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxResults) + } else { + queryParameters["maxresults"] = autorest.Encode("query", 1000) + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}/nodes/{nodeId}/files", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListFromComputeNodeSender sends the ListFromComputeNode request. The method will close the +// http.Response Body if it receives an error. +func (client FileClient) ListFromComputeNodeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListFromComputeNodeResponder handles the response to the ListFromComputeNode request. The method always +// closes the http.Response Body. +func (client FileClient) ListFromComputeNodeResponder(resp *http.Response) (result NodeFileListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listFromComputeNodeNextResults retrieves the next set of results, if any. +func (client FileClient) listFromComputeNodeNextResults(ctx context.Context, lastResults NodeFileListResult) (result NodeFileListResult, err error) { + req, err := lastResults.nodeFileListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.FileClient", "listFromComputeNodeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListFromComputeNodeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.FileClient", "listFromComputeNodeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListFromComputeNodeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.FileClient", "listFromComputeNodeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListFromComputeNodeComplete enumerates all values, automatically crossing page boundaries as required. +func (client FileClient) ListFromComputeNodeComplete(ctx context.Context, poolID string, nodeID string, filter string, recursive *bool, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result NodeFileListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FileClient.ListFromComputeNode") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListFromComputeNode(ctx, poolID, nodeID, filter, recursive, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + return +} + +// ListFromTask sends the list from task request. +// Parameters: +// jobID - the ID of the Job that contains the Task. +// taskID - the ID of the Task whose files you want to list. +// filter - an OData $filter clause. For more information on constructing this filter, see +// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-task-files. +// recursive - whether to list children of the Task directory. This parameter can be used in combination with +// the filter parameter to list specific type of files. +// maxResults - the maximum number of items to return in the response. A maximum of 1000 files can be returned. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client FileClient) ListFromTask(ctx context.Context, jobID string, taskID string, filter string, recursive *bool, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result NodeFileListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FileClient.ListFromTask") + defer func() { + sc := -1 + if result.nflr.Response.Response != nil { + sc = result.nflr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxResults, + Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("batch.FileClient", "ListFromTask", err.Error()) + } + + result.fn = client.listFromTaskNextResults + req, err := client.ListFromTaskPreparer(ctx, jobID, taskID, filter, recursive, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.FileClient", "ListFromTask", nil, "Failure preparing request") + return + } + + resp, err := client.ListFromTaskSender(req) + if err != nil { + result.nflr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.FileClient", "ListFromTask", resp, "Failure sending request") + return + } + + result.nflr, err = client.ListFromTaskResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.FileClient", "ListFromTask", resp, "Failure responding to request") + return + } + if result.nflr.hasNextLink() && result.nflr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListFromTaskPreparer prepares the ListFromTask request. +func (client FileClient) ListFromTaskPreparer(ctx context.Context, jobID string, taskID string, filter string, recursive *bool, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + "taskId": autorest.Encode("path", taskID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if recursive != nil { + queryParameters["recursive"] = autorest.Encode("query", *recursive) + } + if maxResults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxResults) + } else { + queryParameters["maxresults"] = autorest.Encode("query", 1000) + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobs/{jobId}/tasks/{taskId}/files", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListFromTaskSender sends the ListFromTask request. The method will close the +// http.Response Body if it receives an error. +func (client FileClient) ListFromTaskSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListFromTaskResponder handles the response to the ListFromTask request. The method always +// closes the http.Response Body. +func (client FileClient) ListFromTaskResponder(resp *http.Response) (result NodeFileListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listFromTaskNextResults retrieves the next set of results, if any. +func (client FileClient) listFromTaskNextResults(ctx context.Context, lastResults NodeFileListResult) (result NodeFileListResult, err error) { + req, err := lastResults.nodeFileListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.FileClient", "listFromTaskNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListFromTaskSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.FileClient", "listFromTaskNextResults", resp, "Failure sending next results request") + } + result, err = client.ListFromTaskResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.FileClient", "listFromTaskNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListFromTaskComplete enumerates all values, automatically crossing page boundaries as required. +func (client FileClient) ListFromTaskComplete(ctx context.Context, jobID string, taskID string, filter string, recursive *bool, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result NodeFileListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FileClient.ListFromTask") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListFromTask(ctx, jobID, taskID, filter, recursive, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + return +} diff --git a/services/batch/2021-06-01.14.0/batch/job.go b/services/batch/2021-06-01.14.0/batch/job.go new file mode 100644 index 000000000000..600d24f04e28 --- /dev/null +++ b/services/batch/2021-06-01.14.0/batch/job.go @@ -0,0 +1,1888 @@ +package batch + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "github.com/gofrs/uuid" + "net/http" +) + +// JobClient is the a client for issuing REST requests to the Azure Batch service. +type JobClient struct { + BaseClient +} + +// NewJobClient creates an instance of the JobClient client. +func NewJobClient(batchURL string) JobClient { + return JobClient{New(batchURL)} +} + +// Add the Batch service supports two ways to control the work done as part of a Job. In the first approach, the user +// specifies a Job Manager Task. The Batch service launches this Task when it is ready to start the Job. The Job +// Manager Task controls all other Tasks that run under this Job, by using the Task APIs. In the second approach, the +// user directly controls the execution of Tasks under an active Job, by using the Task APIs. Also note: when naming +// Jobs, avoid including sensitive information such as user names or secret project names. This information may appear +// in telemetry logs accessible to Microsoft Support engineers. +// Parameters: +// job - the Job to be added. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client JobClient) Add(ctx context.Context, job JobAddParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.Add") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: job, + Constraints: []validation.Constraint{{Target: "job.ID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "job.JobManagerTask", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "job.JobManagerTask.ID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "job.JobManagerTask.CommandLine", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "job.JobManagerTask.ContainerSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "job.JobManagerTask.ContainerSettings.ImageName", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "job.JobPreparationTask", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "job.JobPreparationTask.CommandLine", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "job.JobPreparationTask.ContainerSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "job.JobPreparationTask.ContainerSettings.ImageName", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "job.JobReleaseTask", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "job.JobReleaseTask.CommandLine", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "job.JobReleaseTask.ContainerSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "job.JobReleaseTask.ContainerSettings.ImageName", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "job.PoolInfo", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "job.PoolInfo.AutoPoolSpecification", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "job.PoolInfo.AutoPoolSpecification.Pool", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "job.PoolInfo.AutoPoolSpecification.Pool.VMSize", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "job.PoolInfo.AutoPoolSpecification.Pool.CloudServiceConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "job.PoolInfo.AutoPoolSpecification.Pool.CloudServiceConfiguration.OsFamily", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "job.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "job.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "job.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.NodeAgentSKUID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "job.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ContainerConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "job.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ContainerConfiguration.Type", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "job.PoolInfo.AutoPoolSpecification.Pool.NetworkConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "job.PoolInfo.AutoPoolSpecification.Pool.NetworkConfiguration.EndpointConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "job.PoolInfo.AutoPoolSpecification.Pool.NetworkConfiguration.EndpointConfiguration.InboundNATPools", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "job.PoolInfo.AutoPoolSpecification.Pool.StartTask", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "job.PoolInfo.AutoPoolSpecification.Pool.StartTask.CommandLine", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "job.PoolInfo.AutoPoolSpecification.Pool.StartTask.ContainerSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "job.PoolInfo.AutoPoolSpecification.Pool.StartTask.ContainerSettings.ImageName", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + }}, + }}, + }}, + {Target: "job.NetworkConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "job.NetworkConfiguration.SubnetID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("batch.JobClient", "Add", err.Error()) + } + + req, err := client.AddPreparer(ctx, job, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "Add", nil, "Failure preparing request") + return + } + + resp, err := client.AddSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.JobClient", "Add", resp, "Failure sending request") + return + } + + result, err = client.AddResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "Add", resp, "Failure responding to request") + return + } + + return +} + +// AddPreparer prepares the Add request. +func (client JobClient) AddPreparer(ctx context.Context, job JobAddParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPath("/jobs"), + autorest.WithJSON(job), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddSender sends the Add request. The method will close the +// http.Response Body if it receives an error. +func (client JobClient) AddSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// AddResponder handles the response to the Add request. The method always +// closes the http.Response Body. +func (client JobClient) AddResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deleting a Job also deletes all Tasks that are part of that Job, and all Job statistics. This also overrides +// the retention period for Task data; that is, if the Job contains Tasks which are still retained on Compute Nodes, +// the Batch services deletes those Tasks' working directories and all their contents. When a Delete Job request is +// received, the Batch service sets the Job to the deleting state. All update operations on a Job that is in deleting +// state will fail with status code 409 (Conflict), with additional information indicating that the Job is being +// deleted. +// Parameters: +// jobID - the ID of the Job to delete. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client JobClient) Delete(ctx context.Context, jobID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, jobID, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.JobClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client JobClient) DeletePreparer(ctx context.Context, jobID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobs/{jobId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client JobClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client JobClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Disable the Batch Service immediately moves the Job to the disabling state. Batch then uses the disableTasks +// parameter to determine what to do with the currently running Tasks of the Job. The Job remains in the disabling +// state until the disable operation is completed and all Tasks have been dealt with according to the disableTasks +// option; the Job then moves to the disabled state. No new Tasks are started under the Job until it moves back to +// active state. If you try to disable a Job that is in any state other than active, disabling, or disabled, the +// request fails with status code 409. +// Parameters: +// jobID - the ID of the Job to disable. +// jobDisableParameter - the parameters for the request. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client JobClient) Disable(ctx context.Context, jobID string, jobDisableParameter JobDisableParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.Disable") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DisablePreparer(ctx, jobID, jobDisableParameter, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "Disable", nil, "Failure preparing request") + return + } + + resp, err := client.DisableSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.JobClient", "Disable", resp, "Failure sending request") + return + } + + result, err = client.DisableResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "Disable", resp, "Failure responding to request") + return + } + + return +} + +// DisablePreparer prepares the Disable request. +func (client JobClient) DisablePreparer(ctx context.Context, jobID string, jobDisableParameter JobDisableParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobs/{jobId}/disable", pathParameters), + autorest.WithJSON(jobDisableParameter), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DisableSender sends the Disable request. The method will close the +// http.Response Body if it receives an error. +func (client JobClient) DisableSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DisableResponder handles the response to the Disable request. The method always +// closes the http.Response Body. +func (client JobClient) DisableResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Enable when you call this API, the Batch service sets a disabled Job to the enabling state. After the this operation +// is completed, the Job moves to the active state, and scheduling of new Tasks under the Job resumes. The Batch +// service does not allow a Task to remain in the active state for more than 180 days. Therefore, if you enable a Job +// containing active Tasks which were added more than 180 days ago, those Tasks will not run. +// Parameters: +// jobID - the ID of the Job to enable. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client JobClient) Enable(ctx context.Context, jobID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.Enable") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.EnablePreparer(ctx, jobID, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "Enable", nil, "Failure preparing request") + return + } + + resp, err := client.EnableSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.JobClient", "Enable", resp, "Failure sending request") + return + } + + result, err = client.EnableResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "Enable", resp, "Failure responding to request") + return + } + + return +} + +// EnablePreparer prepares the Enable request. +func (client JobClient) EnablePreparer(ctx context.Context, jobID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobs/{jobId}/enable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// EnableSender sends the Enable request. The method will close the +// http.Response Body if it receives an error. +func (client JobClient) EnableSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// EnableResponder handles the response to the Enable request. The method always +// closes the http.Response Body. +func (client JobClient) EnableResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// jobID - the ID of the Job. +// selectParameter - an OData $select clause. +// expand - an OData $expand clause. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client JobClient) Get(ctx context.Context, jobID string, selectParameter string, expand string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result CloudJob, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, jobID, selectParameter, expand, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.JobClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client JobClient) GetPreparer(ctx context.Context, jobID string, selectParameter string, expand string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobs/{jobId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client JobClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client JobClient) GetResponder(resp *http.Response) (result CloudJob, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAllLifetimeStatistics statistics are aggregated across all Jobs that have ever existed in the Account, from +// Account creation to the last update time of the statistics. The statistics may not be immediately available. The +// Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. +// Parameters: +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client JobClient) GetAllLifetimeStatistics(ctx context.Context, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result JobStatistics, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.GetAllLifetimeStatistics") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetAllLifetimeStatisticsPreparer(ctx, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "GetAllLifetimeStatistics", nil, "Failure preparing request") + return + } + + resp, err := client.GetAllLifetimeStatisticsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.JobClient", "GetAllLifetimeStatistics", resp, "Failure sending request") + return + } + + result, err = client.GetAllLifetimeStatisticsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "GetAllLifetimeStatistics", resp, "Failure responding to request") + return + } + + return +} + +// GetAllLifetimeStatisticsPreparer prepares the GetAllLifetimeStatistics request. +func (client JobClient) GetAllLifetimeStatisticsPreparer(ctx context.Context, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPath("/lifetimejobstats"), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAllLifetimeStatisticsSender sends the GetAllLifetimeStatistics request. The method will close the +// http.Response Body if it receives an error. +func (client JobClient) GetAllLifetimeStatisticsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetAllLifetimeStatisticsResponder handles the response to the GetAllLifetimeStatistics request. The method always +// closes the http.Response Body. +func (client JobClient) GetAllLifetimeStatisticsResponder(resp *http.Response) (result JobStatistics, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetTaskCounts task counts provide a count of the Tasks by active, running or completed Task state, and a count of +// Tasks which succeeded or failed. Tasks in the preparing state are counted as running. Note that the numbers returned +// may not always be up to date. If you need exact task counts, use a list query. +// Parameters: +// jobID - the ID of the Job. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client JobClient) GetTaskCounts(ctx context.Context, jobID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result TaskCountsResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.GetTaskCounts") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetTaskCountsPreparer(ctx, jobID, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "GetTaskCounts", nil, "Failure preparing request") + return + } + + resp, err := client.GetTaskCountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.JobClient", "GetTaskCounts", resp, "Failure sending request") + return + } + + result, err = client.GetTaskCountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "GetTaskCounts", resp, "Failure responding to request") + return + } + + return +} + +// GetTaskCountsPreparer prepares the GetTaskCounts request. +func (client JobClient) GetTaskCountsPreparer(ctx context.Context, jobID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobs/{jobId}/taskcounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetTaskCountsSender sends the GetTaskCounts request. The method will close the +// http.Response Body if it receives an error. +func (client JobClient) GetTaskCountsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetTaskCountsResponder handles the response to the GetTaskCounts request. The method always +// closes the http.Response Body. +func (client JobClient) GetTaskCountsResponder(resp *http.Response) (result TaskCountsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// filter - an OData $filter clause. For more information on constructing this filter, see +// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-jobs. +// selectParameter - an OData $select clause. +// expand - an OData $expand clause. +// maxResults - the maximum number of items to return in the response. A maximum of 1000 Jobs can be returned. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client JobClient) List(ctx context.Context, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result CloudJobListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.List") + defer func() { + sc := -1 + if result.cjlr.Response.Response != nil { + sc = result.cjlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxResults, + Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("batch.JobClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, filter, selectParameter, expand, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.cjlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.JobClient", "List", resp, "Failure sending request") + return + } + + result.cjlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "List", resp, "Failure responding to request") + return + } + if result.cjlr.hasNextLink() && result.cjlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client JobClient) ListPreparer(ctx context.Context, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if maxResults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxResults) + } else { + queryParameters["maxresults"] = autorest.Encode("query", 1000) + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPath("/jobs"), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client JobClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client JobClient) ListResponder(resp *http.Response) (result CloudJobListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client JobClient) listNextResults(ctx context.Context, lastResults CloudJobListResult) (result CloudJobListResult, err error) { + req, err := lastResults.cloudJobListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.JobClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.JobClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client JobClient) ListComplete(ctx context.Context, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result CloudJobListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, filter, selectParameter, expand, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + return +} + +// ListFromJobSchedule sends the list from job schedule request. +// Parameters: +// jobScheduleID - the ID of the Job Schedule from which you want to get a list of Jobs. +// filter - an OData $filter clause. For more information on constructing this filter, see +// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-jobs-in-a-job-schedule. +// selectParameter - an OData $select clause. +// expand - an OData $expand clause. +// maxResults - the maximum number of items to return in the response. A maximum of 1000 Jobs can be returned. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client JobClient) ListFromJobSchedule(ctx context.Context, jobScheduleID string, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result CloudJobListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.ListFromJobSchedule") + defer func() { + sc := -1 + if result.cjlr.Response.Response != nil { + sc = result.cjlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxResults, + Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("batch.JobClient", "ListFromJobSchedule", err.Error()) + } + + result.fn = client.listFromJobScheduleNextResults + req, err := client.ListFromJobSchedulePreparer(ctx, jobScheduleID, filter, selectParameter, expand, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "ListFromJobSchedule", nil, "Failure preparing request") + return + } + + resp, err := client.ListFromJobScheduleSender(req) + if err != nil { + result.cjlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.JobClient", "ListFromJobSchedule", resp, "Failure sending request") + return + } + + result.cjlr, err = client.ListFromJobScheduleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "ListFromJobSchedule", resp, "Failure responding to request") + return + } + if result.cjlr.hasNextLink() && result.cjlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListFromJobSchedulePreparer prepares the ListFromJobSchedule request. +func (client JobClient) ListFromJobSchedulePreparer(ctx context.Context, jobScheduleID string, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobScheduleId": autorest.Encode("path", jobScheduleID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if maxResults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxResults) + } else { + queryParameters["maxresults"] = autorest.Encode("query", 1000) + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobschedules/{jobScheduleId}/jobs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListFromJobScheduleSender sends the ListFromJobSchedule request. The method will close the +// http.Response Body if it receives an error. +func (client JobClient) ListFromJobScheduleSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListFromJobScheduleResponder handles the response to the ListFromJobSchedule request. The method always +// closes the http.Response Body. +func (client JobClient) ListFromJobScheduleResponder(resp *http.Response) (result CloudJobListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listFromJobScheduleNextResults retrieves the next set of results, if any. +func (client JobClient) listFromJobScheduleNextResults(ctx context.Context, lastResults CloudJobListResult) (result CloudJobListResult, err error) { + req, err := lastResults.cloudJobListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.JobClient", "listFromJobScheduleNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListFromJobScheduleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.JobClient", "listFromJobScheduleNextResults", resp, "Failure sending next results request") + } + result, err = client.ListFromJobScheduleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "listFromJobScheduleNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListFromJobScheduleComplete enumerates all values, automatically crossing page boundaries as required. +func (client JobClient) ListFromJobScheduleComplete(ctx context.Context, jobScheduleID string, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result CloudJobListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.ListFromJobSchedule") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListFromJobSchedule(ctx, jobScheduleID, filter, selectParameter, expand, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + return +} + +// ListPreparationAndReleaseTaskStatus this API returns the Job Preparation and Job Release Task status on all Compute +// Nodes that have run the Job Preparation or Job Release Task. This includes Compute Nodes which have since been +// removed from the Pool. If this API is invoked on a Job which has no Job Preparation or Job Release Task, the Batch +// service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. +// Parameters: +// jobID - the ID of the Job. +// filter - an OData $filter clause. For more information on constructing this filter, see +// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-job-preparation-and-release-status. +// selectParameter - an OData $select clause. +// maxResults - the maximum number of items to return in the response. A maximum of 1000 Tasks can be returned. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client JobClient) ListPreparationAndReleaseTaskStatus(ctx context.Context, jobID string, filter string, selectParameter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result CloudJobListPreparationAndReleaseTaskStatusResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.ListPreparationAndReleaseTaskStatus") + defer func() { + sc := -1 + if result.cjlpartsr.Response.Response != nil { + sc = result.cjlpartsr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxResults, + Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("batch.JobClient", "ListPreparationAndReleaseTaskStatus", err.Error()) + } + + result.fn = client.listPreparationAndReleaseTaskStatusNextResults + req, err := client.ListPreparationAndReleaseTaskStatusPreparer(ctx, jobID, filter, selectParameter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "ListPreparationAndReleaseTaskStatus", nil, "Failure preparing request") + return + } + + resp, err := client.ListPreparationAndReleaseTaskStatusSender(req) + if err != nil { + result.cjlpartsr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.JobClient", "ListPreparationAndReleaseTaskStatus", resp, "Failure sending request") + return + } + + result.cjlpartsr, err = client.ListPreparationAndReleaseTaskStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "ListPreparationAndReleaseTaskStatus", resp, "Failure responding to request") + return + } + if result.cjlpartsr.hasNextLink() && result.cjlpartsr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparationAndReleaseTaskStatusPreparer prepares the ListPreparationAndReleaseTaskStatus request. +func (client JobClient) ListPreparationAndReleaseTaskStatusPreparer(ctx context.Context, jobID string, filter string, selectParameter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if maxResults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxResults) + } else { + queryParameters["maxresults"] = autorest.Encode("query", 1000) + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobs/{jobId}/jobpreparationandreleasetaskstatus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListPreparationAndReleaseTaskStatusSender sends the ListPreparationAndReleaseTaskStatus request. The method will close the +// http.Response Body if it receives an error. +func (client JobClient) ListPreparationAndReleaseTaskStatusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListPreparationAndReleaseTaskStatusResponder handles the response to the ListPreparationAndReleaseTaskStatus request. The method always +// closes the http.Response Body. +func (client JobClient) ListPreparationAndReleaseTaskStatusResponder(resp *http.Response) (result CloudJobListPreparationAndReleaseTaskStatusResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listPreparationAndReleaseTaskStatusNextResults retrieves the next set of results, if any. +func (client JobClient) listPreparationAndReleaseTaskStatusNextResults(ctx context.Context, lastResults CloudJobListPreparationAndReleaseTaskStatusResult) (result CloudJobListPreparationAndReleaseTaskStatusResult, err error) { + req, err := lastResults.cloudJobListPreparationAndReleaseTaskStatusResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.JobClient", "listPreparationAndReleaseTaskStatusNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListPreparationAndReleaseTaskStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.JobClient", "listPreparationAndReleaseTaskStatusNextResults", resp, "Failure sending next results request") + } + result, err = client.ListPreparationAndReleaseTaskStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "listPreparationAndReleaseTaskStatusNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListPreparationAndReleaseTaskStatusComplete enumerates all values, automatically crossing page boundaries as required. +func (client JobClient) ListPreparationAndReleaseTaskStatusComplete(ctx context.Context, jobID string, filter string, selectParameter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result CloudJobListPreparationAndReleaseTaskStatusResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.ListPreparationAndReleaseTaskStatus") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListPreparationAndReleaseTaskStatus(ctx, jobID, filter, selectParameter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + return +} + +// Patch this replaces only the Job properties specified in the request. For example, if the Job has constraints, and a +// request does not specify the constraints element, then the Job keeps the existing constraints. +// Parameters: +// jobID - the ID of the Job whose properties you want to update. +// jobPatchParameter - the parameters for the request. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client JobClient) Patch(ctx context.Context, jobID string, jobPatchParameter JobPatchParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.Patch") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PatchPreparer(ctx, jobID, jobPatchParameter, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "Patch", nil, "Failure preparing request") + return + } + + resp, err := client.PatchSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.JobClient", "Patch", resp, "Failure sending request") + return + } + + result, err = client.PatchResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "Patch", resp, "Failure responding to request") + return + } + + return +} + +// PatchPreparer prepares the Patch request. +func (client JobClient) PatchPreparer(ctx context.Context, jobID string, jobPatchParameter JobPatchParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), + autorest.AsPatch(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobs/{jobId}", pathParameters), + autorest.WithJSON(jobPatchParameter), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PatchSender sends the Patch request. The method will close the +// http.Response Body if it receives an error. +func (client JobClient) PatchSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// PatchResponder handles the response to the Patch request. The method always +// closes the http.Response Body. +func (client JobClient) PatchResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Terminate when a Terminate Job request is received, the Batch service sets the Job to the terminating state. The +// Batch service then terminates any running Tasks associated with the Job and runs any required Job release Tasks. +// Then the Job moves into the completed state. If there are any Tasks in the Job in the active state, they will remain +// in the active state. Once a Job is terminated, new Tasks cannot be added and any remaining active Tasks will not be +// scheduled. +// Parameters: +// jobID - the ID of the Job to terminate. +// jobTerminateParameter - the parameters for the request. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client JobClient) Terminate(ctx context.Context, jobID string, jobTerminateParameter *JobTerminateParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.Terminate") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.TerminatePreparer(ctx, jobID, jobTerminateParameter, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "Terminate", nil, "Failure preparing request") + return + } + + resp, err := client.TerminateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.JobClient", "Terminate", resp, "Failure sending request") + return + } + + result, err = client.TerminateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "Terminate", resp, "Failure responding to request") + return + } + + return +} + +// TerminatePreparer prepares the Terminate request. +func (client JobClient) TerminatePreparer(ctx context.Context, jobID string, jobTerminateParameter *JobTerminateParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobs/{jobId}/terminate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if jobTerminateParameter != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(jobTerminateParameter)) + } + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// TerminateSender sends the Terminate request. The method will close the +// http.Response Body if it receives an error. +func (client JobClient) TerminateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// TerminateResponder handles the response to the Terminate request. The method always +// closes the http.Response Body. +func (client JobClient) TerminateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update this fully replaces all the updatable properties of the Job. For example, if the Job has constraints +// associated with it and if constraints is not specified with this request, then the Batch service will remove the +// existing constraints. +// Parameters: +// jobID - the ID of the Job whose properties you want to update. +// jobUpdateParameter - the parameters for the request. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client JobClient) Update(ctx context.Context, jobID string, jobUpdateParameter JobUpdateParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobClient.Update") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: jobUpdateParameter, + Constraints: []validation.Constraint{{Target: "jobUpdateParameter.PoolInfo", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.VMSize", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.CloudServiceConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.CloudServiceConfiguration.OsFamily", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.NodeAgentSKUID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ContainerConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ContainerConfiguration.Type", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.NetworkConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.NetworkConfiguration.EndpointConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.NetworkConfiguration.EndpointConfiguration.InboundNATPools", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.StartTask", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.StartTask.CommandLine", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.StartTask.ContainerSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.StartTask.ContainerSettings.ImageName", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("batch.JobClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, jobID, jobUpdateParameter, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.JobClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client JobClient) UpdatePreparer(ctx context.Context, jobID string, jobUpdateParameter JobUpdateParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobs/{jobId}", pathParameters), + autorest.WithJSON(jobUpdateParameter), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client JobClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client JobClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/batch/2021-06-01.14.0/batch/jobschedule.go b/services/batch/2021-06-01.14.0/batch/jobschedule.go new file mode 100644 index 000000000000..c1b427a6a8b4 --- /dev/null +++ b/services/batch/2021-06-01.14.0/batch/jobschedule.go @@ -0,0 +1,1464 @@ +package batch + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "github.com/gofrs/uuid" + "net/http" +) + +// JobScheduleClient is the a client for issuing REST requests to the Azure Batch service. +type JobScheduleClient struct { + BaseClient +} + +// NewJobScheduleClient creates an instance of the JobScheduleClient client. +func NewJobScheduleClient(batchURL string) JobScheduleClient { + return JobScheduleClient{New(batchURL)} +} + +// Add sends the add request. +// Parameters: +// cloudJobSchedule - the Job Schedule to be added. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client JobScheduleClient) Add(ctx context.Context, cloudJobSchedule JobScheduleAddParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.Add") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: cloudJobSchedule, + Constraints: []validation.Constraint{{Target: "cloudJobSchedule.ID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "cloudJobSchedule.Schedule", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "cloudJobSchedule.JobSpecification", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.NetworkConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.NetworkConfiguration.SubnetID", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "cloudJobSchedule.JobSpecification.JobManagerTask", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.JobManagerTask.ID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "cloudJobSchedule.JobSpecification.JobManagerTask.CommandLine", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "cloudJobSchedule.JobSpecification.JobManagerTask.ContainerSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.JobManagerTask.ContainerSettings.ImageName", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "cloudJobSchedule.JobSpecification.JobPreparationTask", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.JobPreparationTask.CommandLine", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "cloudJobSchedule.JobSpecification.JobPreparationTask.ContainerSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.JobPreparationTask.ContainerSettings.ImageName", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "cloudJobSchedule.JobSpecification.JobReleaseTask", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.JobReleaseTask.CommandLine", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "cloudJobSchedule.JobSpecification.JobReleaseTask.ContainerSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.JobReleaseTask.ContainerSettings.ImageName", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "cloudJobSchedule.JobSpecification.PoolInfo", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VMSize", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.CloudServiceConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.CloudServiceConfiguration.OsFamily", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.NodeAgentSKUID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ContainerConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ContainerConfiguration.Type", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.NetworkConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.NetworkConfiguration.EndpointConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.NetworkConfiguration.EndpointConfiguration.InboundNATPools", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.StartTask", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.StartTask.CommandLine", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.StartTask.ContainerSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.StartTask.ContainerSettings.ImageName", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("batch.JobScheduleClient", "Add", err.Error()) + } + + req, err := client.AddPreparer(ctx, cloudJobSchedule, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Add", nil, "Failure preparing request") + return + } + + resp, err := client.AddSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Add", resp, "Failure sending request") + return + } + + result, err = client.AddResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Add", resp, "Failure responding to request") + return + } + + return +} + +// AddPreparer prepares the Add request. +func (client JobScheduleClient) AddPreparer(ctx context.Context, cloudJobSchedule JobScheduleAddParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPath("/jobschedules"), + autorest.WithJSON(cloudJobSchedule), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddSender sends the Add request. The method will close the +// http.Response Body if it receives an error. +func (client JobScheduleClient) AddSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// AddResponder handles the response to the Add request. The method always +// closes the http.Response Body. +func (client JobScheduleClient) AddResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete when you delete a Job Schedule, this also deletes all Jobs and Tasks under that schedule. When Tasks are +// deleted, all the files in their working directories on the Compute Nodes are also deleted (the retention period is +// ignored). The Job Schedule statistics are no longer accessible once the Job Schedule is deleted, though they are +// still counted towards Account lifetime statistics. +// Parameters: +// jobScheduleID - the ID of the Job Schedule to delete. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client JobScheduleClient) Delete(ctx context.Context, jobScheduleID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, jobScheduleID, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client JobScheduleClient) DeletePreparer(ctx context.Context, jobScheduleID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobScheduleId": autorest.Encode("path", jobScheduleID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobschedules/{jobScheduleId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client JobScheduleClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client JobScheduleClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Disable no new Jobs will be created until the Job Schedule is enabled again. +// Parameters: +// jobScheduleID - the ID of the Job Schedule to disable. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client JobScheduleClient) Disable(ctx context.Context, jobScheduleID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.Disable") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DisablePreparer(ctx, jobScheduleID, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Disable", nil, "Failure preparing request") + return + } + + resp, err := client.DisableSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Disable", resp, "Failure sending request") + return + } + + result, err = client.DisableResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Disable", resp, "Failure responding to request") + return + } + + return +} + +// DisablePreparer prepares the Disable request. +func (client JobScheduleClient) DisablePreparer(ctx context.Context, jobScheduleID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobScheduleId": autorest.Encode("path", jobScheduleID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobschedules/{jobScheduleId}/disable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DisableSender sends the Disable request. The method will close the +// http.Response Body if it receives an error. +func (client JobScheduleClient) DisableSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DisableResponder handles the response to the Disable request. The method always +// closes the http.Response Body. +func (client JobScheduleClient) DisableResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Enable sends the enable request. +// Parameters: +// jobScheduleID - the ID of the Job Schedule to enable. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client JobScheduleClient) Enable(ctx context.Context, jobScheduleID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.Enable") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.EnablePreparer(ctx, jobScheduleID, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Enable", nil, "Failure preparing request") + return + } + + resp, err := client.EnableSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Enable", resp, "Failure sending request") + return + } + + result, err = client.EnableResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Enable", resp, "Failure responding to request") + return + } + + return +} + +// EnablePreparer prepares the Enable request. +func (client JobScheduleClient) EnablePreparer(ctx context.Context, jobScheduleID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobScheduleId": autorest.Encode("path", jobScheduleID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobschedules/{jobScheduleId}/enable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// EnableSender sends the Enable request. The method will close the +// http.Response Body if it receives an error. +func (client JobScheduleClient) EnableSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// EnableResponder handles the response to the Enable request. The method always +// closes the http.Response Body. +func (client JobScheduleClient) EnableResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Exists sends the exists request. +// Parameters: +// jobScheduleID - the ID of the Job Schedule which you want to check. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client JobScheduleClient) Exists(ctx context.Context, jobScheduleID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.Exists") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ExistsPreparer(ctx, jobScheduleID, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Exists", nil, "Failure preparing request") + return + } + + resp, err := client.ExistsSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Exists", resp, "Failure sending request") + return + } + + result, err = client.ExistsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Exists", resp, "Failure responding to request") + return + } + + return +} + +// ExistsPreparer prepares the Exists request. +func (client JobScheduleClient) ExistsPreparer(ctx context.Context, jobScheduleID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobScheduleId": autorest.Encode("path", jobScheduleID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsHead(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobschedules/{jobScheduleId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExistsSender sends the Exists request. The method will close the +// http.Response Body if it receives an error. +func (client JobScheduleClient) ExistsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ExistsResponder handles the response to the Exists request. The method always +// closes the http.Response Body. +func (client JobScheduleClient) ExistsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified Job Schedule. +// Parameters: +// jobScheduleID - the ID of the Job Schedule to get. +// selectParameter - an OData $select clause. +// expand - an OData $expand clause. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client JobScheduleClient) Get(ctx context.Context, jobScheduleID string, selectParameter string, expand string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result CloudJobSchedule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, jobScheduleID, selectParameter, expand, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client JobScheduleClient) GetPreparer(ctx context.Context, jobScheduleID string, selectParameter string, expand string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobScheduleId": autorest.Encode("path", jobScheduleID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobschedules/{jobScheduleId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client JobScheduleClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client JobScheduleClient) GetResponder(resp *http.Response) (result CloudJobSchedule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// filter - an OData $filter clause. For more information on constructing this filter, see +// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-job-schedules. +// selectParameter - an OData $select clause. +// expand - an OData $expand clause. +// maxResults - the maximum number of items to return in the response. A maximum of 1000 Job Schedules can be +// returned. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client JobScheduleClient) List(ctx context.Context, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result CloudJobScheduleListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.List") + defer func() { + sc := -1 + if result.cjslr.Response.Response != nil { + sc = result.cjslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxResults, + Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("batch.JobScheduleClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, filter, selectParameter, expand, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.cjslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "List", resp, "Failure sending request") + return + } + + result.cjslr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "List", resp, "Failure responding to request") + return + } + if result.cjslr.hasNextLink() && result.cjslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client JobScheduleClient) ListPreparer(ctx context.Context, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if maxResults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxResults) + } else { + queryParameters["maxresults"] = autorest.Encode("query", 1000) + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPath("/jobschedules"), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client JobScheduleClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client JobScheduleClient) ListResponder(resp *http.Response) (result CloudJobScheduleListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client JobScheduleClient) listNextResults(ctx context.Context, lastResults CloudJobScheduleListResult) (result CloudJobScheduleListResult, err error) { + req, err := lastResults.cloudJobScheduleListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.JobScheduleClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.JobScheduleClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client JobScheduleClient) ListComplete(ctx context.Context, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result CloudJobScheduleListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, filter, selectParameter, expand, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + return +} + +// Patch this replaces only the Job Schedule properties specified in the request. For example, if the schedule property +// is not specified with this request, then the Batch service will keep the existing schedule. Changes to a Job +// Schedule only impact Jobs created by the schedule after the update has taken place; currently running Jobs are +// unaffected. +// Parameters: +// jobScheduleID - the ID of the Job Schedule to update. +// jobSchedulePatchParameter - the parameters for the request. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client JobScheduleClient) Patch(ctx context.Context, jobScheduleID string, jobSchedulePatchParameter JobSchedulePatchParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.Patch") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PatchPreparer(ctx, jobScheduleID, jobSchedulePatchParameter, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Patch", nil, "Failure preparing request") + return + } + + resp, err := client.PatchSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Patch", resp, "Failure sending request") + return + } + + result, err = client.PatchResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Patch", resp, "Failure responding to request") + return + } + + return +} + +// PatchPreparer prepares the Patch request. +func (client JobScheduleClient) PatchPreparer(ctx context.Context, jobScheduleID string, jobSchedulePatchParameter JobSchedulePatchParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobScheduleId": autorest.Encode("path", jobScheduleID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), + autorest.AsPatch(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobschedules/{jobScheduleId}", pathParameters), + autorest.WithJSON(jobSchedulePatchParameter), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PatchSender sends the Patch request. The method will close the +// http.Response Body if it receives an error. +func (client JobScheduleClient) PatchSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// PatchResponder handles the response to the Patch request. The method always +// closes the http.Response Body. +func (client JobScheduleClient) PatchResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Terminate sends the terminate request. +// Parameters: +// jobScheduleID - the ID of the Job Schedule to terminates. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client JobScheduleClient) Terminate(ctx context.Context, jobScheduleID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.Terminate") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.TerminatePreparer(ctx, jobScheduleID, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Terminate", nil, "Failure preparing request") + return + } + + resp, err := client.TerminateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Terminate", resp, "Failure sending request") + return + } + + result, err = client.TerminateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Terminate", resp, "Failure responding to request") + return + } + + return +} + +// TerminatePreparer prepares the Terminate request. +func (client JobScheduleClient) TerminatePreparer(ctx context.Context, jobScheduleID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobScheduleId": autorest.Encode("path", jobScheduleID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobschedules/{jobScheduleId}/terminate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// TerminateSender sends the Terminate request. The method will close the +// http.Response Body if it receives an error. +func (client JobScheduleClient) TerminateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// TerminateResponder handles the response to the Terminate request. The method always +// closes the http.Response Body. +func (client JobScheduleClient) TerminateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update this fully replaces all the updatable properties of the Job Schedule. For example, if the schedule property +// is not specified with this request, then the Batch service will remove the existing schedule. Changes to a Job +// Schedule only impact Jobs created by the schedule after the update has taken place; currently running Jobs are +// unaffected. +// Parameters: +// jobScheduleID - the ID of the Job Schedule to update. +// jobScheduleUpdateParameter - the parameters for the request. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client JobScheduleClient) Update(ctx context.Context, jobScheduleID string, jobScheduleUpdateParameter JobScheduleUpdateParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobScheduleClient.Update") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: jobScheduleUpdateParameter, + Constraints: []validation.Constraint{{Target: "jobScheduleUpdateParameter.Schedule", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobScheduleUpdateParameter.JobSpecification", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.NetworkConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.NetworkConfiguration.SubnetID", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "jobScheduleUpdateParameter.JobSpecification.JobManagerTask", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.JobManagerTask.ID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobScheduleUpdateParameter.JobSpecification.JobManagerTask.CommandLine", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobScheduleUpdateParameter.JobSpecification.JobManagerTask.ContainerSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.JobManagerTask.ContainerSettings.ImageName", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "jobScheduleUpdateParameter.JobSpecification.JobPreparationTask", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.JobPreparationTask.CommandLine", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobScheduleUpdateParameter.JobSpecification.JobPreparationTask.ContainerSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.JobPreparationTask.ContainerSettings.ImageName", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "jobScheduleUpdateParameter.JobSpecification.JobReleaseTask", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.JobReleaseTask.CommandLine", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobScheduleUpdateParameter.JobSpecification.JobReleaseTask.ContainerSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.JobReleaseTask.ContainerSettings.ImageName", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VMSize", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.CloudServiceConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.CloudServiceConfiguration.OsFamily", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.NodeAgentSKUID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ContainerConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ContainerConfiguration.Type", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.NetworkConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.NetworkConfiguration.EndpointConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.NetworkConfiguration.EndpointConfiguration.InboundNATPools", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.StartTask", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.StartTask.CommandLine", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.StartTask.ContainerSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.StartTask.ContainerSettings.ImageName", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("batch.JobScheduleClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, jobScheduleID, jobScheduleUpdateParameter, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.JobScheduleClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client JobScheduleClient) UpdatePreparer(ctx context.Context, jobScheduleID string, jobScheduleUpdateParameter JobScheduleUpdateParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobScheduleId": autorest.Encode("path", jobScheduleID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobschedules/{jobScheduleId}", pathParameters), + autorest.WithJSON(jobScheduleUpdateParameter), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client JobScheduleClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client JobScheduleClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/batch/2021-06-01.14.0/batch/models.go b/services/batch/2021-06-01.14.0/batch/models.go new file mode 100644 index 000000000000..8afab3fd6608 --- /dev/null +++ b/services/batch/2021-06-01.14.0/batch/models.go @@ -0,0 +1,3976 @@ +package batch + +// 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. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "io" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/batch/2021-06-01.14.0/batch" + +// AccountListSupportedImagesResult ... +type AccountListSupportedImagesResult struct { + autorest.Response `json:"-"` + Value *[]ImageInformation `json:"value,omitempty"` + OdataNextLink *string `json:"odata.nextLink,omitempty"` +} + +// AccountListSupportedImagesResultIterator provides access to a complete listing of ImageInformation +// values. +type AccountListSupportedImagesResultIterator struct { + i int + page AccountListSupportedImagesResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AccountListSupportedImagesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountListSupportedImagesResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AccountListSupportedImagesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AccountListSupportedImagesResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AccountListSupportedImagesResultIterator) Response() AccountListSupportedImagesResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AccountListSupportedImagesResultIterator) Value() ImageInformation { + if !iter.page.NotDone() { + return ImageInformation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AccountListSupportedImagesResultIterator type. +func NewAccountListSupportedImagesResultIterator(page AccountListSupportedImagesResultPage) AccountListSupportedImagesResultIterator { + return AccountListSupportedImagesResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (alsir AccountListSupportedImagesResult) IsEmpty() bool { + return alsir.Value == nil || len(*alsir.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (alsir AccountListSupportedImagesResult) hasNextLink() bool { + return alsir.OdataNextLink != nil && len(*alsir.OdataNextLink) != 0 +} + +// accountListSupportedImagesResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (alsir AccountListSupportedImagesResult) accountListSupportedImagesResultPreparer(ctx context.Context) (*http.Request, error) { + if !alsir.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(alsir.OdataNextLink))) +} + +// AccountListSupportedImagesResultPage contains a page of ImageInformation values. +type AccountListSupportedImagesResultPage struct { + fn func(context.Context, AccountListSupportedImagesResult) (AccountListSupportedImagesResult, error) + alsir AccountListSupportedImagesResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AccountListSupportedImagesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountListSupportedImagesResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.alsir) + if err != nil { + return err + } + page.alsir = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AccountListSupportedImagesResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AccountListSupportedImagesResultPage) NotDone() bool { + return !page.alsir.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AccountListSupportedImagesResultPage) Response() AccountListSupportedImagesResult { + return page.alsir +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AccountListSupportedImagesResultPage) Values() []ImageInformation { + if page.alsir.IsEmpty() { + return nil + } + return *page.alsir.Value +} + +// Creates a new instance of the AccountListSupportedImagesResultPage type. +func NewAccountListSupportedImagesResultPage(cur AccountListSupportedImagesResult, getNextPage func(context.Context, AccountListSupportedImagesResult) (AccountListSupportedImagesResult, error)) AccountListSupportedImagesResultPage { + return AccountListSupportedImagesResultPage{ + fn: getNextPage, + alsir: cur, + } +} + +// AffinityInformation ... +type AffinityInformation struct { + // AffinityID - You can pass the affinityId of a Node to indicate that this Task needs to run on that Compute Node. Note that this is just a soft affinity. If the target Compute Node is busy or unavailable at the time the Task is scheduled, then the Task will be scheduled elsewhere. + AffinityID *string `json:"affinityId,omitempty"` +} + +// ApplicationListResult ... +type ApplicationListResult struct { + autorest.Response `json:"-"` + Value *[]ApplicationSummary `json:"value,omitempty"` + OdataNextLink *string `json:"odata.nextLink,omitempty"` +} + +// ApplicationListResultIterator provides access to a complete listing of ApplicationSummary values. +type ApplicationListResultIterator struct { + i int + page ApplicationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ApplicationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ApplicationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ApplicationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ApplicationListResultIterator) Response() ApplicationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ApplicationListResultIterator) Value() ApplicationSummary { + if !iter.page.NotDone() { + return ApplicationSummary{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ApplicationListResultIterator type. +func NewApplicationListResultIterator(page ApplicationListResultPage) ApplicationListResultIterator { + return ApplicationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (alr ApplicationListResult) IsEmpty() bool { + return alr.Value == nil || len(*alr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (alr ApplicationListResult) hasNextLink() bool { + return alr.OdataNextLink != nil && len(*alr.OdataNextLink) != 0 +} + +// applicationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (alr ApplicationListResult) applicationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !alr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(alr.OdataNextLink))) +} + +// ApplicationListResultPage contains a page of ApplicationSummary values. +type ApplicationListResultPage struct { + fn func(context.Context, ApplicationListResult) (ApplicationListResult, error) + alr ApplicationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ApplicationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.alr) + if err != nil { + return err + } + page.alr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ApplicationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ApplicationListResultPage) NotDone() bool { + return !page.alr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ApplicationListResultPage) Response() ApplicationListResult { + return page.alr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ApplicationListResultPage) Values() []ApplicationSummary { + if page.alr.IsEmpty() { + return nil + } + return *page.alr.Value +} + +// Creates a new instance of the ApplicationListResultPage type. +func NewApplicationListResultPage(cur ApplicationListResult, getNextPage func(context.Context, ApplicationListResult) (ApplicationListResult, error)) ApplicationListResultPage { + return ApplicationListResultPage{ + fn: getNextPage, + alr: cur, + } +} + +// ApplicationPackageReference ... +type ApplicationPackageReference struct { + ApplicationID *string `json:"applicationId,omitempty"` + // Version - If this is omitted on a Pool, and no default version is specified for this application, the request fails with the error code InvalidApplicationPackageReferences and HTTP status code 409. If this is omitted on a Task, and no default version is specified for this application, the Task fails with a pre-processing error. + Version *string `json:"version,omitempty"` +} + +// ApplicationSummary ... +type ApplicationSummary struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Versions *[]string `json:"versions,omitempty"` +} + +// AuthenticationTokenSettings ... +type AuthenticationTokenSettings struct { + // Access - The authentication token grants access to a limited set of Batch service operations. Currently the only supported value for the access property is 'job', which grants access to all operations related to the Job which contains the Task. + Access *[]AccessScope `json:"access,omitempty"` +} + +// AutoPoolSpecification ... +type AutoPoolSpecification struct { + // AutoPoolIDPrefix - The Batch service assigns each auto Pool a unique identifier on creation. To distinguish between Pools created for different purposes, you can specify this element to add a prefix to the ID that is assigned. The prefix can be up to 20 characters long. + AutoPoolIDPrefix *string `json:"autoPoolIdPrefix,omitempty"` + // PoolLifetimeOption - Possible values include: 'PoolLifetimeOptionJobSchedule', 'PoolLifetimeOptionJob' + PoolLifetimeOption PoolLifetimeOption `json:"poolLifetimeOption,omitempty"` + // KeepAlive - If false, the Batch service deletes the Pool once its lifetime (as determined by the poolLifetimeOption setting) expires; that is, when the Job or Job Schedule completes. If true, the Batch service does not delete the Pool automatically. It is up to the user to delete auto Pools created with this option. + KeepAlive *bool `json:"keepAlive,omitempty"` + Pool *PoolSpecification `json:"pool,omitempty"` +} + +// AutoScaleRun ... +type AutoScaleRun struct { + autorest.Response `json:"-"` + Timestamp *date.Time `json:"timestamp,omitempty"` + // Results - Each variable value is returned in the form $variable=value, and variables are separated by semicolons. + Results *string `json:"results,omitempty"` + Error *AutoScaleRunError `json:"error,omitempty"` +} + +// AutoScaleRunError ... +type AutoScaleRunError struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Values *[]NameValuePair `json:"values,omitempty"` +} + +// AutoUserSpecification ... +type AutoUserSpecification struct { + // Scope - The default value is pool. If the pool is running Windows a value of Task should be specified if stricter isolation between tasks is required. For example, if the task mutates the registry in a way which could impact other tasks, or if certificates have been specified on the pool which should not be accessible by normal tasks but should be accessible by StartTasks. Possible values include: 'Task', 'Pool' + Scope AutoUserScope `json:"scope,omitempty"` + // ElevationLevel - The default value is nonAdmin. Possible values include: 'NonAdmin', 'Admin' + ElevationLevel ElevationLevel `json:"elevationLevel,omitempty"` +} + +// AzureBlobFileSystemConfiguration ... +type AzureBlobFileSystemConfiguration struct { + AccountName *string `json:"accountName,omitempty"` + ContainerName *string `json:"containerName,omitempty"` + // AccountKey - This property is mutually exclusive with both sasKey and identity; exactly one must be specified. + AccountKey *string `json:"accountKey,omitempty"` + // SasKey - This property is mutually exclusive with both accountKey and identity; exactly one must be specified. + SasKey *string `json:"sasKey,omitempty"` + // BlobfuseOptions - These are 'net use' options in Windows and 'mount' options in Linux. + BlobfuseOptions *string `json:"blobfuseOptions,omitempty"` + // RelativeMountPath - All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + RelativeMountPath *string `json:"relativeMountPath,omitempty"` + // IdentityReference - This property is mutually exclusive with both accountKey and sasKey; exactly one must be specified. + IdentityReference *ComputeNodeIdentityReference `json:"identityReference,omitempty"` +} + +// AzureFileShareConfiguration ... +type AzureFileShareConfiguration struct { + AccountName *string `json:"accountName,omitempty"` + // AzureFileURL - This is of the form 'https://{account}.file.core.windows.net/'. + AzureFileURL *string `json:"azureFileUrl,omitempty"` + AccountKey *string `json:"accountKey,omitempty"` + // RelativeMountPath - All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + RelativeMountPath *string `json:"relativeMountPath,omitempty"` + // MountOptions - These are 'net use' options in Windows and 'mount' options in Linux. + MountOptions *string `json:"mountOptions,omitempty"` +} + +// Certificate a Certificate that can be installed on Compute Nodes and can be used to authenticate +// operations on the machine. +type Certificate struct { + autorest.Response `json:"-"` + Thumbprint *string `json:"thumbprint,omitempty"` + ThumbprintAlgorithm *string `json:"thumbprintAlgorithm,omitempty"` + URL *string `json:"url,omitempty"` + // State - Possible values include: 'Active', 'Deleting', 'DeleteFailed' + State CertificateState `json:"state,omitempty"` + StateTransitionTime *date.Time `json:"stateTransitionTime,omitempty"` + // PreviousState - This property is not set if the Certificate is in its initial active state. Possible values include: 'Active', 'Deleting', 'DeleteFailed' + PreviousState CertificateState `json:"previousState,omitempty"` + // PreviousStateTransitionTime - This property is not set if the Certificate is in its initial Active state. + PreviousStateTransitionTime *date.Time `json:"previousStateTransitionTime,omitempty"` + PublicData *string `json:"publicData,omitempty"` + // DeleteCertificateError - This property is set only if the Certificate is in the DeleteFailed state. + DeleteCertificateError *DeleteCertificateError `json:"deleteCertificateError,omitempty"` +} + +// CertificateAddParameter ... +type CertificateAddParameter struct { + Thumbprint *string `json:"thumbprint,omitempty"` + ThumbprintAlgorithm *string `json:"thumbprintAlgorithm,omitempty"` + Data *string `json:"data,omitempty"` + // CertificateFormat - Possible values include: 'Pfx', 'Cer' + CertificateFormat CertificateFormat `json:"certificateFormat,omitempty"` + // Password - This must be omitted if the Certificate format is cer. + Password *string `json:"password,omitempty"` +} + +// CertificateListResult ... +type CertificateListResult struct { + autorest.Response `json:"-"` + Value *[]Certificate `json:"value,omitempty"` + OdataNextLink *string `json:"odata.nextLink,omitempty"` +} + +// CertificateListResultIterator provides access to a complete listing of Certificate values. +type CertificateListResultIterator struct { + i int + page CertificateListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *CertificateListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *CertificateListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CertificateListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter CertificateListResultIterator) Response() CertificateListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter CertificateListResultIterator) Value() Certificate { + if !iter.page.NotDone() { + return Certificate{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CertificateListResultIterator type. +func NewCertificateListResultIterator(page CertificateListResultPage) CertificateListResultIterator { + return CertificateListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (clr CertificateListResult) IsEmpty() bool { + return clr.Value == nil || len(*clr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (clr CertificateListResult) hasNextLink() bool { + return clr.OdataNextLink != nil && len(*clr.OdataNextLink) != 0 +} + +// certificateListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (clr CertificateListResult) certificateListResultPreparer(ctx context.Context) (*http.Request, error) { + if !clr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(clr.OdataNextLink))) +} + +// CertificateListResultPage contains a page of Certificate values. +type CertificateListResultPage struct { + fn func(context.Context, CertificateListResult) (CertificateListResult, error) + clr CertificateListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *CertificateListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.clr) + if err != nil { + return err + } + page.clr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *CertificateListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CertificateListResultPage) NotDone() bool { + return !page.clr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CertificateListResultPage) Response() CertificateListResult { + return page.clr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CertificateListResultPage) Values() []Certificate { + if page.clr.IsEmpty() { + return nil + } + return *page.clr.Value +} + +// Creates a new instance of the CertificateListResultPage type. +func NewCertificateListResultPage(cur CertificateListResult, getNextPage func(context.Context, CertificateListResult) (CertificateListResult, error)) CertificateListResultPage { + return CertificateListResultPage{ + fn: getNextPage, + clr: cur, + } +} + +// CertificateReference ... +type CertificateReference struct { + Thumbprint *string `json:"thumbprint,omitempty"` + ThumbprintAlgorithm *string `json:"thumbprintAlgorithm,omitempty"` + // StoreLocation - The default value is currentuser. This property is applicable only for Pools configured with Windows Compute Nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows Image reference). For Linux Compute Nodes, the Certificates are stored in a directory inside the Task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the Task to query for this location. For Certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and Certificates are placed in that directory. Possible values include: 'CurrentUser', 'LocalMachine' + StoreLocation CertificateStoreLocation `json:"storeLocation,omitempty"` + // StoreName - This property is applicable only for Pools configured with Windows Compute Nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows Image reference). Common store names include: My, Root, CA, Trust, Disallowed, TrustedPeople, TrustedPublisher, AuthRoot, AddressBook, but any custom store name can also be used. The default value is My. + StoreName *string `json:"storeName,omitempty"` + // Visibility - You can specify more than one visibility in this collection. The default is all Accounts. + Visibility *[]CertificateVisibility `json:"visibility,omitempty"` +} + +// CIFSMountConfiguration ... +type CIFSMountConfiguration struct { + Username *string `json:"username,omitempty"` + Source *string `json:"source,omitempty"` + // RelativeMountPath - All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + RelativeMountPath *string `json:"relativeMountPath,omitempty"` + // MountOptions - These are 'net use' options in Windows and 'mount' options in Linux. + MountOptions *string `json:"mountOptions,omitempty"` + Password *string `json:"password,omitempty"` +} + +// CloudJob ... +type CloudJob struct { + autorest.Response `json:"-"` + // ID - The ID is case-preserving and case-insensitive (that is, you may not have two IDs within an Account that differ only by case). + ID *string `json:"id,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + UsesTaskDependencies *bool `json:"usesTaskDependencies,omitempty"` + URL *string `json:"url,omitempty"` + // ETag - This is an opaque string. You can use it to detect whether the Job has changed between requests. In particular, you can be pass the ETag when updating a Job to specify that your changes should take effect only if nobody else has modified the Job in the meantime. + ETag *string `json:"eTag,omitempty"` + // LastModified - This is the last time at which the Job level data, such as the Job state or priority, changed. It does not factor in task-level changes such as adding new Tasks or Tasks changing state. + LastModified *date.Time `json:"lastModified,omitempty"` + CreationTime *date.Time `json:"creationTime,omitempty"` + // State - Possible values include: 'JobStateActive', 'JobStateDisabling', 'JobStateDisabled', 'JobStateEnabling', 'JobStateTerminating', 'JobStateCompleted', 'JobStateDeleting' + State JobState `json:"state,omitempty"` + StateTransitionTime *date.Time `json:"stateTransitionTime,omitempty"` + // PreviousState - This property is not set if the Job is in its initial Active state. Possible values include: 'JobStateActive', 'JobStateDisabling', 'JobStateDisabled', 'JobStateEnabling', 'JobStateTerminating', 'JobStateCompleted', 'JobStateDeleting' + PreviousState JobState `json:"previousState,omitempty"` + // PreviousStateTransitionTime - This property is not set if the Job is in its initial Active state. + PreviousStateTransitionTime *date.Time `json:"previousStateTransitionTime,omitempty"` + // Priority - Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. The default value is 0. + Priority *int32 `json:"priority,omitempty"` + // MaxParallelTasks - The value of maxParallelTasks must be -1 or greater than 0 if specified. If not specified, the default value is -1, which means there's no limit to the number of tasks that can be run at once. You can update a job's maxParallelTasks after it has been created using the update job API. + MaxParallelTasks *int32 `json:"maxParallelTasks,omitempty"` + Constraints *JobConstraints `json:"constraints,omitempty"` + JobManagerTask *JobManagerTask `json:"jobManagerTask,omitempty"` + // JobPreparationTask - The Job Preparation Task is a special Task run on each Compute Node before any other Task of the Job. + JobPreparationTask *JobPreparationTask `json:"jobPreparationTask,omitempty"` + // JobReleaseTask - The Job Release Task is a special Task run at the end of the Job on each Compute Node that has run any other Task of the Job. + JobReleaseTask *JobReleaseTask `json:"jobReleaseTask,omitempty"` + // CommonEnvironmentSettings - Individual Tasks can override an environment setting specified here by specifying the same setting name with a different value. + CommonEnvironmentSettings *[]EnvironmentSetting `json:"commonEnvironmentSettings,omitempty"` + PoolInfo *PoolInformation `json:"poolInfo,omitempty"` + // OnAllTasksComplete - The default is noaction. Possible values include: 'NoAction', 'TerminateJob' + OnAllTasksComplete OnAllTasksComplete `json:"onAllTasksComplete,omitempty"` + // OnTaskFailure - A Task is considered to have failed if has a failureInfo. A failureInfo is set if the Task completes with a non-zero exit code after exhausting its retry count, or if there was an error starting the Task, for example due to a resource file download error. The default is noaction. Possible values include: 'OnTaskFailureNoAction', 'OnTaskFailurePerformExitOptionsJobAction' + OnTaskFailure OnTaskFailure `json:"onTaskFailure,omitempty"` + NetworkConfiguration *JobNetworkConfiguration `json:"networkConfiguration,omitempty"` + // Metadata - The Batch service does not assign any meaning to metadata; it is solely for the use of user code. + Metadata *[]MetadataItem `json:"metadata,omitempty"` + ExecutionInfo *JobExecutionInformation `json:"executionInfo,omitempty"` + // Stats - This property is populated only if the CloudJob was retrieved with an expand clause including the 'stats' attribute; otherwise it is null. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + Stats *JobStatistics `json:"stats,omitempty"` +} + +// CloudJobListPreparationAndReleaseTaskStatusResult ... +type CloudJobListPreparationAndReleaseTaskStatusResult struct { + autorest.Response `json:"-"` + Value *[]JobPreparationAndReleaseTaskExecutionInformation `json:"value,omitempty"` + OdataNextLink *string `json:"odata.nextLink,omitempty"` +} + +// CloudJobListPreparationAndReleaseTaskStatusResultIterator provides access to a complete listing of +// JobPreparationAndReleaseTaskExecutionInformation values. +type CloudJobListPreparationAndReleaseTaskStatusResultIterator struct { + i int + page CloudJobListPreparationAndReleaseTaskStatusResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *CloudJobListPreparationAndReleaseTaskStatusResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CloudJobListPreparationAndReleaseTaskStatusResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *CloudJobListPreparationAndReleaseTaskStatusResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CloudJobListPreparationAndReleaseTaskStatusResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter CloudJobListPreparationAndReleaseTaskStatusResultIterator) Response() CloudJobListPreparationAndReleaseTaskStatusResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter CloudJobListPreparationAndReleaseTaskStatusResultIterator) Value() JobPreparationAndReleaseTaskExecutionInformation { + if !iter.page.NotDone() { + return JobPreparationAndReleaseTaskExecutionInformation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CloudJobListPreparationAndReleaseTaskStatusResultIterator type. +func NewCloudJobListPreparationAndReleaseTaskStatusResultIterator(page CloudJobListPreparationAndReleaseTaskStatusResultPage) CloudJobListPreparationAndReleaseTaskStatusResultIterator { + return CloudJobListPreparationAndReleaseTaskStatusResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cjlpartsr CloudJobListPreparationAndReleaseTaskStatusResult) IsEmpty() bool { + return cjlpartsr.Value == nil || len(*cjlpartsr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cjlpartsr CloudJobListPreparationAndReleaseTaskStatusResult) hasNextLink() bool { + return cjlpartsr.OdataNextLink != nil && len(*cjlpartsr.OdataNextLink) != 0 +} + +// cloudJobListPreparationAndReleaseTaskStatusResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cjlpartsr CloudJobListPreparationAndReleaseTaskStatusResult) cloudJobListPreparationAndReleaseTaskStatusResultPreparer(ctx context.Context) (*http.Request, error) { + if !cjlpartsr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cjlpartsr.OdataNextLink))) +} + +// CloudJobListPreparationAndReleaseTaskStatusResultPage contains a page of +// JobPreparationAndReleaseTaskExecutionInformation values. +type CloudJobListPreparationAndReleaseTaskStatusResultPage struct { + fn func(context.Context, CloudJobListPreparationAndReleaseTaskStatusResult) (CloudJobListPreparationAndReleaseTaskStatusResult, error) + cjlpartsr CloudJobListPreparationAndReleaseTaskStatusResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *CloudJobListPreparationAndReleaseTaskStatusResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CloudJobListPreparationAndReleaseTaskStatusResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.cjlpartsr) + if err != nil { + return err + } + page.cjlpartsr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *CloudJobListPreparationAndReleaseTaskStatusResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CloudJobListPreparationAndReleaseTaskStatusResultPage) NotDone() bool { + return !page.cjlpartsr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CloudJobListPreparationAndReleaseTaskStatusResultPage) Response() CloudJobListPreparationAndReleaseTaskStatusResult { + return page.cjlpartsr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CloudJobListPreparationAndReleaseTaskStatusResultPage) Values() []JobPreparationAndReleaseTaskExecutionInformation { + if page.cjlpartsr.IsEmpty() { + return nil + } + return *page.cjlpartsr.Value +} + +// Creates a new instance of the CloudJobListPreparationAndReleaseTaskStatusResultPage type. +func NewCloudJobListPreparationAndReleaseTaskStatusResultPage(cur CloudJobListPreparationAndReleaseTaskStatusResult, getNextPage func(context.Context, CloudJobListPreparationAndReleaseTaskStatusResult) (CloudJobListPreparationAndReleaseTaskStatusResult, error)) CloudJobListPreparationAndReleaseTaskStatusResultPage { + return CloudJobListPreparationAndReleaseTaskStatusResultPage{ + fn: getNextPage, + cjlpartsr: cur, + } +} + +// CloudJobListResult ... +type CloudJobListResult struct { + autorest.Response `json:"-"` + Value *[]CloudJob `json:"value,omitempty"` + OdataNextLink *string `json:"odata.nextLink,omitempty"` +} + +// CloudJobListResultIterator provides access to a complete listing of CloudJob values. +type CloudJobListResultIterator struct { + i int + page CloudJobListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *CloudJobListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CloudJobListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *CloudJobListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CloudJobListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter CloudJobListResultIterator) Response() CloudJobListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter CloudJobListResultIterator) Value() CloudJob { + if !iter.page.NotDone() { + return CloudJob{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CloudJobListResultIterator type. +func NewCloudJobListResultIterator(page CloudJobListResultPage) CloudJobListResultIterator { + return CloudJobListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cjlr CloudJobListResult) IsEmpty() bool { + return cjlr.Value == nil || len(*cjlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cjlr CloudJobListResult) hasNextLink() bool { + return cjlr.OdataNextLink != nil && len(*cjlr.OdataNextLink) != 0 +} + +// cloudJobListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cjlr CloudJobListResult) cloudJobListResultPreparer(ctx context.Context) (*http.Request, error) { + if !cjlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cjlr.OdataNextLink))) +} + +// CloudJobListResultPage contains a page of CloudJob values. +type CloudJobListResultPage struct { + fn func(context.Context, CloudJobListResult) (CloudJobListResult, error) + cjlr CloudJobListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *CloudJobListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CloudJobListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.cjlr) + if err != nil { + return err + } + page.cjlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *CloudJobListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CloudJobListResultPage) NotDone() bool { + return !page.cjlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CloudJobListResultPage) Response() CloudJobListResult { + return page.cjlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CloudJobListResultPage) Values() []CloudJob { + if page.cjlr.IsEmpty() { + return nil + } + return *page.cjlr.Value +} + +// Creates a new instance of the CloudJobListResultPage type. +func NewCloudJobListResultPage(cur CloudJobListResult, getNextPage func(context.Context, CloudJobListResult) (CloudJobListResult, error)) CloudJobListResultPage { + return CloudJobListResultPage{ + fn: getNextPage, + cjlr: cur, + } +} + +// CloudJobSchedule ... +type CloudJobSchedule struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + URL *string `json:"url,omitempty"` + // ETag - This is an opaque string. You can use it to detect whether the Job Schedule has changed between requests. In particular, you can be pass the ETag with an Update Job Schedule request to specify that your changes should take effect only if nobody else has modified the schedule in the meantime. + ETag *string `json:"eTag,omitempty"` + // LastModified - This is the last time at which the schedule level data, such as the Job specification or recurrence information, changed. It does not factor in job-level changes such as new Jobs being created or Jobs changing state. + LastModified *date.Time `json:"lastModified,omitempty"` + CreationTime *date.Time `json:"creationTime,omitempty"` + // State - Possible values include: 'JobScheduleStateActive', 'JobScheduleStateCompleted', 'JobScheduleStateDisabled', 'JobScheduleStateTerminating', 'JobScheduleStateDeleting' + State JobScheduleState `json:"state,omitempty"` + StateTransitionTime *date.Time `json:"stateTransitionTime,omitempty"` + // PreviousState - This property is not present if the Job Schedule is in its initial active state. Possible values include: 'JobScheduleStateActive', 'JobScheduleStateCompleted', 'JobScheduleStateDisabled', 'JobScheduleStateTerminating', 'JobScheduleStateDeleting' + PreviousState JobScheduleState `json:"previousState,omitempty"` + // PreviousStateTransitionTime - This property is not present if the Job Schedule is in its initial active state. + PreviousStateTransitionTime *date.Time `json:"previousStateTransitionTime,omitempty"` + Schedule *Schedule `json:"schedule,omitempty"` + JobSpecification *JobSpecification `json:"jobSpecification,omitempty"` + ExecutionInfo *JobScheduleExecutionInformation `json:"executionInfo,omitempty"` + // Metadata - The Batch service does not assign any meaning to metadata; it is solely for the use of user code. + Metadata *[]MetadataItem `json:"metadata,omitempty"` + Stats *JobScheduleStatistics `json:"stats,omitempty"` +} + +// CloudJobScheduleListResult ... +type CloudJobScheduleListResult struct { + autorest.Response `json:"-"` + Value *[]CloudJobSchedule `json:"value,omitempty"` + OdataNextLink *string `json:"odata.nextLink,omitempty"` +} + +// CloudJobScheduleListResultIterator provides access to a complete listing of CloudJobSchedule values. +type CloudJobScheduleListResultIterator struct { + i int + page CloudJobScheduleListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *CloudJobScheduleListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CloudJobScheduleListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *CloudJobScheduleListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CloudJobScheduleListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter CloudJobScheduleListResultIterator) Response() CloudJobScheduleListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter CloudJobScheduleListResultIterator) Value() CloudJobSchedule { + if !iter.page.NotDone() { + return CloudJobSchedule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CloudJobScheduleListResultIterator type. +func NewCloudJobScheduleListResultIterator(page CloudJobScheduleListResultPage) CloudJobScheduleListResultIterator { + return CloudJobScheduleListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cjslr CloudJobScheduleListResult) IsEmpty() bool { + return cjslr.Value == nil || len(*cjslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cjslr CloudJobScheduleListResult) hasNextLink() bool { + return cjslr.OdataNextLink != nil && len(*cjslr.OdataNextLink) != 0 +} + +// cloudJobScheduleListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cjslr CloudJobScheduleListResult) cloudJobScheduleListResultPreparer(ctx context.Context) (*http.Request, error) { + if !cjslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cjslr.OdataNextLink))) +} + +// CloudJobScheduleListResultPage contains a page of CloudJobSchedule values. +type CloudJobScheduleListResultPage struct { + fn func(context.Context, CloudJobScheduleListResult) (CloudJobScheduleListResult, error) + cjslr CloudJobScheduleListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *CloudJobScheduleListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CloudJobScheduleListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.cjslr) + if err != nil { + return err + } + page.cjslr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *CloudJobScheduleListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CloudJobScheduleListResultPage) NotDone() bool { + return !page.cjslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CloudJobScheduleListResultPage) Response() CloudJobScheduleListResult { + return page.cjslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CloudJobScheduleListResultPage) Values() []CloudJobSchedule { + if page.cjslr.IsEmpty() { + return nil + } + return *page.cjslr.Value +} + +// Creates a new instance of the CloudJobScheduleListResultPage type. +func NewCloudJobScheduleListResultPage(cur CloudJobScheduleListResult, getNextPage func(context.Context, CloudJobScheduleListResult) (CloudJobScheduleListResult, error)) CloudJobScheduleListResultPage { + return CloudJobScheduleListResultPage{ + fn: getNextPage, + cjslr: cur, + } +} + +// CloudPool ... +type CloudPool struct { + autorest.Response `json:"-"` + // ID - The ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within an Account that differ only by case). + ID *string `json:"id,omitempty"` + // DisplayName - The display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + DisplayName *string `json:"displayName,omitempty"` + URL *string `json:"url,omitempty"` + // ETag - This is an opaque string. You can use it to detect whether the Pool has changed between requests. In particular, you can be pass the ETag when updating a Pool to specify that your changes should take effect only if nobody else has modified the Pool in the meantime. + ETag *string `json:"eTag,omitempty"` + // LastModified - This is the last time at which the Pool level data, such as the targetDedicatedNodes or enableAutoscale settings, changed. It does not factor in node-level changes such as a Compute Node changing state. + LastModified *date.Time `json:"lastModified,omitempty"` + CreationTime *date.Time `json:"creationTime,omitempty"` + // State - Possible values include: 'PoolStateActive', 'PoolStateDeleting' + State PoolState `json:"state,omitempty"` + StateTransitionTime *date.Time `json:"stateTransitionTime,omitempty"` + // AllocationState - Possible values include: 'Steady', 'Resizing', 'Stopping' + AllocationState AllocationState `json:"allocationState,omitempty"` + AllocationStateTransitionTime *date.Time `json:"allocationStateTransitionTime,omitempty"` + // VMSize - For information about available sizes of virtual machines in Pools, see Choose a VM size for Compute Nodes in an Azure Batch Pool (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes). + VMSize *string `json:"vmSize,omitempty"` + // CloudServiceConfiguration - This property and virtualMachineConfiguration are mutually exclusive and one of the properties must be specified. This property cannot be specified if the Batch Account was created with its poolAllocationMode property set to 'UserSubscription'. + CloudServiceConfiguration *CloudServiceConfiguration `json:"cloudServiceConfiguration,omitempty"` + // VirtualMachineConfiguration - This property and cloudServiceConfiguration are mutually exclusive and one of the properties must be specified. + VirtualMachineConfiguration *VirtualMachineConfiguration `json:"virtualMachineConfiguration,omitempty"` + // ResizeTimeout - This is the timeout for the most recent resize operation. (The initial sizing when the Pool is created counts as a resize.) The default value is 15 minutes. + ResizeTimeout *string `json:"resizeTimeout,omitempty"` + // ResizeErrors - This property is set only if one or more errors occurred during the last Pool resize, and only when the Pool allocationState is Steady. + ResizeErrors *[]ResizeError `json:"resizeErrors,omitempty"` + CurrentDedicatedNodes *int32 `json:"currentDedicatedNodes,omitempty"` + // CurrentLowPriorityNodes - low-priority Compute Nodes which have been preempted are included in this count. + CurrentLowPriorityNodes *int32 `json:"currentLowPriorityNodes,omitempty"` + TargetDedicatedNodes *int32 `json:"targetDedicatedNodes,omitempty"` + TargetLowPriorityNodes *int32 `json:"targetLowPriorityNodes,omitempty"` + // EnableAutoScale - If false, at least one of targetDedicatedNodes and targetLowPriorityNodes must be specified. If true, the autoScaleFormula property is required and the Pool automatically resizes according to the formula. The default value is false. + EnableAutoScale *bool `json:"enableAutoScale,omitempty"` + // AutoScaleFormula - This property is set only if the Pool automatically scales, i.e. enableAutoScale is true. + AutoScaleFormula *string `json:"autoScaleFormula,omitempty"` + // AutoScaleEvaluationInterval - This property is set only if the Pool automatically scales, i.e. enableAutoScale is true. + AutoScaleEvaluationInterval *string `json:"autoScaleEvaluationInterval,omitempty"` + // AutoScaleRun - This property is set only if the Pool automatically scales, i.e. enableAutoScale is true. + AutoScaleRun *AutoScaleRun `json:"autoScaleRun,omitempty"` + // EnableInterNodeCommunication - This imposes restrictions on which Compute Nodes can be assigned to the Pool. Specifying this value can reduce the chance of the requested number of Compute Nodes to be allocated in the Pool. + EnableInterNodeCommunication *bool `json:"enableInterNodeCommunication,omitempty"` + NetworkConfiguration *NetworkConfiguration `json:"networkConfiguration,omitempty"` + StartTask *StartTask `json:"startTask,omitempty"` + // CertificateReferences - For Windows Nodes, the Batch service installs the Certificates to the specified Certificate store and location. For Linux Compute Nodes, the Certificates are stored in a directory inside the Task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the Task to query for this location. For Certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and Certificates are placed in that directory. + CertificateReferences *[]CertificateReference `json:"certificateReferences,omitempty"` + // ApplicationPackageReferences - Changes to Package references affect all new Nodes joining the Pool, but do not affect Compute Nodes that are already in the Pool until they are rebooted or reimaged. There is a maximum of 10 Package references on any given Pool. + ApplicationPackageReferences *[]ApplicationPackageReference `json:"applicationPackageReferences,omitempty"` + // ApplicationLicenses - The list of application licenses must be a subset of available Batch service application licenses. If a license is requested which is not supported, Pool creation will fail. + ApplicationLicenses *[]string `json:"applicationLicenses,omitempty"` + // TaskSlotsPerNode - The default value is 1. The maximum value is the smaller of 4 times the number of cores of the vmSize of the pool or 256. + TaskSlotsPerNode *int32 `json:"taskSlotsPerNode,omitempty"` + // TaskSchedulingPolicy - If not specified, the default is spread. + TaskSchedulingPolicy *TaskSchedulingPolicy `json:"taskSchedulingPolicy,omitempty"` + UserAccounts *[]UserAccount `json:"userAccounts,omitempty"` + Metadata *[]MetadataItem `json:"metadata,omitempty"` + // Stats - This property is populated only if the CloudPool was retrieved with an expand clause including the 'stats' attribute; otherwise it is null. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. + Stats *PoolStatistics `json:"stats,omitempty"` + // MountConfiguration - This supports Azure Files, NFS, CIFS/SMB, and Blobfuse. + MountConfiguration *[]MountConfiguration `json:"mountConfiguration,omitempty"` + // Identity - The list of user identities associated with the Batch pool. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + Identity *PoolIdentity `json:"identity,omitempty"` +} + +// CloudPoolListResult ... +type CloudPoolListResult struct { + autorest.Response `json:"-"` + Value *[]CloudPool `json:"value,omitempty"` + OdataNextLink *string `json:"odata.nextLink,omitempty"` +} + +// CloudPoolListResultIterator provides access to a complete listing of CloudPool values. +type CloudPoolListResultIterator struct { + i int + page CloudPoolListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *CloudPoolListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CloudPoolListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *CloudPoolListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CloudPoolListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter CloudPoolListResultIterator) Response() CloudPoolListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter CloudPoolListResultIterator) Value() CloudPool { + if !iter.page.NotDone() { + return CloudPool{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CloudPoolListResultIterator type. +func NewCloudPoolListResultIterator(page CloudPoolListResultPage) CloudPoolListResultIterator { + return CloudPoolListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cplr CloudPoolListResult) IsEmpty() bool { + return cplr.Value == nil || len(*cplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cplr CloudPoolListResult) hasNextLink() bool { + return cplr.OdataNextLink != nil && len(*cplr.OdataNextLink) != 0 +} + +// cloudPoolListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cplr CloudPoolListResult) cloudPoolListResultPreparer(ctx context.Context) (*http.Request, error) { + if !cplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cplr.OdataNextLink))) +} + +// CloudPoolListResultPage contains a page of CloudPool values. +type CloudPoolListResultPage struct { + fn func(context.Context, CloudPoolListResult) (CloudPoolListResult, error) + cplr CloudPoolListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *CloudPoolListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CloudPoolListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.cplr) + if err != nil { + return err + } + page.cplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *CloudPoolListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CloudPoolListResultPage) NotDone() bool { + return !page.cplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CloudPoolListResultPage) Response() CloudPoolListResult { + return page.cplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CloudPoolListResultPage) Values() []CloudPool { + if page.cplr.IsEmpty() { + return nil + } + return *page.cplr.Value +} + +// Creates a new instance of the CloudPoolListResultPage type. +func NewCloudPoolListResultPage(cur CloudPoolListResult, getNextPage func(context.Context, CloudPoolListResult) (CloudPoolListResult, error)) CloudPoolListResultPage { + return CloudPoolListResultPage{ + fn: getNextPage, + cplr: cur, + } +} + +// CloudServiceConfiguration ... +type CloudServiceConfiguration struct { + // OsFamily - Possible values are: + // 2 - OS Family 2, equivalent to Windows Server 2008 R2 SP1. + // 3 - OS Family 3, equivalent to Windows Server 2012. + // 4 - OS Family 4, equivalent to Windows Server 2012 R2. + // 5 - OS Family 5, equivalent to Windows Server 2016. + // 6 - OS Family 6, equivalent to Windows Server 2019. For more information, see Azure Guest OS Releases (https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases). + OsFamily *string `json:"osFamily,omitempty"` + // OsVersion - The default value is * which specifies the latest operating system version for the specified OS family. + OsVersion *string `json:"osVersion,omitempty"` +} + +// CloudTask batch will retry Tasks when a recovery operation is triggered on a Node. Examples of recovery +// operations include (but are not limited to) when an unhealthy Node is rebooted or a Compute Node +// disappeared due to host failure. Retries due to recovery operations are independent of and are not +// counted against the maxTaskRetryCount. Even if the maxTaskRetryCount is 0, an internal retry due to a +// recovery operation may occur. Because of this, all Tasks should be idempotent. This means Tasks need to +// tolerate being interrupted and restarted without causing any corruption or duplicate data. The best +// practice for long running Tasks is to use some form of checkpointing. +type CloudTask struct { + autorest.Response `json:"-"` + // ID - The ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. + ID *string `json:"id,omitempty"` + // DisplayName - The display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + DisplayName *string `json:"displayName,omitempty"` + URL *string `json:"url,omitempty"` + // ETag - This is an opaque string. You can use it to detect whether the Task has changed between requests. In particular, you can be pass the ETag when updating a Task to specify that your changes should take effect only if nobody else has modified the Task in the meantime. + ETag *string `json:"eTag,omitempty"` + LastModified *date.Time `json:"lastModified,omitempty"` + CreationTime *date.Time `json:"creationTime,omitempty"` + // ExitConditions - How the Batch service should respond when the Task completes. + ExitConditions *ExitConditions `json:"exitConditions,omitempty"` + // State - Possible values include: 'TaskStateActive', 'TaskStatePreparing', 'TaskStateRunning', 'TaskStateCompleted' + State TaskState `json:"state,omitempty"` + StateTransitionTime *date.Time `json:"stateTransitionTime,omitempty"` + // PreviousState - This property is not set if the Task is in its initial Active state. Possible values include: 'TaskStateActive', 'TaskStatePreparing', 'TaskStateRunning', 'TaskStateCompleted' + PreviousState TaskState `json:"previousState,omitempty"` + // PreviousStateTransitionTime - This property is not set if the Task is in its initial Active state. + PreviousStateTransitionTime *date.Time `json:"previousStateTransitionTime,omitempty"` + // CommandLine - For multi-instance Tasks, the command line is executed as the primary Task, after the primary Task and all subtasks have finished executing the coordination command line. The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command line refers to file paths, it should use a relative path (relative to the Task working directory), or use the Batch provided environment variable (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). + CommandLine *string `json:"commandLine,omitempty"` + // ContainerSettings - If the Pool that will run this Task has containerConfiguration set, this must be set as well. If the Pool that will run this Task doesn't have containerConfiguration set, this must not be set. When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all Task environment variables are mapped into the container, and the Task command line is executed in the container. Files produced in the container outside of AZ_BATCH_NODE_ROOT_DIR might not be reflected to the host disk, meaning that Batch file APIs will not be able to access those files. + ContainerSettings *TaskContainerSettings `json:"containerSettings,omitempty"` + // ResourceFiles - For multi-instance Tasks, the resource files will only be downloaded to the Compute Node on which the primary Task is executed. There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of ResourceFiles must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers. + ResourceFiles *[]ResourceFile `json:"resourceFiles,omitempty"` + // OutputFiles - For multi-instance Tasks, the files will only be uploaded from the Compute Node on which the primary Task is executed. + OutputFiles *[]OutputFile `json:"outputFiles,omitempty"` + EnvironmentSettings *[]EnvironmentSetting `json:"environmentSettings,omitempty"` + AffinityInfo *AffinityInformation `json:"affinityInfo,omitempty"` + Constraints *TaskConstraints `json:"constraints,omitempty"` + // RequiredSlots - The default is 1. A Task can only be scheduled to run on a compute node if the node has enough free scheduling slots available. For multi-instance Tasks, this must be 1. + RequiredSlots *int32 `json:"requiredSlots,omitempty"` + // UserIdentity - If omitted, the Task runs as a non-administrative user unique to the Task. + UserIdentity *UserIdentity `json:"userIdentity,omitempty"` + ExecutionInfo *TaskExecutionInformation `json:"executionInfo,omitempty"` + NodeInfo *ComputeNodeInformation `json:"nodeInfo,omitempty"` + MultiInstanceSettings *MultiInstanceSettings `json:"multiInstanceSettings,omitempty"` + Stats *TaskStatistics `json:"stats,omitempty"` + // DependsOn - This Task will not be scheduled until all Tasks that it depends on have completed successfully. If any of those Tasks fail and exhaust their retry counts, this Task will never be scheduled. + DependsOn *TaskDependencies `json:"dependsOn,omitempty"` + // ApplicationPackageReferences - Application packages are downloaded and deployed to a shared directory, not the Task working directory. Therefore, if a referenced package is already on the Node, and is up to date, then it is not re-downloaded; the existing copy on the Compute Node is used. If a referenced Package cannot be installed, for example because the package has been deleted or because download failed, the Task fails. + ApplicationPackageReferences *[]ApplicationPackageReference `json:"applicationPackageReferences,omitempty"` + // AuthenticationTokenSettings - If this property is set, the Batch service provides the Task with an authentication token which can be used to authenticate Batch service operations without requiring an Account access key. The token is provided via the AZ_BATCH_AUTHENTICATION_TOKEN environment variable. The operations that the Task can carry out using the token depend on the settings. For example, a Task can request Job permissions in order to add other Tasks to the Job, or check the status of the Job or of other Tasks under the Job. + AuthenticationTokenSettings *AuthenticationTokenSettings `json:"authenticationTokenSettings,omitempty"` +} + +// CloudTaskListResult ... +type CloudTaskListResult struct { + autorest.Response `json:"-"` + Value *[]CloudTask `json:"value,omitempty"` + OdataNextLink *string `json:"odata.nextLink,omitempty"` +} + +// CloudTaskListResultIterator provides access to a complete listing of CloudTask values. +type CloudTaskListResultIterator struct { + i int + page CloudTaskListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *CloudTaskListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CloudTaskListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *CloudTaskListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CloudTaskListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter CloudTaskListResultIterator) Response() CloudTaskListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter CloudTaskListResultIterator) Value() CloudTask { + if !iter.page.NotDone() { + return CloudTask{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CloudTaskListResultIterator type. +func NewCloudTaskListResultIterator(page CloudTaskListResultPage) CloudTaskListResultIterator { + return CloudTaskListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ctlr CloudTaskListResult) IsEmpty() bool { + return ctlr.Value == nil || len(*ctlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ctlr CloudTaskListResult) hasNextLink() bool { + return ctlr.OdataNextLink != nil && len(*ctlr.OdataNextLink) != 0 +} + +// cloudTaskListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ctlr CloudTaskListResult) cloudTaskListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ctlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ctlr.OdataNextLink))) +} + +// CloudTaskListResultPage contains a page of CloudTask values. +type CloudTaskListResultPage struct { + fn func(context.Context, CloudTaskListResult) (CloudTaskListResult, error) + ctlr CloudTaskListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *CloudTaskListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CloudTaskListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ctlr) + if err != nil { + return err + } + page.ctlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *CloudTaskListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CloudTaskListResultPage) NotDone() bool { + return !page.ctlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CloudTaskListResultPage) Response() CloudTaskListResult { + return page.ctlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CloudTaskListResultPage) Values() []CloudTask { + if page.ctlr.IsEmpty() { + return nil + } + return *page.ctlr.Value +} + +// Creates a new instance of the CloudTaskListResultPage type. +func NewCloudTaskListResultPage(cur CloudTaskListResult, getNextPage func(context.Context, CloudTaskListResult) (CloudTaskListResult, error)) CloudTaskListResultPage { + return CloudTaskListResultPage{ + fn: getNextPage, + ctlr: cur, + } +} + +// CloudTaskListSubtasksResult ... +type CloudTaskListSubtasksResult struct { + autorest.Response `json:"-"` + Value *[]SubtaskInformation `json:"value,omitempty"` +} + +// ComputeNode ... +type ComputeNode struct { + autorest.Response `json:"-"` + // ID - Every Compute Node that is added to a Pool is assigned a unique ID. Whenever a Compute Node is removed from a Pool, all of its local files are deleted, and the ID is reclaimed and could be reused for new Compute Nodes. + ID *string `json:"id,omitempty"` + URL *string `json:"url,omitempty"` + // State - The low-priority Compute Node has been preempted. Tasks which were running on the Compute Node when it was preempted will be rescheduled when another Compute Node becomes available. Possible values include: 'Idle', 'Rebooting', 'Reimaging', 'Running', 'Unusable', 'Creating', 'Starting', 'WaitingForStartTask', 'StartTaskFailed', 'Unknown', 'LeavingPool', 'Offline', 'Preempted' + State ComputeNodeState `json:"state,omitempty"` + // SchedulingState - Possible values include: 'Enabled', 'Disabled' + SchedulingState SchedulingState `json:"schedulingState,omitempty"` + StateTransitionTime *date.Time `json:"stateTransitionTime,omitempty"` + // LastBootTime - This property may not be present if the Compute Node state is unusable. + LastBootTime *date.Time `json:"lastBootTime,omitempty"` + // AllocationTime - This is the time when the Compute Node was initially allocated and doesn't change once set. It is not updated when the Compute Node is service healed or preempted. + AllocationTime *date.Time `json:"allocationTime,omitempty"` + // IPAddress - Every Compute Node that is added to a Pool is assigned a unique IP address. Whenever a Compute Node is removed from a Pool, all of its local files are deleted, and the IP address is reclaimed and could be reused for new Compute Nodes. + IPAddress *string `json:"ipAddress,omitempty"` + // AffinityID - Note that this is just a soft affinity. If the target Compute Node is busy or unavailable at the time the Task is scheduled, then the Task will be scheduled elsewhere. + AffinityID *string `json:"affinityId,omitempty"` + // VMSize - For information about available sizes of virtual machines in Pools, see Choose a VM size for Compute Nodes in an Azure Batch Pool (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes). + VMSize *string `json:"vmSize,omitempty"` + TotalTasksRun *int32 `json:"totalTasksRun,omitempty"` + RunningTasksCount *int32 `json:"runningTasksCount,omitempty"` + RunningTaskSlotsCount *int32 `json:"runningTaskSlotsCount,omitempty"` + TotalTasksSucceeded *int32 `json:"totalTasksSucceeded,omitempty"` + // RecentTasks - This property is present only if at least one Task has run on this Compute Node since it was assigned to the Pool. + RecentTasks *[]TaskInformation `json:"recentTasks,omitempty"` + StartTask *StartTask `json:"startTask,omitempty"` + StartTaskInfo *StartTaskInformation `json:"startTaskInfo,omitempty"` + // CertificateReferences - For Windows Nodes, the Batch service installs the Certificates to the specified Certificate store and location. For Linux Compute Nodes, the Certificates are stored in a directory inside the Task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the Task to query for this location. For Certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and Certificates are placed in that directory. + CertificateReferences *[]CertificateReference `json:"certificateReferences,omitempty"` + Errors *[]ComputeNodeError `json:"errors,omitempty"` + IsDedicated *bool `json:"isDedicated,omitempty"` + EndpointConfiguration *ComputeNodeEndpointConfiguration `json:"endpointConfiguration,omitempty"` + NodeAgentInfo *NodeAgentInformation `json:"nodeAgentInfo,omitempty"` + VirtualMachineInfo *VirtualMachineInfo `json:"virtualMachineInfo,omitempty"` +} + +// ComputeNodeEndpointConfiguration ... +type ComputeNodeEndpointConfiguration struct { + InboundEndpoints *[]InboundEndpoint `json:"inboundEndpoints,omitempty"` +} + +// ComputeNodeError ... +type ComputeNodeError struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + ErrorDetails *[]NameValuePair `json:"errorDetails,omitempty"` +} + +// ComputeNodeGetRemoteLoginSettingsResult ... +type ComputeNodeGetRemoteLoginSettingsResult struct { + autorest.Response `json:"-"` + RemoteLoginIPAddress *string `json:"remoteLoginIPAddress,omitempty"` + RemoteLoginPort *int32 `json:"remoteLoginPort,omitempty"` +} + +// ComputeNodeIdentityReference the reference to a user assigned identity associated with the Batch pool +// which a compute node will use. +type ComputeNodeIdentityReference struct { + // ResourceID - The ARM resource id of the user assigned identity. + ResourceID *string `json:"resourceId,omitempty"` +} + +// ComputeNodeInformation ... +type ComputeNodeInformation struct { + AffinityID *string `json:"affinityId,omitempty"` + NodeURL *string `json:"nodeUrl,omitempty"` + PoolID *string `json:"poolId,omitempty"` + NodeID *string `json:"nodeId,omitempty"` + TaskRootDirectory *string `json:"taskRootDirectory,omitempty"` + TaskRootDirectoryURL *string `json:"taskRootDirectoryUrl,omitempty"` +} + +// ComputeNodeListResult ... +type ComputeNodeListResult struct { + autorest.Response `json:"-"` + Value *[]ComputeNode `json:"value,omitempty"` + OdataNextLink *string `json:"odata.nextLink,omitempty"` +} + +// ComputeNodeListResultIterator provides access to a complete listing of ComputeNode values. +type ComputeNodeListResultIterator struct { + i int + page ComputeNodeListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ComputeNodeListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ComputeNodeListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ComputeNodeListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ComputeNodeListResultIterator) Response() ComputeNodeListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ComputeNodeListResultIterator) Value() ComputeNode { + if !iter.page.NotDone() { + return ComputeNode{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ComputeNodeListResultIterator type. +func NewComputeNodeListResultIterator(page ComputeNodeListResultPage) ComputeNodeListResultIterator { + return ComputeNodeListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cnlr ComputeNodeListResult) IsEmpty() bool { + return cnlr.Value == nil || len(*cnlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cnlr ComputeNodeListResult) hasNextLink() bool { + return cnlr.OdataNextLink != nil && len(*cnlr.OdataNextLink) != 0 +} + +// computeNodeListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cnlr ComputeNodeListResult) computeNodeListResultPreparer(ctx context.Context) (*http.Request, error) { + if !cnlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cnlr.OdataNextLink))) +} + +// ComputeNodeListResultPage contains a page of ComputeNode values. +type ComputeNodeListResultPage struct { + fn func(context.Context, ComputeNodeListResult) (ComputeNodeListResult, error) + cnlr ComputeNodeListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ComputeNodeListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeNodeListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.cnlr) + if err != nil { + return err + } + page.cnlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ComputeNodeListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ComputeNodeListResultPage) NotDone() bool { + return !page.cnlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ComputeNodeListResultPage) Response() ComputeNodeListResult { + return page.cnlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ComputeNodeListResultPage) Values() []ComputeNode { + if page.cnlr.IsEmpty() { + return nil + } + return *page.cnlr.Value +} + +// Creates a new instance of the ComputeNodeListResultPage type. +func NewComputeNodeListResultPage(cur ComputeNodeListResult, getNextPage func(context.Context, ComputeNodeListResult) (ComputeNodeListResult, error)) ComputeNodeListResultPage { + return ComputeNodeListResultPage{ + fn: getNextPage, + cnlr: cur, + } +} + +// ComputeNodeUser ... +type ComputeNodeUser struct { + Name *string `json:"name,omitempty"` + // IsAdmin - The default value is false. + IsAdmin *bool `json:"isAdmin,omitempty"` + // ExpiryTime - If omitted, the default is 1 day from the current time. For Linux Compute Nodes, the expiryTime has a precision up to a day. + ExpiryTime *date.Time `json:"expiryTime,omitempty"` + // Password - The password is required for Windows Compute Nodes (those created with 'cloudServiceConfiguration', or created with 'virtualMachineConfiguration' using a Windows Image reference). For Linux Compute Nodes, the password can optionally be specified along with the sshPublicKey property. + Password *string `json:"password,omitempty"` + // SSHPublicKey - The public key should be compatible with OpenSSH encoding and should be base 64 encoded. This property can be specified only for Linux Compute Nodes. If this is specified for a Windows Compute Node, then the Batch service rejects the request; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + SSHPublicKey *string `json:"sshPublicKey,omitempty"` +} + +// ContainerConfiguration ... +type ContainerConfiguration struct { + Type *string `json:"type,omitempty"` + // ContainerImageNames - This is the full Image reference, as would be specified to "docker pull". An Image will be sourced from the default Docker registry unless the Image is fully qualified with an alternative registry. + ContainerImageNames *[]string `json:"containerImageNames,omitempty"` + // ContainerRegistries - If any Images must be downloaded from a private registry which requires credentials, then those credentials must be provided here. + ContainerRegistries *[]ContainerRegistry `json:"containerRegistries,omitempty"` +} + +// ContainerRegistry ... +type ContainerRegistry struct { + // RegistryServer - If omitted, the default is "docker.io". + RegistryServer *string `json:"registryServer,omitempty"` + UserName *string `json:"username,omitempty"` + Password *string `json:"password,omitempty"` + IdentityReference *ComputeNodeIdentityReference `json:"identityReference,omitempty"` +} + +// DataDisk ... +type DataDisk struct { + // Lun - The lun is used to uniquely identify each data disk. If attaching multiple disks, each should have a distinct lun. The value must be between 0 and 63, inclusive. + Lun *int32 `json:"lun,omitempty"` + // Caching - The default value for caching is readwrite. For information about the caching options see: https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. Possible values include: 'None', 'ReadOnly', 'ReadWrite' + Caching CachingType `json:"caching,omitempty"` + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // StorageAccountType - If omitted, the default is "standard_lrs". Possible values include: 'StandardLRS', 'PremiumLRS' + StorageAccountType StorageAccountType `json:"storageAccountType,omitempty"` +} + +// DeleteCertificateError ... +type DeleteCertificateError struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + // Values - This list includes details such as the active Pools and Compute Nodes referencing this Certificate. However, if a large number of resources reference the Certificate, the list contains only about the first hundred. + Values *[]NameValuePair `json:"values,omitempty"` +} + +// DiffDiskSettings ... +type DiffDiskSettings struct { + // Placement - This property can be used by user in the request to choose the location e.g., cache disk space for Ephemeral OS disk provisioning. For more information on Ephemeral OS disk size requirements, please refer to Ephemeral OS disk size requirements for Windows VMs at https://docs.microsoft.com/en-us/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements and Linux VMs at https://docs.microsoft.com/en-us/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements. Possible values include: 'CacheDisk' + Placement DiffDiskPlacement `json:"placement,omitempty"` +} + +// DiskEncryptionConfiguration the disk encryption configuration applied on compute nodes in the pool. Disk +// encryption configuration is not supported on Linux pool created with Shared Image Gallery Image. +type DiskEncryptionConfiguration struct { + // Targets - If omitted, no disks on the compute nodes in the pool will be encrypted. On Linux pool, only "TemporaryDisk" is supported; on Windows pool, "OsDisk" and "TemporaryDisk" must be specified. + Targets *[]DiskEncryptionTarget `json:"targets,omitempty"` +} + +// EnvironmentSetting ... +type EnvironmentSetting struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// Error ... +type Error struct { + Code *string `json:"code,omitempty"` + Message *ErrorMessage `json:"message,omitempty"` + Values *[]ErrorDetail `json:"values,omitempty"` +} + +// ErrorDetail ... +type ErrorDetail struct { + Key *string `json:"key,omitempty"` + Value *string `json:"value,omitempty"` +} + +// ErrorMessage ... +type ErrorMessage struct { + Lang *string `json:"lang,omitempty"` + Value *string `json:"value,omitempty"` +} + +// ExitCodeMapping ... +type ExitCodeMapping struct { + Code *int32 `json:"code,omitempty"` + ExitOptions *ExitOptions `json:"exitOptions,omitempty"` +} + +// ExitCodeRangeMapping ... +type ExitCodeRangeMapping struct { + Start *int32 `json:"start,omitempty"` + End *int32 `json:"end,omitempty"` + ExitOptions *ExitOptions `json:"exitOptions,omitempty"` +} + +// ExitConditions ... +type ExitConditions struct { + ExitCodes *[]ExitCodeMapping `json:"exitCodes,omitempty"` + ExitCodeRanges *[]ExitCodeRangeMapping `json:"exitCodeRanges,omitempty"` + PreProcessingError *ExitOptions `json:"preProcessingError,omitempty"` + // FileUploadError - If the Task exited with an exit code that was specified via exitCodes or exitCodeRanges, and then encountered a file upload error, then the action specified by the exit code takes precedence. + FileUploadError *ExitOptions `json:"fileUploadError,omitempty"` + // Default - This value is used if the Task exits with any nonzero exit code not listed in the exitCodes or exitCodeRanges collection, with a pre-processing error if the preProcessingError property is not present, or with a file upload error if the fileUploadError property is not present. If you want non-default behavior on exit code 0, you must list it explicitly using the exitCodes or exitCodeRanges collection. + Default *ExitOptions `json:"default,omitempty"` +} + +// ExitOptions ... +type ExitOptions struct { + // JobAction - The default is none for exit code 0 and terminate for all other exit conditions. If the Job's onTaskFailed property is noaction, then specifying this property returns an error and the add Task request fails with an invalid property value error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). Possible values include: 'JobActionNone', 'JobActionDisable', 'JobActionTerminate' + JobAction JobAction `json:"jobAction,omitempty"` + // DependencyAction - Possible values are 'satisfy' (allowing dependent tasks to progress) and 'block' (dependent tasks continue to wait). Batch does not yet support cancellation of dependent tasks. Possible values include: 'Satisfy', 'Block' + DependencyAction DependencyAction `json:"dependencyAction,omitempty"` +} + +// FileProperties ... +type FileProperties struct { + // CreationTime - The creation time is not returned for files on Linux Compute Nodes. + CreationTime *date.Time `json:"creationTime,omitempty"` + LastModified *date.Time `json:"lastModified,omitempty"` + ContentLength *int64 `json:"contentLength,omitempty"` + ContentType *string `json:"contentType,omitempty"` + // FileMode - The file mode is returned only for files on Linux Compute Nodes. + FileMode *string `json:"fileMode,omitempty"` +} + +// ImageInformation ... +type ImageInformation struct { + NodeAgentSKUID *string `json:"nodeAgentSKUId,omitempty"` + ImageReference *ImageReference `json:"imageReference,omitempty"` + // OsType - Possible values include: 'Linux', 'Windows' + OsType OSType `json:"osType,omitempty"` + // Capabilities - Not every capability of the Image is listed. Capabilities in this list are considered of special interest and are generally related to integration with other features in the Azure Batch service. + Capabilities *[]string `json:"capabilities,omitempty"` + BatchSupportEndOfLife *date.Time `json:"batchSupportEndOfLife,omitempty"` + // VerificationType - Possible values include: 'Verified', 'Unverified' + VerificationType VerificationType `json:"verificationType,omitempty"` +} + +// ImageReference ... +type ImageReference struct { + // Publisher - For example, Canonical or MicrosoftWindowsServer. + Publisher *string `json:"publisher,omitempty"` + // Offer - For example, UbuntuServer or WindowsServer. + Offer *string `json:"offer,omitempty"` + // Sku - For example, 18.04-LTS or 2019-Datacenter. + Sku *string `json:"sku,omitempty"` + // Version - A value of 'latest' can be specified to select the latest version of an Image. If omitted, the default is 'latest'. + Version *string `json:"version,omitempty"` + // VirtualMachineImageID - This property is mutually exclusive with other ImageReference properties. The Shared Image Gallery Image must have replicas in the same region and must be in the same subscription as the Azure Batch account. If the image version is not specified in the imageId, the latest version will be used. For information about the firewall settings for the Batch Compute 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. + VirtualMachineImageID *string `json:"virtualMachineImageId,omitempty"` + // ExactVersion - READ-ONLY; The specific version of the platform image or marketplace image used to create the node. This read-only field differs from 'version' only if the value specified for 'version' when the pool was created was 'latest'. + ExactVersion *string `json:"exactVersion,omitempty"` +} + +// MarshalJSON is the custom marshaler for ImageReference. +func (ir ImageReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ir.Publisher != nil { + objectMap["publisher"] = ir.Publisher + } + if ir.Offer != nil { + objectMap["offer"] = ir.Offer + } + if ir.Sku != nil { + objectMap["sku"] = ir.Sku + } + if ir.Version != nil { + objectMap["version"] = ir.Version + } + if ir.VirtualMachineImageID != nil { + objectMap["virtualMachineImageId"] = ir.VirtualMachineImageID + } + return json.Marshal(objectMap) +} + +// InboundEndpoint ... +type InboundEndpoint struct { + Name *string `json:"name,omitempty"` + // Protocol - Possible values include: 'TCP', 'UDP' + Protocol InboundEndpointProtocol `json:"protocol,omitempty"` + PublicIPAddress *string `json:"publicIPAddress,omitempty"` + PublicFQDN *string `json:"publicFQDN,omitempty"` + FrontendPort *int32 `json:"frontendPort,omitempty"` + BackendPort *int32 `json:"backendPort,omitempty"` +} + +// InboundNATPool ... +type InboundNATPool struct { + // Name - The name must be unique within a Batch Pool, can contain letters, numbers, underscores, periods, and hyphens. Names must start with a letter or number, must end with a letter, number, or underscore, and cannot exceed 77 characters. If any invalid values are provided the request fails with HTTP status code 400. + Name *string `json:"name,omitempty"` + // Protocol - Possible values include: 'TCP', 'UDP' + Protocol InboundEndpointProtocol `json:"protocol,omitempty"` + // BackendPort - This must be unique within a Batch Pool. Acceptable values are between 1 and 65535 except for 22, 3389, 29876 and 29877 as these are reserved. If any reserved values are provided the request fails with HTTP status code 400. + BackendPort *int32 `json:"backendPort,omitempty"` + // FrontendPortRangeStart - Acceptable values range between 1 and 65534 except ports from 50000 to 55000 which are reserved. All ranges within a Pool must be distinct and cannot overlap. Each range must contain at least 40 ports. If any reserved or overlapping values are provided the request fails with HTTP status code 400. + FrontendPortRangeStart *int32 `json:"frontendPortRangeStart,omitempty"` + // FrontendPortRangeEnd - Acceptable values range between 1 and 65534 except ports from 50000 to 55000 which are reserved by the Batch service. All ranges within a Pool must be distinct and cannot overlap. Each range must contain at least 40 ports. If any reserved or overlapping values are provided the request fails with HTTP status code 400. + FrontendPortRangeEnd *int32 `json:"frontendPortRangeEnd,omitempty"` + // NetworkSecurityGroupRules - The maximum number of rules that can be specified across all the endpoints on a Batch Pool is 25. If no network security group rules are specified, a default rule will be created to allow inbound access to the specified backendPort. If the maximum number of network security group rules is exceeded the request fails with HTTP status code 400. + NetworkSecurityGroupRules *[]NetworkSecurityGroupRule `json:"networkSecurityGroupRules,omitempty"` +} + +// InstanceViewStatus ... +type InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + // Level - Possible values include: 'StatusLevelTypesError', 'StatusLevelTypesInfo', 'StatusLevelTypesWarning' + Level StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + // Time - The time of the status. + Time *string `json:"time,omitempty"` +} + +// JobAddParameter ... +type JobAddParameter struct { + // ID - The ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within an Account that differ only by case). + ID *string `json:"id,omitempty"` + // DisplayName - The display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + DisplayName *string `json:"displayName,omitempty"` + // Priority - Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. The default value is 0. + Priority *int32 `json:"priority,omitempty"` + // MaxParallelTasks - The value of maxParallelTasks must be -1 or greater than 0 if specified. If not specified, the default value is -1, which means there's no limit to the number of tasks that can be run at once. You can update a job's maxParallelTasks after it has been created using the update job API. + MaxParallelTasks *int32 `json:"maxParallelTasks,omitempty"` + // Constraints - The execution constraints for the Job. + Constraints *JobConstraints `json:"constraints,omitempty"` + // JobManagerTask - If the Job does not specify a Job Manager Task, the user must explicitly add Tasks to the Job. If the Job does specify a Job Manager Task, the Batch service creates the Job Manager Task when the Job is created, and will try to schedule the Job Manager Task before scheduling other Tasks in the Job. The Job Manager Task's typical purpose is to control and/or monitor Job execution, for example by deciding what additional Tasks to run, determining when the work is complete, etc. (However, a Job Manager Task is not restricted to these activities - it is a fully-fledged Task in the system and perform whatever actions are required for the Job.) For example, a Job Manager Task might download a file specified as a parameter, analyze the contents of that file and submit additional Tasks based on those contents. + JobManagerTask *JobManagerTask `json:"jobManagerTask,omitempty"` + // JobPreparationTask - If a Job has a Job Preparation Task, the Batch service will run the Job Preparation Task on a Node before starting any Tasks of that Job on that Compute Node. + JobPreparationTask *JobPreparationTask `json:"jobPreparationTask,omitempty"` + // JobReleaseTask - A Job Release Task cannot be specified without also specifying a Job Preparation Task for the Job. The Batch service runs the Job Release Task on the Nodes that have run the Job Preparation Task. The primary purpose of the Job Release Task is to undo changes to Compute Nodes made by the Job Preparation Task. Example activities include deleting local files, or shutting down services that were started as part of Job preparation. + JobReleaseTask *JobReleaseTask `json:"jobReleaseTask,omitempty"` + // CommonEnvironmentSettings - Individual Tasks can override an environment setting specified here by specifying the same setting name with a different value. + CommonEnvironmentSettings *[]EnvironmentSetting `json:"commonEnvironmentSettings,omitempty"` + PoolInfo *PoolInformation `json:"poolInfo,omitempty"` + // OnAllTasksComplete - Note that if a Job contains no Tasks, then all Tasks are considered complete. This option is therefore most commonly used with a Job Manager task; if you want to use automatic Job termination without a Job Manager, you should initially set onAllTasksComplete to noaction and update the Job properties to set onAllTasksComplete to terminatejob once you have finished adding Tasks. The default is noaction. Possible values include: 'NoAction', 'TerminateJob' + OnAllTasksComplete OnAllTasksComplete `json:"onAllTasksComplete,omitempty"` + // OnTaskFailure - A Task is considered to have failed if has a failureInfo. A failureInfo is set if the Task completes with a non-zero exit code after exhausting its retry count, or if there was an error starting the Task, for example due to a resource file download error. The default is noaction. Possible values include: 'OnTaskFailureNoAction', 'OnTaskFailurePerformExitOptionsJobAction' + OnTaskFailure OnTaskFailure `json:"onTaskFailure,omitempty"` + // Metadata - The Batch service does not assign any meaning to metadata; it is solely for the use of user code. + Metadata *[]MetadataItem `json:"metadata,omitempty"` + UsesTaskDependencies *bool `json:"usesTaskDependencies,omitempty"` + NetworkConfiguration *JobNetworkConfiguration `json:"networkConfiguration,omitempty"` +} + +// JobConstraints ... +type JobConstraints struct { + // MaxWallClockTime - If the Job does not complete within the time limit, the Batch service terminates it and any Tasks that are still running. In this case, the termination reason will be MaxWallClockTimeExpiry. If this property is not specified, there is no time limit on how long the Job may run. + MaxWallClockTime *string `json:"maxWallClockTime,omitempty"` + // MaxTaskRetryCount - Note that this value specifically controls the number of retries. The Batch service will try each Task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries a Task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry Tasks. If the maximum retry count is -1, the Batch service retries Tasks without limit. The default value is 0 (no retries). + MaxTaskRetryCount *int32 `json:"maxTaskRetryCount,omitempty"` +} + +// JobDisableParameter ... +type JobDisableParameter struct { + // DisableTasks - Possible values include: 'DisableJobOptionRequeue', 'DisableJobOptionTerminate', 'DisableJobOptionWait' + DisableTasks DisableJobOption `json:"disableTasks,omitempty"` +} + +// JobExecutionInformation ... +type JobExecutionInformation struct { + // StartTime - This is the time at which the Job was created. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - This property is set only if the Job is in the completed state. + EndTime *date.Time `json:"endTime,omitempty"` + // PoolID - This element contains the actual Pool where the Job is assigned. When you get Job details from the service, they also contain a poolInfo element, which contains the Pool configuration data from when the Job was added or updated. That poolInfo element may also contain a poolId element. If it does, the two IDs are the same. If it does not, it means the Job ran on an auto Pool, and this property contains the ID of that auto Pool. + PoolID *string `json:"poolId,omitempty"` + // SchedulingError - This property is not set if there was no error starting the Job. + SchedulingError *JobSchedulingError `json:"schedulingError,omitempty"` + // TerminateReason - This property is set only if the Job is in the completed state. If the Batch service terminates the Job, it sets the reason as follows: JMComplete - the Job Manager Task completed, and killJobOnCompletion was set to true. MaxWallClockTimeExpiry - the Job reached its maxWallClockTime constraint. TerminateJobSchedule - the Job ran as part of a schedule, and the schedule terminated. AllTasksComplete - the Job's onAllTasksComplete attribute is set to terminatejob, and all Tasks in the Job are complete. TaskFailed - the Job's onTaskFailure attribute is set to performExitOptionsJobAction, and a Task in the Job failed with an exit condition that specified a jobAction of terminatejob. Any other string is a user-defined reason specified in a call to the 'Terminate a Job' operation. + TerminateReason *string `json:"terminateReason,omitempty"` +} + +// JobManagerTask the Job Manager Task is automatically started when the Job is created. The Batch service +// tries to schedule the Job Manager Task before any other Tasks in the Job. When shrinking a Pool, the +// Batch service tries to preserve Nodes where Job Manager Tasks are running for as long as possible (that +// is, Compute Nodes running 'normal' Tasks are removed before Compute Nodes running Job Manager Tasks). +// When a Job Manager Task fails and needs to be restarted, the system tries to schedule it at the highest +// priority. If there are no idle Compute Nodes available, the system may terminate one of the running +// Tasks in the Pool and return it to the queue in order to make room for the Job Manager Task to restart. +// Note that a Job Manager Task in one Job does not have priority over Tasks in other Jobs. Across Jobs, +// only Job level priorities are observed. For example, if a Job Manager in a priority 0 Job needs to be +// restarted, it will not displace Tasks of a priority 1 Job. Batch will retry Tasks when a recovery +// operation is triggered on a Node. Examples of recovery operations include (but are not limited to) when +// an unhealthy Node is rebooted or a Compute Node disappeared due to host failure. Retries due to recovery +// operations are independent of and are not counted against the maxTaskRetryCount. Even if the +// maxTaskRetryCount is 0, an internal retry due to a recovery operation may occur. Because of this, all +// Tasks should be idempotent. This means Tasks need to tolerate being interrupted and restarted without +// causing any corruption or duplicate data. The best practice for long running Tasks is to use some form +// of checkpointing. +type JobManagerTask struct { + // ID - The ID can contain any combination of alphanumeric characters including hyphens and underscores and cannot contain more than 64 characters. + ID *string `json:"id,omitempty"` + // DisplayName - It need not be unique and can contain any Unicode characters up to a maximum length of 1024. + DisplayName *string `json:"displayName,omitempty"` + // CommandLine - The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command line refers to file paths, it should use a relative path (relative to the Task working directory), or use the Batch provided environment variable (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). + CommandLine *string `json:"commandLine,omitempty"` + // ContainerSettings - If the Pool that will run this Task has containerConfiguration set, this must be set as well. If the Pool that will run this Task doesn't have containerConfiguration set, this must not be set. When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all Task environment variables are mapped into the container, and the Task command line is executed in the container. Files produced in the container outside of AZ_BATCH_NODE_ROOT_DIR might not be reflected to the host disk, meaning that Batch file APIs will not be able to access those files. + ContainerSettings *TaskContainerSettings `json:"containerSettings,omitempty"` + // ResourceFiles - Files listed under this element are located in the Task's working directory. There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of ResourceFiles must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers. + ResourceFiles *[]ResourceFile `json:"resourceFiles,omitempty"` + // OutputFiles - For multi-instance Tasks, the files will only be uploaded from the Compute Node on which the primary Task is executed. + OutputFiles *[]OutputFile `json:"outputFiles,omitempty"` + EnvironmentSettings *[]EnvironmentSetting `json:"environmentSettings,omitempty"` + Constraints *TaskConstraints `json:"constraints,omitempty"` + // RequiredSlots - The default is 1. A Task can only be scheduled to run on a compute node if the node has enough free scheduling slots available. For multi-instance Tasks, this property is not supported and must not be specified. + RequiredSlots *int32 `json:"requiredSlots,omitempty"` + // KillJobOnCompletion - If true, when the Job Manager Task completes, the Batch service marks the Job as complete. If any Tasks are still running at this time (other than Job Release), those Tasks are terminated. If false, the completion of the Job Manager Task does not affect the Job status. In this case, you should either use the onAllTasksComplete attribute to terminate the Job, or have a client or user terminate the Job explicitly. An example of this is if the Job Manager creates a set of Tasks but then takes no further role in their execution. The default value is true. If you are using the onAllTasksComplete and onTaskFailure attributes to control Job lifetime, and using the Job Manager Task only to create the Tasks for the Job (not to monitor progress), then it is important to set killJobOnCompletion to false. + KillJobOnCompletion *bool `json:"killJobOnCompletion,omitempty"` + // UserIdentity - If omitted, the Task runs as a non-administrative user unique to the Task. + UserIdentity *UserIdentity `json:"userIdentity,omitempty"` + // RunExclusive - If true, no other Tasks will run on the same Node for as long as the Job Manager is running. If false, other Tasks can run simultaneously with the Job Manager on a Compute Node. The Job Manager Task counts normally against the Compute Node's concurrent Task limit, so this is only relevant if the Compute Node allows multiple concurrent Tasks. The default value is true. + RunExclusive *bool `json:"runExclusive,omitempty"` + // ApplicationPackageReferences - Application Packages are downloaded and deployed to a shared directory, not the Task working directory. Therefore, if a referenced Application Package is already on the Compute Node, and is up to date, then it is not re-downloaded; the existing copy on the Compute Node is used. If a referenced Application Package cannot be installed, for example because the package has been deleted or because download failed, the Task fails. + ApplicationPackageReferences *[]ApplicationPackageReference `json:"applicationPackageReferences,omitempty"` + // AuthenticationTokenSettings - If this property is set, the Batch service provides the Task with an authentication token which can be used to authenticate Batch service operations without requiring an Account access key. The token is provided via the AZ_BATCH_AUTHENTICATION_TOKEN environment variable. The operations that the Task can carry out using the token depend on the settings. For example, a Task can request Job permissions in order to add other Tasks to the Job, or check the status of the Job or of other Tasks under the Job. + AuthenticationTokenSettings *AuthenticationTokenSettings `json:"authenticationTokenSettings,omitempty"` + // AllowLowPriorityNode - The default value is true. + AllowLowPriorityNode *bool `json:"allowLowPriorityNode,omitempty"` +} + +// JobNetworkConfiguration ... +type JobNetworkConfiguration struct { + // SubnetID - The virtual network must be in the same region and subscription as the Azure Batch Account. The specified subnet should have enough free IP addresses to accommodate the number of Compute Nodes which will run Tasks from the Job. This can be up to the number of Compute Nodes in the Pool. The 'MicrosoftAzureBatch' service principal must have the 'Classic Virtual Machine Contributor' Role-Based Access Control (RBAC) role for the specified VNet so that Azure Batch service can schedule Tasks on the Nodes. This can be verified by checking if the specified VNet has any associated Network Security Groups (NSG). If communication to the Nodes in the specified subnet is denied by an NSG, then the Batch service will set the state of the Compute Nodes to unusable. This is of the form /subscriptions/{subscription}/resourceGroups/{group}/providers/{provider}/virtualNetworks/{network}/subnets/{subnet}. If the specified VNet has any associated Network Security Groups (NSG), then a few reserved system ports must be enabled for inbound communication from the Azure Batch service. For Pools created with a Virtual Machine configuration, enable ports 29876 and 29877, as well as port 22 for Linux and port 3389 for Windows. Port 443 is also required to be open for outbound connections for communications to Azure Storage. For more details see: https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration + SubnetID *string `json:"subnetId,omitempty"` +} + +// JobPatchParameter ... +type JobPatchParameter struct { + // Priority - Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. If omitted, the priority of the Job is left unchanged. + Priority *int32 `json:"priority,omitempty"` + // MaxParallelTasks - The value of maxParallelTasks must be -1 or greater than 0 if specified. If not specified, the default value is -1, which means there's no limit to the number of tasks that can be run at once. You can update a job's maxParallelTasks after it has been created using the update job API. + MaxParallelTasks *int32 `json:"maxParallelTasks,omitempty"` + // OnAllTasksComplete - If omitted, the completion behavior is left unchanged. You may not change the value from terminatejob to noaction - that is, once you have engaged automatic Job termination, you cannot turn it off again. If you try to do this, the request fails with an 'invalid property value' error response; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). Possible values include: 'NoAction', 'TerminateJob' + OnAllTasksComplete OnAllTasksComplete `json:"onAllTasksComplete,omitempty"` + // Constraints - If omitted, the existing execution constraints are left unchanged. + Constraints *JobConstraints `json:"constraints,omitempty"` + // PoolInfo - You may change the Pool for a Job only when the Job is disabled. The Patch Job call will fail if you include the poolInfo element and the Job is not disabled. If you specify an autoPoolSpecification in the poolInfo, only the keepAlive property of the autoPoolSpecification can be updated, and then only if the autoPoolSpecification has a poolLifetimeOption of Job (other job properties can be updated as normal). If omitted, the Job continues to run on its current Pool. + PoolInfo *PoolInformation `json:"poolInfo,omitempty"` + // Metadata - If omitted, the existing Job metadata is left unchanged. + Metadata *[]MetadataItem `json:"metadata,omitempty"` +} + +// JobPreparationAndReleaseTaskExecutionInformation ... +type JobPreparationAndReleaseTaskExecutionInformation struct { + PoolID *string `json:"poolId,omitempty"` + NodeID *string `json:"nodeId,omitempty"` + NodeURL *string `json:"nodeUrl,omitempty"` + JobPreparationTaskExecutionInfo *JobPreparationTaskExecutionInformation `json:"jobPreparationTaskExecutionInfo,omitempty"` + // JobReleaseTaskExecutionInfo - This property is set only if the Job Release Task has run on the Compute Node. + JobReleaseTaskExecutionInfo *JobReleaseTaskExecutionInformation `json:"jobReleaseTaskExecutionInfo,omitempty"` +} + +// JobPreparationTask you can use Job Preparation to prepare a Node to run Tasks for the Job. Activities +// commonly performed in Job Preparation include: Downloading common resource files used by all the Tasks +// in the Job. The Job Preparation Task can download these common resource files to the shared location on +// the Node. (AZ_BATCH_NODE_ROOT_DIR\shared), or starting a local service on the Node so that all Tasks of +// that Job can communicate with it. If the Job Preparation Task fails (that is, exhausts its retry count +// before exiting with exit code 0), Batch will not run Tasks of this Job on the Node. The Compute Node +// remains ineligible to run Tasks of this Job until it is reimaged. The Compute Node remains active and +// can be used for other Jobs. The Job Preparation Task can run multiple times on the same Node. Therefore, +// you should write the Job Preparation Task to handle re-execution. If the Node is rebooted, the Job +// Preparation Task is run again on the Compute Node before scheduling any other Task of the Job, if +// rerunOnNodeRebootAfterSuccess is true or if the Job Preparation Task did not previously complete. If the +// Node is reimaged, the Job Preparation Task is run again before scheduling any Task of the Job. Batch +// will retry Tasks when a recovery operation is triggered on a Node. Examples of recovery operations +// include (but are not limited to) when an unhealthy Node is rebooted or a Compute Node disappeared due to +// host failure. Retries due to recovery operations are independent of and are not counted against the +// maxTaskRetryCount. Even if the maxTaskRetryCount is 0, an internal retry due to a recovery operation may +// occur. Because of this, all Tasks should be idempotent. This means Tasks need to tolerate being +// interrupted and restarted without causing any corruption or duplicate data. The best practice for long +// running Tasks is to use some form of checkpointing. +type JobPreparationTask struct { + // ID - The ID can contain any combination of alphanumeric characters including hyphens and underscores and cannot contain more than 64 characters. If you do not specify this property, the Batch service assigns a default value of 'jobpreparation'. No other Task in the Job can have the same ID as the Job Preparation Task. If you try to submit a Task with the same id, the Batch service rejects the request with error code TaskIdSameAsJobPreparationTask; if you are calling the REST API directly, the HTTP status code is 409 (Conflict). + ID *string `json:"id,omitempty"` + // CommandLine - The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command line refers to file paths, it should use a relative path (relative to the Task working directory), or use the Batch provided environment variable (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). + CommandLine *string `json:"commandLine,omitempty"` + // ContainerSettings - When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all Task environment variables are mapped into the container, and the Task command line is executed in the container. Files produced in the container outside of AZ_BATCH_NODE_ROOT_DIR might not be reflected to the host disk, meaning that Batch file APIs will not be able to access those files. + ContainerSettings *TaskContainerSettings `json:"containerSettings,omitempty"` + // ResourceFiles - Files listed under this element are located in the Task's working directory. There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of ResourceFiles must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers. + ResourceFiles *[]ResourceFile `json:"resourceFiles,omitempty"` + EnvironmentSettings *[]EnvironmentSetting `json:"environmentSettings,omitempty"` + Constraints *TaskConstraints `json:"constraints,omitempty"` + // WaitForSuccess - If true and the Job Preparation Task fails on a Node, the Batch service retries the Job Preparation Task up to its maximum retry count (as specified in the constraints element). If the Task has still not completed successfully after all retries, then the Batch service will not schedule Tasks of the Job to the Node. The Node remains active and eligible to run Tasks of other Jobs. If false, the Batch service will not wait for the Job Preparation Task to complete. In this case, other Tasks of the Job can start executing on the Compute Node while the Job Preparation Task is still running; and even if the Job Preparation Task fails, new Tasks will continue to be scheduled on the Compute Node. The default value is true. + WaitForSuccess *bool `json:"waitForSuccess,omitempty"` + // UserIdentity - If omitted, the Task runs as a non-administrative user unique to the Task on Windows Compute Nodes, or a non-administrative user unique to the Pool on Linux Compute Nodes. + UserIdentity *UserIdentity `json:"userIdentity,omitempty"` + // RerunOnNodeRebootAfterSuccess - The Job Preparation Task is always rerun if a Compute Node is reimaged, or if the Job Preparation Task did not complete (e.g. because the reboot occurred while the Task was running). Therefore, you should always write a Job Preparation Task to be idempotent and to behave correctly if run multiple times. The default value is true. + RerunOnNodeRebootAfterSuccess *bool `json:"rerunOnNodeRebootAfterSuccess,omitempty"` +} + +// JobPreparationTaskExecutionInformation ... +type JobPreparationTaskExecutionInformation struct { + // StartTime - If the Task has been restarted or retried, this is the most recent time at which the Task started running. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - This property is set only if the Task is in the Completed state. + EndTime *date.Time `json:"endTime,omitempty"` + // State - Possible values include: 'JobPreparationTaskStateRunning', 'JobPreparationTaskStateCompleted' + State JobPreparationTaskState `json:"state,omitempty"` + TaskRootDirectory *string `json:"taskRootDirectory,omitempty"` + TaskRootDirectoryURL *string `json:"taskRootDirectoryUrl,omitempty"` + // ExitCode - This parameter is returned only if the Task is in the completed state. The exit code for a process reflects the specific convention implemented by the application developer for that process. If you use the exit code value to make decisions in your code, be sure that you know the exit code convention used by the application process. Note that the exit code may also be generated by the Compute Node operating system, such as when a process is forcibly terminated. + ExitCode *int32 `json:"exitCode,omitempty"` + // ContainerInfo - This property is set only if the Task runs in a container context. + ContainerInfo *TaskContainerExecutionInformation `json:"containerInfo,omitempty"` + // FailureInfo - This property is set only if the Task is in the completed state and encountered a failure. + FailureInfo *TaskFailureInformation `json:"failureInfo,omitempty"` + // RetryCount - Task application failures (non-zero exit code) are retried, pre-processing errors (the Task could not be run) and file upload errors are not retried. The Batch service will retry the Task up to the limit specified by the constraints. + RetryCount *int32 `json:"retryCount,omitempty"` + // LastRetryTime - This property is set only if the Task was retried (i.e. retryCount is nonzero). If present, this is typically the same as startTime, but may be different if the Task has been restarted for reasons other than retry; for example, if the Compute Node was rebooted during a retry, then the startTime is updated but the lastRetryTime is not. + LastRetryTime *date.Time `json:"lastRetryTime,omitempty"` + // Result - If the value is 'failed', then the details of the failure can be found in the failureInfo property. Possible values include: 'Success', 'Failure' + Result TaskExecutionResult `json:"result,omitempty"` +} + +// JobReleaseTask the Job Release Task runs when the Job ends, because of one of the following: The user +// calls the Terminate Job API, or the Delete Job API while the Job is still active, the Job's maximum wall +// clock time constraint is reached, and the Job is still active, or the Job's Job Manager Task completed, +// and the Job is configured to terminate when the Job Manager completes. The Job Release Task runs on each +// Node where Tasks of the Job have run and the Job Preparation Task ran and completed. If you reimage a +// Node after it has run the Job Preparation Task, and the Job ends without any further Tasks of the Job +// running on that Node (and hence the Job Preparation Task does not re-run), then the Job Release Task +// does not run on that Compute Node. If a Node reboots while the Job Release Task is still running, the +// Job Release Task runs again when the Compute Node starts up. The Job is not marked as complete until all +// Job Release Tasks have completed. The Job Release Task runs in the background. It does not occupy a +// scheduling slot; that is, it does not count towards the taskSlotsPerNode limit specified on the Pool. +type JobReleaseTask struct { + // ID - The ID can contain any combination of alphanumeric characters including hyphens and underscores and cannot contain more than 64 characters. If you do not specify this property, the Batch service assigns a default value of 'jobrelease'. No other Task in the Job can have the same ID as the Job Release Task. If you try to submit a Task with the same id, the Batch service rejects the request with error code TaskIdSameAsJobReleaseTask; if you are calling the REST API directly, the HTTP status code is 409 (Conflict). + ID *string `json:"id,omitempty"` + // CommandLine - The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command line refers to file paths, it should use a relative path (relative to the Task working directory), or use the Batch provided environment variable (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). + CommandLine *string `json:"commandLine,omitempty"` + // ContainerSettings - When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all Task environment variables are mapped into the container, and the Task command line is executed in the container. Files produced in the container outside of AZ_BATCH_NODE_ROOT_DIR might not be reflected to the host disk, meaning that Batch file APIs will not be able to access those files. + ContainerSettings *TaskContainerSettings `json:"containerSettings,omitempty"` + // ResourceFiles - Files listed under this element are located in the Task's working directory. + ResourceFiles *[]ResourceFile `json:"resourceFiles,omitempty"` + EnvironmentSettings *[]EnvironmentSetting `json:"environmentSettings,omitempty"` + MaxWallClockTime *string `json:"maxWallClockTime,omitempty"` + // RetentionTime - The default is 7 days, i.e. the Task directory will be retained for 7 days unless the Compute Node is removed or the Job is deleted. + RetentionTime *string `json:"retentionTime,omitempty"` + // UserIdentity - If omitted, the Task runs as a non-administrative user unique to the Task. + UserIdentity *UserIdentity `json:"userIdentity,omitempty"` +} + +// JobReleaseTaskExecutionInformation ... +type JobReleaseTaskExecutionInformation struct { + // StartTime - If the Task has been restarted or retried, this is the most recent time at which the Task started running. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - This property is set only if the Task is in the Completed state. + EndTime *date.Time `json:"endTime,omitempty"` + // State - Possible values include: 'JobReleaseTaskStateRunning', 'JobReleaseTaskStateCompleted' + State JobReleaseTaskState `json:"state,omitempty"` + TaskRootDirectory *string `json:"taskRootDirectory,omitempty"` + TaskRootDirectoryURL *string `json:"taskRootDirectoryUrl,omitempty"` + // ExitCode - This parameter is returned only if the Task is in the completed state. The exit code for a process reflects the specific convention implemented by the application developer for that process. If you use the exit code value to make decisions in your code, be sure that you know the exit code convention used by the application process. Note that the exit code may also be generated by the Compute Node operating system, such as when a process is forcibly terminated. + ExitCode *int32 `json:"exitCode,omitempty"` + // ContainerInfo - This property is set only if the Task runs in a container context. + ContainerInfo *TaskContainerExecutionInformation `json:"containerInfo,omitempty"` + // FailureInfo - This property is set only if the Task is in the completed state and encountered a failure. + FailureInfo *TaskFailureInformation `json:"failureInfo,omitempty"` + // Result - If the value is 'failed', then the details of the failure can be found in the failureInfo property. Possible values include: 'Success', 'Failure' + Result TaskExecutionResult `json:"result,omitempty"` +} + +// JobScheduleAddParameter ... +type JobScheduleAddParameter struct { + // ID - The ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within an Account that differ only by case). + ID *string `json:"id,omitempty"` + // DisplayName - The display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + DisplayName *string `json:"displayName,omitempty"` + Schedule *Schedule `json:"schedule,omitempty"` + JobSpecification *JobSpecification `json:"jobSpecification,omitempty"` + // Metadata - The Batch service does not assign any meaning to metadata; it is solely for the use of user code. + Metadata *[]MetadataItem `json:"metadata,omitempty"` +} + +// JobScheduleExecutionInformation ... +type JobScheduleExecutionInformation struct { + // NextRunTime - This property is meaningful only if the schedule is in the active state when the time comes around. For example, if the schedule is disabled, no Job will be created at nextRunTime unless the Job is enabled before then. + NextRunTime *date.Time `json:"nextRunTime,omitempty"` + // RecentJob - This property is present only if the at least one Job has run under the schedule. + RecentJob *RecentJob `json:"recentJob,omitempty"` + // EndTime - This property is set only if the Job Schedule is in the completed state. + EndTime *date.Time `json:"endTime,omitempty"` +} + +// JobSchedulePatchParameter ... +type JobSchedulePatchParameter struct { + // Schedule - If you do not specify this element, the existing schedule is left unchanged. + Schedule *Schedule `json:"schedule,omitempty"` + // JobSpecification - Updates affect only Jobs that are started after the update has taken place. Any currently active Job continues with the older specification. + JobSpecification *JobSpecification `json:"jobSpecification,omitempty"` + // Metadata - If you do not specify this element, existing metadata is left unchanged. + Metadata *[]MetadataItem `json:"metadata,omitempty"` +} + +// JobScheduleStatistics ... +type JobScheduleStatistics struct { + URL *string `json:"url,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + LastUpdateTime *date.Time `json:"lastUpdateTime,omitempty"` + UserCPUTime *string `json:"userCPUTime,omitempty"` + KernelCPUTime *string `json:"kernelCPUTime,omitempty"` + // WallClockTime - The wall clock time is the elapsed time from when the Task started running on a Compute Node to when it finished (or to the last time the statistics were updated, if the Task had not finished by then). If a Task was retried, this includes the wall clock time of all the Task retries. + WallClockTime *string `json:"wallClockTime,omitempty"` + ReadIOps *int64 `json:"readIOps,omitempty"` + WriteIOps *int64 `json:"writeIOps,omitempty"` + ReadIOGiB *float64 `json:"readIOGiB,omitempty"` + WriteIOGiB *float64 `json:"writeIOGiB,omitempty"` + NumSucceededTasks *int64 `json:"numSucceededTasks,omitempty"` + NumFailedTasks *int64 `json:"numFailedTasks,omitempty"` + NumTaskRetries *int64 `json:"numTaskRetries,omitempty"` + // WaitTime - This value is only reported in the Account lifetime statistics; it is not included in the Job statistics. + WaitTime *string `json:"waitTime,omitempty"` +} + +// JobScheduleUpdateParameter ... +type JobScheduleUpdateParameter struct { + // Schedule - If you do not specify this element, it is equivalent to passing the default schedule: that is, a single Job scheduled to run immediately. + Schedule *Schedule `json:"schedule,omitempty"` + // JobSpecification - Updates affect only Jobs that are started after the update has taken place. Any currently active Job continues with the older specification. + JobSpecification *JobSpecification `json:"jobSpecification,omitempty"` + // Metadata - If you do not specify this element, it takes the default value of an empty list; in effect, any existing metadata is deleted. + Metadata *[]MetadataItem `json:"metadata,omitempty"` +} + +// JobSchedulingError ... +type JobSchedulingError struct { + // Category - Possible values include: 'UserError', 'ServerError' + Category ErrorCategory `json:"category,omitempty"` + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Details *[]NameValuePair `json:"details,omitempty"` +} + +// JobSpecification ... +type JobSpecification struct { + // Priority - Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. The default value is 0. This priority is used as the default for all Jobs under the Job Schedule. You can update a Job's priority after it has been created using by using the update Job API. + Priority *int32 `json:"priority,omitempty"` + // MaxParallelTasks - The value of maxParallelTasks must be -1 or greater than 0 if specified. If not specified, the default value is -1, which means there's no limit to the number of tasks that can be run at once. You can update a job's maxParallelTasks after it has been created using the update job API. + MaxParallelTasks *int32 `json:"maxParallelTasks,omitempty"` + // DisplayName - The name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + DisplayName *string `json:"displayName,omitempty"` + UsesTaskDependencies *bool `json:"usesTaskDependencies,omitempty"` + // OnAllTasksComplete - Note that if a Job contains no Tasks, then all Tasks are considered complete. This option is therefore most commonly used with a Job Manager task; if you want to use automatic Job termination without a Job Manager, you should initially set onAllTasksComplete to noaction and update the Job properties to set onAllTasksComplete to terminatejob once you have finished adding Tasks. The default is noaction. Possible values include: 'NoAction', 'TerminateJob' + OnAllTasksComplete OnAllTasksComplete `json:"onAllTasksComplete,omitempty"` + // OnTaskFailure - The default is noaction. Possible values include: 'OnTaskFailureNoAction', 'OnTaskFailurePerformExitOptionsJobAction' + OnTaskFailure OnTaskFailure `json:"onTaskFailure,omitempty"` + NetworkConfiguration *JobNetworkConfiguration `json:"networkConfiguration,omitempty"` + Constraints *JobConstraints `json:"constraints,omitempty"` + // JobManagerTask - If the Job does not specify a Job Manager Task, the user must explicitly add Tasks to the Job using the Task API. If the Job does specify a Job Manager Task, the Batch service creates the Job Manager Task when the Job is created, and will try to schedule the Job Manager Task before scheduling other Tasks in the Job. + JobManagerTask *JobManagerTask `json:"jobManagerTask,omitempty"` + // JobPreparationTask - If a Job has a Job Preparation Task, the Batch service will run the Job Preparation Task on a Node before starting any Tasks of that Job on that Compute Node. + JobPreparationTask *JobPreparationTask `json:"jobPreparationTask,omitempty"` + // JobReleaseTask - The primary purpose of the Job Release Task is to undo changes to Nodes made by the Job Preparation Task. Example activities include deleting local files, or shutting down services that were started as part of Job preparation. A Job Release Task cannot be specified without also specifying a Job Preparation Task for the Job. The Batch service runs the Job Release Task on the Compute Nodes that have run the Job Preparation Task. + JobReleaseTask *JobReleaseTask `json:"jobReleaseTask,omitempty"` + // CommonEnvironmentSettings - Individual Tasks can override an environment setting specified here by specifying the same setting name with a different value. + CommonEnvironmentSettings *[]EnvironmentSetting `json:"commonEnvironmentSettings,omitempty"` + PoolInfo *PoolInformation `json:"poolInfo,omitempty"` + // Metadata - The Batch service does not assign any meaning to metadata; it is solely for the use of user code. + Metadata *[]MetadataItem `json:"metadata,omitempty"` +} + +// JobStatistics ... +type JobStatistics struct { + autorest.Response `json:"-"` + URL *string `json:"url,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + LastUpdateTime *date.Time `json:"lastUpdateTime,omitempty"` + UserCPUTime *string `json:"userCPUTime,omitempty"` + KernelCPUTime *string `json:"kernelCPUTime,omitempty"` + // WallClockTime - The wall clock time is the elapsed time from when the Task started running on a Compute Node to when it finished (or to the last time the statistics were updated, if the Task had not finished by then). If a Task was retried, this includes the wall clock time of all the Task retries. + WallClockTime *string `json:"wallClockTime,omitempty"` + ReadIOps *int64 `json:"readIOps,omitempty"` + WriteIOps *int64 `json:"writeIOps,omitempty"` + ReadIOGiB *float64 `json:"readIOGiB,omitempty"` + WriteIOGiB *float64 `json:"writeIOGiB,omitempty"` + // NumSucceededTasks - A Task completes successfully if it returns exit code 0. + NumSucceededTasks *int64 `json:"numSucceededTasks,omitempty"` + // NumFailedTasks - A Task fails if it exhausts its maximum retry count without returning exit code 0. + NumFailedTasks *int64 `json:"numFailedTasks,omitempty"` + NumTaskRetries *int64 `json:"numTaskRetries,omitempty"` + // WaitTime - The wait time for a Task is defined as the elapsed time between the creation of the Task and the start of Task execution. (If the Task is retried due to failures, the wait time is the time to the most recent Task execution.) This value is only reported in the Account lifetime statistics; it is not included in the Job statistics. + WaitTime *string `json:"waitTime,omitempty"` +} + +// JobTerminateParameter ... +type JobTerminateParameter struct { + TerminateReason *string `json:"terminateReason,omitempty"` +} + +// JobUpdateParameter ... +type JobUpdateParameter struct { + // Priority - Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. If omitted, it is set to the default value 0. + Priority *int32 `json:"priority,omitempty"` + // Constraints - If omitted, the constraints are cleared. + Constraints *JobConstraints `json:"constraints,omitempty"` + // PoolInfo - You may change the Pool for a Job only when the Job is disabled. The Update Job call will fail if you include the poolInfo element and the Job is not disabled. If you specify an autoPoolSpecification in the poolInfo, only the keepAlive property of the autoPoolSpecification can be updated, and then only if the autoPoolSpecification has a poolLifetimeOption of Job (other job properties can be updated as normal). + PoolInfo *PoolInformation `json:"poolInfo,omitempty"` + // Metadata - If omitted, it takes the default value of an empty list; in effect, any existing metadata is deleted. + Metadata *[]MetadataItem `json:"metadata,omitempty"` + // OnAllTasksComplete - If omitted, the completion behavior is set to noaction. If the current value is terminatejob, this is an error because a Job's completion behavior may not be changed from terminatejob to noaction. You may not change the value from terminatejob to noaction - that is, once you have engaged automatic Job termination, you cannot turn it off again. If you try to do this, the request fails and Batch returns status code 400 (Bad Request) and an 'invalid property value' error response. If you do not specify this element in a PUT request, it is equivalent to passing noaction. This is an error if the current value is terminatejob. Possible values include: 'NoAction', 'TerminateJob' + OnAllTasksComplete OnAllTasksComplete `json:"onAllTasksComplete,omitempty"` +} + +// LinuxUserConfiguration ... +type LinuxUserConfiguration struct { + // UID - The uid and gid properties must be specified together or not at all. If not specified the underlying operating system picks the uid. + UID *int32 `json:"uid,omitempty"` + // Gid - The uid and gid properties must be specified together or not at all. If not specified the underlying operating system picks the gid. + Gid *int32 `json:"gid,omitempty"` + // SSHPrivateKey - The private key must not be password protected. The private key is used to automatically configure asymmetric-key based authentication for SSH between Compute Nodes in a Linux Pool when the Pool's enableInterNodeCommunication property is true (it is ignored if enableInterNodeCommunication is false). It does this by placing the key pair into the user's .ssh directory. If not specified, password-less SSH is not configured between Compute Nodes (no modification of the user's .ssh directory is done). + SSHPrivateKey *string `json:"sshPrivateKey,omitempty"` +} + +// MetadataItem the Batch service does not assign any meaning to this metadata; it is solely for the use of +// user code. +type MetadataItem struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// MountConfiguration ... +type MountConfiguration struct { + // AzureBlobFileSystemConfiguration - This property is mutually exclusive with all other properties. + AzureBlobFileSystemConfiguration *AzureBlobFileSystemConfiguration `json:"azureBlobFileSystemConfiguration,omitempty"` + // NfsMountConfiguration - This property is mutually exclusive with all other properties. + NfsMountConfiguration *NFSMountConfiguration `json:"nfsMountConfiguration,omitempty"` + // CifsMountConfiguration - This property is mutually exclusive with all other properties. + CifsMountConfiguration *CIFSMountConfiguration `json:"cifsMountConfiguration,omitempty"` + // AzureFileShareConfiguration - This property is mutually exclusive with all other properties. + AzureFileShareConfiguration *AzureFileShareConfiguration `json:"azureFileShareConfiguration,omitempty"` +} + +// MultiInstanceSettings multi-instance Tasks are commonly used to support MPI Tasks. In the MPI case, if +// any of the subtasks fail (for example due to exiting with a non-zero exit code) the entire +// multi-instance Task fails. The multi-instance Task is then terminated and retried, up to its retry +// limit. +type MultiInstanceSettings struct { + // NumberOfInstances - If omitted, the default is 1. + NumberOfInstances *int32 `json:"numberOfInstances,omitempty"` + // CoordinationCommandLine - A typical coordination command line launches a background service and verifies that the service is ready to process inter-node messages. + CoordinationCommandLine *string `json:"coordinationCommandLine,omitempty"` + // CommonResourceFiles - The difference between common resource files and Task resource files is that common resource files are downloaded for all subtasks including the primary, whereas Task resource files are downloaded only for the primary. Also note that these resource files are not downloaded to the Task working directory, but instead are downloaded to the Task root directory (one directory above the working directory). There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of ResourceFiles must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers. + CommonResourceFiles *[]ResourceFile `json:"commonResourceFiles,omitempty"` +} + +// NameValuePair ... +type NameValuePair struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// NetworkConfiguration the network configuration for a Pool. +type NetworkConfiguration struct { + // SubnetID - The virtual network must be in the same region and subscription as the Azure Batch Account. The specified subnet should have enough free IP addresses to accommodate the number of Compute Nodes in the Pool. If the subnet doesn't have enough free IP addresses, the Pool will partially allocate Nodes and a resize error will occur. The 'MicrosoftAzureBatch' service principal must have the 'Classic Virtual Machine Contributor' Role-Based Access Control (RBAC) role for the specified VNet. The specified subnet must allow communication from the Azure Batch service to be able to schedule Tasks on the Nodes. This can be verified by checking if the specified VNet has any associated Network Security Groups (NSG). If communication to the Nodes in the specified subnet is denied by an NSG, then the Batch service will set the state of the Compute Nodes to unusable. For Pools created with virtualMachineConfiguration only ARM virtual networks ('Microsoft.Network/virtualNetworks') are supported, but for Pools created with cloudServiceConfiguration both ARM and classic virtual networks are supported. If the specified VNet has any associated Network Security Groups (NSG), then a few reserved system ports must be enabled for inbound communication. For Pools created with a virtual machine configuration, enable ports 29876 and 29877, as well as port 22 for Linux and port 3389 for Windows. For Pools created with a cloud service configuration, enable ports 10100, 20100, and 30100. Also enable outbound connections to Azure Storage on port 443. For more details see: https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration + SubnetID *string `json:"subnetId,omitempty"` + // DynamicVNetAssignmentScope - Possible values include: 'DynamicVNetAssignmentScopeNone', 'DynamicVNetAssignmentScopeJob' + DynamicVNetAssignmentScope DynamicVNetAssignmentScope `json:"dynamicVNetAssignmentScope,omitempty"` + // EndpointConfiguration - Pool endpoint configuration is only supported on Pools with the virtualMachineConfiguration property. + EndpointConfiguration *PoolEndpointConfiguration `json:"endpointConfiguration,omitempty"` + // PublicIPAddressConfiguration - Public IP configuration property is only supported on Pools with the virtualMachineConfiguration property. + PublicIPAddressConfiguration *PublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` +} + +// NetworkSecurityGroupRule ... +type NetworkSecurityGroupRule struct { + // Priority - Priorities within a Pool must be unique and are evaluated in order of priority. The lower the number the higher the priority. For example, rules could be specified with order numbers of 150, 250, and 350. The rule with the order number of 150 takes precedence over the rule that has an order of 250. Allowed priorities are 150 to 4096. If any reserved or duplicate values are provided the request fails with HTTP status code 400. + Priority *int32 `json:"priority,omitempty"` + // Access - Possible values include: 'Allow', 'Deny' + Access NetworkSecurityGroupRuleAccess `json:"access,omitempty"` + // SourceAddressPrefix - Valid values are a single IP address (i.e. 10.10.10.10), IP subnet (i.e. 192.168.1.0/24), default tag, or * (for all addresses). If any other values are provided the request fails with HTTP status code 400. + SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` + // SourcePortRanges - Valid values are '*' (for all ports 0 - 65535), a specific port (i.e. 22), or a port range (i.e. 100-200). The ports must be in the range of 0 to 65535. Each entry in this collection must not overlap any other entry (either a range or an individual port). If any other values are provided the request fails with HTTP status code 400. The default value is '*'. + SourcePortRanges *[]string `json:"sourcePortRanges,omitempty"` +} + +// NFSMountConfiguration ... +type NFSMountConfiguration struct { + Source *string `json:"source,omitempty"` + // RelativeMountPath - All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + RelativeMountPath *string `json:"relativeMountPath,omitempty"` + // MountOptions - These are 'net use' options in Windows and 'mount' options in Linux. + MountOptions *string `json:"mountOptions,omitempty"` +} + +// NodeAgentInformation the Batch Compute Node agent is a program that runs on each Compute Node in the +// Pool and provides Batch capability on the Compute Node. +type NodeAgentInformation struct { + // Version - This version number can be checked against the Compute Node agent release notes located at https://github.com/Azure/Batch/blob/master/changelogs/nodeagent/CHANGELOG.md. + Version *string `json:"version,omitempty"` + // LastUpdateTime - This is the most recent time that the Compute Node agent was updated to a new version. + LastUpdateTime *date.Time `json:"lastUpdateTime,omitempty"` +} + +// NodeCounts ... +type NodeCounts struct { + Creating *int32 `json:"creating,omitempty"` + Idle *int32 `json:"idle,omitempty"` + Offline *int32 `json:"offline,omitempty"` + Preempted *int32 `json:"preempted,omitempty"` + Rebooting *int32 `json:"rebooting,omitempty"` + Reimaging *int32 `json:"reimaging,omitempty"` + Running *int32 `json:"running,omitempty"` + Starting *int32 `json:"starting,omitempty"` + StartTaskFailed *int32 `json:"startTaskFailed,omitempty"` + LeavingPool *int32 `json:"leavingPool,omitempty"` + Unknown *int32 `json:"unknown,omitempty"` + Unusable *int32 `json:"unusable,omitempty"` + WaitingForStartTask *int32 `json:"waitingForStartTask,omitempty"` + Total *int32 `json:"total,omitempty"` +} + +// NodeDisableSchedulingParameter ... +type NodeDisableSchedulingParameter struct { + // NodeDisableSchedulingOption - The default value is requeue. Possible values include: 'DisableComputeNodeSchedulingOptionRequeue', 'DisableComputeNodeSchedulingOptionTerminate', 'DisableComputeNodeSchedulingOptionTaskCompletion' + NodeDisableSchedulingOption DisableComputeNodeSchedulingOption `json:"nodeDisableSchedulingOption,omitempty"` +} + +// NodeFile ... +type NodeFile struct { + Name *string `json:"name,omitempty"` + URL *string `json:"url,omitempty"` + IsDirectory *bool `json:"isDirectory,omitempty"` + Properties *FileProperties `json:"properties,omitempty"` +} + +// NodeFileListResult ... +type NodeFileListResult struct { + autorest.Response `json:"-"` + Value *[]NodeFile `json:"value,omitempty"` + OdataNextLink *string `json:"odata.nextLink,omitempty"` +} + +// NodeFileListResultIterator provides access to a complete listing of NodeFile values. +type NodeFileListResultIterator struct { + i int + page NodeFileListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *NodeFileListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NodeFileListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *NodeFileListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter NodeFileListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter NodeFileListResultIterator) Response() NodeFileListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter NodeFileListResultIterator) Value() NodeFile { + if !iter.page.NotDone() { + return NodeFile{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the NodeFileListResultIterator type. +func NewNodeFileListResultIterator(page NodeFileListResultPage) NodeFileListResultIterator { + return NodeFileListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (nflr NodeFileListResult) IsEmpty() bool { + return nflr.Value == nil || len(*nflr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (nflr NodeFileListResult) hasNextLink() bool { + return nflr.OdataNextLink != nil && len(*nflr.OdataNextLink) != 0 +} + +// nodeFileListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (nflr NodeFileListResult) nodeFileListResultPreparer(ctx context.Context) (*http.Request, error) { + if !nflr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(nflr.OdataNextLink))) +} + +// NodeFileListResultPage contains a page of NodeFile values. +type NodeFileListResultPage struct { + fn func(context.Context, NodeFileListResult) (NodeFileListResult, error) + nflr NodeFileListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *NodeFileListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NodeFileListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.nflr) + if err != nil { + return err + } + page.nflr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *NodeFileListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page NodeFileListResultPage) NotDone() bool { + return !page.nflr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page NodeFileListResultPage) Response() NodeFileListResult { + return page.nflr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page NodeFileListResultPage) Values() []NodeFile { + if page.nflr.IsEmpty() { + return nil + } + return *page.nflr.Value +} + +// Creates a new instance of the NodeFileListResultPage type. +func NewNodeFileListResultPage(cur NodeFileListResult, getNextPage func(context.Context, NodeFileListResult) (NodeFileListResult, error)) NodeFileListResultPage { + return NodeFileListResultPage{ + fn: getNextPage, + nflr: cur, + } +} + +// NodePlacementConfiguration for regional placement, nodes in the pool will be allocated in the same +// region. For zonal placement, nodes in the pool will be spread across different zones with best effort +// balancing. +type NodePlacementConfiguration struct { + // Policy - Allocation policy used by Batch Service to provision the nodes. If not specified, Batch will use the regional policy. Possible values include: 'Regional', 'Zonal' + Policy NodePlacementPolicyType `json:"policy,omitempty"` +} + +// NodeRebootParameter ... +type NodeRebootParameter struct { + // NodeRebootOption - The default value is requeue. Possible values include: 'ComputeNodeRebootOptionRequeue', 'ComputeNodeRebootOptionTerminate', 'ComputeNodeRebootOptionTaskCompletion', 'ComputeNodeRebootOptionRetainedData' + NodeRebootOption ComputeNodeRebootOption `json:"nodeRebootOption,omitempty"` +} + +// NodeReimageParameter ... +type NodeReimageParameter struct { + // NodeReimageOption - The default value is requeue. Possible values include: 'ComputeNodeReimageOptionRequeue', 'ComputeNodeReimageOptionTerminate', 'ComputeNodeReimageOptionTaskCompletion', 'ComputeNodeReimageOptionRetainedData' + NodeReimageOption ComputeNodeReimageOption `json:"nodeReimageOption,omitempty"` +} + +// NodeRemoveParameter ... +type NodeRemoveParameter struct { + // NodeList - A maximum of 100 nodes may be removed per request. + NodeList *[]string `json:"nodeList,omitempty"` + // ResizeTimeout - The default value is 15 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + ResizeTimeout *string `json:"resizeTimeout,omitempty"` + // NodeDeallocationOption - The default value is requeue. Possible values include: 'Requeue', 'Terminate', 'TaskCompletion', 'RetainedData' + NodeDeallocationOption ComputeNodeDeallocationOption `json:"nodeDeallocationOption,omitempty"` +} + +// NodeUpdateUserParameter ... +type NodeUpdateUserParameter struct { + // Password - The password is required for Windows Compute Nodes (those created with 'cloudServiceConfiguration', or created with 'virtualMachineConfiguration' using a Windows Image reference). For Linux Compute Nodes, the password can optionally be specified along with the sshPublicKey property. If omitted, any existing password is removed. + Password *string `json:"password,omitempty"` + // ExpiryTime - If omitted, the default is 1 day from the current time. For Linux Compute Nodes, the expiryTime has a precision up to a day. + ExpiryTime *date.Time `json:"expiryTime,omitempty"` + // SSHPublicKey - The public key should be compatible with OpenSSH encoding and should be base 64 encoded. This property can be specified only for Linux Compute Nodes. If this is specified for a Windows Compute Node, then the Batch service rejects the request; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). If omitted, any existing SSH public key is removed. + SSHPublicKey *string `json:"sshPublicKey,omitempty"` +} + +// NodeVMExtension ... +type NodeVMExtension struct { + autorest.Response `json:"-"` + ProvisioningState *string `json:"provisioningState,omitempty"` + VMExtension *VMExtension `json:"vmExtension,omitempty"` + InstanceView *VMExtensionInstanceView `json:"instanceView,omitempty"` +} + +// NodeVMExtensionList ... +type NodeVMExtensionList struct { + autorest.Response `json:"-"` + Value *[]NodeVMExtension `json:"value,omitempty"` + OdataNextLink *string `json:"odata.nextLink,omitempty"` +} + +// NodeVMExtensionListIterator provides access to a complete listing of NodeVMExtension values. +type NodeVMExtensionListIterator struct { + i int + page NodeVMExtensionListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *NodeVMExtensionListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NodeVMExtensionListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *NodeVMExtensionListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter NodeVMExtensionListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter NodeVMExtensionListIterator) Response() NodeVMExtensionList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter NodeVMExtensionListIterator) Value() NodeVMExtension { + if !iter.page.NotDone() { + return NodeVMExtension{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the NodeVMExtensionListIterator type. +func NewNodeVMExtensionListIterator(page NodeVMExtensionListPage) NodeVMExtensionListIterator { + return NodeVMExtensionListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (nvel NodeVMExtensionList) IsEmpty() bool { + return nvel.Value == nil || len(*nvel.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (nvel NodeVMExtensionList) hasNextLink() bool { + return nvel.OdataNextLink != nil && len(*nvel.OdataNextLink) != 0 +} + +// nodeVMExtensionListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (nvel NodeVMExtensionList) nodeVMExtensionListPreparer(ctx context.Context) (*http.Request, error) { + if !nvel.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(nvel.OdataNextLink))) +} + +// NodeVMExtensionListPage contains a page of NodeVMExtension values. +type NodeVMExtensionListPage struct { + fn func(context.Context, NodeVMExtensionList) (NodeVMExtensionList, error) + nvel NodeVMExtensionList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *NodeVMExtensionListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NodeVMExtensionListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.nvel) + if err != nil { + return err + } + page.nvel = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *NodeVMExtensionListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page NodeVMExtensionListPage) NotDone() bool { + return !page.nvel.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page NodeVMExtensionListPage) Response() NodeVMExtensionList { + return page.nvel +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page NodeVMExtensionListPage) Values() []NodeVMExtension { + if page.nvel.IsEmpty() { + return nil + } + return *page.nvel.Value +} + +// Creates a new instance of the NodeVMExtensionListPage type. +func NewNodeVMExtensionListPage(cur NodeVMExtensionList, getNextPage func(context.Context, NodeVMExtensionList) (NodeVMExtensionList, error)) NodeVMExtensionListPage { + return NodeVMExtensionListPage{ + fn: getNextPage, + nvel: cur, + } +} + +// OSDisk ... +type OSDisk struct { + EphemeralOSDiskSettings *DiffDiskSettings `json:"ephemeralOSDiskSettings,omitempty"` +} + +// OutputFile on every file uploads, Batch service writes two log files to the compute node, +// 'fileuploadout.txt' and 'fileuploaderr.txt'. These log files are used to learn more about a specific +// failure. +type OutputFile struct { + // FilePattern - Both relative and absolute paths are supported. Relative paths are relative to the Task working directory. The following wildcards are supported: * matches 0 or more characters (for example pattern abc* would match abc or abcdef), ** matches any directory, ? matches any single character, [abc] matches one character in the brackets, and [a-c] matches one character in the range. Brackets can include a negation to match any character not specified (for example [!abc] matches any character but a, b, or c). If a file name starts with "." it is ignored by default but may be matched by specifying it explicitly (for example *.gif will not match .a.gif, but .*.gif will). A simple example: **\*.txt matches any file that does not start in '.' and ends with .txt in the Task working directory or any subdirectory. If the filename contains a wildcard character it can be escaped using brackets (for example abc[*] would match a file named abc*). Note that both \ and / are treated as directory separators on Windows, but only / is on Linux. Environment variables (%var% on Windows or $var on Linux) are expanded prior to the pattern being applied. + FilePattern *string `json:"filePattern,omitempty"` + Destination *OutputFileDestination `json:"destination,omitempty"` + UploadOptions *OutputFileUploadOptions `json:"uploadOptions,omitempty"` +} + +// OutputFileBlobContainerDestination ... +type OutputFileBlobContainerDestination struct { + // Path - If filePattern refers to a specific file (i.e. contains no wildcards), then path is the name of the blob to which to upload that file. If filePattern contains one or more wildcards (and therefore may match multiple files), then path is the name of the blob virtual directory (which is prepended to each blob name) to which to upload the file(s). If omitted, file(s) are uploaded to the root of the container with a blob name matching their file name. + Path *string `json:"path,omitempty"` + // ContainerURL - If not using a managed identity, the URL must include a Shared Access Signature (SAS) granting write permissions to the container. + ContainerURL *string `json:"containerUrl,omitempty"` + // IdentityReference - The identity must have write access to the Azure Blob Storage container + IdentityReference *ComputeNodeIdentityReference `json:"identityReference,omitempty"` +} + +// OutputFileDestination ... +type OutputFileDestination struct { + Container *OutputFileBlobContainerDestination `json:"container,omitempty"` +} + +// OutputFileUploadOptions ... +type OutputFileUploadOptions struct { + // UploadCondition - The default is taskcompletion. Possible values include: 'OutputFileUploadConditionTaskSuccess', 'OutputFileUploadConditionTaskFailure', 'OutputFileUploadConditionTaskCompletion' + UploadCondition OutputFileUploadCondition `json:"uploadCondition,omitempty"` +} + +// PoolAddParameter ... +type PoolAddParameter struct { + // ID - The ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two Pool IDs within an Account that differ only by case). + ID *string `json:"id,omitempty"` + // DisplayName - The display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + DisplayName *string `json:"displayName,omitempty"` + // VMSize - For information about available sizes of virtual machines for Cloud Services Pools (pools created with cloudServiceConfiguration), see Sizes for Cloud Services (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). Batch supports all Cloud Services VM sizes except ExtraSmall, A1V2 and A2V2. For information about available VM sizes for Pools using Images from the Virtual Machines Marketplace (pools created with virtualMachineConfiguration) see Sizes for Virtual Machines (Linux) (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) or Sizes for Virtual Machines (Windows) (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). Batch supports all Azure VM sizes except STANDARD_A0 and those with premium storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series). + VMSize *string `json:"vmSize,omitempty"` + // CloudServiceConfiguration - This property and virtualMachineConfiguration are mutually exclusive and one of the properties must be specified. This property cannot be specified if the Batch Account was created with its poolAllocationMode property set to 'UserSubscription'. + CloudServiceConfiguration *CloudServiceConfiguration `json:"cloudServiceConfiguration,omitempty"` + // VirtualMachineConfiguration - This property and cloudServiceConfiguration are mutually exclusive and one of the properties must be specified. + VirtualMachineConfiguration *VirtualMachineConfiguration `json:"virtualMachineConfiguration,omitempty"` + // ResizeTimeout - This timeout applies only to manual scaling; it has no effect when enableAutoScale is set to true. The default value is 15 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + ResizeTimeout *string `json:"resizeTimeout,omitempty"` + // TargetDedicatedNodes - This property must not be specified if enableAutoScale is set to true. If enableAutoScale is set to false, then you must set either targetDedicatedNodes, targetLowPriorityNodes, or both. + TargetDedicatedNodes *int32 `json:"targetDedicatedNodes,omitempty"` + // TargetLowPriorityNodes - This property must not be specified if enableAutoScale is set to true. If enableAutoScale is set to false, then you must set either targetDedicatedNodes, targetLowPriorityNodes, or both. + TargetLowPriorityNodes *int32 `json:"targetLowPriorityNodes,omitempty"` + // EnableAutoScale - If false, at least one of targetDedicatedNodes and targetLowPriorityNodes must be specified. If true, the autoScaleFormula property is required and the Pool automatically resizes according to the formula. The default value is false. + EnableAutoScale *bool `json:"enableAutoScale,omitempty"` + // AutoScaleFormula - This property must not be specified if enableAutoScale is set to false. It is required if enableAutoScale is set to true. The formula is checked for validity before the Pool is created. If the formula is not valid, the Batch service rejects the request with detailed error information. For more information about specifying this formula, see 'Automatically scale Compute Nodes in an Azure Batch Pool' (https://azure.microsoft.com/documentation/articles/batch-automatic-scaling/). + AutoScaleFormula *string `json:"autoScaleFormula,omitempty"` + // AutoScaleEvaluationInterval - The default value is 15 minutes. The minimum and maximum value are 5 minutes and 168 hours respectively. If you specify a value less than 5 minutes or greater than 168 hours, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + AutoScaleEvaluationInterval *string `json:"autoScaleEvaluationInterval,omitempty"` + // EnableInterNodeCommunication - Enabling inter-node communication limits the maximum size of the Pool due to deployment restrictions on the Compute Nodes of the Pool. This may result in the Pool not reaching its desired size. The default value is false. + EnableInterNodeCommunication *bool `json:"enableInterNodeCommunication,omitempty"` + NetworkConfiguration *NetworkConfiguration `json:"networkConfiguration,omitempty"` + // StartTask - The Task runs when the Compute Node is added to the Pool or when the Compute Node is restarted. + StartTask *StartTask `json:"startTask,omitempty"` + // CertificateReferences - For Windows Nodes, the Batch service installs the Certificates to the specified Certificate store and location. For Linux Compute Nodes, the Certificates are stored in a directory inside the Task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the Task to query for this location. For Certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and Certificates are placed in that directory. + CertificateReferences *[]CertificateReference `json:"certificateReferences,omitempty"` + // ApplicationPackageReferences - Changes to Package references affect all new Nodes joining the Pool, but do not affect Compute Nodes that are already in the Pool until they are rebooted or reimaged. There is a maximum of 10 Package references on any given Pool. + ApplicationPackageReferences *[]ApplicationPackageReference `json:"applicationPackageReferences,omitempty"` + // ApplicationLicenses - The list of application licenses must be a subset of available Batch service application licenses. If a license is requested which is not supported, Pool creation will fail. + ApplicationLicenses *[]string `json:"applicationLicenses,omitempty"` + // TaskSlotsPerNode - The default value is 1. The maximum value is the smaller of 4 times the number of cores of the vmSize of the pool or 256. + TaskSlotsPerNode *int32 `json:"taskSlotsPerNode,omitempty"` + // TaskSchedulingPolicy - If not specified, the default is spread. + TaskSchedulingPolicy *TaskSchedulingPolicy `json:"taskSchedulingPolicy,omitempty"` + UserAccounts *[]UserAccount `json:"userAccounts,omitempty"` + // Metadata - The Batch service does not assign any meaning to metadata; it is solely for the use of user code. + Metadata *[]MetadataItem `json:"metadata,omitempty"` + // MountConfiguration - Mount the storage using Azure fileshare, NFS, CIFS or Blobfuse based file system. + MountConfiguration *[]MountConfiguration `json:"mountConfiguration,omitempty"` +} + +// PoolEnableAutoScaleParameter ... +type PoolEnableAutoScaleParameter struct { + // AutoScaleFormula - The formula is checked for validity before it is applied to the Pool. If the formula is not valid, the Batch service rejects the request with detailed error information. For more information about specifying this formula, see Automatically scale Compute Nodes in an Azure Batch Pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling). + AutoScaleFormula *string `json:"autoScaleFormula,omitempty"` + // AutoScaleEvaluationInterval - The default value is 15 minutes. The minimum and maximum value are 5 minutes and 168 hours respectively. If you specify a value less than 5 minutes or greater than 168 hours, the Batch service rejects the request with an invalid property value error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). If you specify a new interval, then the existing autoscale evaluation schedule will be stopped and a new autoscale evaluation schedule will be started, with its starting time being the time when this request was issued. + AutoScaleEvaluationInterval *string `json:"autoScaleEvaluationInterval,omitempty"` +} + +// PoolEndpointConfiguration ... +type PoolEndpointConfiguration struct { + // InboundNATPools - The maximum number of inbound NAT Pools per Batch Pool is 5. If the maximum number of inbound NAT Pools is exceeded the request fails with HTTP status code 400. This cannot be specified if the IPAddressProvisioningType is NoPublicIPAddresses. + InboundNATPools *[]InboundNATPool `json:"inboundNATPools,omitempty"` +} + +// PoolEvaluateAutoScaleParameter ... +type PoolEvaluateAutoScaleParameter struct { + // AutoScaleFormula - The formula is validated and its results calculated, but it is not applied to the Pool. To apply the formula to the Pool, 'Enable automatic scaling on a Pool'. For more information about specifying this formula, see Automatically scale Compute Nodes in an Azure Batch Pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling). + AutoScaleFormula *string `json:"autoScaleFormula,omitempty"` +} + +// PoolIdentity the identity of the Batch pool, if configured. +type PoolIdentity struct { + // Type - The list of user identities associated with the Batch pool. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. Possible values include: 'PoolIdentityTypeUserAssigned', 'PoolIdentityTypeNone' + Type PoolIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + UserAssignedIdentities *[]UserAssignedIdentity `json:"userAssignedIdentities,omitempty"` +} + +// PoolInformation ... +type PoolInformation struct { + // PoolID - You must ensure that the Pool referenced by this property exists. If the Pool does not exist at the time the Batch service tries to schedule a Job, no Tasks for the Job will run until you create a Pool with that id. Note that the Batch service will not reject the Job request; it will simply not run Tasks until the Pool exists. You must specify either the Pool ID or the auto Pool specification, but not both. + PoolID *string `json:"poolId,omitempty"` + // AutoPoolSpecification - If auto Pool creation fails, the Batch service moves the Job to a completed state, and the Pool creation error is set in the Job's scheduling error property. The Batch service manages the lifetime (both creation and, unless keepAlive is specified, deletion) of the auto Pool. Any user actions that affect the lifetime of the auto Pool while the Job is active will result in unexpected behavior. You must specify either the Pool ID or the auto Pool specification, but not both. + AutoPoolSpecification *AutoPoolSpecification `json:"autoPoolSpecification,omitempty"` +} + +// PoolListUsageMetricsResult ... +type PoolListUsageMetricsResult struct { + autorest.Response `json:"-"` + Value *[]PoolUsageMetrics `json:"value,omitempty"` + OdataNextLink *string `json:"odata.nextLink,omitempty"` +} + +// PoolListUsageMetricsResultIterator provides access to a complete listing of PoolUsageMetrics values. +type PoolListUsageMetricsResultIterator struct { + i int + page PoolListUsageMetricsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PoolListUsageMetricsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolListUsageMetricsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PoolListUsageMetricsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PoolListUsageMetricsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PoolListUsageMetricsResultIterator) Response() PoolListUsageMetricsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PoolListUsageMetricsResultIterator) Value() PoolUsageMetrics { + if !iter.page.NotDone() { + return PoolUsageMetrics{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PoolListUsageMetricsResultIterator type. +func NewPoolListUsageMetricsResultIterator(page PoolListUsageMetricsResultPage) PoolListUsageMetricsResultIterator { + return PoolListUsageMetricsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (plumr PoolListUsageMetricsResult) IsEmpty() bool { + return plumr.Value == nil || len(*plumr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (plumr PoolListUsageMetricsResult) hasNextLink() bool { + return plumr.OdataNextLink != nil && len(*plumr.OdataNextLink) != 0 +} + +// poolListUsageMetricsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (plumr PoolListUsageMetricsResult) poolListUsageMetricsResultPreparer(ctx context.Context) (*http.Request, error) { + if !plumr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(plumr.OdataNextLink))) +} + +// PoolListUsageMetricsResultPage contains a page of PoolUsageMetrics values. +type PoolListUsageMetricsResultPage struct { + fn func(context.Context, PoolListUsageMetricsResult) (PoolListUsageMetricsResult, error) + plumr PoolListUsageMetricsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PoolListUsageMetricsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolListUsageMetricsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.plumr) + if err != nil { + return err + } + page.plumr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PoolListUsageMetricsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PoolListUsageMetricsResultPage) NotDone() bool { + return !page.plumr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PoolListUsageMetricsResultPage) Response() PoolListUsageMetricsResult { + return page.plumr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PoolListUsageMetricsResultPage) Values() []PoolUsageMetrics { + if page.plumr.IsEmpty() { + return nil + } + return *page.plumr.Value +} + +// Creates a new instance of the PoolListUsageMetricsResultPage type. +func NewPoolListUsageMetricsResultPage(cur PoolListUsageMetricsResult, getNextPage func(context.Context, PoolListUsageMetricsResult) (PoolListUsageMetricsResult, error)) PoolListUsageMetricsResultPage { + return PoolListUsageMetricsResultPage{ + fn: getNextPage, + plumr: cur, + } +} + +// PoolNodeCounts ... +type PoolNodeCounts struct { + PoolID *string `json:"poolId,omitempty"` + Dedicated *NodeCounts `json:"dedicated,omitempty"` + LowPriority *NodeCounts `json:"lowPriority,omitempty"` +} + +// PoolNodeCountsListResult ... +type PoolNodeCountsListResult struct { + autorest.Response `json:"-"` + // Value - A list of Compute Node counts by Pool. + Value *[]PoolNodeCounts `json:"value,omitempty"` + OdataNextLink *string `json:"odata.nextLink,omitempty"` +} + +// PoolNodeCountsListResultIterator provides access to a complete listing of PoolNodeCounts values. +type PoolNodeCountsListResultIterator struct { + i int + page PoolNodeCountsListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PoolNodeCountsListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolNodeCountsListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PoolNodeCountsListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PoolNodeCountsListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PoolNodeCountsListResultIterator) Response() PoolNodeCountsListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PoolNodeCountsListResultIterator) Value() PoolNodeCounts { + if !iter.page.NotDone() { + return PoolNodeCounts{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PoolNodeCountsListResultIterator type. +func NewPoolNodeCountsListResultIterator(page PoolNodeCountsListResultPage) PoolNodeCountsListResultIterator { + return PoolNodeCountsListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pnclr PoolNodeCountsListResult) IsEmpty() bool { + return pnclr.Value == nil || len(*pnclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (pnclr PoolNodeCountsListResult) hasNextLink() bool { + return pnclr.OdataNextLink != nil && len(*pnclr.OdataNextLink) != 0 +} + +// poolNodeCountsListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pnclr PoolNodeCountsListResult) poolNodeCountsListResultPreparer(ctx context.Context) (*http.Request, error) { + if !pnclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pnclr.OdataNextLink))) +} + +// PoolNodeCountsListResultPage contains a page of PoolNodeCounts values. +type PoolNodeCountsListResultPage struct { + fn func(context.Context, PoolNodeCountsListResult) (PoolNodeCountsListResult, error) + pnclr PoolNodeCountsListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PoolNodeCountsListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolNodeCountsListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.pnclr) + if err != nil { + return err + } + page.pnclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PoolNodeCountsListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PoolNodeCountsListResultPage) NotDone() bool { + return !page.pnclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PoolNodeCountsListResultPage) Response() PoolNodeCountsListResult { + return page.pnclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PoolNodeCountsListResultPage) Values() []PoolNodeCounts { + if page.pnclr.IsEmpty() { + return nil + } + return *page.pnclr.Value +} + +// Creates a new instance of the PoolNodeCountsListResultPage type. +func NewPoolNodeCountsListResultPage(cur PoolNodeCountsListResult, getNextPage func(context.Context, PoolNodeCountsListResult) (PoolNodeCountsListResult, error)) PoolNodeCountsListResultPage { + return PoolNodeCountsListResultPage{ + fn: getNextPage, + pnclr: cur, + } +} + +// PoolPatchParameter ... +type PoolPatchParameter struct { + // StartTask - If this element is present, it overwrites any existing StartTask. If omitted, any existing StartTask is left unchanged. + StartTask *StartTask `json:"startTask,omitempty"` + // CertificateReferences - If this element is present, it replaces any existing Certificate references configured on the Pool. If omitted, any existing Certificate references are left unchanged. For Windows Nodes, the Batch service installs the Certificates to the specified Certificate store and location. For Linux Compute Nodes, the Certificates are stored in a directory inside the Task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the Task to query for this location. For Certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and Certificates are placed in that directory. + CertificateReferences *[]CertificateReference `json:"certificateReferences,omitempty"` + // ApplicationPackageReferences - Changes to Package references affect all new Nodes joining the Pool, but do not affect Compute Nodes that are already in the Pool until they are rebooted or reimaged. If this element is present, it replaces any existing Package references. If you specify an empty collection, then all Package references are removed from the Pool. If omitted, any existing Package references are left unchanged. + ApplicationPackageReferences *[]ApplicationPackageReference `json:"applicationPackageReferences,omitempty"` + // Metadata - If this element is present, it replaces any existing metadata configured on the Pool. If you specify an empty collection, any metadata is removed from the Pool. If omitted, any existing metadata is left unchanged. + Metadata *[]MetadataItem `json:"metadata,omitempty"` +} + +// PoolResizeParameter ... +type PoolResizeParameter struct { + TargetDedicatedNodes *int32 `json:"targetDedicatedNodes,omitempty"` + TargetLowPriorityNodes *int32 `json:"targetLowPriorityNodes,omitempty"` + // ResizeTimeout - The default value is 15 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + ResizeTimeout *string `json:"resizeTimeout,omitempty"` + // NodeDeallocationOption - The default value is requeue. Possible values include: 'Requeue', 'Terminate', 'TaskCompletion', 'RetainedData' + NodeDeallocationOption ComputeNodeDeallocationOption `json:"nodeDeallocationOption,omitempty"` +} + +// PoolSpecification ... +type PoolSpecification struct { + // DisplayName - The display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + DisplayName *string `json:"displayName,omitempty"` + // VMSize - For information about available sizes of virtual machines in Pools, see Choose a VM size for Compute Nodes in an Azure Batch Pool (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes). + VMSize *string `json:"vmSize,omitempty"` + // CloudServiceConfiguration - This property must be specified if the Pool needs to be created with Azure PaaS VMs. This property and virtualMachineConfiguration are mutually exclusive and one of the properties must be specified. If neither is specified then the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). This property cannot be specified if the Batch Account was created with its poolAllocationMode property set to 'UserSubscription'. + CloudServiceConfiguration *CloudServiceConfiguration `json:"cloudServiceConfiguration,omitempty"` + // VirtualMachineConfiguration - This property must be specified if the Pool needs to be created with Azure IaaS VMs. This property and cloudServiceConfiguration are mutually exclusive and one of the properties must be specified. If neither is specified then the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + VirtualMachineConfiguration *VirtualMachineConfiguration `json:"virtualMachineConfiguration,omitempty"` + // TaskSlotsPerNode - The default value is 1. The maximum value is the smaller of 4 times the number of cores of the vmSize of the pool or 256. + TaskSlotsPerNode *int32 `json:"taskSlotsPerNode,omitempty"` + // TaskSchedulingPolicy - If not specified, the default is spread. + TaskSchedulingPolicy *TaskSchedulingPolicy `json:"taskSchedulingPolicy,omitempty"` + // ResizeTimeout - This timeout applies only to manual scaling; it has no effect when enableAutoScale is set to true. The default value is 15 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service rejects the request with an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + ResizeTimeout *string `json:"resizeTimeout,omitempty"` + // TargetDedicatedNodes - This property must not be specified if enableAutoScale is set to true. If enableAutoScale is set to false, then you must set either targetDedicatedNodes, targetLowPriorityNodes, or both. + TargetDedicatedNodes *int32 `json:"targetDedicatedNodes,omitempty"` + // TargetLowPriorityNodes - This property must not be specified if enableAutoScale is set to true. If enableAutoScale is set to false, then you must set either targetDedicatedNodes, targetLowPriorityNodes, or both. + TargetLowPriorityNodes *int32 `json:"targetLowPriorityNodes,omitempty"` + // EnableAutoScale - If false, at least one of targetDedicatedNodes and targetLowPriorityNodes must be specified. If true, the autoScaleFormula element is required. The Pool automatically resizes according to the formula. The default value is false. + EnableAutoScale *bool `json:"enableAutoScale,omitempty"` + // AutoScaleFormula - This property must not be specified if enableAutoScale is set to false. It is required if enableAutoScale is set to true. The formula is checked for validity before the Pool is created. If the formula is not valid, the Batch service rejects the request with detailed error information. + AutoScaleFormula *string `json:"autoScaleFormula,omitempty"` + // AutoScaleEvaluationInterval - The default value is 15 minutes. The minimum and maximum value are 5 minutes and 168 hours respectively. If you specify a value less than 5 minutes or greater than 168 hours, the Batch service rejects the request with an invalid property value error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + AutoScaleEvaluationInterval *string `json:"autoScaleEvaluationInterval,omitempty"` + // EnableInterNodeCommunication - Enabling inter-node communication limits the maximum size of the Pool due to deployment restrictions on the Compute Nodes of the Pool. This may result in the Pool not reaching its desired size. The default value is false. + EnableInterNodeCommunication *bool `json:"enableInterNodeCommunication,omitempty"` + NetworkConfiguration *NetworkConfiguration `json:"networkConfiguration,omitempty"` + StartTask *StartTask `json:"startTask,omitempty"` + // CertificateReferences - For Windows Nodes, the Batch service installs the Certificates to the specified Certificate store and location. For Linux Compute Nodes, the Certificates are stored in a directory inside the Task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the Task to query for this location. For Certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and Certificates are placed in that directory. + CertificateReferences *[]CertificateReference `json:"certificateReferences,omitempty"` + // ApplicationPackageReferences - Changes to Package references affect all new Nodes joining the Pool, but do not affect Compute Nodes that are already in the Pool until they are rebooted or reimaged. There is a maximum of 10 Package references on any given Pool. + ApplicationPackageReferences *[]ApplicationPackageReference `json:"applicationPackageReferences,omitempty"` + // ApplicationLicenses - The list of application licenses must be a subset of available Batch service application licenses. If a license is requested which is not supported, Pool creation will fail. The permitted licenses available on the Pool are 'maya', 'vray', '3dsmax', 'arnold'. An additional charge applies for each application license added to the Pool. + ApplicationLicenses *[]string `json:"applicationLicenses,omitempty"` + UserAccounts *[]UserAccount `json:"userAccounts,omitempty"` + // Metadata - The Batch service does not assign any meaning to metadata; it is solely for the use of user code. + Metadata *[]MetadataItem `json:"metadata,omitempty"` + // MountConfiguration - This supports Azure Files, NFS, CIFS/SMB, and Blobfuse. + MountConfiguration *[]MountConfiguration `json:"mountConfiguration,omitempty"` +} + +// PoolStatistics ... +type PoolStatistics struct { + autorest.Response `json:"-"` + URL *string `json:"url,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + LastUpdateTime *date.Time `json:"lastUpdateTime,omitempty"` + UsageStats *UsageStatistics `json:"usageStats,omitempty"` + ResourceStats *ResourceStatistics `json:"resourceStats,omitempty"` +} + +// PoolUpdatePropertiesParameter ... +type PoolUpdatePropertiesParameter struct { + // StartTask - If this element is present, it overwrites any existing StartTask. If omitted, any existing StartTask is removed from the Pool. + StartTask *StartTask `json:"startTask,omitempty"` + // CertificateReferences - This list replaces any existing Certificate references configured on the Pool. If you specify an empty collection, any existing Certificate references are removed from the Pool. For Windows Nodes, the Batch service installs the Certificates to the specified Certificate store and location. For Linux Compute Nodes, the Certificates are stored in a directory inside the Task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the Task to query for this location. For Certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and Certificates are placed in that directory. + CertificateReferences *[]CertificateReference `json:"certificateReferences,omitempty"` + // ApplicationPackageReferences - The list replaces any existing Application Package references on the Pool. Changes to Application Package references affect all new Compute Nodes joining the Pool, but do not affect Compute Nodes that are already in the Pool until they are rebooted or reimaged. There is a maximum of 10 Application Package references on any given Pool. If omitted, or if you specify an empty collection, any existing Application Packages references are removed from the Pool. A maximum of 10 references may be specified on a given Pool. + ApplicationPackageReferences *[]ApplicationPackageReference `json:"applicationPackageReferences,omitempty"` + // Metadata - This list replaces any existing metadata configured on the Pool. If omitted, or if you specify an empty collection, any existing metadata is removed from the Pool. + Metadata *[]MetadataItem `json:"metadata,omitempty"` +} + +// PoolUsageMetrics ... +type PoolUsageMetrics struct { + PoolID *string `json:"poolId,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + // VMSize - For information about available sizes of virtual machines in Pools, see Choose a VM size for Compute Nodes in an Azure Batch Pool (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes). + VMSize *string `json:"vmSize,omitempty"` + TotalCoreHours *float64 `json:"totalCoreHours,omitempty"` +} + +// PublicIPAddressConfiguration the public IP Address configuration of the networking configuration of a +// Pool. +type PublicIPAddressConfiguration struct { + // Provision - The default value is BatchManaged. Possible values include: 'BatchManaged', 'UserManaged', 'NoPublicIPAddresses' + Provision IPAddressProvisioningType `json:"provision,omitempty"` + // IPAddressIds - The number of IPs specified here limits the maximum size of the Pool - 100 dedicated nodes or 100 low-priority nodes can be allocated for each public IP. For example, a pool needing 250 dedicated VMs would need at least 3 public IPs specified. Each element of this collection is of the form: /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/publicIPAddresses/{ip}. + IPAddressIds *[]string `json:"ipAddressIds,omitempty"` +} + +// ReadCloser ... +type ReadCloser struct { + autorest.Response `json:"-"` + Value *io.ReadCloser `json:"value,omitempty"` +} + +// RecentJob ... +type RecentJob struct { + ID *string `json:"id,omitempty"` + URL *string `json:"url,omitempty"` +} + +// ResizeError ... +type ResizeError struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Values *[]NameValuePair `json:"values,omitempty"` +} + +// ResourceFile ... +type ResourceFile struct { + // AutoStorageContainerName - The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. + AutoStorageContainerName *string `json:"autoStorageContainerName,omitempty"` + // StorageContainerURL - The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. This URL must be readable and listable from compute nodes. There are three ways to get such a URL for a container in Azure storage: include a Shared Access Signature (SAS) granting read and list permissions on the container, use a managed identity with read and list permissions, or set the ACL for the container to allow public access. + StorageContainerURL *string `json:"storageContainerUrl,omitempty"` + // HTTPURL - The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. If the URL points to Azure Blob Storage, it must be readable from compute nodes. There are three ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read permissions on the blob, use a managed identity with read permission, or set the ACL for the blob or its container to allow public access. + HTTPURL *string `json:"httpUrl,omitempty"` + // BlobPrefix - The property is valid only when autoStorageContainerName or storageContainerUrl is used. This prefix can be a partial filename or a subdirectory. If a prefix is not specified, all the files in the container will be downloaded. + BlobPrefix *string `json:"blobPrefix,omitempty"` + // FilePath - If the httpUrl property is specified, the filePath is required and describes the path which the file will be downloaded to, including the filename. Otherwise, if the autoStorageContainerName or storageContainerUrl property is specified, filePath is optional and is the directory to download the files to. In the case where filePath is used as a directory, any directory structure already associated with the input data will be retained in full and appended to the specified filePath directory. The specified relative path cannot break out of the Task's working directory (for example by using '..'). + FilePath *string `json:"filePath,omitempty"` + // FileMode - This property applies only to files being downloaded to Linux Compute Nodes. It will be ignored if it is specified for a resourceFile which will be downloaded to a Windows Compute Node. If this property is not specified for a Linux Compute Node, then a default value of 0770 is applied to the file. + FileMode *string `json:"fileMode,omitempty"` + IdentityReference *ComputeNodeIdentityReference `json:"identityReference,omitempty"` +} + +// ResourceStatistics ... +type ResourceStatistics struct { + StartTime *date.Time `json:"startTime,omitempty"` + LastUpdateTime *date.Time `json:"lastUpdateTime,omitempty"` + AvgCPUPercentage *float64 `json:"avgCPUPercentage,omitempty"` + AvgMemoryGiB *float64 `json:"avgMemoryGiB,omitempty"` + PeakMemoryGiB *float64 `json:"peakMemoryGiB,omitempty"` + AvgDiskGiB *float64 `json:"avgDiskGiB,omitempty"` + PeakDiskGiB *float64 `json:"peakDiskGiB,omitempty"` + DiskReadIOps *int64 `json:"diskReadIOps,omitempty"` + DiskWriteIOps *int64 `json:"diskWriteIOps,omitempty"` + DiskReadGiB *float64 `json:"diskReadGiB,omitempty"` + DiskWriteGiB *float64 `json:"diskWriteGiB,omitempty"` + NetworkReadGiB *float64 `json:"networkReadGiB,omitempty"` + NetworkWriteGiB *float64 `json:"networkWriteGiB,omitempty"` +} + +// Schedule ... +type Schedule struct { + // DoNotRunUntil - If you do not specify a doNotRunUntil time, the schedule becomes ready to create Jobs immediately. + DoNotRunUntil *date.Time `json:"doNotRunUntil,omitempty"` + // DoNotRunAfter - If you do not specify a doNotRunAfter time, and you are creating a recurring Job Schedule, the Job Schedule will remain active until you explicitly terminate it. + DoNotRunAfter *date.Time `json:"doNotRunAfter,omitempty"` + // StartWindow - If a Job is not created within the startWindow interval, then the 'opportunity' is lost; no Job will be created until the next recurrence of the schedule. If the schedule is recurring, and the startWindow is longer than the recurrence interval, then this is equivalent to an infinite startWindow, because the Job that is 'due' in one recurrenceInterval is not carried forward into the next recurrence interval. The default is infinite. The minimum value is 1 minute. If you specify a lower value, the Batch service rejects the schedule with an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + StartWindow *string `json:"startWindow,omitempty"` + // RecurrenceInterval - Because a Job Schedule can have at most one active Job under it at any given time, if it is time to create a new Job under a Job Schedule, but the previous Job is still running, the Batch service will not create the new Job until the previous Job finishes. If the previous Job does not finish within the startWindow period of the new recurrenceInterval, then no new Job will be scheduled for that interval. For recurring Jobs, you should normally specify a jobManagerTask in the jobSpecification. If you do not use jobManagerTask, you will need an external process to monitor when Jobs are created, add Tasks to the Jobs and terminate the Jobs ready for the next recurrence. The default is that the schedule does not recur: one Job is created, within the startWindow after the doNotRunUntil time, and the schedule is complete as soon as that Job finishes. The minimum value is 1 minute. If you specify a lower value, the Batch service rejects the schedule with an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + RecurrenceInterval *string `json:"recurrenceInterval,omitempty"` +} + +// StartTask batch will retry Tasks when a recovery operation is triggered on a Node. Examples of recovery +// operations include (but are not limited to) when an unhealthy Node is rebooted or a Compute Node +// disappeared due to host failure. Retries due to recovery operations are independent of and are not +// counted against the maxTaskRetryCount. Even if the maxTaskRetryCount is 0, an internal retry due to a +// recovery operation may occur. Because of this, all Tasks should be idempotent. This means Tasks need to +// tolerate being interrupted and restarted without causing any corruption or duplicate data. The best +// practice for long running Tasks is to use some form of checkpointing. In some cases the StartTask may be +// re-run even though the Compute Node was not rebooted. Special care should be taken to avoid StartTasks +// which create breakaway process or install/launch services from the StartTask working directory, as this +// will block Batch from being able to re-run the StartTask. +type StartTask struct { + // CommandLine - The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command line refers to file paths, it should use a relative path (relative to the Task working directory), or use the Batch provided environment variable (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). + CommandLine *string `json:"commandLine,omitempty"` + // ContainerSettings - When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all Task environment variables are mapped into the container, and the Task command line is executed in the container. Files produced in the container outside of AZ_BATCH_NODE_ROOT_DIR might not be reflected to the host disk, meaning that Batch file APIs will not be able to access those files. + ContainerSettings *TaskContainerSettings `json:"containerSettings,omitempty"` + // ResourceFiles - Files listed under this element are located in the Task's working directory. + ResourceFiles *[]ResourceFile `json:"resourceFiles,omitempty"` + EnvironmentSettings *[]EnvironmentSetting `json:"environmentSettings,omitempty"` + // UserIdentity - If omitted, the Task runs as a non-administrative user unique to the Task. + UserIdentity *UserIdentity `json:"userIdentity,omitempty"` + // MaxTaskRetryCount - The Batch service retries a Task if its exit code is nonzero. Note that this value specifically controls the number of retries. The Batch service will try the Task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries the Task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the Task. If the maximum retry count is -1, the Batch service retries the Task without limit. + MaxTaskRetryCount *int32 `json:"maxTaskRetryCount,omitempty"` + // WaitForSuccess - If true and the StartTask fails on a Node, the Batch service retries the StartTask up to its maximum retry count (maxTaskRetryCount). If the Task has still not completed successfully after all retries, then the Batch service marks the Node unusable, and will not schedule Tasks to it. This condition can be detected via the Compute Node state and failure info details. If false, the Batch service will not wait for the StartTask to complete. In this case, other Tasks can start executing on the Compute Node while the StartTask is still running; and even if the StartTask fails, new Tasks will continue to be scheduled on the Compute Node. The default is true. + WaitForSuccess *bool `json:"waitForSuccess,omitempty"` +} + +// StartTaskInformation ... +type StartTaskInformation struct { + // State - Possible values include: 'StartTaskStateRunning', 'StartTaskStateCompleted' + State StartTaskState `json:"state,omitempty"` + // StartTime - This value is reset every time the Task is restarted or retried (that is, this is the most recent time at which the StartTask started running). + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - This is the end time of the most recent run of the StartTask, if that run has completed (even if that run failed and a retry is pending). This element is not present if the StartTask is currently running. + EndTime *date.Time `json:"endTime,omitempty"` + // ExitCode - This property is set only if the StartTask is in the completed state. In general, the exit code for a process reflects the specific convention implemented by the application developer for that process. If you use the exit code value to make decisions in your code, be sure that you know the exit code convention used by the application process. However, if the Batch service terminates the StartTask (due to timeout, or user termination via the API) you may see an operating system-defined exit code. + ExitCode *int32 `json:"exitCode,omitempty"` + // ContainerInfo - This property is set only if the Task runs in a container context. + ContainerInfo *TaskContainerExecutionInformation `json:"containerInfo,omitempty"` + // FailureInfo - This property is set only if the Task is in the completed state and encountered a failure. + FailureInfo *TaskFailureInformation `json:"failureInfo,omitempty"` + // RetryCount - Task application failures (non-zero exit code) are retried, pre-processing errors (the Task could not be run) and file upload errors are not retried. The Batch service will retry the Task up to the limit specified by the constraints. + RetryCount *int32 `json:"retryCount,omitempty"` + // LastRetryTime - This element is present only if the Task was retried (i.e. retryCount is nonzero). If present, this is typically the same as startTime, but may be different if the Task has been restarted for reasons other than retry; for example, if the Compute Node was rebooted during a retry, then the startTime is updated but the lastRetryTime is not. + LastRetryTime *date.Time `json:"lastRetryTime,omitempty"` + // Result - If the value is 'failed', then the details of the failure can be found in the failureInfo property. Possible values include: 'Success', 'Failure' + Result TaskExecutionResult `json:"result,omitempty"` +} + +// SubtaskInformation ... +type SubtaskInformation struct { + ID *int32 `json:"id,omitempty"` + NodeInfo *ComputeNodeInformation `json:"nodeInfo,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - This property is set only if the subtask is in the Completed state. + EndTime *date.Time `json:"endTime,omitempty"` + // ExitCode - This property is set only if the subtask is in the completed state. In general, the exit code for a process reflects the specific convention implemented by the application developer for that process. If you use the exit code value to make decisions in your code, be sure that you know the exit code convention used by the application process. However, if the Batch service terminates the subtask (due to timeout, or user termination via the API) you may see an operating system-defined exit code. + ExitCode *int32 `json:"exitCode,omitempty"` + // ContainerInfo - This property is set only if the Task runs in a container context. + ContainerInfo *TaskContainerExecutionInformation `json:"containerInfo,omitempty"` + // FailureInfo - This property is set only if the Task is in the completed state and encountered a failure. + FailureInfo *TaskFailureInformation `json:"failureInfo,omitempty"` + // State - Possible values include: 'SubtaskStatePreparing', 'SubtaskStateRunning', 'SubtaskStateCompleted' + State SubtaskState `json:"state,omitempty"` + StateTransitionTime *date.Time `json:"stateTransitionTime,omitempty"` + // PreviousState - This property is not set if the subtask is in its initial running state. Possible values include: 'SubtaskStatePreparing', 'SubtaskStateRunning', 'SubtaskStateCompleted' + PreviousState SubtaskState `json:"previousState,omitempty"` + // PreviousStateTransitionTime - This property is not set if the subtask is in its initial running state. + PreviousStateTransitionTime *date.Time `json:"previousStateTransitionTime,omitempty"` + // Result - If the value is 'failed', then the details of the failure can be found in the failureInfo property. Possible values include: 'Success', 'Failure' + Result TaskExecutionResult `json:"result,omitempty"` +} + +// TaskAddCollectionParameter ... +type TaskAddCollectionParameter struct { + // Value - The total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each Task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer Tasks. + Value *[]TaskAddParameter `json:"value,omitempty"` +} + +// TaskAddCollectionResult ... +type TaskAddCollectionResult struct { + autorest.Response `json:"-"` + Value *[]TaskAddResult `json:"value,omitempty"` +} + +// TaskAddParameter batch will retry Tasks when a recovery operation is triggered on a Node. Examples of +// recovery operations include (but are not limited to) when an unhealthy Node is rebooted or a Compute +// Node disappeared due to host failure. Retries due to recovery operations are independent of and are not +// counted against the maxTaskRetryCount. Even if the maxTaskRetryCount is 0, an internal retry due to a +// recovery operation may occur. Because of this, all Tasks should be idempotent. This means Tasks need to +// tolerate being interrupted and restarted without causing any corruption or duplicate data. The best +// practice for long running Tasks is to use some form of checkpointing. +type TaskAddParameter struct { + // ID - The ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within a Job that differ only by case). + ID *string `json:"id,omitempty"` + // DisplayName - The display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + DisplayName *string `json:"displayName,omitempty"` + // CommandLine - For multi-instance Tasks, the command line is executed as the primary Task, after the primary Task and all subtasks have finished executing the coordination command line. The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command line refers to file paths, it should use a relative path (relative to the Task working directory), or use the Batch provided environment variable (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). + CommandLine *string `json:"commandLine,omitempty"` + // ContainerSettings - If the Pool that will run this Task has containerConfiguration set, this must be set as well. If the Pool that will run this Task doesn't have containerConfiguration set, this must not be set. When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all Task environment variables are mapped into the container, and the Task command line is executed in the container. Files produced in the container outside of AZ_BATCH_NODE_ROOT_DIR might not be reflected to the host disk, meaning that Batch file APIs will not be able to access those files. + ContainerSettings *TaskContainerSettings `json:"containerSettings,omitempty"` + // ExitConditions - How the Batch service should respond when the Task completes. + ExitConditions *ExitConditions `json:"exitConditions,omitempty"` + // ResourceFiles - For multi-instance Tasks, the resource files will only be downloaded to the Compute Node on which the primary Task is executed. There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of ResourceFiles must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers. + ResourceFiles *[]ResourceFile `json:"resourceFiles,omitempty"` + // OutputFiles - For multi-instance Tasks, the files will only be uploaded from the Compute Node on which the primary Task is executed. + OutputFiles *[]OutputFile `json:"outputFiles,omitempty"` + EnvironmentSettings *[]EnvironmentSetting `json:"environmentSettings,omitempty"` + AffinityInfo *AffinityInformation `json:"affinityInfo,omitempty"` + // Constraints - If you do not specify constraints, the maxTaskRetryCount is the maxTaskRetryCount specified for the Job, the maxWallClockTime is infinite, and the retentionTime is 7 days. + Constraints *TaskConstraints `json:"constraints,omitempty"` + // RequiredSlots - The default is 1. A Task can only be scheduled to run on a compute node if the node has enough free scheduling slots available. For multi-instance Tasks, this must be 1. + RequiredSlots *int32 `json:"requiredSlots,omitempty"` + // UserIdentity - If omitted, the Task runs as a non-administrative user unique to the Task. + UserIdentity *UserIdentity `json:"userIdentity,omitempty"` + MultiInstanceSettings *MultiInstanceSettings `json:"multiInstanceSettings,omitempty"` + // DependsOn - This Task will not be scheduled until all Tasks that it depends on have completed successfully. If any of those Tasks fail and exhaust their retry counts, this Task will never be scheduled. If the Job does not have usesTaskDependencies set to true, and this element is present, the request fails with error code TaskDependenciesNotSpecifiedOnJob. + DependsOn *TaskDependencies `json:"dependsOn,omitempty"` + // ApplicationPackageReferences - Application packages are downloaded and deployed to a shared directory, not the Task working directory. Therefore, if a referenced package is already on the Node, and is up to date, then it is not re-downloaded; the existing copy on the Compute Node is used. If a referenced Package cannot be installed, for example because the package has been deleted or because download failed, the Task fails. + ApplicationPackageReferences *[]ApplicationPackageReference `json:"applicationPackageReferences,omitempty"` + // AuthenticationTokenSettings - If this property is set, the Batch service provides the Task with an authentication token which can be used to authenticate Batch service operations without requiring an Account access key. The token is provided via the AZ_BATCH_AUTHENTICATION_TOKEN environment variable. The operations that the Task can carry out using the token depend on the settings. For example, a Task can request Job permissions in order to add other Tasks to the Job, or check the status of the Job or of other Tasks under the Job. + AuthenticationTokenSettings *AuthenticationTokenSettings `json:"authenticationTokenSettings,omitempty"` +} + +// TaskAddResult ... +type TaskAddResult struct { + // Status - Possible values include: 'TaskAddStatusSuccess', 'TaskAddStatusClientError', 'TaskAddStatusServerError' + Status TaskAddStatus `json:"status,omitempty"` + TaskID *string `json:"taskId,omitempty"` + // ETag - You can use this to detect whether the Task has changed between requests. In particular, you can be pass the ETag with an Update Task request to specify that your changes should take effect only if nobody else has modified the Job in the meantime. + ETag *string `json:"eTag,omitempty"` + LastModified *date.Time `json:"lastModified,omitempty"` + Location *string `json:"location,omitempty"` + Error *Error `json:"error,omitempty"` +} + +// TaskConstraints ... +type TaskConstraints struct { + // MaxWallClockTime - If this is not specified, there is no time limit on how long the Task may run. + MaxWallClockTime *string `json:"maxWallClockTime,omitempty"` + // RetentionTime - The default is 7 days, i.e. the Task directory will be retained for 7 days unless the Compute Node is removed or the Job is deleted. + RetentionTime *string `json:"retentionTime,omitempty"` + // MaxTaskRetryCount - Note that this value specifically controls the number of retries for the Task executable due to a nonzero exit code. The Batch service will try the Task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries the Task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the Task after the first attempt. If the maximum retry count is -1, the Batch service retries the Task without limit. + MaxTaskRetryCount *int32 `json:"maxTaskRetryCount,omitempty"` +} + +// TaskContainerExecutionInformation ... +type TaskContainerExecutionInformation struct { + ContainerID *string `json:"containerId,omitempty"` + // State - This is the state of the container according to the Docker service. It is equivalent to the status field returned by "docker inspect". + State *string `json:"state,omitempty"` + // Error - This is the detailed error string from the Docker service, if available. It is equivalent to the error field returned by "docker inspect". + Error *string `json:"error,omitempty"` +} + +// TaskContainerSettings ... +type TaskContainerSettings struct { + // ContainerRunOptions - These additional options are supplied as arguments to the "docker create" command, in addition to those controlled by the Batch Service. + ContainerRunOptions *string `json:"containerRunOptions,omitempty"` + // ImageName - This is the full Image reference, as would be specified to "docker pull". If no tag is provided as part of the Image name, the tag ":latest" is used as a default. + ImageName *string `json:"imageName,omitempty"` + // Registry - This setting can be omitted if was already provided at Pool creation. + Registry *ContainerRegistry `json:"registry,omitempty"` + // WorkingDirectory - The default is 'taskWorkingDirectory'. Possible values include: 'TaskWorkingDirectory', 'ContainerImageDefault' + WorkingDirectory ContainerWorkingDirectory `json:"workingDirectory,omitempty"` +} + +// TaskCounts ... +type TaskCounts struct { + Active *int32 `json:"active,omitempty"` + Running *int32 `json:"running,omitempty"` + Completed *int32 `json:"completed,omitempty"` + Succeeded *int32 `json:"succeeded,omitempty"` + Failed *int32 `json:"failed,omitempty"` +} + +// TaskCountsResult ... +type TaskCountsResult struct { + autorest.Response `json:"-"` + TaskCounts *TaskCounts `json:"taskCounts,omitempty"` + TaskSlotCounts *TaskSlotCounts `json:"taskSlotCounts,omitempty"` +} + +// TaskDependencies ... +type TaskDependencies struct { + // TaskIds - The taskIds collection is limited to 64000 characters total (i.e. the combined length of all Task IDs). If the taskIds collection exceeds the maximum length, the Add Task request fails with error code TaskDependencyListTooLong. In this case consider using Task ID ranges instead. + TaskIds *[]string `json:"taskIds,omitempty"` + TaskIDRanges *[]TaskIDRange `json:"taskIdRanges,omitempty"` +} + +// TaskExecutionInformation ... +type TaskExecutionInformation struct { + // StartTime - 'Running' corresponds to the running state, so if the Task specifies resource files or Packages, then the start time reflects the time at which the Task started downloading or deploying these. If the Task has been restarted or retried, this is the most recent time at which the Task started running. This property is present only for Tasks that are in the running or completed state. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - This property is set only if the Task is in the Completed state. + EndTime *date.Time `json:"endTime,omitempty"` + // ExitCode - This property is set only if the Task is in the completed state. In general, the exit code for a process reflects the specific convention implemented by the application developer for that process. If you use the exit code value to make decisions in your code, be sure that you know the exit code convention used by the application process. However, if the Batch service terminates the Task (due to timeout, or user termination via the API) you may see an operating system-defined exit code. + ExitCode *int32 `json:"exitCode,omitempty"` + // ContainerInfo - This property is set only if the Task runs in a container context. + ContainerInfo *TaskContainerExecutionInformation `json:"containerInfo,omitempty"` + // FailureInfo - This property is set only if the Task is in the completed state and encountered a failure. + FailureInfo *TaskFailureInformation `json:"failureInfo,omitempty"` + // RetryCount - Task application failures (non-zero exit code) are retried, pre-processing errors (the Task could not be run) and file upload errors are not retried. The Batch service will retry the Task up to the limit specified by the constraints. + RetryCount *int32 `json:"retryCount,omitempty"` + // LastRetryTime - This element is present only if the Task was retried (i.e. retryCount is nonzero). If present, this is typically the same as startTime, but may be different if the Task has been restarted for reasons other than retry; for example, if the Compute Node was rebooted during a retry, then the startTime is updated but the lastRetryTime is not. + LastRetryTime *date.Time `json:"lastRetryTime,omitempty"` + // RequeueCount - When the user removes Compute Nodes from a Pool (by resizing/shrinking the pool) or when the Job is being disabled, the user can specify that running Tasks on the Compute Nodes be requeued for execution. This count tracks how many times the Task has been requeued for these reasons. + RequeueCount *int32 `json:"requeueCount,omitempty"` + // LastRequeueTime - This property is set only if the requeueCount is nonzero. + LastRequeueTime *date.Time `json:"lastRequeueTime,omitempty"` + // Result - If the value is 'failed', then the details of the failure can be found in the failureInfo property. Possible values include: 'Success', 'Failure' + Result TaskExecutionResult `json:"result,omitempty"` +} + +// TaskFailureInformation ... +type TaskFailureInformation struct { + // Category - Possible values include: 'UserError', 'ServerError' + Category ErrorCategory `json:"category,omitempty"` + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Details *[]NameValuePair `json:"details,omitempty"` +} + +// TaskIDRange the start and end of the range are inclusive. For example, if a range has start 9 and end +// 12, then it represents Tasks '9', '10', '11' and '12'. +type TaskIDRange struct { + Start *int32 `json:"start,omitempty"` + End *int32 `json:"end,omitempty"` +} + +// TaskInformation ... +type TaskInformation struct { + TaskURL *string `json:"taskUrl,omitempty"` + JobID *string `json:"jobId,omitempty"` + TaskID *string `json:"taskId,omitempty"` + SubtaskID *int32 `json:"subtaskId,omitempty"` + // TaskState - Possible values include: 'TaskStateActive', 'TaskStatePreparing', 'TaskStateRunning', 'TaskStateCompleted' + TaskState TaskState `json:"taskState,omitempty"` + ExecutionInfo *TaskExecutionInformation `json:"executionInfo,omitempty"` +} + +// TaskSchedulingPolicy ... +type TaskSchedulingPolicy struct { + // NodeFillType - If not specified, the default is spread. Possible values include: 'Spread', 'Pack' + NodeFillType ComputeNodeFillType `json:"nodeFillType,omitempty"` +} + +// TaskSlotCounts ... +type TaskSlotCounts struct { + Active *int32 `json:"active,omitempty"` + Running *int32 `json:"running,omitempty"` + Completed *int32 `json:"completed,omitempty"` + Succeeded *int32 `json:"succeeded,omitempty"` + Failed *int32 `json:"failed,omitempty"` +} + +// TaskStatistics ... +type TaskStatistics struct { + URL *string `json:"url,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + LastUpdateTime *date.Time `json:"lastUpdateTime,omitempty"` + UserCPUTime *string `json:"userCPUTime,omitempty"` + KernelCPUTime *string `json:"kernelCPUTime,omitempty"` + // WallClockTime - The wall clock time is the elapsed time from when the Task started running on a Compute Node to when it finished (or to the last time the statistics were updated, if the Task had not finished by then). If the Task was retried, this includes the wall clock time of all the Task retries. + WallClockTime *string `json:"wallClockTime,omitempty"` + ReadIOps *int64 `json:"readIOps,omitempty"` + WriteIOps *int64 `json:"writeIOps,omitempty"` + ReadIOGiB *float64 `json:"readIOGiB,omitempty"` + WriteIOGiB *float64 `json:"writeIOGiB,omitempty"` + WaitTime *string `json:"waitTime,omitempty"` +} + +// TaskUpdateParameter ... +type TaskUpdateParameter struct { + // Constraints - If omitted, the Task is given the default constraints. For multi-instance Tasks, updating the retention time applies only to the primary Task and not subtasks. + Constraints *TaskConstraints `json:"constraints,omitempty"` +} + +// UploadBatchServiceLogsConfiguration ... +type UploadBatchServiceLogsConfiguration struct { + // ContainerURL - If a user assigned managed identity is not being used, the URL must include a Shared Access Signature (SAS) granting write permissions to the container. The SAS duration must allow enough time for the upload to finish. The start time for SAS is optional and recommended to not be specified. + ContainerURL *string `json:"containerUrl,omitempty"` + // StartTime - Any log file containing a log message in the time range will be uploaded. This means that the operation might retrieve more logs than have been requested since the entire log file is always uploaded, but the operation should not retrieve fewer logs than have been requested. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - Any log file containing a log message in the time range will be uploaded. This means that the operation might retrieve more logs than have been requested since the entire log file is always uploaded, but the operation should not retrieve fewer logs than have been requested. If omitted, the default is to upload all logs available after the startTime. + EndTime *date.Time `json:"endTime,omitempty"` + // IdentityReference - The identity must have write access to the Azure Blob Storage container. + IdentityReference *ComputeNodeIdentityReference `json:"identityReference,omitempty"` +} + +// UploadBatchServiceLogsResult ... +type UploadBatchServiceLogsResult struct { + autorest.Response `json:"-"` + // VirtualDirectoryName - The virtual directory name is part of the blob name for each log file uploaded, and it is built based poolId, nodeId and a unique identifier. + VirtualDirectoryName *string `json:"virtualDirectoryName,omitempty"` + NumberOfFilesUploaded *int32 `json:"numberOfFilesUploaded,omitempty"` +} + +// UsageStatistics ... +type UsageStatistics struct { + StartTime *date.Time `json:"startTime,omitempty"` + LastUpdateTime *date.Time `json:"lastUpdateTime,omitempty"` + DedicatedCoreTime *string `json:"dedicatedCoreTime,omitempty"` +} + +// UserAccount ... +type UserAccount struct { + Name *string `json:"name,omitempty"` + Password *string `json:"password,omitempty"` + // ElevationLevel - The default value is nonAdmin. Possible values include: 'NonAdmin', 'Admin' + ElevationLevel ElevationLevel `json:"elevationLevel,omitempty"` + // LinuxUserConfiguration - This property is ignored if specified on a Windows Pool. If not specified, the user is created with the default options. + LinuxUserConfiguration *LinuxUserConfiguration `json:"linuxUserConfiguration,omitempty"` + // WindowsUserConfiguration - This property can only be specified if the user is on a Windows Pool. If not specified and on a Windows Pool, the user is created with the default options. + WindowsUserConfiguration *WindowsUserConfiguration `json:"windowsUserConfiguration,omitempty"` +} + +// UserAssignedIdentity the user assigned Identity +type UserAssignedIdentity struct { + // ResourceID - The ARM resource id of the user assigned identity + ResourceID *string `json:"resourceId,omitempty"` + // ClientID - READ-ONLY; The client id of the user assigned identity. + ClientID *string `json:"clientId,omitempty"` + // PrincipalID - READ-ONLY; The principal id of the user assigned identity. + PrincipalID *string `json:"principalId,omitempty"` +} + +// MarshalJSON is the custom marshaler for UserAssignedIdentity. +func (uai UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if uai.ResourceID != nil { + objectMap["resourceId"] = uai.ResourceID + } + return json.Marshal(objectMap) +} + +// UserIdentity specify either the userName or autoUser property, but not both. +type UserIdentity struct { + // UserName - The userName and autoUser properties are mutually exclusive; you must specify one but not both. + UserName *string `json:"username,omitempty"` + // AutoUser - The userName and autoUser properties are mutually exclusive; you must specify one but not both. + AutoUser *AutoUserSpecification `json:"autoUser,omitempty"` +} + +// VirtualMachineConfiguration ... +type VirtualMachineConfiguration struct { + ImageReference *ImageReference `json:"imageReference,omitempty"` + // NodeAgentSKUID - The Batch Compute Node agent is a program that runs on each Compute Node in the Pool, and provides the command-and-control interface between the Compute Node and the Batch service. There are different implementations of the Compute Node agent, known as SKUs, for different operating systems. You must specify a Compute Node agent SKU which matches the selected Image reference. To get the list of supported Compute Node agent SKUs along with their list of verified Image references, see the 'List supported Compute Node agent SKUs' operation. + NodeAgentSKUID *string `json:"nodeAgentSKUId,omitempty"` + // WindowsConfiguration - This property must not be specified if the imageReference property specifies a Linux OS Image. + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` + // DataDisks - This property must be specified if the Compute Nodes in the Pool need to have empty data disks attached to them. This cannot be updated. Each Compute Node gets its own disk (the disk is not a file share). Existing disks cannot be attached, each attached disk is empty. When the Compute Node is removed from the Pool, the disk and all data associated with it is also deleted. The disk is not formatted after being attached, it must be formatted before use - for more information see https://docs.microsoft.com/en-us/azure/virtual-machines/linux/classic/attach-disk#initialize-a-new-data-disk-in-linux and https://docs.microsoft.com/en-us/azure/virtual-machines/windows/attach-disk-ps#add-an-empty-data-disk-to-a-virtual-machine. + DataDisks *[]DataDisk `json:"dataDisks,omitempty"` + // LicenseType - This only applies to Images that contain the Windows operating system, and should only be used when you hold valid on-premises licenses for the Compute Nodes which will be deployed. If omitted, no on-premises licensing discount is applied. Values are: + // Windows_Server - The on-premises license is for Windows Server. + // Windows_Client - The on-premises license is for Windows Client. + LicenseType *string `json:"licenseType,omitempty"` + // ContainerConfiguration - If specified, setup is performed on each Compute Node in the Pool to allow Tasks to run in containers. All regular Tasks and Job manager Tasks run on this Pool must specify the containerSettings property, and all other Tasks may specify it. + ContainerConfiguration *ContainerConfiguration `json:"containerConfiguration,omitempty"` + // DiskEncryptionConfiguration - If specified, encryption is performed on each node in the pool during node provisioning. + DiskEncryptionConfiguration *DiskEncryptionConfiguration `json:"diskEncryptionConfiguration,omitempty"` + // NodePlacementConfiguration - This configuration will specify rules on how nodes in the pool will be physically allocated. + NodePlacementConfiguration *NodePlacementConfiguration `json:"nodePlacementConfiguration,omitempty"` + // Extensions - If specified, the extensions mentioned in this configuration will be installed on each node. + Extensions *[]VMExtension `json:"extensions,omitempty"` + OsDisk *OSDisk `json:"osDisk,omitempty"` +} + +// VirtualMachineInfo ... +type VirtualMachineInfo struct { + ImageReference *ImageReference `json:"imageReference,omitempty"` +} + +// VMExtension ... +type VMExtension struct { + Name *string `json:"name,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` + // AutoUpgradeMinorVersion - Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + Settings interface{} `json:"settings,omitempty"` + // ProtectedSettings - The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + ProtectedSettings interface{} `json:"protectedSettings,omitempty"` + // ProvisionAfterExtensions - Collection of extension names after which this extension needs to be provisioned. + ProvisionAfterExtensions *[]string `json:"provisionAfterExtensions,omitempty"` +} + +// VMExtensionInstanceView ... +type VMExtensionInstanceView struct { + Name *string `json:"name,omitempty"` + // Statuses - The resource status information. + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + // SubStatuses - The resource status information. + SubStatuses *[]InstanceViewStatus `json:"subStatuses,omitempty"` +} + +// WindowsConfiguration ... +type WindowsConfiguration struct { + // EnableAutomaticUpdates - If omitted, the default value is true. + EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` +} + +// WindowsUserConfiguration ... +type WindowsUserConfiguration struct { + // LoginMode - The default value for VirtualMachineConfiguration Pools is 'batch' and for CloudServiceConfiguration Pools is 'interactive'. Possible values include: 'Batch', 'Interactive' + LoginMode LoginMode `json:"loginMode,omitempty"` +} diff --git a/services/batch/2021-06-01.14.0/batch/pool.go b/services/batch/2021-06-01.14.0/batch/pool.go new file mode 100644 index 000000000000..54aa1d5d3ad9 --- /dev/null +++ b/services/batch/2021-06-01.14.0/batch/pool.go @@ -0,0 +1,2026 @@ +package batch + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "github.com/gofrs/uuid" + "net/http" +) + +// PoolClient is the a client for issuing REST requests to the Azure Batch service. +type PoolClient struct { + BaseClient +} + +// NewPoolClient creates an instance of the PoolClient client. +func NewPoolClient(batchURL string) PoolClient { + return PoolClient{New(batchURL)} +} + +// Add when naming Pools, avoid including sensitive information such as user names or secret project names. This +// information may appear in telemetry logs accessible to Microsoft Support engineers. +// Parameters: +// pool - the Pool to be added. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client PoolClient) Add(ctx context.Context, pool PoolAddParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.Add") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: pool, + Constraints: []validation.Constraint{{Target: "pool.ID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "pool.VMSize", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "pool.CloudServiceConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "pool.CloudServiceConfiguration.OsFamily", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "pool.VirtualMachineConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "pool.VirtualMachineConfiguration.ImageReference", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "pool.VirtualMachineConfiguration.NodeAgentSKUID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "pool.VirtualMachineConfiguration.ContainerConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "pool.VirtualMachineConfiguration.ContainerConfiguration.Type", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "pool.NetworkConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "pool.NetworkConfiguration.EndpointConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "pool.NetworkConfiguration.EndpointConfiguration.InboundNATPools", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "pool.StartTask", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "pool.StartTask.CommandLine", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "pool.StartTask.ContainerSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "pool.StartTask.ContainerSettings.ImageName", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("batch.PoolClient", "Add", err.Error()) + } + + req, err := client.AddPreparer(ctx, pool, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Add", nil, "Failure preparing request") + return + } + + resp, err := client.AddSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Add", resp, "Failure sending request") + return + } + + result, err = client.AddResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Add", resp, "Failure responding to request") + return + } + + return +} + +// AddPreparer prepares the Add request. +func (client PoolClient) AddPreparer(ctx context.Context, pool PoolAddParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPath("/pools"), + autorest.WithJSON(pool), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddSender sends the Add request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) AddSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// AddResponder handles the response to the Add request. The method always +// closes the http.Response Body. +func (client PoolClient) AddResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete when you request that a Pool be deleted, the following actions occur: the Pool state is set to deleting; any +// ongoing resize operation on the Pool are stopped; the Batch service starts resizing the Pool to zero Compute Nodes; +// any Tasks running on existing Compute Nodes are terminated and requeued (as if a resize Pool operation had been +// requested with the default requeue option); finally, the Pool is removed from the system. Because running Tasks are +// requeued, the user can rerun these Tasks by updating their Job to target a different Pool. The Tasks can then run on +// the new Pool. If you want to override the requeue behavior, then you should call resize Pool explicitly to shrink +// the Pool to zero size before deleting the Pool. If you call an Update, Patch or Delete API on a Pool in the deleting +// state, it will fail with HTTP status code 409 with error code PoolBeingDeleted. +// Parameters: +// poolID - the ID of the Pool to delete. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client PoolClient) Delete(ctx context.Context, poolID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, poolID, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PoolClient) DeletePreparer(ctx context.Context, poolID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PoolClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// DisableAutoScale sends the disable auto scale request. +// Parameters: +// poolID - the ID of the Pool on which to disable automatic scaling. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client PoolClient) DisableAutoScale(ctx context.Context, poolID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.DisableAutoScale") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DisableAutoScalePreparer(ctx, poolID, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "DisableAutoScale", nil, "Failure preparing request") + return + } + + resp, err := client.DisableAutoScaleSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.PoolClient", "DisableAutoScale", resp, "Failure sending request") + return + } + + result, err = client.DisableAutoScaleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "DisableAutoScale", resp, "Failure responding to request") + return + } + + return +} + +// DisableAutoScalePreparer prepares the DisableAutoScale request. +func (client PoolClient) DisableAutoScalePreparer(ctx context.Context, poolID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}/disableautoscale", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DisableAutoScaleSender sends the DisableAutoScale request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) DisableAutoScaleSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DisableAutoScaleResponder handles the response to the DisableAutoScale request. The method always +// closes the http.Response Body. +func (client PoolClient) DisableAutoScaleResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// EnableAutoScale you cannot enable automatic scaling on a Pool if a resize operation is in progress on the Pool. If +// automatic scaling of the Pool is currently disabled, you must specify a valid autoscale formula as part of the +// request. If automatic scaling of the Pool is already enabled, you may specify a new autoscale formula and/or a new +// evaluation interval. You cannot call this API for the same Pool more than once every 30 seconds. +// Parameters: +// poolID - the ID of the Pool on which to enable automatic scaling. +// poolEnableAutoScaleParameter - the parameters for the request. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client PoolClient) EnableAutoScale(ctx context.Context, poolID string, poolEnableAutoScaleParameter PoolEnableAutoScaleParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.EnableAutoScale") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.EnableAutoScalePreparer(ctx, poolID, poolEnableAutoScaleParameter, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "EnableAutoScale", nil, "Failure preparing request") + return + } + + resp, err := client.EnableAutoScaleSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.PoolClient", "EnableAutoScale", resp, "Failure sending request") + return + } + + result, err = client.EnableAutoScaleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "EnableAutoScale", resp, "Failure responding to request") + return + } + + return +} + +// EnableAutoScalePreparer prepares the EnableAutoScale request. +func (client PoolClient) EnableAutoScalePreparer(ctx context.Context, poolID string, poolEnableAutoScaleParameter PoolEnableAutoScaleParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}/enableautoscale", pathParameters), + autorest.WithJSON(poolEnableAutoScaleParameter), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// EnableAutoScaleSender sends the EnableAutoScale request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) EnableAutoScaleSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// EnableAutoScaleResponder handles the response to the EnableAutoScale request. The method always +// closes the http.Response Body. +func (client PoolClient) EnableAutoScaleResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// EvaluateAutoScale this API is primarily for validating an autoscale formula, as it simply returns the result without +// applying the formula to the Pool. The Pool must have auto scaling enabled in order to evaluate a formula. +// Parameters: +// poolID - the ID of the Pool on which to evaluate the automatic scaling formula. +// poolEvaluateAutoScaleParameter - the parameters for the request. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client PoolClient) EvaluateAutoScale(ctx context.Context, poolID string, poolEvaluateAutoScaleParameter PoolEvaluateAutoScaleParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result AutoScaleRun, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.EvaluateAutoScale") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: poolEvaluateAutoScaleParameter, + Constraints: []validation.Constraint{{Target: "poolEvaluateAutoScaleParameter.AutoScaleFormula", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.PoolClient", "EvaluateAutoScale", err.Error()) + } + + req, err := client.EvaluateAutoScalePreparer(ctx, poolID, poolEvaluateAutoScaleParameter, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "EvaluateAutoScale", nil, "Failure preparing request") + return + } + + resp, err := client.EvaluateAutoScaleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.PoolClient", "EvaluateAutoScale", resp, "Failure sending request") + return + } + + result, err = client.EvaluateAutoScaleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "EvaluateAutoScale", resp, "Failure responding to request") + return + } + + return +} + +// EvaluateAutoScalePreparer prepares the EvaluateAutoScale request. +func (client PoolClient) EvaluateAutoScalePreparer(ctx context.Context, poolID string, poolEvaluateAutoScaleParameter PoolEvaluateAutoScaleParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}/evaluateautoscale", pathParameters), + autorest.WithJSON(poolEvaluateAutoScaleParameter), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// EvaluateAutoScaleSender sends the EvaluateAutoScale request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) EvaluateAutoScaleSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// EvaluateAutoScaleResponder handles the response to the EvaluateAutoScale request. The method always +// closes the http.Response Body. +func (client PoolClient) EvaluateAutoScaleResponder(resp *http.Response) (result AutoScaleRun, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Exists gets basic properties of a Pool. +// Parameters: +// poolID - the ID of the Pool to get. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client PoolClient) Exists(ctx context.Context, poolID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.Exists") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ExistsPreparer(ctx, poolID, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Exists", nil, "Failure preparing request") + return + } + + resp, err := client.ExistsSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Exists", resp, "Failure sending request") + return + } + + result, err = client.ExistsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Exists", resp, "Failure responding to request") + return + } + + return +} + +// ExistsPreparer prepares the Exists request. +func (client PoolClient) ExistsPreparer(ctx context.Context, poolID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsHead(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExistsSender sends the Exists request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) ExistsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ExistsResponder handles the response to the Exists request. The method always +// closes the http.Response Body. +func (client PoolClient) ExistsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified Pool. +// Parameters: +// poolID - the ID of the Pool to get. +// selectParameter - an OData $select clause. +// expand - an OData $expand clause. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client PoolClient) Get(ctx context.Context, poolID string, selectParameter string, expand string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result CloudPool, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, poolID, selectParameter, expand, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PoolClient) GetPreparer(ctx context.Context, poolID string, selectParameter string, expand string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PoolClient) GetResponder(resp *http.Response) (result CloudPool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAllLifetimeStatistics statistics are aggregated across all Pools that have ever existed in the Account, from +// Account creation to the last update time of the statistics. The statistics may not be immediately available. The +// Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes. +// Parameters: +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client PoolClient) GetAllLifetimeStatistics(ctx context.Context, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result PoolStatistics, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.GetAllLifetimeStatistics") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetAllLifetimeStatisticsPreparer(ctx, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "GetAllLifetimeStatistics", nil, "Failure preparing request") + return + } + + resp, err := client.GetAllLifetimeStatisticsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.PoolClient", "GetAllLifetimeStatistics", resp, "Failure sending request") + return + } + + result, err = client.GetAllLifetimeStatisticsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "GetAllLifetimeStatistics", resp, "Failure responding to request") + return + } + + return +} + +// GetAllLifetimeStatisticsPreparer prepares the GetAllLifetimeStatistics request. +func (client PoolClient) GetAllLifetimeStatisticsPreparer(ctx context.Context, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPath("/lifetimepoolstats"), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAllLifetimeStatisticsSender sends the GetAllLifetimeStatistics request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) GetAllLifetimeStatisticsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetAllLifetimeStatisticsResponder handles the response to the GetAllLifetimeStatistics request. The method always +// closes the http.Response Body. +func (client PoolClient) GetAllLifetimeStatisticsResponder(resp *http.Response) (result PoolStatistics, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// filter - an OData $filter clause. For more information on constructing this filter, see +// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-pools. +// selectParameter - an OData $select clause. +// expand - an OData $expand clause. +// maxResults - the maximum number of items to return in the response. A maximum of 1000 Pools can be returned. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client PoolClient) List(ctx context.Context, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result CloudPoolListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.List") + defer func() { + sc := -1 + if result.cplr.Response.Response != nil { + sc = result.cplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxResults, + Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("batch.PoolClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, filter, selectParameter, expand, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.cplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.PoolClient", "List", resp, "Failure sending request") + return + } + + result.cplr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "List", resp, "Failure responding to request") + return + } + if result.cplr.hasNextLink() && result.cplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PoolClient) ListPreparer(ctx context.Context, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if maxResults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxResults) + } else { + queryParameters["maxresults"] = autorest.Encode("query", 1000) + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPath("/pools"), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PoolClient) ListResponder(resp *http.Response) (result CloudPoolListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client PoolClient) listNextResults(ctx context.Context, lastResults CloudPoolListResult) (result CloudPoolListResult, err error) { + req, err := lastResults.cloudPoolListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.PoolClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.PoolClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PoolClient) ListComplete(ctx context.Context, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result CloudPoolListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, filter, selectParameter, expand, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + return +} + +// ListUsageMetrics if you do not specify a $filter clause including a poolId, the response includes all Pools that +// existed in the Account in the time range of the returned aggregation intervals. If you do not specify a $filter +// clause including a startTime or endTime these filters default to the start and end times of the last aggregation +// interval currently available; that is, only the last aggregation interval is returned. +// Parameters: +// startTime - the earliest time from which to include metrics. This must be at least two and a half hours +// before the current time. If not specified this defaults to the start time of the last aggregation interval +// currently available. +// endTime - the latest time from which to include metrics. This must be at least two hours before the current +// time. If not specified this defaults to the end time of the last aggregation interval currently available. +// filter - an OData $filter clause. For more information on constructing this filter, see +// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-account-usage-metrics. +// maxResults - the maximum number of items to return in the response. A maximum of 1000 results will be +// returned. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client PoolClient) ListUsageMetrics(ctx context.Context, startTime *date.Time, endTime *date.Time, filter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result PoolListUsageMetricsResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.ListUsageMetrics") + defer func() { + sc := -1 + if result.plumr.Response.Response != nil { + sc = result.plumr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxResults, + Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("batch.PoolClient", "ListUsageMetrics", err.Error()) + } + + result.fn = client.listUsageMetricsNextResults + req, err := client.ListUsageMetricsPreparer(ctx, startTime, endTime, filter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "ListUsageMetrics", nil, "Failure preparing request") + return + } + + resp, err := client.ListUsageMetricsSender(req) + if err != nil { + result.plumr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.PoolClient", "ListUsageMetrics", resp, "Failure sending request") + return + } + + result.plumr, err = client.ListUsageMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "ListUsageMetrics", resp, "Failure responding to request") + return + } + if result.plumr.hasNextLink() && result.plumr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListUsageMetricsPreparer prepares the ListUsageMetrics request. +func (client PoolClient) ListUsageMetricsPreparer(ctx context.Context, startTime *date.Time, endTime *date.Time, filter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if startTime != nil { + queryParameters["starttime"] = autorest.Encode("query", *startTime) + } + if endTime != nil { + queryParameters["endtime"] = autorest.Encode("query", *endTime) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if maxResults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxResults) + } else { + queryParameters["maxresults"] = autorest.Encode("query", 1000) + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPath("/poolusagemetrics"), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListUsageMetricsSender sends the ListUsageMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) ListUsageMetricsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListUsageMetricsResponder handles the response to the ListUsageMetrics request. The method always +// closes the http.Response Body. +func (client PoolClient) ListUsageMetricsResponder(resp *http.Response) (result PoolListUsageMetricsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listUsageMetricsNextResults retrieves the next set of results, if any. +func (client PoolClient) listUsageMetricsNextResults(ctx context.Context, lastResults PoolListUsageMetricsResult) (result PoolListUsageMetricsResult, err error) { + req, err := lastResults.poolListUsageMetricsResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.PoolClient", "listUsageMetricsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListUsageMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.PoolClient", "listUsageMetricsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListUsageMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "listUsageMetricsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListUsageMetricsComplete enumerates all values, automatically crossing page boundaries as required. +func (client PoolClient) ListUsageMetricsComplete(ctx context.Context, startTime *date.Time, endTime *date.Time, filter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result PoolListUsageMetricsResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.ListUsageMetrics") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListUsageMetrics(ctx, startTime, endTime, filter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + return +} + +// Patch this only replaces the Pool properties specified in the request. For example, if the Pool has a StartTask +// associated with it, and a request does not specify a StartTask element, then the Pool keeps the existing StartTask. +// Parameters: +// poolID - the ID of the Pool to update. +// poolPatchParameter - the parameters for the request. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client PoolClient) Patch(ctx context.Context, poolID string, poolPatchParameter PoolPatchParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.Patch") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PatchPreparer(ctx, poolID, poolPatchParameter, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Patch", nil, "Failure preparing request") + return + } + + resp, err := client.PatchSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Patch", resp, "Failure sending request") + return + } + + result, err = client.PatchResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Patch", resp, "Failure responding to request") + return + } + + return +} + +// PatchPreparer prepares the Patch request. +func (client PoolClient) PatchPreparer(ctx context.Context, poolID string, poolPatchParameter PoolPatchParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), + autorest.AsPatch(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}", pathParameters), + autorest.WithJSON(poolPatchParameter), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PatchSender sends the Patch request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) PatchSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// PatchResponder handles the response to the Patch request. The method always +// closes the http.Response Body. +func (client PoolClient) PatchResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// RemoveNodes this operation can only run when the allocation state of the Pool is steady. When this operation runs, +// the allocation state changes from steady to resizing. Each request may remove up to 100 nodes. +// Parameters: +// poolID - the ID of the Pool from which you want to remove Compute Nodes. +// nodeRemoveParameter - the parameters for the request. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client PoolClient) RemoveNodes(ctx context.Context, poolID string, nodeRemoveParameter NodeRemoveParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.RemoveNodes") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: nodeRemoveParameter, + Constraints: []validation.Constraint{{Target: "nodeRemoveParameter.NodeList", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "nodeRemoveParameter.NodeList", Name: validation.MaxItems, Rule: 100, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("batch.PoolClient", "RemoveNodes", err.Error()) + } + + req, err := client.RemoveNodesPreparer(ctx, poolID, nodeRemoveParameter, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "RemoveNodes", nil, "Failure preparing request") + return + } + + resp, err := client.RemoveNodesSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.PoolClient", "RemoveNodes", resp, "Failure sending request") + return + } + + result, err = client.RemoveNodesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "RemoveNodes", resp, "Failure responding to request") + return + } + + return +} + +// RemoveNodesPreparer prepares the RemoveNodes request. +func (client PoolClient) RemoveNodesPreparer(ctx context.Context, poolID string, nodeRemoveParameter NodeRemoveParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}/removenodes", pathParameters), + autorest.WithJSON(nodeRemoveParameter), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RemoveNodesSender sends the RemoveNodes request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) RemoveNodesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// RemoveNodesResponder handles the response to the RemoveNodes request. The method always +// closes the http.Response Body. +func (client PoolClient) RemoveNodesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Resize you can only resize a Pool when its allocation state is steady. If the Pool is already resizing, the request +// fails with status code 409. When you resize a Pool, the Pool's allocation state changes from steady to resizing. You +// cannot resize Pools which are configured for automatic scaling. If you try to do this, the Batch service returns an +// error 409. If you resize a Pool downwards, the Batch service chooses which Compute Nodes to remove. To remove +// specific Compute Nodes, use the Pool remove Compute Nodes API instead. +// Parameters: +// poolID - the ID of the Pool to resize. +// poolResizeParameter - the parameters for the request. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client PoolClient) Resize(ctx context.Context, poolID string, poolResizeParameter PoolResizeParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.Resize") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ResizePreparer(ctx, poolID, poolResizeParameter, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Resize", nil, "Failure preparing request") + return + } + + resp, err := client.ResizeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Resize", resp, "Failure sending request") + return + } + + result, err = client.ResizeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Resize", resp, "Failure responding to request") + return + } + + return +} + +// ResizePreparer prepares the Resize request. +func (client PoolClient) ResizePreparer(ctx context.Context, poolID string, poolResizeParameter PoolResizeParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}/resize", pathParameters), + autorest.WithJSON(poolResizeParameter), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResizeSender sends the Resize request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) ResizeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ResizeResponder handles the response to the Resize request. The method always +// closes the http.Response Body. +func (client PoolClient) ResizeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// StopResize this does not restore the Pool to its previous state before the resize operation: it only stops any +// further changes being made, and the Pool maintains its current state. After stopping, the Pool stabilizes at the +// number of Compute Nodes it was at when the stop operation was done. During the stop operation, the Pool allocation +// state changes first to stopping and then to steady. A resize operation need not be an explicit resize Pool request; +// this API can also be used to halt the initial sizing of the Pool when it is created. +// Parameters: +// poolID - the ID of the Pool whose resizing you want to stop. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client PoolClient) StopResize(ctx context.Context, poolID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.StopResize") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StopResizePreparer(ctx, poolID, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "StopResize", nil, "Failure preparing request") + return + } + + resp, err := client.StopResizeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.PoolClient", "StopResize", resp, "Failure sending request") + return + } + + result, err = client.StopResizeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "StopResize", resp, "Failure responding to request") + return + } + + return +} + +// StopResizePreparer prepares the StopResize request. +func (client PoolClient) StopResizePreparer(ctx context.Context, poolID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}/stopresize", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopResizeSender sends the StopResize request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) StopResizeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// StopResizeResponder handles the response to the StopResize request. The method always +// closes the http.Response Body. +func (client PoolClient) StopResizeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// UpdateProperties this fully replaces all the updatable properties of the Pool. For example, if the Pool has a +// StartTask associated with it and if StartTask is not specified with this request, then the Batch service will remove +// the existing StartTask. +// Parameters: +// poolID - the ID of the Pool to update. +// poolUpdatePropertiesParameter - the parameters for the request. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client PoolClient) UpdateProperties(ctx context.Context, poolID string, poolUpdatePropertiesParameter PoolUpdatePropertiesParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.UpdateProperties") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: poolUpdatePropertiesParameter, + Constraints: []validation.Constraint{{Target: "poolUpdatePropertiesParameter.StartTask", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "poolUpdatePropertiesParameter.StartTask.CommandLine", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "poolUpdatePropertiesParameter.StartTask.ContainerSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "poolUpdatePropertiesParameter.StartTask.ContainerSettings.ImageName", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "poolUpdatePropertiesParameter.CertificateReferences", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "poolUpdatePropertiesParameter.ApplicationPackageReferences", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "poolUpdatePropertiesParameter.Metadata", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.PoolClient", "UpdateProperties", err.Error()) + } + + req, err := client.UpdatePropertiesPreparer(ctx, poolID, poolUpdatePropertiesParameter, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "UpdateProperties", nil, "Failure preparing request") + return + } + + resp, err := client.UpdatePropertiesSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.PoolClient", "UpdateProperties", resp, "Failure sending request") + return + } + + result, err = client.UpdatePropertiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "UpdateProperties", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePropertiesPreparer prepares the UpdateProperties request. +func (client PoolClient) UpdatePropertiesPreparer(ctx context.Context, poolID string, poolUpdatePropertiesParameter PoolUpdatePropertiesParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/pools/{poolId}/updateproperties", pathParameters), + autorest.WithJSON(poolUpdatePropertiesParameter), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdatePropertiesSender sends the UpdateProperties request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) UpdatePropertiesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// UpdatePropertiesResponder handles the response to the UpdateProperties request. The method always +// closes the http.Response Body. +func (client PoolClient) UpdatePropertiesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/batch/2021-06-01.14.0/batch/task.go b/services/batch/2021-06-01.14.0/batch/task.go new file mode 100644 index 000000000000..f7dd70a6e6c9 --- /dev/null +++ b/services/batch/2021-06-01.14.0/batch/task.go @@ -0,0 +1,1237 @@ +package batch + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "github.com/gofrs/uuid" + "net/http" +) + +// TaskClient is the a client for issuing REST requests to the Azure Batch service. +type TaskClient struct { + BaseClient +} + +// NewTaskClient creates an instance of the TaskClient client. +func NewTaskClient(batchURL string) TaskClient { + return TaskClient{New(batchURL)} +} + +// Add the maximum lifetime of a Task from addition to completion is 180 days. If a Task has not completed within 180 +// days of being added it will be terminated by the Batch service and left in whatever state it was in at that time. +// Parameters: +// jobID - the ID of the Job to which the Task is to be added. +// task - the Task to be added. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client TaskClient) Add(ctx context.Context, jobID string, task TaskAddParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskClient.Add") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: task, + Constraints: []validation.Constraint{{Target: "task.ID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "task.CommandLine", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "task.ContainerSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "task.ContainerSettings.ImageName", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "task.AffinityInfo", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "task.AffinityInfo.AffinityID", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "task.MultiInstanceSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "task.MultiInstanceSettings.CoordinationCommandLine", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("batch.TaskClient", "Add", err.Error()) + } + + req, err := client.AddPreparer(ctx, jobID, task, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.TaskClient", "Add", nil, "Failure preparing request") + return + } + + resp, err := client.AddSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.TaskClient", "Add", resp, "Failure sending request") + return + } + + result, err = client.AddResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.TaskClient", "Add", resp, "Failure responding to request") + return + } + + return +} + +// AddPreparer prepares the Add request. +func (client TaskClient) AddPreparer(ctx context.Context, jobID string, task TaskAddParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobs/{jobId}/tasks", pathParameters), + autorest.WithJSON(task), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddSender sends the Add request. The method will close the +// http.Response Body if it receives an error. +func (client TaskClient) AddSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// AddResponder handles the response to the Add request. The method always +// closes the http.Response Body. +func (client TaskClient) AddResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByClosing()) + result.Response = resp + return +} + +// AddCollection note that each Task must have a unique ID. The Batch service may not return the results for each Task +// in the same order the Tasks were submitted in this request. If the server times out or the connection is closed +// during the request, the request may have been partially or fully processed, or not at all. In such cases, the user +// should re-issue the request. Note that it is up to the user to correctly handle failures when re-issuing a request. +// For example, you should use the same Task IDs during a retry so that if the prior operation succeeded, the retry +// will not create extra Tasks unexpectedly. If the response contains any Tasks which failed to add, a client can retry +// the request. In a retry, it is most efficient to resubmit only Tasks that failed to add, and to omit Tasks that were +// successfully added on the first attempt. The maximum lifetime of a Task from addition to completion is 180 days. If +// a Task has not completed within 180 days of being added it will be terminated by the Batch service and left in +// whatever state it was in at that time. +// Parameters: +// jobID - the ID of the Job to which the Task collection is to be added. +// taskCollection - the Tasks to be added. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client TaskClient) AddCollection(ctx context.Context, jobID string, taskCollection TaskAddCollectionParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result TaskAddCollectionResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskClient.AddCollection") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: taskCollection, + Constraints: []validation.Constraint{{Target: "taskCollection.Value", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "taskCollection.Value", Name: validation.MaxItems, Rule: 100, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("batch.TaskClient", "AddCollection", err.Error()) + } + + req, err := client.AddCollectionPreparer(ctx, jobID, taskCollection, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.TaskClient", "AddCollection", nil, "Failure preparing request") + return + } + + resp, err := client.AddCollectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.TaskClient", "AddCollection", resp, "Failure sending request") + return + } + + result, err = client.AddCollectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.TaskClient", "AddCollection", resp, "Failure responding to request") + return + } + + return +} + +// AddCollectionPreparer prepares the AddCollection request. +func (client TaskClient) AddCollectionPreparer(ctx context.Context, jobID string, taskCollection TaskAddCollectionParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobs/{jobId}/addtaskcollection", pathParameters), + autorest.WithJSON(taskCollection), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddCollectionSender sends the AddCollection request. The method will close the +// http.Response Body if it receives an error. +func (client TaskClient) AddCollectionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// AddCollectionResponder handles the response to the AddCollection request. The method always +// closes the http.Response Body. +func (client TaskClient) AddCollectionResponder(resp *http.Response) (result TaskAddCollectionResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete when a Task is deleted, all of the files in its directory on the Compute Node where it ran are also deleted +// (regardless of the retention time). For multi-instance Tasks, the delete Task operation applies synchronously to the +// primary task; subtasks and their files are then deleted asynchronously in the background. +// Parameters: +// jobID - the ID of the Job from which to delete the Task. +// taskID - the ID of the Task to delete. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client TaskClient) Delete(ctx context.Context, jobID string, taskID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, jobID, taskID, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.TaskClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.TaskClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.TaskClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client TaskClient) DeletePreparer(ctx context.Context, jobID string, taskID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + "taskId": autorest.Encode("path", taskID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobs/{jobId}/tasks/{taskId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client TaskClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client TaskClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get for multi-instance Tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary Task. +// Use the list subtasks API to retrieve information about subtasks. +// Parameters: +// jobID - the ID of the Job that contains the Task. +// taskID - the ID of the Task to get information about. +// selectParameter - an OData $select clause. +// expand - an OData $expand clause. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client TaskClient) Get(ctx context.Context, jobID string, taskID string, selectParameter string, expand string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result CloudTask, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, jobID, taskID, selectParameter, expand, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.TaskClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.TaskClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.TaskClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client TaskClient) GetPreparer(ctx context.Context, jobID string, taskID string, selectParameter string, expand string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + "taskId": autorest.Encode("path", taskID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobs/{jobId}/tasks/{taskId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client TaskClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client TaskClient) GetResponder(resp *http.Response) (result CloudTask, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List for multi-instance Tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary Task. +// Use the list subtasks API to retrieve information about subtasks. +// Parameters: +// jobID - the ID of the Job. +// filter - an OData $filter clause. For more information on constructing this filter, see +// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-tasks. +// selectParameter - an OData $select clause. +// expand - an OData $expand clause. +// maxResults - the maximum number of items to return in the response. A maximum of 1000 Tasks can be returned. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client TaskClient) List(ctx context.Context, jobID string, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result CloudTaskListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskClient.List") + defer func() { + sc := -1 + if result.ctlr.Response.Response != nil { + sc = result.ctlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxResults, + Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("batch.TaskClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, jobID, filter, selectParameter, expand, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.TaskClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ctlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.TaskClient", "List", resp, "Failure sending request") + return + } + + result.ctlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.TaskClient", "List", resp, "Failure responding to request") + return + } + if result.ctlr.hasNextLink() && result.ctlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client TaskClient) ListPreparer(ctx context.Context, jobID string, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if maxResults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxResults) + } else { + queryParameters["maxresults"] = autorest.Encode("query", 1000) + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobs/{jobId}/tasks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client TaskClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client TaskClient) ListResponder(resp *http.Response) (result CloudTaskListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client TaskClient) listNextResults(ctx context.Context, lastResults CloudTaskListResult) (result CloudTaskListResult, err error) { + req, err := lastResults.cloudTaskListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.TaskClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.TaskClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.TaskClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client TaskClient) ListComplete(ctx context.Context, jobID string, filter string, selectParameter string, expand string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result CloudTaskListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, jobID, filter, selectParameter, expand, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + return +} + +// ListSubtasks if the Task is not a multi-instance Task then this returns an empty collection. +// Parameters: +// jobID - the ID of the Job. +// taskID - the ID of the Task. +// selectParameter - an OData $select clause. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +func (client TaskClient) ListSubtasks(ctx context.Context, jobID string, taskID string, selectParameter string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result CloudTaskListSubtasksResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskClient.ListSubtasks") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListSubtasksPreparer(ctx, jobID, taskID, selectParameter, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.TaskClient", "ListSubtasks", nil, "Failure preparing request") + return + } + + resp, err := client.ListSubtasksSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.TaskClient", "ListSubtasks", resp, "Failure sending request") + return + } + + result, err = client.ListSubtasksResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.TaskClient", "ListSubtasks", resp, "Failure responding to request") + return + } + + return +} + +// ListSubtasksPreparer prepares the ListSubtasks request. +func (client TaskClient) ListSubtasksPreparer(ctx context.Context, jobID string, taskID string, selectParameter string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + "taskId": autorest.Encode("path", taskID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobs/{jobId}/tasks/{taskId}/subtasksinfo", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSubtasksSender sends the ListSubtasks request. The method will close the +// http.Response Body if it receives an error. +func (client TaskClient) ListSubtasksSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListSubtasksResponder handles the response to the ListSubtasks request. The method always +// closes the http.Response Body. +func (client TaskClient) ListSubtasksResponder(resp *http.Response) (result CloudTaskListSubtasksResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Reactivate reactivation makes a Task eligible to be retried again up to its maximum retry count. The Task's state is +// changed to active. As the Task is no longer in the completed state, any previous exit code or failure information is +// no longer available after reactivation. Each time a Task is reactivated, its retry count is reset to 0. Reactivation +// will fail for Tasks that are not completed or that previously completed successfully (with an exit code of 0). +// Additionally, it will fail if the Job has completed (or is terminating or deleting). +// Parameters: +// jobID - the ID of the Job containing the Task. +// taskID - the ID of the Task to reactivate. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client TaskClient) Reactivate(ctx context.Context, jobID string, taskID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskClient.Reactivate") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ReactivatePreparer(ctx, jobID, taskID, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.TaskClient", "Reactivate", nil, "Failure preparing request") + return + } + + resp, err := client.ReactivateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.TaskClient", "Reactivate", resp, "Failure sending request") + return + } + + result, err = client.ReactivateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.TaskClient", "Reactivate", resp, "Failure responding to request") + return + } + + return +} + +// ReactivatePreparer prepares the Reactivate request. +func (client TaskClient) ReactivatePreparer(ctx context.Context, jobID string, taskID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + "taskId": autorest.Encode("path", taskID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobs/{jobId}/tasks/{taskId}/reactivate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ReactivateSender sends the Reactivate request. The method will close the +// http.Response Body if it receives an error. +func (client TaskClient) ReactivateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ReactivateResponder handles the response to the Reactivate request. The method always +// closes the http.Response Body. +func (client TaskClient) ReactivateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Terminate when the Task has been terminated, it moves to the completed state. For multi-instance Tasks, the +// terminate Task operation applies synchronously to the primary task; subtasks are then terminated asynchronously in +// the background. +// Parameters: +// jobID - the ID of the Job containing the Task. +// taskID - the ID of the Task to terminate. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client TaskClient) Terminate(ctx context.Context, jobID string, taskID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskClient.Terminate") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.TerminatePreparer(ctx, jobID, taskID, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.TaskClient", "Terminate", nil, "Failure preparing request") + return + } + + resp, err := client.TerminateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.TaskClient", "Terminate", resp, "Failure sending request") + return + } + + result, err = client.TerminateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.TaskClient", "Terminate", resp, "Failure responding to request") + return + } + + return +} + +// TerminatePreparer prepares the Terminate request. +func (client TaskClient) TerminatePreparer(ctx context.Context, jobID string, taskID string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + "taskId": autorest.Encode("path", taskID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobs/{jobId}/tasks/{taskId}/terminate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// TerminateSender sends the Terminate request. The method will close the +// http.Response Body if it receives an error. +func (client TaskClient) TerminateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// TerminateResponder handles the response to the Terminate request. The method always +// closes the http.Response Body. +func (client TaskClient) TerminateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update updates the properties of the specified Task. +// Parameters: +// jobID - the ID of the Job containing the Task. +// taskID - the ID of the Task to update. +// taskUpdateParameter - the parameters for the request. +// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. +// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as +// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. +// returnClientRequestID - whether the server should return the client-request-id in the response. +// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock +// time; set it explicitly if you are calling the REST API directly. +// ifMatch - an ETag value associated with the version of the resource known to the client. The operation will +// be performed only if the resource's current ETag on the service exactly matches the value specified by the +// client. +// ifNoneMatch - an ETag value associated with the version of the resource known to the client. The operation +// will be performed only if the resource's current ETag on the service does not match the value specified by +// the client. +// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has been modified since the specified time. +// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The +// operation will be performed only if the resource on the service has not been modified since the specified +// time. +func (client TaskClient) Update(ctx context.Context, jobID string, taskID string, taskUpdateParameter TaskUpdateParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskClient.Update") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, jobID, taskID, taskUpdateParameter, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.TaskClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.TaskClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.TaskClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client TaskClient) UpdatePreparer(ctx context.Context, jobID string, taskID string, taskUpdateParameter TaskUpdateParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "batchUrl": client.BatchURL, + } + + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + "taskId": autorest.Encode("path", taskID), + } + + const APIVersion = "2021-06-01.14.0" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timeout != nil { + queryParameters["timeout"] = autorest.Encode("query", *timeout) + } else { + queryParameters["timeout"] = autorest.Encode("query", 30) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; odata=minimalmetadata; charset=utf-8"), + autorest.AsPut(), + autorest.WithCustomBaseURL("{batchUrl}", urlParameters), + autorest.WithPathParameters("/jobs/{jobId}/tasks/{taskId}", pathParameters), + autorest.WithJSON(taskUpdateParameter), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("client-request-id", autorest.String(clientRequestID))) + } + if returnClientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(returnClientRequestID))) + } else { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("return-client-request-id", autorest.String(false))) + } + if ocpDate != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("ocp-date", autorest.String(ocpDate))) + } + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + if ifModifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince))) + } + if ifUnmodifiedSince != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client TaskClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client TaskClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/batch/2021-06-01.14.0/batch/version.go b/services/batch/2021-06-01.14.0/batch/version.go new file mode 100644 index 000000000000..468bdec991b1 --- /dev/null +++ b/services/batch/2021-06-01.14.0/batch/version.go @@ -0,0 +1,19 @@ +package batch + +import "github.com/Azure/azure-sdk-for-go/version" + +// 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. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " batch/2021-06-01.14.0" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/batch/mgmt/2015-12-01/batch/CHANGELOG.md b/services/batch/mgmt/2015-12-01/batch/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/batch/mgmt/2015-12-01/batch/CHANGELOG.md +++ b/services/batch/mgmt/2015-12-01/batch/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/batch/mgmt/2015-12-01/batch/_meta.json b/services/batch/mgmt/2015-12-01/batch/_meta.json index 2dbaf9ac1deb..156d64de7011 100644 --- a/services/batch/mgmt/2015-12-01/batch/_meta.json +++ b/services/batch/mgmt/2015-12-01/batch/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "18b54ea5e241eddd47527a166c38ed75958b3227", "readme": "/_/azure-rest-api-specs/specification/batch/resource-manager/readme.md", "tag": "package-2015-12", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/batch/mgmt/2017-01-01/batch/CHANGELOG.md b/services/batch/mgmt/2017-01-01/batch/CHANGELOG.md index 7e0a6f61fec9..a1ecf841edb0 100644 --- a/services/batch/mgmt/2017-01-01/batch/CHANGELOG.md +++ b/services/batch/mgmt/2017-01-01/batch/CHANGELOG.md @@ -1,10 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. AccountKeys.MarshalJSON() ([]byte, error) -1. AccountProperties.MarshalJSON() ([]byte, error) -1. ApplicationPackage.MarshalJSON() ([]byte, error) -1. LocationQuota.MarshalJSON() ([]byte, error) diff --git a/services/batch/mgmt/2017-01-01/batch/_meta.json b/services/batch/mgmt/2017-01-01/batch/_meta.json index 32e58946ab43..da90807222bb 100644 --- a/services/batch/mgmt/2017-01-01/batch/_meta.json +++ b/services/batch/mgmt/2017-01-01/batch/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "18b54ea5e241eddd47527a166c38ed75958b3227", "readme": "/_/azure-rest-api-specs/specification/batch/resource-manager/readme.md", "tag": "package-2017-01", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/batch/mgmt/2017-05-01/batch/CHANGELOG.md b/services/batch/mgmt/2017-05-01/batch/CHANGELOG.md index 2e7a86ca25d6..a1ecf841edb0 100644 --- a/services/batch/mgmt/2017-05-01/batch/CHANGELOG.md +++ b/services/batch/mgmt/2017-05-01/batch/CHANGELOG.md @@ -1,11 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. AccountKeys.MarshalJSON() ([]byte, error) -1. AccountProperties.MarshalJSON() ([]byte, error) -1. ApplicationPackage.MarshalJSON() ([]byte, error) -1. CheckNameAvailabilityResult.MarshalJSON() ([]byte, error) -1. LocationQuota.MarshalJSON() ([]byte, error) diff --git a/services/batch/mgmt/2017-05-01/batch/_meta.json b/services/batch/mgmt/2017-05-01/batch/_meta.json index 80060f03518a..7f6fd1e83845 100644 --- a/services/batch/mgmt/2017-05-01/batch/_meta.json +++ b/services/batch/mgmt/2017-05-01/batch/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "18b54ea5e241eddd47527a166c38ed75958b3227", "readme": "/_/azure-rest-api-specs/specification/batch/resource-manager/readme.md", "tag": "package-2017-05", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/batch/mgmt/2017-09-01/batch/CHANGELOG.md b/services/batch/mgmt/2017-09-01/batch/CHANGELOG.md index b1df97d51518..a1ecf841edb0 100644 --- a/services/batch/mgmt/2017-09-01/batch/CHANGELOG.md +++ b/services/batch/mgmt/2017-09-01/batch/CHANGELOG.md @@ -1,12 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. AccountKeys.MarshalJSON() ([]byte, error) -1. AccountProperties.MarshalJSON() ([]byte, error) -1. ApplicationPackage.MarshalJSON() ([]byte, error) -1. CheckNameAvailabilityResult.MarshalJSON() ([]byte, error) -1. LocationQuota.MarshalJSON() ([]byte, error) -1. ProxyResource.MarshalJSON() ([]byte, error) diff --git a/services/batch/mgmt/2017-09-01/batch/_meta.json b/services/batch/mgmt/2017-09-01/batch/_meta.json index 765bba8edbe0..d08e7c139d18 100644 --- a/services/batch/mgmt/2017-09-01/batch/_meta.json +++ b/services/batch/mgmt/2017-09-01/batch/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "18b54ea5e241eddd47527a166c38ed75958b3227", "readme": "/_/azure-rest-api-specs/specification/batch/resource-manager/readme.md", "tag": "package-2017-09", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/batch/mgmt/2018-12-01/batch/CHANGELOG.md b/services/batch/mgmt/2018-12-01/batch/CHANGELOG.md index 689fdf12e1a8..a1ecf841edb0 100644 --- a/services/batch/mgmt/2018-12-01/batch/CHANGELOG.md +++ b/services/batch/mgmt/2018-12-01/batch/CHANGELOG.md @@ -1,12 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. AccountKeys.MarshalJSON() ([]byte, error) -1. AccountProperties.MarshalJSON() ([]byte, error) -1. ApplicationPackageProperties.MarshalJSON() ([]byte, error) -1. CheckNameAvailabilityResult.MarshalJSON() ([]byte, error) -1. LocationQuota.MarshalJSON() ([]byte, error) -1. ProxyResource.MarshalJSON() ([]byte, error) diff --git a/services/batch/mgmt/2018-12-01/batch/_meta.json b/services/batch/mgmt/2018-12-01/batch/_meta.json index d53d4a3101d9..dc622f851c4b 100644 --- a/services/batch/mgmt/2018-12-01/batch/_meta.json +++ b/services/batch/mgmt/2018-12-01/batch/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "18b54ea5e241eddd47527a166c38ed75958b3227", "readme": "/_/azure-rest-api-specs/specification/batch/resource-manager/readme.md", "tag": "package-2018-12", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/batch/mgmt/2019-04-01/batch/CHANGELOG.md b/services/batch/mgmt/2019-04-01/batch/CHANGELOG.md index 974fecc13592..a1ecf841edb0 100644 --- a/services/batch/mgmt/2019-04-01/batch/CHANGELOG.md +++ b/services/batch/mgmt/2019-04-01/batch/CHANGELOG.md @@ -1,13 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. AccountKeys.MarshalJSON() ([]byte, error) -1. AccountProperties.MarshalJSON() ([]byte, error) -1. ApplicationPackageProperties.MarshalJSON() ([]byte, error) -1. CheckNameAvailabilityResult.MarshalJSON() ([]byte, error) -1. LocationQuota.MarshalJSON() ([]byte, error) -1. ProxyResource.MarshalJSON() ([]byte, error) -1. VirtualMachineFamilyCoreQuota.MarshalJSON() ([]byte, error) diff --git a/services/batch/mgmt/2019-04-01/batch/_meta.json b/services/batch/mgmt/2019-04-01/batch/_meta.json index e809ab7f266f..2cc942f4f927 100644 --- a/services/batch/mgmt/2019-04-01/batch/_meta.json +++ b/services/batch/mgmt/2019-04-01/batch/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "18b54ea5e241eddd47527a166c38ed75958b3227", "readme": "/_/azure-rest-api-specs/specification/batch/resource-manager/readme.md", "tag": "package-2019-04", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/batch/mgmt/2019-08-01/batch/CHANGELOG.md b/services/batch/mgmt/2019-08-01/batch/CHANGELOG.md index 974fecc13592..a1ecf841edb0 100644 --- a/services/batch/mgmt/2019-08-01/batch/CHANGELOG.md +++ b/services/batch/mgmt/2019-08-01/batch/CHANGELOG.md @@ -1,13 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. AccountKeys.MarshalJSON() ([]byte, error) -1. AccountProperties.MarshalJSON() ([]byte, error) -1. ApplicationPackageProperties.MarshalJSON() ([]byte, error) -1. CheckNameAvailabilityResult.MarshalJSON() ([]byte, error) -1. LocationQuota.MarshalJSON() ([]byte, error) -1. ProxyResource.MarshalJSON() ([]byte, error) -1. VirtualMachineFamilyCoreQuota.MarshalJSON() ([]byte, error) diff --git a/services/batch/mgmt/2019-08-01/batch/_meta.json b/services/batch/mgmt/2019-08-01/batch/_meta.json index b56eb8128403..00e542e82fe9 100644 --- a/services/batch/mgmt/2019-08-01/batch/_meta.json +++ b/services/batch/mgmt/2019-08-01/batch/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "18b54ea5e241eddd47527a166c38ed75958b3227", "readme": "/_/azure-rest-api-specs/specification/batch/resource-manager/readme.md", "tag": "package-2019-08", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/batch/mgmt/2020-03-01/batch/CHANGELOG.md b/services/batch/mgmt/2020-03-01/batch/CHANGELOG.md index 9e1aae370d36..a1ecf841edb0 100644 --- a/services/batch/mgmt/2020-03-01/batch/CHANGELOG.md +++ b/services/batch/mgmt/2020-03-01/batch/CHANGELOG.md @@ -1,15 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. AccountKeys.MarshalJSON() ([]byte, error) -1. AccountProperties.MarshalJSON() ([]byte, error) -1. ApplicationPackageProperties.MarshalJSON() ([]byte, error) -1. CheckNameAvailabilityResult.MarshalJSON() ([]byte, error) -1. LocationQuota.MarshalJSON() ([]byte, error) -1. PrivateEndpoint.MarshalJSON() ([]byte, error) -1. PrivateLinkResourceProperties.MarshalJSON() ([]byte, error) -1. ProxyResource.MarshalJSON() ([]byte, error) -1. VirtualMachineFamilyCoreQuota.MarshalJSON() ([]byte, error) diff --git a/services/batch/mgmt/2020-03-01/batch/_meta.json b/services/batch/mgmt/2020-03-01/batch/_meta.json index c724991f5a6f..146fc34c655a 100644 --- a/services/batch/mgmt/2020-03-01/batch/_meta.json +++ b/services/batch/mgmt/2020-03-01/batch/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "18b54ea5e241eddd47527a166c38ed75958b3227", "readme": "/_/azure-rest-api-specs/specification/batch/resource-manager/readme.md", "tag": "package-2020-03", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/batch/mgmt/2020-05-01/batch/CHANGELOG.md b/services/batch/mgmt/2020-05-01/batch/CHANGELOG.md index 9e1aae370d36..a1ecf841edb0 100644 --- a/services/batch/mgmt/2020-05-01/batch/CHANGELOG.md +++ b/services/batch/mgmt/2020-05-01/batch/CHANGELOG.md @@ -1,15 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. AccountKeys.MarshalJSON() ([]byte, error) -1. AccountProperties.MarshalJSON() ([]byte, error) -1. ApplicationPackageProperties.MarshalJSON() ([]byte, error) -1. CheckNameAvailabilityResult.MarshalJSON() ([]byte, error) -1. LocationQuota.MarshalJSON() ([]byte, error) -1. PrivateEndpoint.MarshalJSON() ([]byte, error) -1. PrivateLinkResourceProperties.MarshalJSON() ([]byte, error) -1. ProxyResource.MarshalJSON() ([]byte, error) -1. VirtualMachineFamilyCoreQuota.MarshalJSON() ([]byte, error) diff --git a/services/batch/mgmt/2020-05-01/batch/_meta.json b/services/batch/mgmt/2020-05-01/batch/_meta.json index 126eadcb1db0..b41b39775da2 100644 --- a/services/batch/mgmt/2020-05-01/batch/_meta.json +++ b/services/batch/mgmt/2020-05-01/batch/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "18b54ea5e241eddd47527a166c38ed75958b3227", "readme": "/_/azure-rest-api-specs/specification/batch/resource-manager/readme.md", "tag": "package-2020-05", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/batch/mgmt/2020-09-01/batch/CHANGELOG.md b/services/batch/mgmt/2020-09-01/batch/CHANGELOG.md index 9e1aae370d36..a1ecf841edb0 100644 --- a/services/batch/mgmt/2020-09-01/batch/CHANGELOG.md +++ b/services/batch/mgmt/2020-09-01/batch/CHANGELOG.md @@ -1,15 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. AccountKeys.MarshalJSON() ([]byte, error) -1. AccountProperties.MarshalJSON() ([]byte, error) -1. ApplicationPackageProperties.MarshalJSON() ([]byte, error) -1. CheckNameAvailabilityResult.MarshalJSON() ([]byte, error) -1. LocationQuota.MarshalJSON() ([]byte, error) -1. PrivateEndpoint.MarshalJSON() ([]byte, error) -1. PrivateLinkResourceProperties.MarshalJSON() ([]byte, error) -1. ProxyResource.MarshalJSON() ([]byte, error) -1. VirtualMachineFamilyCoreQuota.MarshalJSON() ([]byte, error) diff --git a/services/batch/mgmt/2020-09-01/batch/_meta.json b/services/batch/mgmt/2020-09-01/batch/_meta.json index 11c3aba58112..3b25ecee3ae7 100644 --- a/services/batch/mgmt/2020-09-01/batch/_meta.json +++ b/services/batch/mgmt/2020-09-01/batch/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "18b54ea5e241eddd47527a166c38ed75958b3227", "readme": "/_/azure-rest-api-specs/specification/batch/resource-manager/readme.md", "tag": "package-2020-09", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/batch/mgmt/2021-01-01/batch/CHANGELOG.md b/services/batch/mgmt/2021-01-01/batch/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/batch/mgmt/2021-01-01/batch/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/batch/mgmt/2021-01-01/batch/_meta.json b/services/batch/mgmt/2021-01-01/batch/_meta.json new file mode 100644 index 000000000000..d3e6f78c09d1 --- /dev/null +++ b/services/batch/mgmt/2021-01-01/batch/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "18b54ea5e241eddd47527a166c38ed75958b3227", + "readme": "/_/azure-rest-api-specs/specification/batch/resource-manager/readme.md", + "tag": "package-2021-01", + "use": "@microsoft.azure/autorest.go@2.1.183", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2021-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/batch/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/batch/mgmt/2021-01-01/batch/account.go b/services/batch/mgmt/2021-01-01/batch/account.go new file mode 100644 index 000000000000..e3b0b35851d2 --- /dev/null +++ b/services/batch/mgmt/2021-01-01/batch/account.go @@ -0,0 +1,877 @@ +package batch + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AccountClient is the client for the Account methods of the Batch service. +type AccountClient struct { + BaseClient +} + +// NewAccountClient creates an instance of the AccountClient client. +func NewAccountClient(subscriptionID string) AccountClient { + return NewAccountClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAccountClientWithBaseURI creates an instance of the AccountClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAccountClientWithBaseURI(baseURI string, subscriptionID string) AccountClient { + return AccountClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API +// and should instead be updated with the Update Batch Account API. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - a name for the Batch account which must be unique within the region. Batch account names must +// be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used +// as part of the DNS name that is used to access the Batch service in the region in which the account is +// created. For example: http://accountname.region.batch.azure.com/. +// parameters - additional parameters for account creation. +func (client AccountClient) Create(ctx context.Context, resourceGroupName string, accountName string, parameters AccountCreateParameters) (result AccountCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AccountCreateProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AccountCreateProperties.AutoStorage", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AccountCreateProperties.AutoStorage.StorageAccountID", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.AccountCreateProperties.KeyVaultReference", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AccountCreateProperties.KeyVaultReference.ID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AccountCreateProperties.KeyVaultReference.URL", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("batch.AccountClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Create", nil, "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client AccountClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, parameters AccountCreateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) CreateSender(req *http.Request) (future AccountCreateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client AccountClient) CreateResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified Batch account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +func (client AccountClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result AccountDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.AccountClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AccountClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) DeleteSender(req *http.Request) (future AccountDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AccountClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified Batch account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +func (client AccountClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result Account, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.AccountClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AccountClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AccountClient) GetResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetKeys this operation applies only to Batch accounts created with a poolAllocationMode of 'BatchService'. If the +// Batch account was created with a poolAllocationMode of 'UserSubscription', clients cannot use access to keys to +// authenticate, and must use Azure Active Directory instead. In this case, getting the keys will fail. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +func (client AccountClient) GetKeys(ctx context.Context, resourceGroupName string, accountName string) (result AccountKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.GetKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.AccountClient", "GetKeys", err.Error()) + } + + req, err := client.GetKeysPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetKeys", nil, "Failure preparing request") + return + } + + resp, err := client.GetKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetKeys", resp, "Failure sending request") + return + } + + result, err = client.GetKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetKeys", resp, "Failure responding to request") + return + } + + return +} + +// GetKeysPreparer prepares the GetKeys request. +func (client AccountClient) GetKeysPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetKeysSender sends the GetKeys request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) GetKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetKeysResponder handles the response to the GetKeys request. The method always +// closes the http.Response Body. +func (client AccountClient) GetKeysResponder(resp *http.Response) (result AccountKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets information about the Batch accounts associated with the subscription. +func (client AccountClient) List(ctx context.Context) (result AccountListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.List") + defer func() { + sc := -1 + if result.alr.Response.Response != nil { + sc = result.alr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.alr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.AccountClient", "List", resp, "Failure sending request") + return + } + + result.alr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "List", resp, "Failure responding to request") + return + } + if result.alr.hasNextLink() && result.alr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AccountClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Batch/batchAccounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AccountClient) ListResponder(resp *http.Response) (result AccountListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AccountClient) listNextResults(ctx context.Context, lastResults AccountListResult) (result AccountListResult, err error) { + req, err := lastResults.accountListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AccountClient) ListComplete(ctx context.Context) (result AccountListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup gets information about the Batch accounts associated with the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +func (client AccountClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AccountListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.alr.Response.Response != nil { + sc = result.alr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.alr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.alr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.alr.hasNextLink() && result.alr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AccountClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AccountClient) ListByResourceGroupResponder(resp *http.Response) (result AccountListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client AccountClient) listByResourceGroupNextResults(ctx context.Context, lastResults AccountListResult) (result AccountListResult, err error) { + req, err := lastResults.accountListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client AccountClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AccountListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// RegenerateKey regenerates the specified account key for the Batch account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// parameters - the type of key to regenerate. +func (client AccountClient) RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, parameters AccountRegenerateKeyParameters) (result AccountKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.RegenerateKey") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.AccountClient", "RegenerateKey", err.Error()) + } + + req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, accountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "RegenerateKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.AccountClient", "RegenerateKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "RegenerateKey", resp, "Failure responding to request") + return + } + + return +} + +// RegenerateKeyPreparer prepares the RegenerateKey request. +func (client AccountClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, accountName string, parameters AccountRegenerateKeyParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/regenerateKeys", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegenerateKeySender sends the RegenerateKey request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always +// closes the http.Response Body. +func (client AccountClient) RegenerateKeyResponder(resp *http.Response) (result AccountKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SynchronizeAutoStorageKeys synchronizes access keys for the auto-storage account configured for the specified Batch +// account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +func (client AccountClient) SynchronizeAutoStorageKeys(ctx context.Context, resourceGroupName string, accountName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.SynchronizeAutoStorageKeys") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.AccountClient", "SynchronizeAutoStorageKeys", err.Error()) + } + + req, err := client.SynchronizeAutoStorageKeysPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "SynchronizeAutoStorageKeys", nil, "Failure preparing request") + return + } + + resp, err := client.SynchronizeAutoStorageKeysSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.AccountClient", "SynchronizeAutoStorageKeys", resp, "Failure sending request") + return + } + + result, err = client.SynchronizeAutoStorageKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "SynchronizeAutoStorageKeys", resp, "Failure responding to request") + return + } + + return +} + +// SynchronizeAutoStorageKeysPreparer prepares the SynchronizeAutoStorageKeys request. +func (client AccountClient) SynchronizeAutoStorageKeysPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/syncAutoStorageKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SynchronizeAutoStorageKeysSender sends the SynchronizeAutoStorageKeys request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) SynchronizeAutoStorageKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// SynchronizeAutoStorageKeysResponder handles the response to the SynchronizeAutoStorageKeys request. The method always +// closes the http.Response Body. +func (client AccountClient) SynchronizeAutoStorageKeysResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update updates the properties of an existing Batch account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// parameters - additional parameters for account update. +func (client AccountClient) Update(ctx context.Context, resourceGroupName string, accountName string, parameters AccountUpdateParameters) (result Account, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.AccountClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AccountClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, parameters AccountUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AccountClient) UpdateResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/batch/mgmt/2021-01-01/batch/application.go b/services/batch/mgmt/2021-01-01/batch/application.go new file mode 100644 index 000000000000..843f85261b8f --- /dev/null +++ b/services/batch/mgmt/2021-01-01/batch/application.go @@ -0,0 +1,530 @@ +package batch + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ApplicationClient is the client for the Application methods of the Batch service. +type ApplicationClient struct { + BaseClient +} + +// NewApplicationClient creates an instance of the ApplicationClient client. +func NewApplicationClient(subscriptionID string) ApplicationClient { + return NewApplicationClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewApplicationClientWithBaseURI creates an instance of the ApplicationClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewApplicationClientWithBaseURI(baseURI string, subscriptionID string) ApplicationClient { + return ApplicationClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create adds an application to the specified Batch account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// applicationName - the name of the application. This must be unique within the account. +// parameters - the parameters for the request. +func (client ApplicationClient) Create(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters *Application) (result Application, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.ApplicationClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, applicationName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ApplicationClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters *Application) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationName": autorest.Encode("path", applicationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ApplicationClient) CreateResponder(resp *http.Response) (result Application, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an application. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// applicationName - the name of the application. This must be unique within the account. +func (client ApplicationClient) Delete(ctx context.Context, resourceGroupName string, accountName string, applicationName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.ApplicationClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, applicationName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ApplicationClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationName": autorest.Encode("path", applicationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ApplicationClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified application. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// applicationName - the name of the application. This must be unique within the account. +func (client ApplicationClient) Get(ctx context.Context, resourceGroupName string, accountName string, applicationName string) (result Application, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.ApplicationClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, applicationName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ApplicationClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationName": autorest.Encode("path", applicationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ApplicationClient) GetResponder(resp *http.Response) (result Application, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all of the applications in the specified account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// maxresults - the maximum number of items to return in the response. +func (client ApplicationClient) List(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result ListApplicationsResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.List") + defer func() { + sc := -1 + if result.lar.Response.Response != nil { + sc = result.lar.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.ApplicationClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, accountName, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lar.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", resp, "Failure sending request") + return + } + + result.lar, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", resp, "Failure responding to request") + return + } + if result.lar.hasNextLink() && result.lar.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ApplicationClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ApplicationClient) ListResponder(resp *http.Response) (result ListApplicationsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ApplicationClient) listNextResults(ctx context.Context, lastResults ListApplicationsResult) (result ListApplicationsResult, err error) { + req, err := lastResults.listApplicationsResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ApplicationClient) ListComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result ListApplicationsResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, accountName, maxresults) + return +} + +// Update updates settings for the specified application. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// applicationName - the name of the application. This must be unique within the account. +// parameters - the parameters for the request. +func (client ApplicationClient) Update(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters Application) (result Application, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.ApplicationClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, applicationName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ApplicationClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters Application) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationName": autorest.Encode("path", applicationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ApplicationClient) UpdateResponder(resp *http.Response) (result Application, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/batch/mgmt/2021-01-01/batch/applicationpackage.go b/services/batch/mgmt/2021-01-01/batch/applicationpackage.go new file mode 100644 index 000000000000..efd62f78cf89 --- /dev/null +++ b/services/batch/mgmt/2021-01-01/batch/applicationpackage.go @@ -0,0 +1,566 @@ +package batch + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ApplicationPackageClient is the client for the ApplicationPackage methods of the Batch service. +type ApplicationPackageClient struct { + BaseClient +} + +// NewApplicationPackageClient creates an instance of the ApplicationPackageClient client. +func NewApplicationPackageClient(subscriptionID string) ApplicationPackageClient { + return NewApplicationPackageClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewApplicationPackageClientWithBaseURI creates an instance of the ApplicationPackageClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewApplicationPackageClientWithBaseURI(baseURI string, subscriptionID string) ApplicationPackageClient { + return ApplicationPackageClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Activate activates the specified application package. This should be done after the `ApplicationPackage` was created +// and uploaded. This needs to be done before an `ApplicationPackage` can be used on Pools or Tasks. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// applicationName - the name of the application. This must be unique within the account. +// versionName - the version of the application. +// parameters - the parameters for the request. +func (client ApplicationPackageClient) Activate(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters ActivateApplicationPackageParameters) (result ApplicationPackage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.Activate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}, + {TargetValue: versionName, + Constraints: []validation.Constraint{{Target: "versionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "versionName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "versionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Format", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.ApplicationPackageClient", "Activate", err.Error()) + } + + req, err := client.ActivatePreparer(ctx, resourceGroupName, accountName, applicationName, versionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Activate", nil, "Failure preparing request") + return + } + + resp, err := client.ActivateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Activate", resp, "Failure sending request") + return + } + + result, err = client.ActivateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Activate", resp, "Failure responding to request") + return + } + + return +} + +// ActivatePreparer prepares the Activate request. +func (client ApplicationPackageClient) ActivatePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters ActivateApplicationPackageParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationName": autorest.Encode("path", applicationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "versionName": autorest.Encode("path", versionName), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}/activate", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ActivateSender sends the Activate request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationPackageClient) ActivateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ActivateResponder handles the response to the Activate request. The method always +// closes the http.Response Body. +func (client ApplicationPackageClient) ActivateResponder(resp *http.Response) (result ApplicationPackage, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Create creates an application package record. The record contains the SAS where the package should be uploaded to. +// Once it is uploaded the `ApplicationPackage` needs to be activated using `ApplicationPackageActive` before it can be +// used. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// applicationName - the name of the application. This must be unique within the account. +// versionName - the version of the application. +// parameters - the parameters for the request. +func (client ApplicationPackageClient) Create(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters *ApplicationPackage) (result ApplicationPackage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}, + {TargetValue: versionName, + Constraints: []validation.Constraint{{Target: "versionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "versionName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "versionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.ApplicationPackageClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, applicationName, versionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ApplicationPackageClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters *ApplicationPackage) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationName": autorest.Encode("path", applicationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "versionName": autorest.Encode("path", versionName), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationPackageClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ApplicationPackageClient) CreateResponder(resp *http.Response) (result ApplicationPackage, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an application package record and its associated binary file. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// applicationName - the name of the application. This must be unique within the account. +// versionName - the version of the application. +func (client ApplicationPackageClient) Delete(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}, + {TargetValue: versionName, + Constraints: []validation.Constraint{{Target: "versionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "versionName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "versionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.ApplicationPackageClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, applicationName, versionName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ApplicationPackageClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationName": autorest.Encode("path", applicationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "versionName": autorest.Encode("path", versionName), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationPackageClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ApplicationPackageClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified application package. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// applicationName - the name of the application. This must be unique within the account. +// versionName - the version of the application. +func (client ApplicationPackageClient) Get(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string) (result ApplicationPackage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}, + {TargetValue: versionName, + Constraints: []validation.Constraint{{Target: "versionName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "versionName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "versionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.ApplicationPackageClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, applicationName, versionName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ApplicationPackageClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationName": autorest.Encode("path", applicationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "versionName": autorest.Encode("path", versionName), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationPackageClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ApplicationPackageClient) GetResponder(resp *http.Response) (result ApplicationPackage, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all of the application packages in the specified application. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// applicationName - the name of the application. This must be unique within the account. +// maxresults - the maximum number of items to return in the response. +func (client ApplicationPackageClient) List(ctx context.Context, resourceGroupName string, accountName string, applicationName string, maxresults *int32) (result ListApplicationPackagesResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.List") + defer func() { + sc := -1 + if result.lapr.Response.Response != nil { + sc = result.lapr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: applicationName, + Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "applicationName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "applicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.ApplicationPackageClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, accountName, applicationName, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "List", resp, "Failure sending request") + return + } + + result.lapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "List", resp, "Failure responding to request") + return + } + if result.lapr.hasNextLink() && result.lapr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ApplicationPackageClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string, applicationName string, maxresults *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationName": autorest.Encode("path", applicationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationPackageClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ApplicationPackageClient) ListResponder(resp *http.Response) (result ListApplicationPackagesResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ApplicationPackageClient) listNextResults(ctx context.Context, lastResults ListApplicationPackagesResult) (result ListApplicationPackagesResult, err error) { + req, err := lastResults.listApplicationPackagesResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ApplicationPackageClient) ListComplete(ctx context.Context, resourceGroupName string, accountName string, applicationName string, maxresults *int32) (result ListApplicationPackagesResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationPackageClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, accountName, applicationName, maxresults) + return +} diff --git a/services/batch/mgmt/2021-01-01/batch/batchapi/interfaces.go b/services/batch/mgmt/2021-01-01/batch/batchapi/interfaces.go new file mode 100644 index 000000000000..34af2d79b2b3 --- /dev/null +++ b/services/batch/mgmt/2021-01-01/batch/batchapi/interfaces.go @@ -0,0 +1,116 @@ +package batchapi + +// 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. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2021-01-01/batch" + "github.com/Azure/go-autorest/autorest" +) + +// AccountClientAPI contains the set of methods on the AccountClient type. +type AccountClientAPI interface { + Create(ctx context.Context, resourceGroupName string, accountName string, parameters batch.AccountCreateParameters) (result batch.AccountCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string) (result batch.AccountDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, accountName string) (result batch.Account, err error) + GetKeys(ctx context.Context, resourceGroupName string, accountName string) (result batch.AccountKeys, err error) + List(ctx context.Context) (result batch.AccountListResultPage, err error) + ListComplete(ctx context.Context) (result batch.AccountListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result batch.AccountListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result batch.AccountListResultIterator, err error) + RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, parameters batch.AccountRegenerateKeyParameters) (result batch.AccountKeys, err error) + SynchronizeAutoStorageKeys(ctx context.Context, resourceGroupName string, accountName string) (result autorest.Response, err error) + Update(ctx context.Context, resourceGroupName string, accountName string, parameters batch.AccountUpdateParameters) (result batch.Account, err error) +} + +var _ AccountClientAPI = (*batch.AccountClient)(nil) + +// ApplicationPackageClientAPI contains the set of methods on the ApplicationPackageClient type. +type ApplicationPackageClientAPI interface { + Activate(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters batch.ActivateApplicationPackageParameters) (result batch.ApplicationPackage, err error) + Create(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string, parameters *batch.ApplicationPackage) (result batch.ApplicationPackage, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, accountName string, applicationName string, versionName string) (result batch.ApplicationPackage, err error) + List(ctx context.Context, resourceGroupName string, accountName string, applicationName string, maxresults *int32) (result batch.ListApplicationPackagesResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, accountName string, applicationName string, maxresults *int32) (result batch.ListApplicationPackagesResultIterator, err error) +} + +var _ ApplicationPackageClientAPI = (*batch.ApplicationPackageClient)(nil) + +// ApplicationClientAPI contains the set of methods on the ApplicationClient type. +type ApplicationClientAPI interface { + Create(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters *batch.Application) (result batch.Application, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string, applicationName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, accountName string, applicationName string) (result batch.Application, err error) + List(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result batch.ListApplicationsResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result batch.ListApplicationsResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, accountName string, applicationName string, parameters batch.Application) (result batch.Application, err error) +} + +var _ ApplicationClientAPI = (*batch.ApplicationClient)(nil) + +// LocationClientAPI contains the set of methods on the LocationClient type. +type LocationClientAPI interface { + CheckNameAvailability(ctx context.Context, locationName string, parameters batch.CheckNameAvailabilityParameters) (result batch.CheckNameAvailabilityResult, err error) + GetQuotas(ctx context.Context, locationName string) (result batch.LocationQuota, err error) +} + +var _ LocationClientAPI = (*batch.LocationClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result batch.OperationListResultPage, err error) + ListComplete(ctx context.Context) (result batch.OperationListResultIterator, err error) +} + +var _ OperationsClientAPI = (*batch.OperationsClient)(nil) + +// CertificateClientAPI contains the set of methods on the CertificateClient type. +type CertificateClientAPI interface { + CancelDeletion(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (result batch.Certificate, err error) + Create(ctx context.Context, resourceGroupName string, accountName string, certificateName string, parameters batch.CertificateCreateOrUpdateParameters, ifMatch string, ifNoneMatch string) (result batch.Certificate, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (result batch.CertificateDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (result batch.Certificate, err error) + ListByBatchAccount(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (result batch.ListCertificatesResultPage, err error) + ListByBatchAccountComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (result batch.ListCertificatesResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, accountName string, certificateName string, parameters batch.CertificateCreateOrUpdateParameters, ifMatch string) (result batch.Certificate, err error) +} + +var _ CertificateClientAPI = (*batch.CertificateClient)(nil) + +// PrivateLinkResourceClientAPI contains the set of methods on the PrivateLinkResourceClient type. +type PrivateLinkResourceClientAPI interface { + Get(ctx context.Context, resourceGroupName string, accountName string, privateLinkResourceName string) (result batch.PrivateLinkResource, err error) + ListByBatchAccount(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result batch.ListPrivateLinkResourcesResultPage, err error) + ListByBatchAccountComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result batch.ListPrivateLinkResourcesResultIterator, err error) +} + +var _ PrivateLinkResourceClientAPI = (*batch.PrivateLinkResourceClient)(nil) + +// PrivateEndpointConnectionClientAPI contains the set of methods on the PrivateEndpointConnectionClient type. +type PrivateEndpointConnectionClientAPI interface { + Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result batch.PrivateEndpointConnection, err error) + ListByBatchAccount(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result batch.ListPrivateEndpointConnectionsResultPage, err error) + ListByBatchAccountComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result batch.ListPrivateEndpointConnectionsResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters batch.PrivateEndpointConnection, ifMatch string) (result batch.PrivateEndpointConnectionUpdateFuture, err error) +} + +var _ PrivateEndpointConnectionClientAPI = (*batch.PrivateEndpointConnectionClient)(nil) + +// PoolClientAPI contains the set of methods on the PoolClient type. +type PoolClientAPI interface { + Create(ctx context.Context, resourceGroupName string, accountName string, poolName string, parameters batch.Pool, ifMatch string, ifNoneMatch string) (result batch.Pool, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result batch.PoolDeleteFuture, err error) + DisableAutoScale(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result batch.Pool, err error) + Get(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result batch.Pool, err error) + ListByBatchAccount(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (result batch.ListPoolsResultPage, err error) + ListByBatchAccountComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (result batch.ListPoolsResultIterator, err error) + StopResize(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result batch.Pool, err error) + Update(ctx context.Context, resourceGroupName string, accountName string, poolName string, parameters batch.Pool, ifMatch string) (result batch.Pool, err error) +} + +var _ PoolClientAPI = (*batch.PoolClient)(nil) diff --git a/services/batch/mgmt/2021-01-01/batch/certificate.go b/services/batch/mgmt/2021-01-01/batch/certificate.go new file mode 100644 index 000000000000..f29035e7118d --- /dev/null +++ b/services/batch/mgmt/2021-01-01/batch/certificate.go @@ -0,0 +1,659 @@ +package batch + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// CertificateClient is the client for the Certificate methods of the Batch service. +type CertificateClient struct { + BaseClient +} + +// NewCertificateClient creates an instance of the CertificateClient client. +func NewCertificateClient(subscriptionID string) CertificateClient { + return NewCertificateClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCertificateClientWithBaseURI creates an instance of the CertificateClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewCertificateClientWithBaseURI(baseURI string, subscriptionID string) CertificateClient { + return CertificateClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CancelDeletion if you try to delete a certificate that is being used by a pool or compute node, the status of the +// certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this +// operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not +// need to run this operation after the deletion failed. You must make sure that the certificate is not being used by +// any resources, and then you can try again to delete the certificate. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// certificateName - the identifier for the certificate. This must be made up of algorithm and thumbprint +// separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. +func (client CertificateClient) CancelDeletion(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (result Certificate, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.CancelDeletion") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: certificateName, + Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.MaxLength, Rule: 45, Chain: nil}, + {Target: "certificateName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "certificateName", Name: validation.Pattern, Rule: `^[\w]+-[\w]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.CertificateClient", "CancelDeletion", err.Error()) + } + + req, err := client.CancelDeletionPreparer(ctx, resourceGroupName, accountName, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "CancelDeletion", nil, "Failure preparing request") + return + } + + resp, err := client.CancelDeletionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "CancelDeletion", resp, "Failure sending request") + return + } + + result, err = client.CancelDeletionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "CancelDeletion", resp, "Failure responding to request") + return + } + + return +} + +// CancelDeletionPreparer prepares the CancelDeletion request. +func (client CertificateClient) CancelDeletionPreparer(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}/cancelDelete", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CancelDeletionSender sends the CancelDeletion request. The method will close the +// http.Response Body if it receives an error. +func (client CertificateClient) CancelDeletionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CancelDeletionResponder handles the response to the CancelDeletion request. The method always +// closes the http.Response Body. +func (client CertificateClient) CancelDeletionResponder(resp *http.Response) (result Certificate, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Create creates a new certificate inside the specified account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// certificateName - the identifier for the certificate. This must be made up of algorithm and thumbprint +// separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. +// parameters - additional parameters for certificate creation. +// ifMatch - the entity state (ETag) version of the certificate to update. A value of "*" can be used to apply +// the operation only if the certificate already exists. If omitted, this operation will always be applied. +// ifNoneMatch - set to '*' to allow a new certificate to be created, but to prevent updating an existing +// certificate. Other values will be ignored. +func (client CertificateClient) Create(ctx context.Context, resourceGroupName string, accountName string, certificateName string, parameters CertificateCreateOrUpdateParameters, ifMatch string, ifNoneMatch string) (result Certificate, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: certificateName, + Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.MaxLength, Rule: 45, Chain: nil}, + {Target: "certificateName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "certificateName", Name: validation.Pattern, Rule: `^[\w]+-[\w]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.CertificateCreateOrUpdateProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.CertificateCreateOrUpdateProperties.Data", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("batch.CertificateClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, certificateName, parameters, ifMatch, ifNoneMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client CertificateClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, certificateName string, parameters CertificateCreateOrUpdateParameters, ifMatch string, ifNoneMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client CertificateClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client CertificateClient) CreateResponder(resp *http.Response) (result Certificate, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified certificate. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// certificateName - the identifier for the certificate. This must be made up of algorithm and thumbprint +// separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. +func (client CertificateClient) Delete(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (result CertificateDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: certificateName, + Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.MaxLength, Rule: 45, Chain: nil}, + {Target: "certificateName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "certificateName", Name: validation.Pattern, Rule: `^[\w]+-[\w]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.CertificateClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CertificateClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client CertificateClient) DeleteSender(req *http.Request) (future CertificateDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client CertificateClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified certificate. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// certificateName - the identifier for the certificate. This must be made up of algorithm and thumbprint +// separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. +func (client CertificateClient) Get(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (result Certificate, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: certificateName, + Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.MaxLength, Rule: 45, Chain: nil}, + {Target: "certificateName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "certificateName", Name: validation.Pattern, Rule: `^[\w]+-[\w]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.CertificateClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client CertificateClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, certificateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CertificateClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client CertificateClient) GetResponder(resp *http.Response) (result Certificate, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByBatchAccount lists all of the certificates in the specified account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// maxresults - the maximum number of items to return in the response. +// selectParameter - comma separated list of properties that should be returned. e.g. +// "properties/provisioningState". Only top level properties under properties/ are valid for selection. +// filter - oData filter expression. Valid properties for filtering are "properties/provisioningState", +// "properties/provisioningStateTransitionTime", "name". +func (client CertificateClient) ListByBatchAccount(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (result ListCertificatesResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.ListByBatchAccount") + defer func() { + sc := -1 + if result.lcr.Response.Response != nil { + sc = result.lcr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.CertificateClient", "ListByBatchAccount", err.Error()) + } + + result.fn = client.listByBatchAccountNextResults + req, err := client.ListByBatchAccountPreparer(ctx, resourceGroupName, accountName, maxresults, selectParameter, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "ListByBatchAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByBatchAccountSender(req) + if err != nil { + result.lcr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "ListByBatchAccount", resp, "Failure sending request") + return + } + + result.lcr, err = client.ListByBatchAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "ListByBatchAccount", resp, "Failure responding to request") + return + } + if result.lcr.hasNextLink() && result.lcr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByBatchAccountPreparer prepares the ListByBatchAccount request. +func (client CertificateClient) ListByBatchAccountPreparer(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByBatchAccountSender sends the ListByBatchAccount request. The method will close the +// http.Response Body if it receives an error. +func (client CertificateClient) ListByBatchAccountSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByBatchAccountResponder handles the response to the ListByBatchAccount request. The method always +// closes the http.Response Body. +func (client CertificateClient) ListByBatchAccountResponder(resp *http.Response) (result ListCertificatesResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByBatchAccountNextResults retrieves the next set of results, if any. +func (client CertificateClient) listByBatchAccountNextResults(ctx context.Context, lastResults ListCertificatesResult) (result ListCertificatesResult, err error) { + req, err := lastResults.listCertificatesResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.CertificateClient", "listByBatchAccountNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByBatchAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.CertificateClient", "listByBatchAccountNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByBatchAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "listByBatchAccountNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByBatchAccountComplete enumerates all values, automatically crossing page boundaries as required. +func (client CertificateClient) ListByBatchAccountComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (result ListCertificatesResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.ListByBatchAccount") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByBatchAccount(ctx, resourceGroupName, accountName, maxresults, selectParameter, filter) + return +} + +// Update updates the properties of an existing certificate. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// certificateName - the identifier for the certificate. This must be made up of algorithm and thumbprint +// separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. +// parameters - certificate entity to update. +// ifMatch - the entity state (ETag) version of the certificate to update. This value can be omitted or set to +// "*" to apply the operation unconditionally. +func (client CertificateClient) Update(ctx context.Context, resourceGroupName string, accountName string, certificateName string, parameters CertificateCreateOrUpdateParameters, ifMatch string) (result Certificate, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: certificateName, + Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.MaxLength, Rule: 45, Chain: nil}, + {Target: "certificateName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "certificateName", Name: validation.Pattern, Rule: `^[\w]+-[\w]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.CertificateClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, certificateName, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client CertificateClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, certificateName string, parameters CertificateCreateOrUpdateParameters, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client CertificateClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client CertificateClient) UpdateResponder(resp *http.Response) (result Certificate, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/batch/mgmt/2021-01-01/batch/client.go b/services/batch/mgmt/2021-01-01/batch/client.go new file mode 100644 index 000000000000..bb7b9047233b --- /dev/null +++ b/services/batch/mgmt/2021-01-01/batch/client.go @@ -0,0 +1,41 @@ +// Package batch implements the Azure ARM Batch service API version 2021-01-01. +// +// +package batch + +// 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. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Batch + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Batch. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/batch/mgmt/2021-01-01/batch/enums.go b/services/batch/mgmt/2021-01-01/batch/enums.go new file mode 100644 index 000000000000..1bfcd9316f77 --- /dev/null +++ b/services/batch/mgmt/2021-01-01/batch/enums.go @@ -0,0 +1,543 @@ +package batch + +// 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. + +// AccountKeyType enumerates the values for account key type. +type AccountKeyType string + +const ( + // Primary The primary account key. + Primary AccountKeyType = "Primary" + // Secondary The secondary account key. + Secondary AccountKeyType = "Secondary" +) + +// PossibleAccountKeyTypeValues returns an array of possible values for the AccountKeyType const type. +func PossibleAccountKeyTypeValues() []AccountKeyType { + return []AccountKeyType{Primary, Secondary} +} + +// AllocationState enumerates the values for allocation state. +type AllocationState string + +const ( + // Resizing The pool is resizing; that is, compute nodes are being added to or removed from the pool. + Resizing AllocationState = "Resizing" + // Steady The pool is not resizing. There are no changes to the number of nodes in the pool in progress. A + // pool enters this state when it is created and when no operations are being performed on the pool to + // change the number of nodes. + Steady AllocationState = "Steady" + // Stopping The pool was resizing, but the user has requested that the resize be stopped, but the stop + // request has not yet been completed. + Stopping AllocationState = "Stopping" +) + +// PossibleAllocationStateValues returns an array of possible values for the AllocationState const type. +func PossibleAllocationStateValues() []AllocationState { + return []AllocationState{Resizing, Steady, Stopping} +} + +// AutoUserScope enumerates the values for auto user scope. +type AutoUserScope string + +const ( + // AutoUserScopePool Specifies that the task runs as the common auto user account which is created on every + // node in a pool. + AutoUserScopePool AutoUserScope = "Pool" + // AutoUserScopeTask Specifies that the service should create a new user for the task. + AutoUserScopeTask AutoUserScope = "Task" +) + +// PossibleAutoUserScopeValues returns an array of possible values for the AutoUserScope const type. +func PossibleAutoUserScopeValues() []AutoUserScope { + return []AutoUserScope{AutoUserScopePool, AutoUserScopeTask} +} + +// CachingType enumerates the values for caching type. +type CachingType string + +const ( + // None The caching mode for the disk is not enabled. + None CachingType = "None" + // ReadOnly The caching mode for the disk is read only. + ReadOnly CachingType = "ReadOnly" + // ReadWrite The caching mode for the disk is read and write. + ReadWrite CachingType = "ReadWrite" +) + +// PossibleCachingTypeValues returns an array of possible values for the CachingType const type. +func PossibleCachingTypeValues() []CachingType { + return []CachingType{None, ReadOnly, ReadWrite} +} + +// CertificateFormat enumerates the values for certificate format. +type CertificateFormat string + +const ( + // Cer The certificate is a base64-encoded X.509 certificate. + Cer CertificateFormat = "Cer" + // Pfx The certificate is a PFX (PKCS#12) formatted certificate or certificate chain. + Pfx CertificateFormat = "Pfx" +) + +// PossibleCertificateFormatValues returns an array of possible values for the CertificateFormat const type. +func PossibleCertificateFormatValues() []CertificateFormat { + return []CertificateFormat{Cer, Pfx} +} + +// CertificateProvisioningState enumerates the values for certificate provisioning state. +type CertificateProvisioningState string + +const ( + // Deleting The user has requested that the certificate be deleted, but the delete operation has not yet + // completed. You may not reference the certificate when creating or updating pools. + Deleting CertificateProvisioningState = "Deleting" + // Failed The user requested that the certificate be deleted, but there are pools that still have + // references to the certificate, or it is still installed on one or more compute nodes. (The latter can + // occur if the certificate has been removed from the pool, but the node has not yet restarted. Nodes + // refresh their certificates only when they restart.) You may use the cancel certificate delete operation + // to cancel the delete, or the delete certificate operation to retry the delete. + Failed CertificateProvisioningState = "Failed" + // Succeeded The certificate is available for use in pools. + Succeeded CertificateProvisioningState = "Succeeded" +) + +// PossibleCertificateProvisioningStateValues returns an array of possible values for the CertificateProvisioningState const type. +func PossibleCertificateProvisioningStateValues() []CertificateProvisioningState { + return []CertificateProvisioningState{Deleting, Failed, Succeeded} +} + +// CertificateStoreLocation enumerates the values for certificate store location. +type CertificateStoreLocation string + +const ( + // CurrentUser Certificates should be installed to the CurrentUser certificate store. + CurrentUser CertificateStoreLocation = "CurrentUser" + // LocalMachine Certificates should be installed to the LocalMachine certificate store. + LocalMachine CertificateStoreLocation = "LocalMachine" +) + +// PossibleCertificateStoreLocationValues returns an array of possible values for the CertificateStoreLocation const type. +func PossibleCertificateStoreLocationValues() []CertificateStoreLocation { + return []CertificateStoreLocation{CurrentUser, LocalMachine} +} + +// CertificateVisibility enumerates the values for certificate visibility. +type CertificateVisibility string + +const ( + // CertificateVisibilityRemoteUser The certificate should be visible to the user accounts under which users + // remotely access the node. + CertificateVisibilityRemoteUser CertificateVisibility = "RemoteUser" + // CertificateVisibilityStartTask The certificate should be visible to the user account under which the + // start task is run. Note that if AutoUser Scope is Pool for both the StartTask and a Task, this + // certificate will be visible to the Task as well. + CertificateVisibilityStartTask CertificateVisibility = "StartTask" + // CertificateVisibilityTask The certificate should be visible to the user accounts under which job tasks + // are run. + CertificateVisibilityTask CertificateVisibility = "Task" +) + +// PossibleCertificateVisibilityValues returns an array of possible values for the CertificateVisibility const type. +func PossibleCertificateVisibilityValues() []CertificateVisibility { + return []CertificateVisibility{CertificateVisibilityRemoteUser, CertificateVisibilityStartTask, CertificateVisibilityTask} +} + +// ComputeNodeDeallocationOption enumerates the values for compute node deallocation option. +type ComputeNodeDeallocationOption string + +const ( + // Requeue Terminate running task processes and requeue the tasks. The tasks will run again when a node is + // available. Remove nodes as soon as tasks have been terminated. + Requeue ComputeNodeDeallocationOption = "Requeue" + // RetainedData Allow currently running tasks to complete, then wait for all task data retention periods to + // expire. Schedule no new tasks while waiting. Remove nodes when all task retention periods have expired. + RetainedData ComputeNodeDeallocationOption = "RetainedData" + // TaskCompletion Allow currently running tasks to complete. Schedule no new tasks while waiting. Remove + // nodes when all tasks have completed. + TaskCompletion ComputeNodeDeallocationOption = "TaskCompletion" + // Terminate Terminate running tasks. The tasks will be completed with failureInfo indicating that they + // were terminated, and will not run again. Remove nodes as soon as tasks have been terminated. + Terminate ComputeNodeDeallocationOption = "Terminate" +) + +// PossibleComputeNodeDeallocationOptionValues returns an array of possible values for the ComputeNodeDeallocationOption const type. +func PossibleComputeNodeDeallocationOptionValues() []ComputeNodeDeallocationOption { + return []ComputeNodeDeallocationOption{Requeue, RetainedData, TaskCompletion, Terminate} +} + +// ComputeNodeFillType enumerates the values for compute node fill type. +type ComputeNodeFillType string + +const ( + // Pack As many tasks as possible (taskSlotsPerNode) should be assigned to each node in the pool before any + // tasks are assigned to the next node in the pool. + Pack ComputeNodeFillType = "Pack" + // Spread Tasks should be assigned evenly across all nodes in the pool. + Spread ComputeNodeFillType = "Spread" +) + +// PossibleComputeNodeFillTypeValues returns an array of possible values for the ComputeNodeFillType const type. +func PossibleComputeNodeFillTypeValues() []ComputeNodeFillType { + return []ComputeNodeFillType{Pack, Spread} +} + +// ContainerWorkingDirectory enumerates the values for container working directory. +type ContainerWorkingDirectory string + +const ( + // ContainerImageDefault Using container image defined working directory. Beware that this directory will + // not contain the resource files downloaded by Batch. + ContainerImageDefault ContainerWorkingDirectory = "ContainerImageDefault" + // TaskWorkingDirectory Use the standard Batch service task working directory, which will contain the Task + // resource files populated by Batch. + TaskWorkingDirectory ContainerWorkingDirectory = "TaskWorkingDirectory" +) + +// PossibleContainerWorkingDirectoryValues returns an array of possible values for the ContainerWorkingDirectory const type. +func PossibleContainerWorkingDirectoryValues() []ContainerWorkingDirectory { + return []ContainerWorkingDirectory{ContainerImageDefault, TaskWorkingDirectory} +} + +// DiskEncryptionTarget enumerates the values for disk encryption target. +type DiskEncryptionTarget string + +const ( + // OsDisk The OS Disk on the compute node is encrypted. + OsDisk DiskEncryptionTarget = "OsDisk" + // TemporaryDisk The temporary disk on the compute node is encrypted. On Linux this encryption applies to + // other partitions (such as those on mounted data disks) when encryption occurs at boot time. + TemporaryDisk DiskEncryptionTarget = "TemporaryDisk" +) + +// PossibleDiskEncryptionTargetValues returns an array of possible values for the DiskEncryptionTarget const type. +func PossibleDiskEncryptionTargetValues() []DiskEncryptionTarget { + return []DiskEncryptionTarget{OsDisk, TemporaryDisk} +} + +// ElevationLevel enumerates the values for elevation level. +type ElevationLevel string + +const ( + // Admin The user is a user with elevated access and operates with full Administrator permissions. + Admin ElevationLevel = "Admin" + // NonAdmin The user is a standard user without elevated access. + NonAdmin ElevationLevel = "NonAdmin" +) + +// PossibleElevationLevelValues returns an array of possible values for the ElevationLevel const type. +func PossibleElevationLevelValues() []ElevationLevel { + return []ElevationLevel{Admin, NonAdmin} +} + +// InboundEndpointProtocol enumerates the values for inbound endpoint protocol. +type InboundEndpointProtocol string + +const ( + // TCP Use TCP for the endpoint. + TCP InboundEndpointProtocol = "TCP" + // UDP Use UDP for the endpoint. + UDP InboundEndpointProtocol = "UDP" +) + +// PossibleInboundEndpointProtocolValues returns an array of possible values for the InboundEndpointProtocol const type. +func PossibleInboundEndpointProtocolValues() []InboundEndpointProtocol { + return []InboundEndpointProtocol{TCP, UDP} +} + +// InterNodeCommunicationState enumerates the values for inter node communication state. +type InterNodeCommunicationState string + +const ( + // Disabled Disable network communication between virtual machines. + Disabled InterNodeCommunicationState = "Disabled" + // Enabled Enable network communication between virtual machines. + Enabled InterNodeCommunicationState = "Enabled" +) + +// PossibleInterNodeCommunicationStateValues returns an array of possible values for the InterNodeCommunicationState const type. +func PossibleInterNodeCommunicationStateValues() []InterNodeCommunicationState { + return []InterNodeCommunicationState{Disabled, Enabled} +} + +// IPAddressProvisioningType enumerates the values for ip address provisioning type. +type IPAddressProvisioningType string + +const ( + // BatchManaged A public IP will be created and managed by Batch. There may be multiple public IPs + // depending on the size of the Pool. + BatchManaged IPAddressProvisioningType = "BatchManaged" + // NoPublicIPAddresses No public IP Address will be created for the Compute Nodes in the Pool. + NoPublicIPAddresses IPAddressProvisioningType = "NoPublicIPAddresses" + // UserManaged Public IPs are provided by the user and will be used to provision the Compute Nodes. + UserManaged IPAddressProvisioningType = "UserManaged" +) + +// PossibleIPAddressProvisioningTypeValues returns an array of possible values for the IPAddressProvisioningType const type. +func PossibleIPAddressProvisioningTypeValues() []IPAddressProvisioningType { + return []IPAddressProvisioningType{BatchManaged, NoPublicIPAddresses, UserManaged} +} + +// KeySource enumerates the values for key source. +type KeySource string + +const ( + // MicrosoftBatch Batch creates and manages the encryption keys used to protect the account data. + MicrosoftBatch KeySource = "Microsoft.Batch" + // MicrosoftKeyVault The encryption keys used to protect the account data are stored in an external key + // vault. If this is set then the Batch Account identity must be set to `SystemAssigned` and a valid Key + // Identifier must also be supplied under the keyVaultProperties. + MicrosoftKeyVault KeySource = "Microsoft.KeyVault" +) + +// PossibleKeySourceValues returns an array of possible values for the KeySource const type. +func PossibleKeySourceValues() []KeySource { + return []KeySource{MicrosoftBatch, MicrosoftKeyVault} +} + +// LoginMode enumerates the values for login mode. +type LoginMode string + +const ( + // Batch The LOGON32_LOGON_BATCH Win32 login mode. The batch login mode is recommended for long running + // parallel processes. + Batch LoginMode = "Batch" + // Interactive The LOGON32_LOGON_INTERACTIVE Win32 login mode. Some applications require having permissions + // associated with the interactive login mode. If this is the case for an application used in your task, + // then this option is recommended. + Interactive LoginMode = "Interactive" +) + +// PossibleLoginModeValues returns an array of possible values for the LoginMode const type. +func PossibleLoginModeValues() []LoginMode { + return []LoginMode{Batch, Interactive} +} + +// NameAvailabilityReason enumerates the values for name availability reason. +type NameAvailabilityReason string + +const ( + // AlreadyExists The requested name is already in use. + AlreadyExists NameAvailabilityReason = "AlreadyExists" + // Invalid The requested name is invalid. + Invalid NameAvailabilityReason = "Invalid" +) + +// PossibleNameAvailabilityReasonValues returns an array of possible values for the NameAvailabilityReason const type. +func PossibleNameAvailabilityReasonValues() []NameAvailabilityReason { + return []NameAvailabilityReason{AlreadyExists, Invalid} +} + +// NetworkSecurityGroupRuleAccess enumerates the values for network security group rule access. +type NetworkSecurityGroupRuleAccess string + +const ( + // Allow Allow access. + Allow NetworkSecurityGroupRuleAccess = "Allow" + // Deny Deny access. + Deny NetworkSecurityGroupRuleAccess = "Deny" +) + +// PossibleNetworkSecurityGroupRuleAccessValues returns an array of possible values for the NetworkSecurityGroupRuleAccess const type. +func PossibleNetworkSecurityGroupRuleAccessValues() []NetworkSecurityGroupRuleAccess { + return []NetworkSecurityGroupRuleAccess{Allow, Deny} +} + +// NodePlacementPolicyType enumerates the values for node placement policy type. +type NodePlacementPolicyType string + +const ( + // Regional All nodes in the pool will be allocated in the same region. + Regional NodePlacementPolicyType = "Regional" + // Zonal Nodes in the pool will be spread across different zones with best effort balancing. + Zonal NodePlacementPolicyType = "Zonal" +) + +// PossibleNodePlacementPolicyTypeValues returns an array of possible values for the NodePlacementPolicyType const type. +func PossibleNodePlacementPolicyTypeValues() []NodePlacementPolicyType { + return []NodePlacementPolicyType{Regional, Zonal} +} + +// PackageState enumerates the values for package state. +type PackageState string + +const ( + // Active The application package is ready for use. + Active PackageState = "Active" + // Pending The application package has been created but has not yet been activated. + Pending PackageState = "Pending" +) + +// PossiblePackageStateValues returns an array of possible values for the PackageState const type. +func PossiblePackageStateValues() []PackageState { + return []PackageState{Active, Pending} +} + +// PoolAllocationMode enumerates the values for pool allocation mode. +type PoolAllocationMode string + +const ( + // BatchService Pools will be allocated in subscriptions owned by the Batch service. + BatchService PoolAllocationMode = "BatchService" + // UserSubscription Pools will be allocated in a subscription owned by the user. + UserSubscription PoolAllocationMode = "UserSubscription" +) + +// PossiblePoolAllocationModeValues returns an array of possible values for the PoolAllocationMode const type. +func PossiblePoolAllocationModeValues() []PoolAllocationMode { + return []PoolAllocationMode{BatchService, UserSubscription} +} + +// PoolIdentityType enumerates the values for pool identity type. +type PoolIdentityType string + +const ( + // PoolIdentityTypeNone Batch pool has no identity associated with it. Setting `None` in update pool will + // remove existing identities. + PoolIdentityTypeNone PoolIdentityType = "None" + // PoolIdentityTypeUserAssigned Batch pool has user assigned identities with it. + PoolIdentityTypeUserAssigned PoolIdentityType = "UserAssigned" +) + +// PossiblePoolIdentityTypeValues returns an array of possible values for the PoolIdentityType const type. +func PossiblePoolIdentityTypeValues() []PoolIdentityType { + return []PoolIdentityType{PoolIdentityTypeNone, PoolIdentityTypeUserAssigned} +} + +// PoolProvisioningState enumerates the values for pool provisioning state. +type PoolProvisioningState string + +const ( + // PoolProvisioningStateDeleting The user has requested that the pool be deleted, but the delete operation + // has not yet completed. + PoolProvisioningStateDeleting PoolProvisioningState = "Deleting" + // PoolProvisioningStateSucceeded The pool is available to run tasks subject to the availability of compute + // nodes. + PoolProvisioningStateSucceeded PoolProvisioningState = "Succeeded" +) + +// PossiblePoolProvisioningStateValues returns an array of possible values for the PoolProvisioningState const type. +func PossiblePoolProvisioningStateValues() []PoolProvisioningState { + return []PoolProvisioningState{PoolProvisioningStateDeleting, PoolProvisioningStateSucceeded} +} + +// PrivateEndpointConnectionProvisioningState enumerates the values for private endpoint connection +// provisioning state. +type PrivateEndpointConnectionProvisioningState string + +const ( + // PrivateEndpointConnectionProvisioningStateFailed The user requested that the connection be updated and + // it failed. You may retry the update operation. + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + // PrivateEndpointConnectionProvisioningStateSucceeded The connection status is final and is ready for use + // if Status is Approved. + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" + // PrivateEndpointConnectionProvisioningStateUpdating The user has requested that the connection status be + // updated, but the update operation has not yet completed. You may not reference the connection when + // connecting the Batch account. + PrivateEndpointConnectionProvisioningStateUpdating PrivateEndpointConnectionProvisioningState = "Updating" +) + +// PossiblePrivateEndpointConnectionProvisioningStateValues returns an array of possible values for the PrivateEndpointConnectionProvisioningState const type. +func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { + return []PrivateEndpointConnectionProvisioningState{PrivateEndpointConnectionProvisioningStateFailed, PrivateEndpointConnectionProvisioningStateSucceeded, PrivateEndpointConnectionProvisioningStateUpdating} +} + +// PrivateLinkServiceConnectionStatus enumerates the values for private link service connection status. +type PrivateLinkServiceConnectionStatus string + +const ( + // PrivateLinkServiceConnectionStatusApproved The private endpoint connection is approved and can be used + // to access Batch account + PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" + // PrivateLinkServiceConnectionStatusDisconnected The private endpoint connection is disconnected and + // cannot be used to access Batch account + PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected" + // PrivateLinkServiceConnectionStatusPending The private endpoint connection is pending and cannot be used + // to access Batch account + PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" + // PrivateLinkServiceConnectionStatusRejected The private endpoint connection is rejected and cannot be + // used to access Batch account + PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" +) + +// PossiblePrivateLinkServiceConnectionStatusValues returns an array of possible values for the PrivateLinkServiceConnectionStatus const type. +func PossiblePrivateLinkServiceConnectionStatusValues() []PrivateLinkServiceConnectionStatus { + return []PrivateLinkServiceConnectionStatus{PrivateLinkServiceConnectionStatusApproved, PrivateLinkServiceConnectionStatusDisconnected, PrivateLinkServiceConnectionStatusPending, PrivateLinkServiceConnectionStatusRejected} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCancelled The last operation for the account is cancelled. + ProvisioningStateCancelled ProvisioningState = "Cancelled" + // ProvisioningStateCreating The account is being created. + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleting The account is being deleted. + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed The last operation for the account is failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateInvalid The account is in an invalid state. + ProvisioningStateInvalid ProvisioningState = "Invalid" + // ProvisioningStateSucceeded The account has been created and is ready for use. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateCancelled, ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateInvalid, ProvisioningStateSucceeded} +} + +// PublicNetworkAccessType enumerates the values for public network access type. +type PublicNetworkAccessType string + +const ( + // PublicNetworkAccessTypeDisabled Disables public connectivity and enables private connectivity to Azure + // Batch Service through private endpoint resource. + PublicNetworkAccessTypeDisabled PublicNetworkAccessType = "Disabled" + // PublicNetworkAccessTypeEnabled Enables connectivity to Azure Batch through public DNS. + PublicNetworkAccessTypeEnabled PublicNetworkAccessType = "Enabled" +) + +// PossiblePublicNetworkAccessTypeValues returns an array of possible values for the PublicNetworkAccessType const type. +func PossiblePublicNetworkAccessTypeValues() []PublicNetworkAccessType { + return []PublicNetworkAccessType{PublicNetworkAccessTypeDisabled, PublicNetworkAccessTypeEnabled} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // ResourceIdentityTypeNone Batch account has no identity associated with it. Setting `None` in update + // account will remove existing identities. + ResourceIdentityTypeNone ResourceIdentityType = "None" + // ResourceIdentityTypeSystemAssigned Batch account has a system assigned identity with it. + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + // ResourceIdentityTypeUserAssigned Batch account has user assigned identities with it. + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeUserAssigned} +} + +// StorageAccountType enumerates the values for storage account type. +type StorageAccountType string + +const ( + // PremiumLRS The data disk should use premium locally redundant storage. + PremiumLRS StorageAccountType = "Premium_LRS" + // StandardLRS The data disk should use standard locally redundant storage. + StandardLRS StorageAccountType = "Standard_LRS" +) + +// PossibleStorageAccountTypeValues returns an array of possible values for the StorageAccountType const type. +func PossibleStorageAccountTypeValues() []StorageAccountType { + return []StorageAccountType{PremiumLRS, StandardLRS} +} diff --git a/services/batch/mgmt/2021-01-01/batch/location.go b/services/batch/mgmt/2021-01-01/batch/location.go new file mode 100644 index 000000000000..391fa9733491 --- /dev/null +++ b/services/batch/mgmt/2021-01-01/batch/location.go @@ -0,0 +1,190 @@ +package batch + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// LocationClient is the client for the Location methods of the Batch service. +type LocationClient struct { + BaseClient +} + +// NewLocationClient creates an instance of the LocationClient client. +func NewLocationClient(subscriptionID string) LocationClient { + return NewLocationClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLocationClientWithBaseURI creates an instance of the LocationClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewLocationClientWithBaseURI(baseURI string, subscriptionID string) LocationClient { + return LocationClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckNameAvailability checks whether the Batch account name is available in the specified region. +// Parameters: +// locationName - the desired region for the name check. +// parameters - properties needed to check the availability of a name. +func (client LocationClient) CheckNameAvailability(ctx context.Context, locationName string, parameters CheckNameAvailabilityParameters) (result CheckNameAvailabilityResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.CheckNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.LocationClient", "CheckNameAvailability", err.Error()) + } + + req, err := client.CheckNameAvailabilityPreparer(ctx, locationName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.LocationClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.LocationClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.LocationClient", "CheckNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client LocationClient) CheckNameAvailabilityPreparer(ctx context.Context, locationName string, parameters CheckNameAvailabilityParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "locationName": autorest.Encode("path", locationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/checkNameAvailability", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client LocationClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client LocationClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetQuotas gets the Batch service quotas for the specified subscription at the given location. +// Parameters: +// locationName - the region for which to retrieve Batch service quotas. +func (client LocationClient) GetQuotas(ctx context.Context, locationName string) (result LocationQuota, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.GetQuotas") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetQuotasPreparer(ctx, locationName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.LocationClient", "GetQuotas", nil, "Failure preparing request") + return + } + + resp, err := client.GetQuotasSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.LocationClient", "GetQuotas", resp, "Failure sending request") + return + } + + result, err = client.GetQuotasResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.LocationClient", "GetQuotas", resp, "Failure responding to request") + return + } + + return +} + +// GetQuotasPreparer prepares the GetQuotas request. +func (client LocationClient) GetQuotasPreparer(ctx context.Context, locationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "locationName": autorest.Encode("path", locationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/quotas", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetQuotasSender sends the GetQuotas request. The method will close the +// http.Response Body if it receives an error. +func (client LocationClient) GetQuotasSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetQuotasResponder handles the response to the GetQuotas request. The method always +// closes the http.Response Body. +func (client LocationClient) GetQuotasResponder(resp *http.Response) (result LocationQuota, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/batch/mgmt/2021-01-01/batch/models.go b/services/batch/mgmt/2021-01-01/batch/models.go new file mode 100644 index 000000000000..703cc6607b58 --- /dev/null +++ b/services/batch/mgmt/2021-01-01/batch/models.go @@ -0,0 +1,3386 @@ +package batch + +// 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. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2021-01-01/batch" + +// Account contains information about an Azure Batch account. +type Account struct { + autorest.Response `json:"-"` + // AccountProperties - The properties associated with the account. + *AccountProperties `json:"properties,omitempty"` + // Identity - The identity of the Batch account. + Identity *AccountIdentity `json:"identity,omitempty"` + // ID - READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - READ-ONLY; The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Account. +func (a Account) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.AccountProperties != nil { + objectMap["properties"] = a.AccountProperties + } + if a.Identity != nil { + objectMap["identity"] = a.Identity + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Account struct. +func (a *Account) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var accountProperties AccountProperties + err = json.Unmarshal(*v, &accountProperties) + if err != nil { + return err + } + a.AccountProperties = &accountProperties + } + case "identity": + if v != nil { + var identity AccountIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + a.Identity = &identity + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + a.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + a.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + a.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + a.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + a.Tags = tags + } + } + } + + return nil +} + +// AccountCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AccountCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AccountClient) (Account, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AccountCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AccountCreateFuture.Result. +func (future *AccountCreateFuture) result(client AccountClient) (a Account, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + a.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("batch.AccountCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { + a, err = client.CreateResponder(a.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountCreateFuture", "Result", a.Response.Response, "Failure responding to request") + } + } + return +} + +// AccountCreateParameters parameters supplied to the Create operation. +type AccountCreateParameters struct { + // Location - The region in which to create the account. + Location *string `json:"location,omitempty"` + // Tags - The user-specified tags associated with the account. + Tags map[string]*string `json:"tags"` + // AccountCreateProperties - The properties of the Batch account. + *AccountCreateProperties `json:"properties,omitempty"` + // Identity - The identity of the Batch account. + Identity *AccountIdentity `json:"identity,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountCreateParameters. +func (acp AccountCreateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if acp.Location != nil { + objectMap["location"] = acp.Location + } + if acp.Tags != nil { + objectMap["tags"] = acp.Tags + } + if acp.AccountCreateProperties != nil { + objectMap["properties"] = acp.AccountCreateProperties + } + if acp.Identity != nil { + objectMap["identity"] = acp.Identity + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AccountCreateParameters struct. +func (acp *AccountCreateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + acp.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + acp.Tags = tags + } + case "properties": + if v != nil { + var accountCreateProperties AccountCreateProperties + err = json.Unmarshal(*v, &accountCreateProperties) + if err != nil { + return err + } + acp.AccountCreateProperties = &accountCreateProperties + } + case "identity": + if v != nil { + var identity AccountIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + acp.Identity = &identity + } + } + } + + return nil +} + +// AccountCreateProperties the properties of a Batch account. +type AccountCreateProperties struct { + // AutoStorage - The properties related to the auto-storage account. + AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"` + // PoolAllocationMode - The pool allocation mode also affects how clients may authenticate to the Batch Service API. If the mode is BatchService, clients may authenticate using access keys or Azure Active Directory. If the mode is UserSubscription, clients must use Azure Active Directory. The default is BatchService. Possible values include: 'BatchService', 'UserSubscription' + PoolAllocationMode PoolAllocationMode `json:"poolAllocationMode,omitempty"` + // KeyVaultReference - A reference to the Azure key vault associated with the Batch account. + KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"` + // PublicNetworkAccess - If not specified, the default value is 'enabled'. Possible values include: 'PublicNetworkAccessTypeEnabled', 'PublicNetworkAccessTypeDisabled' + PublicNetworkAccess PublicNetworkAccessType `json:"publicNetworkAccess,omitempty"` + // Encryption - Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used instead. + Encryption *EncryptionProperties `json:"encryption,omitempty"` +} + +// AccountDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AccountDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AccountClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AccountDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AccountDeleteFuture.Result. +func (future *AccountDeleteFuture) result(client AccountClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("batch.AccountDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AccountIdentity the identity of the Batch account, if configured. This is only used when the user +// specifies 'Microsoft.KeyVault' as their Batch account encryption configuration. +type AccountIdentity struct { + // PrincipalID - READ-ONLY; The principal id of the Batch account. This property will only be provided for a system assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant id associated with the Batch account. This property will only be provided for a system assigned identity. + TenantID *string `json:"tenantId,omitempty"` + // Type - The type of identity used for the Batch account. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeNone' + Type ResourceIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - The list of user identities associated with the Batch account. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + UserAssignedIdentities map[string]*AccountIdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for AccountIdentity. +func (ai AccountIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ai.Type != "" { + objectMap["type"] = ai.Type + } + if ai.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = ai.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// AccountIdentityUserAssignedIdentitiesValue ... +type AccountIdentityUserAssignedIdentitiesValue struct { + // PrincipalID - READ-ONLY; The principal id of user assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The client id of user assigned identity. + ClientID *string `json:"clientId,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountIdentityUserAssignedIdentitiesValue. +func (aiAiv AccountIdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AccountKeys a set of Azure Batch account keys. +type AccountKeys struct { + autorest.Response `json:"-"` + // AccountName - READ-ONLY; The Batch account name. + AccountName *string `json:"accountName,omitempty"` + // Primary - READ-ONLY; The primary key associated with the account. + Primary *string `json:"primary,omitempty"` + // Secondary - READ-ONLY; The secondary key associated with the account. + Secondary *string `json:"secondary,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountKeys. +func (ak AccountKeys) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AccountListResult values returned by the List operation. +type AccountListResult struct { + autorest.Response `json:"-"` + // Value - The collection of Batch accounts returned by the listing operation. + Value *[]Account `json:"value,omitempty"` + // NextLink - The continuation token. + NextLink *string `json:"nextLink,omitempty"` +} + +// AccountListResultIterator provides access to a complete listing of Account values. +type AccountListResultIterator struct { + i int + page AccountListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AccountListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AccountListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AccountListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AccountListResultIterator) Response() AccountListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AccountListResultIterator) Value() Account { + if !iter.page.NotDone() { + return Account{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AccountListResultIterator type. +func NewAccountListResultIterator(page AccountListResultPage) AccountListResultIterator { + return AccountListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (alr AccountListResult) IsEmpty() bool { + return alr.Value == nil || len(*alr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (alr AccountListResult) hasNextLink() bool { + return alr.NextLink != nil && len(*alr.NextLink) != 0 +} + +// accountListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (alr AccountListResult) accountListResultPreparer(ctx context.Context) (*http.Request, error) { + if !alr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(alr.NextLink))) +} + +// AccountListResultPage contains a page of Account values. +type AccountListResultPage struct { + fn func(context.Context, AccountListResult) (AccountListResult, error) + alr AccountListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AccountListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.alr) + if err != nil { + return err + } + page.alr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AccountListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AccountListResultPage) NotDone() bool { + return !page.alr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AccountListResultPage) Response() AccountListResult { + return page.alr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AccountListResultPage) Values() []Account { + if page.alr.IsEmpty() { + return nil + } + return *page.alr.Value +} + +// Creates a new instance of the AccountListResultPage type. +func NewAccountListResultPage(cur AccountListResult, getNextPage func(context.Context, AccountListResult) (AccountListResult, error)) AccountListResultPage { + return AccountListResultPage{ + fn: getNextPage, + alr: cur, + } +} + +// AccountProperties account specific properties. +type AccountProperties struct { + // AccountEndpoint - READ-ONLY; The account endpoint used to interact with the Batch service. + AccountEndpoint *string `json:"accountEndpoint,omitempty"` + // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateInvalid', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCancelled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // PoolAllocationMode - READ-ONLY; Possible values include: 'BatchService', 'UserSubscription' + PoolAllocationMode PoolAllocationMode `json:"poolAllocationMode,omitempty"` + // KeyVaultReference - READ-ONLY + KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"` + // PublicNetworkAccess - READ-ONLY; If not specified, the default value is 'enabled'. Possible values include: 'PublicNetworkAccessTypeEnabled', 'PublicNetworkAccessTypeDisabled' + PublicNetworkAccess PublicNetworkAccessType `json:"publicNetworkAccess,omitempty"` + // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections associated with the Batch account + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + // AutoStorage - READ-ONLY + AutoStorage *AutoStorageProperties `json:"autoStorage,omitempty"` + // Encryption - READ-ONLY; Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used instead. + Encryption *EncryptionProperties `json:"encryption,omitempty"` + // DedicatedCoreQuota - READ-ONLY; For accounts with PoolAllocationMode set to UserSubscription, quota is managed on the subscription so this value is not returned. + DedicatedCoreQuota *int32 `json:"dedicatedCoreQuota,omitempty"` + // LowPriorityCoreQuota - READ-ONLY; For accounts with PoolAllocationMode set to UserSubscription, quota is managed on the subscription so this value is not returned. + LowPriorityCoreQuota *int32 `json:"lowPriorityCoreQuota,omitempty"` + // DedicatedCoreQuotaPerVMFamily - READ-ONLY; A list of the dedicated core quota per Virtual Machine family for the Batch account. For accounts with PoolAllocationMode set to UserSubscription, quota is managed on the subscription so this value is not returned. + DedicatedCoreQuotaPerVMFamily *[]VirtualMachineFamilyCoreQuota `json:"dedicatedCoreQuotaPerVMFamily,omitempty"` + // DedicatedCoreQuotaPerVMFamilyEnforced - READ-ONLY; Batch is transitioning its core quota system for dedicated cores to be enforced per Virtual Machine family. During this transitional phase, the dedicated core quota per Virtual Machine family may not yet be enforced. If this flag is false, dedicated core quota is enforced via the old dedicatedCoreQuota property on the account and does not consider Virtual Machine family. If this flag is true, dedicated core quota is enforced via the dedicatedCoreQuotaPerVMFamily property on the account, and the old dedicatedCoreQuota does not apply. + DedicatedCoreQuotaPerVMFamilyEnforced *bool `json:"dedicatedCoreQuotaPerVMFamilyEnforced,omitempty"` + // PoolQuota - READ-ONLY + PoolQuota *int32 `json:"poolQuota,omitempty"` + // ActiveJobAndJobScheduleQuota - READ-ONLY + ActiveJobAndJobScheduleQuota *int32 `json:"activeJobAndJobScheduleQuota,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountProperties. +func (ap AccountProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AccountRegenerateKeyParameters parameters supplied to the RegenerateKey operation. +type AccountRegenerateKeyParameters struct { + // KeyName - The type of account key to regenerate. Possible values include: 'Primary', 'Secondary' + KeyName AccountKeyType `json:"keyName,omitempty"` +} + +// AccountUpdateParameters parameters for updating an Azure Batch account. +type AccountUpdateParameters struct { + // Tags - The user-specified tags associated with the account. + Tags map[string]*string `json:"tags"` + // AccountUpdateProperties - The properties of the account. + *AccountUpdateProperties `json:"properties,omitempty"` + // Identity - The identity of the Batch account. + Identity *AccountIdentity `json:"identity,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountUpdateParameters. +func (aup AccountUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aup.Tags != nil { + objectMap["tags"] = aup.Tags + } + if aup.AccountUpdateProperties != nil { + objectMap["properties"] = aup.AccountUpdateProperties + } + if aup.Identity != nil { + objectMap["identity"] = aup.Identity + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AccountUpdateParameters struct. +func (aup *AccountUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + aup.Tags = tags + } + case "properties": + if v != nil { + var accountUpdateProperties AccountUpdateProperties + err = json.Unmarshal(*v, &accountUpdateProperties) + if err != nil { + return err + } + aup.AccountUpdateProperties = &accountUpdateProperties + } + case "identity": + if v != nil { + var identity AccountIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + aup.Identity = &identity + } + } + } + + return nil +} + +// AccountUpdateProperties the properties of a Batch account. +type AccountUpdateProperties struct { + // AutoStorage - The properties related to the auto-storage account. + AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"` + // Encryption - Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used instead. + Encryption *EncryptionProperties `json:"encryption,omitempty"` +} + +// ActivateApplicationPackageParameters parameters for an activating an application package. +type ActivateApplicationPackageParameters struct { + // Format - The format of the application package binary file. + Format *string `json:"format,omitempty"` +} + +// Application contains information about an application in a Batch account. +type Application struct { + autorest.Response `json:"-"` + // ApplicationProperties - The properties associated with the Application. + *ApplicationProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for Application. +func (a Application) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.ApplicationProperties != nil { + objectMap["properties"] = a.ApplicationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Application struct. +func (a *Application) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationProperties ApplicationProperties + err = json.Unmarshal(*v, &applicationProperties) + if err != nil { + return err + } + a.ApplicationProperties = &applicationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + a.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + a.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + a.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + a.Etag = &etag + } + } + } + + return nil +} + +// ApplicationPackage an application package which represents a particular version of an application. +type ApplicationPackage struct { + autorest.Response `json:"-"` + // ApplicationPackageProperties - The properties associated with the Application Package. + *ApplicationPackageProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationPackage. +func (ap ApplicationPackage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ap.ApplicationPackageProperties != nil { + objectMap["properties"] = ap.ApplicationPackageProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationPackage struct. +func (ap *ApplicationPackage) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationPackageProperties ApplicationPackageProperties + err = json.Unmarshal(*v, &applicationPackageProperties) + if err != nil { + return err + } + ap.ApplicationPackageProperties = &applicationPackageProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ap.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ap.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ap.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ap.Etag = &etag + } + } + } + + return nil +} + +// ApplicationPackageProperties properties of an application package +type ApplicationPackageProperties struct { + // State - READ-ONLY; The current state of the application package. Possible values include: 'Pending', 'Active' + State PackageState `json:"state,omitempty"` + // Format - READ-ONLY; The format of the application package, if the package is active. + Format *string `json:"format,omitempty"` + // StorageURL - READ-ONLY; The URL for the application package in Azure Storage. + StorageURL *string `json:"storageUrl,omitempty"` + // StorageURLExpiry - READ-ONLY; The UTC time at which the Azure Storage URL will expire. + StorageURLExpiry *date.Time `json:"storageUrlExpiry,omitempty"` + // LastActivationTime - READ-ONLY; The time at which the package was last activated, if the package is active. + LastActivationTime *date.Time `json:"lastActivationTime,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationPackageProperties. +func (app ApplicationPackageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ApplicationPackageReference ... +type ApplicationPackageReference struct { + ID *string `json:"id,omitempty"` + // Version - If this is omitted, and no default version is specified for this application, the request fails with the error code InvalidApplicationPackageReferences. If you are calling the REST API directly, the HTTP status code is 409. + Version *string `json:"version,omitempty"` +} + +// ApplicationProperties the properties associated with the Application. +type ApplicationProperties struct { + // DisplayName - The display name for the application. + DisplayName *string `json:"displayName,omitempty"` + // AllowUpdates - A value indicating whether packages within the application may be overwritten using the same version string. + AllowUpdates *bool `json:"allowUpdates,omitempty"` + // DefaultVersion - The package to use if a client requests the application but does not specify a version. This property can only be set to the name of an existing package. + DefaultVersion *string `json:"defaultVersion,omitempty"` +} + +// AutoScaleRun ... +type AutoScaleRun struct { + EvaluationTime *date.Time `json:"evaluationTime,omitempty"` + // Results - Each variable value is returned in the form $variable=value, and variables are separated by semicolons. + Results *string `json:"results,omitempty"` + Error *AutoScaleRunError `json:"error,omitempty"` +} + +// AutoScaleRunError ... +type AutoScaleRunError struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + Details *[]AutoScaleRunError `json:"details,omitempty"` +} + +// AutoScaleSettings ... +type AutoScaleSettings struct { + Formula *string `json:"formula,omitempty"` + // EvaluationInterval - If omitted, the default value is 15 minutes (PT15M). + EvaluationInterval *string `json:"evaluationInterval,omitempty"` +} + +// AutoStorageBaseProperties the properties related to the auto-storage account. +type AutoStorageBaseProperties struct { + // StorageAccountID - The resource ID of the storage account to be used for auto-storage account. + StorageAccountID *string `json:"storageAccountId,omitempty"` +} + +// AutoStorageProperties contains information about the auto-storage account associated with a Batch +// account. +type AutoStorageProperties struct { + // LastKeySync - The UTC time at which storage keys were last synchronized with the Batch account. + LastKeySync *date.Time `json:"lastKeySync,omitempty"` + // StorageAccountID - The resource ID of the storage account to be used for auto-storage account. + StorageAccountID *string `json:"storageAccountId,omitempty"` +} + +// AutoUserSpecification ... +type AutoUserSpecification struct { + // Scope - The default value is Pool. If the pool is running Windows a value of Task should be specified if stricter isolation between tasks is required. For example, if the task mutates the registry in a way which could impact other tasks, or if certificates have been specified on the pool which should not be accessible by normal tasks but should be accessible by start tasks. Possible values include: 'AutoUserScopeTask', 'AutoUserScopePool' + Scope AutoUserScope `json:"scope,omitempty"` + // ElevationLevel - The default value is nonAdmin. Possible values include: 'NonAdmin', 'Admin' + ElevationLevel ElevationLevel `json:"elevationLevel,omitempty"` +} + +// AzureBlobFileSystemConfiguration ... +type AzureBlobFileSystemConfiguration struct { + AccountName *string `json:"accountName,omitempty"` + ContainerName *string `json:"containerName,omitempty"` + // AccountKey - This property is mutually exclusive with sasKey and one must be specified. + AccountKey *string `json:"accountKey,omitempty"` + // SasKey - This property is mutually exclusive with accountKey and one must be specified. + SasKey *string `json:"sasKey,omitempty"` + // BlobfuseOptions - These are 'net use' options in Windows and 'mount' options in Linux. + BlobfuseOptions *string `json:"blobfuseOptions,omitempty"` + // RelativeMountPath - All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + RelativeMountPath *string `json:"relativeMountPath,omitempty"` +} + +// AzureFileShareConfiguration ... +type AzureFileShareConfiguration struct { + AccountName *string `json:"accountName,omitempty"` + // AzureFileURL - This is of the form 'https://{account}.file.core.windows.net/'. + AzureFileURL *string `json:"azureFileUrl,omitempty"` + AccountKey *string `json:"accountKey,omitempty"` + // RelativeMountPath - All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + RelativeMountPath *string `json:"relativeMountPath,omitempty"` + // MountOptions - These are 'net use' options in Windows and 'mount' options in Linux. + MountOptions *string `json:"mountOptions,omitempty"` +} + +// Certificate contains information about a certificate. +type Certificate struct { + autorest.Response `json:"-"` + // CertificateProperties - The properties associated with the certificate. + *CertificateProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for Certificate. +func (c Certificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if c.CertificateProperties != nil { + objectMap["properties"] = c.CertificateProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Certificate struct. +func (c *Certificate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var certificateProperties CertificateProperties + err = json.Unmarshal(*v, &certificateProperties) + if err != nil { + return err + } + c.CertificateProperties = &certificateProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + c.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + c.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + c.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + c.Etag = &etag + } + } + } + + return nil +} + +// CertificateBaseProperties ... +type CertificateBaseProperties struct { + // ThumbprintAlgorithm - This must match the first portion of the certificate name. Currently required to be 'SHA1'. + ThumbprintAlgorithm *string `json:"thumbprintAlgorithm,omitempty"` + // Thumbprint - This must match the thumbprint from the name. + Thumbprint *string `json:"thumbprint,omitempty"` + // Format - The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. Possible values include: 'Pfx', 'Cer' + Format CertificateFormat `json:"format,omitempty"` +} + +// CertificateCreateOrUpdateParameters contains information about a certificate. +type CertificateCreateOrUpdateParameters struct { + // CertificateCreateOrUpdateProperties - The properties associated with the certificate. + *CertificateCreateOrUpdateProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificateCreateOrUpdateParameters. +func (ccoup CertificateCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ccoup.CertificateCreateOrUpdateProperties != nil { + objectMap["properties"] = ccoup.CertificateCreateOrUpdateProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CertificateCreateOrUpdateParameters struct. +func (ccoup *CertificateCreateOrUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var certificateCreateOrUpdateProperties CertificateCreateOrUpdateProperties + err = json.Unmarshal(*v, &certificateCreateOrUpdateProperties) + if err != nil { + return err + } + ccoup.CertificateCreateOrUpdateProperties = &certificateCreateOrUpdateProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ccoup.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ccoup.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ccoup.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ccoup.Etag = &etag + } + } + } + + return nil +} + +// CertificateCreateOrUpdateProperties certificate properties for create operations +type CertificateCreateOrUpdateProperties struct { + // Data - The maximum size is 10KB. + Data *string `json:"data,omitempty"` + // Password - This must not be specified if the certificate format is Cer. + Password *string `json:"password,omitempty"` + // ThumbprintAlgorithm - This must match the first portion of the certificate name. Currently required to be 'SHA1'. + ThumbprintAlgorithm *string `json:"thumbprintAlgorithm,omitempty"` + // Thumbprint - This must match the thumbprint from the name. + Thumbprint *string `json:"thumbprint,omitempty"` + // Format - The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. Possible values include: 'Pfx', 'Cer' + Format CertificateFormat `json:"format,omitempty"` +} + +// CertificateDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CertificateDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CertificateClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CertificateDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CertificateDeleteFuture.Result. +func (future *CertificateDeleteFuture) result(client CertificateClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.CertificateDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("batch.CertificateDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// CertificateProperties certificate properties. +type CertificateProperties struct { + // ProvisioningState - READ-ONLY; Possible values include: 'Succeeded', 'Deleting', 'Failed' + ProvisioningState CertificateProvisioningState `json:"provisioningState,omitempty"` + // ProvisioningStateTransitionTime - READ-ONLY + ProvisioningStateTransitionTime *date.Time `json:"provisioningStateTransitionTime,omitempty"` + // PreviousProvisioningState - READ-ONLY; The previous provisioned state of the resource. Possible values include: 'Succeeded', 'Deleting', 'Failed' + PreviousProvisioningState CertificateProvisioningState `json:"previousProvisioningState,omitempty"` + // PreviousProvisioningStateTransitionTime - READ-ONLY + PreviousProvisioningStateTransitionTime *date.Time `json:"previousProvisioningStateTransitionTime,omitempty"` + // PublicData - READ-ONLY; The public key of the certificate. + PublicData *string `json:"publicData,omitempty"` + // DeleteCertificateError - READ-ONLY; This is only returned when the certificate provisioningState is 'Failed'. + DeleteCertificateError *DeleteCertificateError `json:"deleteCertificateError,omitempty"` + // ThumbprintAlgorithm - This must match the first portion of the certificate name. Currently required to be 'SHA1'. + ThumbprintAlgorithm *string `json:"thumbprintAlgorithm,omitempty"` + // Thumbprint - This must match the thumbprint from the name. + Thumbprint *string `json:"thumbprint,omitempty"` + // Format - The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. Possible values include: 'Pfx', 'Cer' + Format CertificateFormat `json:"format,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificateProperties. +func (cp CertificateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cp.ThumbprintAlgorithm != nil { + objectMap["thumbprintAlgorithm"] = cp.ThumbprintAlgorithm + } + if cp.Thumbprint != nil { + objectMap["thumbprint"] = cp.Thumbprint + } + if cp.Format != "" { + objectMap["format"] = cp.Format + } + return json.Marshal(objectMap) +} + +// CertificateReference ... +type CertificateReference struct { + ID *string `json:"id,omitempty"` + // StoreLocation - The default value is currentUser. This property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. Possible values include: 'CurrentUser', 'LocalMachine' + StoreLocation CertificateStoreLocation `json:"storeLocation,omitempty"` + // StoreName - This property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). Common store names include: My, Root, CA, Trust, Disallowed, TrustedPeople, TrustedPublisher, AuthRoot, AddressBook, but any custom store name can also be used. The default value is My. + StoreName *string `json:"storeName,omitempty"` + Visibility *[]CertificateVisibility `json:"visibility,omitempty"` +} + +// CheckNameAvailabilityParameters parameters for a check name availability request. +type CheckNameAvailabilityParameters struct { + // Name - The name to check for availability + Name *string `json:"name,omitempty"` + // Type - The resource type. + Type *string `json:"type,omitempty"` +} + +// CheckNameAvailabilityResult the CheckNameAvailability operation response. +type CheckNameAvailabilityResult struct { + autorest.Response `json:"-"` + // NameAvailable - READ-ONLY; Gets a boolean value that indicates whether the name is available for you to use. If true, the name is available. If false, the name has already been taken or invalid and cannot be used. + NameAvailable *bool `json:"nameAvailable,omitempty"` + // Reason - READ-ONLY; Gets the reason that a Batch account name could not be used. The Reason element is only returned if NameAvailable is false. Possible values include: 'Invalid', 'AlreadyExists' + Reason NameAvailabilityReason `json:"reason,omitempty"` + // Message - READ-ONLY; Gets an error message explaining the Reason value in more detail. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for CheckNameAvailabilityResult. +func (cnar CheckNameAvailabilityResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CIFSMountConfiguration ... +type CIFSMountConfiguration struct { + Username *string `json:"username,omitempty"` + Source *string `json:"source,omitempty"` + // RelativeMountPath - All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + RelativeMountPath *string `json:"relativeMountPath,omitempty"` + // MountOptions - These are 'net use' options in Windows and 'mount' options in Linux. + MountOptions *string `json:"mountOptions,omitempty"` + Password *string `json:"password,omitempty"` +} + +// CloudError an error response from the Batch service. +type CloudError struct { + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from the Batch service. +type CloudErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]CloudErrorBody `json:"details,omitempty"` +} + +// CloudServiceConfiguration ... +type CloudServiceConfiguration struct { + // OsFamily - Possible values are: 2 - OS Family 2, equivalent to Windows Server 2008 R2 SP1. 3 - OS Family 3, equivalent to Windows Server 2012. 4 - OS Family 4, equivalent to Windows Server 2012 R2. 5 - OS Family 5, equivalent to Windows Server 2016. 6 - OS Family 6, equivalent to Windows Server 2019. For more information, see Azure Guest OS Releases (https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases). + OsFamily *string `json:"osFamily,omitempty"` + // OsVersion - The default value is * which specifies the latest operating system version for the specified OS family. + OsVersion *string `json:"osVersion,omitempty"` +} + +// ContainerConfiguration ... +type ContainerConfiguration struct { + Type *string `json:"type,omitempty"` + // ContainerImageNames - This is the full image reference, as would be specified to "docker pull". An image will be sourced from the default Docker registry unless the image is fully qualified with an alternative registry. + ContainerImageNames *[]string `json:"containerImageNames,omitempty"` + // ContainerRegistries - If any images must be downloaded from a private registry which requires credentials, then those credentials must be provided here. + ContainerRegistries *[]ContainerRegistry `json:"containerRegistries,omitempty"` +} + +// ContainerRegistry ... +type ContainerRegistry struct { + // RegistryServer - If omitted, the default is "docker.io". + RegistryServer *string `json:"registryServer,omitempty"` + UserName *string `json:"username,omitempty"` + Password *string `json:"password,omitempty"` +} + +// DataDisk settings which will be used by the data disks associated to Compute Nodes in the Pool. When +// using attached data disks, you need to mount and format the disks from within a VM to use them. +type DataDisk struct { + // Lun - The lun is used to uniquely identify each data disk. If attaching multiple disks, each should have a distinct lun. The value must be between 0 and 63, inclusive. + Lun *int32 `json:"lun,omitempty"` + // Caching - Values are: + // none - The caching mode for the disk is not enabled. + // readOnly - The caching mode for the disk is read only. + // readWrite - The caching mode for the disk is read and write. + // The default value for caching is none. For information about the caching options see: https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. Possible values include: 'None', 'ReadOnly', 'ReadWrite' + Caching CachingType `json:"caching,omitempty"` + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // StorageAccountType - If omitted, the default is "Standard_LRS". Values are: + // Standard_LRS - The data disk should use standard locally redundant storage. + // Premium_LRS - The data disk should use premium locally redundant storage. Possible values include: 'StandardLRS', 'PremiumLRS' + StorageAccountType StorageAccountType `json:"storageAccountType,omitempty"` +} + +// DeleteCertificateError an error response from the Batch service. +type DeleteCertificateError struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]DeleteCertificateError `json:"details,omitempty"` +} + +// DeploymentConfiguration ... +type DeploymentConfiguration struct { + // CloudServiceConfiguration - This property and virtualMachineConfiguration are mutually exclusive and one of the properties must be specified. This property cannot be specified if the Batch account was created with its poolAllocationMode property set to 'UserSubscription'. + CloudServiceConfiguration *CloudServiceConfiguration `json:"cloudServiceConfiguration,omitempty"` + // VirtualMachineConfiguration - This property and cloudServiceConfiguration are mutually exclusive and one of the properties must be specified. + VirtualMachineConfiguration *VirtualMachineConfiguration `json:"virtualMachineConfiguration,omitempty"` +} + +// DiskEncryptionConfiguration the disk encryption configuration applied on compute nodes in the pool. Disk +// encryption configuration is not supported on Linux pool created with Virtual Machine Image or Shared +// Image Gallery Image. +type DiskEncryptionConfiguration struct { + // Targets - On Linux pool, only "TemporaryDisk" is supported; on Windows pool, "OsDisk" and "TemporaryDisk" must be specified. + Targets *[]DiskEncryptionTarget `json:"targets,omitempty"` +} + +// EncryptionProperties configures how customer data is encrypted inside the Batch account. By default, +// accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can +// be used instead. +type EncryptionProperties struct { + // KeySource - Type of the key source. Possible values include: 'MicrosoftBatch', 'MicrosoftKeyVault' + KeySource KeySource `json:"keySource,omitempty"` + // KeyVaultProperties - Additional details when using Microsoft.KeyVault + KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` +} + +// EnvironmentSetting ... +type EnvironmentSetting struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// FixedScaleSettings ... +type FixedScaleSettings struct { + // ResizeTimeout - The default value is 15 minutes. Timeout values use ISO 8601 format. For example, use PT10M for 10 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service rejects the request with an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + ResizeTimeout *string `json:"resizeTimeout,omitempty"` + // TargetDedicatedNodes - At least one of targetDedicatedNodes, targetLowPriorityNodes must be set. + TargetDedicatedNodes *int32 `json:"targetDedicatedNodes,omitempty"` + // TargetLowPriorityNodes - At least one of targetDedicatedNodes, targetLowPriorityNodes must be set. + TargetLowPriorityNodes *int32 `json:"targetLowPriorityNodes,omitempty"` + // NodeDeallocationOption - If omitted, the default value is Requeue. Possible values include: 'Requeue', 'Terminate', 'TaskCompletion', 'RetainedData' + NodeDeallocationOption ComputeNodeDeallocationOption `json:"nodeDeallocationOption,omitempty"` +} + +// ImageReference ... +type ImageReference struct { + // Publisher - For example, Canonical or MicrosoftWindowsServer. + Publisher *string `json:"publisher,omitempty"` + // Offer - For example, UbuntuServer or WindowsServer. + Offer *string `json:"offer,omitempty"` + // Sku - For example, 18.04-LTS or 2019-Datacenter. + Sku *string `json:"sku,omitempty"` + // Version - A value of 'latest' can be specified to select the latest version of an image. If omitted, the default is 'latest'. + Version *string `json:"version,omitempty"` + // ID - This property is mutually exclusive with other properties. The Shared Image Gallery image must have replicas in the same region as the Azure Batch account. 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. + ID *string `json:"id,omitempty"` +} + +// InboundNatPool ... +type InboundNatPool struct { + // Name - The name must be unique within a Batch pool, can contain letters, numbers, underscores, periods, and hyphens. Names must start with a letter or number, must end with a letter, number, or underscore, and cannot exceed 77 characters. If any invalid values are provided the request fails with HTTP status code 400. + Name *string `json:"name,omitempty"` + // Protocol - Possible values include: 'TCP', 'UDP' + Protocol InboundEndpointProtocol `json:"protocol,omitempty"` + // BackendPort - This must be unique within a Batch pool. Acceptable values are between 1 and 65535 except for 22, 3389, 29876 and 29877 as these are reserved. If any reserved values are provided the request fails with HTTP status code 400. + BackendPort *int32 `json:"backendPort,omitempty"` + // FrontendPortRangeStart - Acceptable values range between 1 and 65534 except ports from 50000 to 55000 which are reserved. All ranges within a pool must be distinct and cannot overlap. If any reserved or overlapping values are provided the request fails with HTTP status code 400. + FrontendPortRangeStart *int32 `json:"frontendPortRangeStart,omitempty"` + // FrontendPortRangeEnd - Acceptable values range between 1 and 65534 except ports from 50000 to 55000 which are reserved by the Batch service. All ranges within a pool must be distinct and cannot overlap. If any reserved or overlapping values are provided the request fails with HTTP status code 400. + FrontendPortRangeEnd *int32 `json:"frontendPortRangeEnd,omitempty"` + // NetworkSecurityGroupRules - The maximum number of rules that can be specified across all the endpoints on a Batch pool is 25. If no network security group rules are specified, a default rule will be created to allow inbound access to the specified backendPort. If the maximum number of network security group rules is exceeded the request fails with HTTP status code 400. + NetworkSecurityGroupRules *[]NetworkSecurityGroupRule `json:"networkSecurityGroupRules,omitempty"` +} + +// KeyVaultProperties keyVault configuration when using an encryption KeySource of Microsoft.KeyVault. +type KeyVaultProperties struct { + // KeyIdentifier - Full path to the versioned secret. Example https://mykeyvault.vault.azure.net/keys/testkey/6e34a81fef704045975661e297a4c053. To be usable the following prerequisites must be met: + // The Batch Account has a System Assigned identity + // The account identity has been granted Key/Get, Key/Unwrap and Key/Wrap permissions + // The KeyVault has soft-delete and purge protection enabled + KeyIdentifier *string `json:"keyIdentifier,omitempty"` +} + +// KeyVaultReference identifies the Azure key vault associated with a Batch account. +type KeyVaultReference struct { + // ID - The resource ID of the Azure key vault associated with the Batch account. + ID *string `json:"id,omitempty"` + // URL - The URL of the Azure key vault associated with the Batch account. + URL *string `json:"url,omitempty"` +} + +// LinuxUserConfiguration ... +type LinuxUserConfiguration struct { + // UID - The uid and gid properties must be specified together or not at all. If not specified the underlying operating system picks the uid. + UID *int32 `json:"uid,omitempty"` + // Gid - The uid and gid properties must be specified together or not at all. If not specified the underlying operating system picks the gid. + Gid *int32 `json:"gid,omitempty"` + // SSHPrivateKey - The private key must not be password protected. The private key is used to automatically configure asymmetric-key based authentication for SSH between nodes in a Linux pool when the pool's enableInterNodeCommunication property is true (it is ignored if enableInterNodeCommunication is false). It does this by placing the key pair into the user's .ssh directory. If not specified, password-less SSH is not configured between nodes (no modification of the user's .ssh directory is done). + SSHPrivateKey *string `json:"sshPrivateKey,omitempty"` +} + +// ListApplicationPackagesResult the result of performing list application packages. +type ListApplicationPackagesResult struct { + autorest.Response `json:"-"` + // Value - The list of application packages. + Value *[]ApplicationPackage `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListApplicationPackagesResultIterator provides access to a complete listing of ApplicationPackage +// values. +type ListApplicationPackagesResultIterator struct { + i int + page ListApplicationPackagesResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListApplicationPackagesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationPackagesResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListApplicationPackagesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListApplicationPackagesResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListApplicationPackagesResultIterator) Response() ListApplicationPackagesResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListApplicationPackagesResultIterator) Value() ApplicationPackage { + if !iter.page.NotDone() { + return ApplicationPackage{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListApplicationPackagesResultIterator type. +func NewListApplicationPackagesResultIterator(page ListApplicationPackagesResultPage) ListApplicationPackagesResultIterator { + return ListApplicationPackagesResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lapr ListApplicationPackagesResult) IsEmpty() bool { + return lapr.Value == nil || len(*lapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lapr ListApplicationPackagesResult) hasNextLink() bool { + return lapr.NextLink != nil && len(*lapr.NextLink) != 0 +} + +// listApplicationPackagesResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lapr ListApplicationPackagesResult) listApplicationPackagesResultPreparer(ctx context.Context) (*http.Request, error) { + if !lapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lapr.NextLink))) +} + +// ListApplicationPackagesResultPage contains a page of ApplicationPackage values. +type ListApplicationPackagesResultPage struct { + fn func(context.Context, ListApplicationPackagesResult) (ListApplicationPackagesResult, error) + lapr ListApplicationPackagesResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListApplicationPackagesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationPackagesResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lapr) + if err != nil { + return err + } + page.lapr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListApplicationPackagesResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListApplicationPackagesResultPage) NotDone() bool { + return !page.lapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListApplicationPackagesResultPage) Response() ListApplicationPackagesResult { + return page.lapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListApplicationPackagesResultPage) Values() []ApplicationPackage { + if page.lapr.IsEmpty() { + return nil + } + return *page.lapr.Value +} + +// Creates a new instance of the ListApplicationPackagesResultPage type. +func NewListApplicationPackagesResultPage(cur ListApplicationPackagesResult, getNextPage func(context.Context, ListApplicationPackagesResult) (ListApplicationPackagesResult, error)) ListApplicationPackagesResultPage { + return ListApplicationPackagesResultPage{ + fn: getNextPage, + lapr: cur, + } +} + +// ListApplicationsResult the result of performing list applications. +type ListApplicationsResult struct { + autorest.Response `json:"-"` + // Value - The list of applications. + Value *[]Application `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListApplicationsResultIterator provides access to a complete listing of Application values. +type ListApplicationsResultIterator struct { + i int + page ListApplicationsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListApplicationsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListApplicationsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListApplicationsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListApplicationsResultIterator) Response() ListApplicationsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListApplicationsResultIterator) Value() Application { + if !iter.page.NotDone() { + return Application{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListApplicationsResultIterator type. +func NewListApplicationsResultIterator(page ListApplicationsResultPage) ListApplicationsResultIterator { + return ListApplicationsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lar ListApplicationsResult) IsEmpty() bool { + return lar.Value == nil || len(*lar.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lar ListApplicationsResult) hasNextLink() bool { + return lar.NextLink != nil && len(*lar.NextLink) != 0 +} + +// listApplicationsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lar ListApplicationsResult) listApplicationsResultPreparer(ctx context.Context) (*http.Request, error) { + if !lar.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lar.NextLink))) +} + +// ListApplicationsResultPage contains a page of Application values. +type ListApplicationsResultPage struct { + fn func(context.Context, ListApplicationsResult) (ListApplicationsResult, error) + lar ListApplicationsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListApplicationsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lar) + if err != nil { + return err + } + page.lar = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListApplicationsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListApplicationsResultPage) NotDone() bool { + return !page.lar.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListApplicationsResultPage) Response() ListApplicationsResult { + return page.lar +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListApplicationsResultPage) Values() []Application { + if page.lar.IsEmpty() { + return nil + } + return *page.lar.Value +} + +// Creates a new instance of the ListApplicationsResultPage type. +func NewListApplicationsResultPage(cur ListApplicationsResult, getNextPage func(context.Context, ListApplicationsResult) (ListApplicationsResult, error)) ListApplicationsResultPage { + return ListApplicationsResultPage{ + fn: getNextPage, + lar: cur, + } +} + +// ListCertificatesResult values returned by the List operation. +type ListCertificatesResult struct { + autorest.Response `json:"-"` + // Value - The collection of returned certificates. + Value *[]Certificate `json:"value,omitempty"` + // NextLink - The continuation token. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListCertificatesResultIterator provides access to a complete listing of Certificate values. +type ListCertificatesResultIterator struct { + i int + page ListCertificatesResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListCertificatesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListCertificatesResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListCertificatesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListCertificatesResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListCertificatesResultIterator) Response() ListCertificatesResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListCertificatesResultIterator) Value() Certificate { + if !iter.page.NotDone() { + return Certificate{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListCertificatesResultIterator type. +func NewListCertificatesResultIterator(page ListCertificatesResultPage) ListCertificatesResultIterator { + return ListCertificatesResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lcr ListCertificatesResult) IsEmpty() bool { + return lcr.Value == nil || len(*lcr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lcr ListCertificatesResult) hasNextLink() bool { + return lcr.NextLink != nil && len(*lcr.NextLink) != 0 +} + +// listCertificatesResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lcr ListCertificatesResult) listCertificatesResultPreparer(ctx context.Context) (*http.Request, error) { + if !lcr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lcr.NextLink))) +} + +// ListCertificatesResultPage contains a page of Certificate values. +type ListCertificatesResultPage struct { + fn func(context.Context, ListCertificatesResult) (ListCertificatesResult, error) + lcr ListCertificatesResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListCertificatesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListCertificatesResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lcr) + if err != nil { + return err + } + page.lcr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListCertificatesResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListCertificatesResultPage) NotDone() bool { + return !page.lcr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListCertificatesResultPage) Response() ListCertificatesResult { + return page.lcr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListCertificatesResultPage) Values() []Certificate { + if page.lcr.IsEmpty() { + return nil + } + return *page.lcr.Value +} + +// Creates a new instance of the ListCertificatesResultPage type. +func NewListCertificatesResultPage(cur ListCertificatesResult, getNextPage func(context.Context, ListCertificatesResult) (ListCertificatesResult, error)) ListCertificatesResultPage { + return ListCertificatesResultPage{ + fn: getNextPage, + lcr: cur, + } +} + +// ListPoolsResult values returned by the List operation. +type ListPoolsResult struct { + autorest.Response `json:"-"` + // Value - The collection of returned pools. + Value *[]Pool `json:"value,omitempty"` + // NextLink - The continuation token. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListPoolsResultIterator provides access to a complete listing of Pool values. +type ListPoolsResultIterator struct { + i int + page ListPoolsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListPoolsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListPoolsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListPoolsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListPoolsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListPoolsResultIterator) Response() ListPoolsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListPoolsResultIterator) Value() Pool { + if !iter.page.NotDone() { + return Pool{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListPoolsResultIterator type. +func NewListPoolsResultIterator(page ListPoolsResultPage) ListPoolsResultIterator { + return ListPoolsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lpr ListPoolsResult) IsEmpty() bool { + return lpr.Value == nil || len(*lpr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lpr ListPoolsResult) hasNextLink() bool { + return lpr.NextLink != nil && len(*lpr.NextLink) != 0 +} + +// listPoolsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lpr ListPoolsResult) listPoolsResultPreparer(ctx context.Context) (*http.Request, error) { + if !lpr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lpr.NextLink))) +} + +// ListPoolsResultPage contains a page of Pool values. +type ListPoolsResultPage struct { + fn func(context.Context, ListPoolsResult) (ListPoolsResult, error) + lpr ListPoolsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListPoolsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListPoolsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lpr) + if err != nil { + return err + } + page.lpr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListPoolsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListPoolsResultPage) NotDone() bool { + return !page.lpr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListPoolsResultPage) Response() ListPoolsResult { + return page.lpr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListPoolsResultPage) Values() []Pool { + if page.lpr.IsEmpty() { + return nil + } + return *page.lpr.Value +} + +// Creates a new instance of the ListPoolsResultPage type. +func NewListPoolsResultPage(cur ListPoolsResult, getNextPage func(context.Context, ListPoolsResult) (ListPoolsResult, error)) ListPoolsResultPage { + return ListPoolsResultPage{ + fn: getNextPage, + lpr: cur, + } +} + +// ListPrivateEndpointConnectionsResult values returned by the List operation. +type ListPrivateEndpointConnectionsResult struct { + autorest.Response `json:"-"` + // Value - The collection of returned private endpoint connection. + Value *[]PrivateEndpointConnection `json:"value,omitempty"` + // NextLink - The continuation token. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListPrivateEndpointConnectionsResultIterator provides access to a complete listing of +// PrivateEndpointConnection values. +type ListPrivateEndpointConnectionsResultIterator struct { + i int + page ListPrivateEndpointConnectionsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListPrivateEndpointConnectionsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListPrivateEndpointConnectionsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListPrivateEndpointConnectionsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListPrivateEndpointConnectionsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListPrivateEndpointConnectionsResultIterator) Response() ListPrivateEndpointConnectionsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListPrivateEndpointConnectionsResultIterator) Value() PrivateEndpointConnection { + if !iter.page.NotDone() { + return PrivateEndpointConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListPrivateEndpointConnectionsResultIterator type. +func NewListPrivateEndpointConnectionsResultIterator(page ListPrivateEndpointConnectionsResultPage) ListPrivateEndpointConnectionsResultIterator { + return ListPrivateEndpointConnectionsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lpecr ListPrivateEndpointConnectionsResult) IsEmpty() bool { + return lpecr.Value == nil || len(*lpecr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lpecr ListPrivateEndpointConnectionsResult) hasNextLink() bool { + return lpecr.NextLink != nil && len(*lpecr.NextLink) != 0 +} + +// listPrivateEndpointConnectionsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lpecr ListPrivateEndpointConnectionsResult) listPrivateEndpointConnectionsResultPreparer(ctx context.Context) (*http.Request, error) { + if !lpecr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lpecr.NextLink))) +} + +// ListPrivateEndpointConnectionsResultPage contains a page of PrivateEndpointConnection values. +type ListPrivateEndpointConnectionsResultPage struct { + fn func(context.Context, ListPrivateEndpointConnectionsResult) (ListPrivateEndpointConnectionsResult, error) + lpecr ListPrivateEndpointConnectionsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListPrivateEndpointConnectionsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListPrivateEndpointConnectionsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lpecr) + if err != nil { + return err + } + page.lpecr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListPrivateEndpointConnectionsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListPrivateEndpointConnectionsResultPage) NotDone() bool { + return !page.lpecr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListPrivateEndpointConnectionsResultPage) Response() ListPrivateEndpointConnectionsResult { + return page.lpecr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListPrivateEndpointConnectionsResultPage) Values() []PrivateEndpointConnection { + if page.lpecr.IsEmpty() { + return nil + } + return *page.lpecr.Value +} + +// Creates a new instance of the ListPrivateEndpointConnectionsResultPage type. +func NewListPrivateEndpointConnectionsResultPage(cur ListPrivateEndpointConnectionsResult, getNextPage func(context.Context, ListPrivateEndpointConnectionsResult) (ListPrivateEndpointConnectionsResult, error)) ListPrivateEndpointConnectionsResultPage { + return ListPrivateEndpointConnectionsResultPage{ + fn: getNextPage, + lpecr: cur, + } +} + +// ListPrivateLinkResourcesResult values returned by the List operation. +type ListPrivateLinkResourcesResult struct { + autorest.Response `json:"-"` + // Value - The collection of returned private link resources. + Value *[]PrivateLinkResource `json:"value,omitempty"` + // NextLink - The continuation token. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListPrivateLinkResourcesResultIterator provides access to a complete listing of PrivateLinkResource +// values. +type ListPrivateLinkResourcesResultIterator struct { + i int + page ListPrivateLinkResourcesResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListPrivateLinkResourcesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListPrivateLinkResourcesResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListPrivateLinkResourcesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListPrivateLinkResourcesResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListPrivateLinkResourcesResultIterator) Response() ListPrivateLinkResourcesResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListPrivateLinkResourcesResultIterator) Value() PrivateLinkResource { + if !iter.page.NotDone() { + return PrivateLinkResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListPrivateLinkResourcesResultIterator type. +func NewListPrivateLinkResourcesResultIterator(page ListPrivateLinkResourcesResultPage) ListPrivateLinkResourcesResultIterator { + return ListPrivateLinkResourcesResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lplrr ListPrivateLinkResourcesResult) IsEmpty() bool { + return lplrr.Value == nil || len(*lplrr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lplrr ListPrivateLinkResourcesResult) hasNextLink() bool { + return lplrr.NextLink != nil && len(*lplrr.NextLink) != 0 +} + +// listPrivateLinkResourcesResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lplrr ListPrivateLinkResourcesResult) listPrivateLinkResourcesResultPreparer(ctx context.Context) (*http.Request, error) { + if !lplrr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lplrr.NextLink))) +} + +// ListPrivateLinkResourcesResultPage contains a page of PrivateLinkResource values. +type ListPrivateLinkResourcesResultPage struct { + fn func(context.Context, ListPrivateLinkResourcesResult) (ListPrivateLinkResourcesResult, error) + lplrr ListPrivateLinkResourcesResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListPrivateLinkResourcesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListPrivateLinkResourcesResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lplrr) + if err != nil { + return err + } + page.lplrr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListPrivateLinkResourcesResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListPrivateLinkResourcesResultPage) NotDone() bool { + return !page.lplrr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListPrivateLinkResourcesResultPage) Response() ListPrivateLinkResourcesResult { + return page.lplrr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListPrivateLinkResourcesResultPage) Values() []PrivateLinkResource { + if page.lplrr.IsEmpty() { + return nil + } + return *page.lplrr.Value +} + +// Creates a new instance of the ListPrivateLinkResourcesResultPage type. +func NewListPrivateLinkResourcesResultPage(cur ListPrivateLinkResourcesResult, getNextPage func(context.Context, ListPrivateLinkResourcesResult) (ListPrivateLinkResourcesResult, error)) ListPrivateLinkResourcesResultPage { + return ListPrivateLinkResourcesResultPage{ + fn: getNextPage, + lplrr: cur, + } +} + +// LocationQuota quotas associated with a Batch region for a particular subscription. +type LocationQuota struct { + autorest.Response `json:"-"` + // AccountQuota - READ-ONLY; The number of Batch accounts that may be created under the subscription in the specified region. + AccountQuota *int32 `json:"accountQuota,omitempty"` +} + +// MarshalJSON is the custom marshaler for LocationQuota. +func (lq LocationQuota) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// MetadataItem the Batch service does not assign any meaning to this metadata; it is solely for the use of +// user code. +type MetadataItem struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// MountConfiguration ... +type MountConfiguration struct { + // AzureBlobFileSystemConfiguration - This property is mutually exclusive with all other properties. + AzureBlobFileSystemConfiguration *AzureBlobFileSystemConfiguration `json:"azureBlobFileSystemConfiguration,omitempty"` + // NfsMountConfiguration - This property is mutually exclusive with all other properties. + NfsMountConfiguration *NFSMountConfiguration `json:"nfsMountConfiguration,omitempty"` + // CifsMountConfiguration - This property is mutually exclusive with all other properties. + CifsMountConfiguration *CIFSMountConfiguration `json:"cifsMountConfiguration,omitempty"` + // AzureFileShareConfiguration - This property is mutually exclusive with all other properties. + AzureFileShareConfiguration *AzureFileShareConfiguration `json:"azureFileShareConfiguration,omitempty"` +} + +// NetworkConfiguration the network configuration for a pool. +type NetworkConfiguration struct { + // SubnetID - The virtual network must be in the same region and subscription as the Azure Batch account. The specified subnet should have enough free IP addresses to accommodate the number of nodes in the pool. If the subnet doesn't have enough free IP addresses, the pool will partially allocate compute nodes and a resize error will occur. The 'MicrosoftAzureBatch' service principal must have the 'Classic Virtual Machine Contributor' Role-Based Access Control (RBAC) role for the specified VNet. The specified subnet must allow communication from the Azure Batch service to be able to schedule tasks on the compute nodes. This can be verified by checking if the specified VNet has any associated Network Security Groups (NSG). If communication to the compute nodes in the specified subnet is denied by an NSG, then the Batch service will set the state of the compute nodes to unusable. If the specified VNet has any associated Network Security Groups (NSG), then a few reserved system ports must be enabled for inbound communication. For pools created with a virtual machine configuration, enable ports 29876 and 29877, as well as port 22 for Linux and port 3389 for Windows. For pools created with a cloud service configuration, enable ports 10100, 20100, and 30100. Also enable outbound connections to Azure Storage on port 443. For cloudServiceConfiguration pools, only 'classic' VNETs are supported. For more details see: https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration + SubnetID *string `json:"subnetId,omitempty"` + // EndpointConfiguration - Pool endpoint configuration is only supported on pools with the virtualMachineConfiguration property. + EndpointConfiguration *PoolEndpointConfiguration `json:"endpointConfiguration,omitempty"` + // PublicIPAddressConfiguration - This property is only supported on Pools with the virtualMachineConfiguration property. + PublicIPAddressConfiguration *PublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` +} + +// NetworkSecurityGroupRule ... +type NetworkSecurityGroupRule struct { + // Priority - Priorities within a pool must be unique and are evaluated in order of priority. The lower the number the higher the priority. For example, rules could be specified with order numbers of 150, 250, and 350. The rule with the order number of 150 takes precedence over the rule that has an order of 250. Allowed priorities are 150 to 4096. If any reserved or duplicate values are provided the request fails with HTTP status code 400. + Priority *int32 `json:"priority,omitempty"` + // Access - Possible values include: 'Allow', 'Deny' + Access NetworkSecurityGroupRuleAccess `json:"access,omitempty"` + // SourceAddressPrefix - Valid values are a single IP address (i.e. 10.10.10.10), IP subnet (i.e. 192.168.1.0/24), default tag, or * (for all addresses). If any other values are provided the request fails with HTTP status code 400. + SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` + // SourcePortRanges - Valid values are '*' (for all ports 0 - 65535) or arrays of ports or port ranges (i.e. 100-200). The ports should in the range of 0 to 65535 and the port ranges or ports can't overlap. If any other values are provided the request fails with HTTP status code 400. Default value will be *. + SourcePortRanges *[]string `json:"sourcePortRanges,omitempty"` +} + +// NFSMountConfiguration ... +type NFSMountConfiguration struct { + Source *string `json:"source,omitempty"` + // RelativeMountPath - All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + RelativeMountPath *string `json:"relativeMountPath,omitempty"` + // MountOptions - These are 'net use' options in Windows and 'mount' options in Linux. + MountOptions *string `json:"mountOptions,omitempty"` +} + +// NodePlacementConfiguration allocation configuration used by Batch Service to provision the nodes. +type NodePlacementConfiguration struct { + // Policy - Allocation policy used by Batch Service to provision the nodes. If not specified, Batch will use the regional policy. Possible values include: 'Regional', 'Zonal' + Policy NodePlacementPolicyType `json:"policy,omitempty"` +} + +// Operation ... +type Operation struct { + // Name - This is of the format {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` + Origin *string `json:"origin,omitempty"` + Properties interface{} `json:"properties,omitempty"` +} + +// OperationDisplay ... +type OperationDisplay struct { + Provider *string `json:"provider,omitempty"` + // Operation - For example: read, write, delete, or listKeys/action + Operation *string `json:"operation,omitempty"` + Resource *string `json:"resource,omitempty"` + Description *string `json:"description,omitempty"` +} + +// OperationListResult ... +type OperationListResult struct { + autorest.Response `json:"-"` + Value *[]Operation `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListResultIterator) Response() OperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// Pool contains information about a pool. +type Pool struct { + autorest.Response `json:"-"` + // PoolProperties - The properties associated with the pool. + *PoolProperties `json:"properties,omitempty"` + // Identity - The type of identity used for the Batch Pool. + Identity *PoolIdentity `json:"identity,omitempty"` + // ID - READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for Pool. +func (p Pool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if p.PoolProperties != nil { + objectMap["properties"] = p.PoolProperties + } + if p.Identity != nil { + objectMap["identity"] = p.Identity + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Pool struct. +func (p *Pool) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var poolProperties PoolProperties + err = json.Unmarshal(*v, &poolProperties) + if err != nil { + return err + } + p.PoolProperties = &poolProperties + } + case "identity": + if v != nil { + var identity PoolIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + p.Identity = &identity + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + p.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + p.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + p.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + p.Etag = &etag + } + } + } + + return nil +} + +// PoolDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type PoolDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PoolClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PoolDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PoolDeleteFuture.Result. +func (future *PoolDeleteFuture) result(client PoolClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("batch.PoolDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PoolEndpointConfiguration ... +type PoolEndpointConfiguration struct { + // InboundNatPools - The maximum number of inbound NAT pools per Batch pool is 5. If the maximum number of inbound NAT pools is exceeded the request fails with HTTP status code 400. This cannot be specified if the IPAddressProvisioningType is NoPublicIPAddresses. + InboundNatPools *[]InboundNatPool `json:"inboundNatPools,omitempty"` +} + +// PoolIdentity the identity of the Batch pool, if configured. If the pool identity is updated during +// update an existing pool, only the new vms which are created after the pool shrinks to 0 will have the +// updated identities +type PoolIdentity struct { + // Type - The type of identity used for the Batch Pool. Possible values include: 'PoolIdentityTypeUserAssigned', 'PoolIdentityTypeNone' + Type PoolIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - The list of user identities associated with the Batch pool. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + UserAssignedIdentities map[string]*PoolIdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for PoolIdentity. +func (pi PoolIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pi.Type != "" { + objectMap["type"] = pi.Type + } + if pi.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = pi.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// PoolIdentityUserAssignedIdentitiesValue ... +type PoolIdentityUserAssignedIdentitiesValue struct { + // PrincipalID - READ-ONLY; The principal id of user assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The client id of user assigned identity. + ClientID *string `json:"clientId,omitempty"` +} + +// MarshalJSON is the custom marshaler for PoolIdentityUserAssignedIdentitiesValue. +func (piAiv PoolIdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PoolProperties pool properties. +type PoolProperties struct { + // DisplayName - The display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. + DisplayName *string `json:"displayName,omitempty"` + // LastModified - READ-ONLY; This is the last time at which the pool level data, such as the targetDedicatedNodes or autoScaleSettings, changed. It does not factor in node-level changes such as a compute node changing state. + LastModified *date.Time `json:"lastModified,omitempty"` + // CreationTime - READ-ONLY + CreationTime *date.Time `json:"creationTime,omitempty"` + // ProvisioningState - READ-ONLY; Possible values include: 'PoolProvisioningStateSucceeded', 'PoolProvisioningStateDeleting' + ProvisioningState PoolProvisioningState `json:"provisioningState,omitempty"` + // ProvisioningStateTransitionTime - READ-ONLY + ProvisioningStateTransitionTime *date.Time `json:"provisioningStateTransitionTime,omitempty"` + // AllocationState - READ-ONLY; Possible values include: 'Steady', 'Resizing', 'Stopping' + AllocationState AllocationState `json:"allocationState,omitempty"` + // AllocationStateTransitionTime - READ-ONLY + AllocationStateTransitionTime *date.Time `json:"allocationStateTransitionTime,omitempty"` + // VMSize - For information about available sizes of virtual machines for Cloud Services pools (pools created with cloudServiceConfiguration), see Sizes for Cloud Services (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). Batch supports all Cloud Services VM sizes except ExtraSmall. For information about available VM sizes for pools using images from the Virtual Machines Marketplace (pools created with virtualMachineConfiguration) see Sizes for Virtual Machines (Linux) (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) or Sizes for Virtual Machines (Windows) (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). Batch supports all Azure VM sizes except STANDARD_A0 and those with premium storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series). + VMSize *string `json:"vmSize,omitempty"` + // DeploymentConfiguration - Using CloudServiceConfiguration specifies that the nodes should be creating using Azure Cloud Services (PaaS), while VirtualMachineConfiguration uses Azure Virtual Machines (IaaS). + DeploymentConfiguration *DeploymentConfiguration `json:"deploymentConfiguration,omitempty"` + // CurrentDedicatedNodes - READ-ONLY + CurrentDedicatedNodes *int32 `json:"currentDedicatedNodes,omitempty"` + // CurrentLowPriorityNodes - READ-ONLY + CurrentLowPriorityNodes *int32 `json:"currentLowPriorityNodes,omitempty"` + ScaleSettings *ScaleSettings `json:"scaleSettings,omitempty"` + // AutoScaleRun - READ-ONLY; This property is set only if the pool automatically scales, i.e. autoScaleSettings are used. + AutoScaleRun *AutoScaleRun `json:"autoScaleRun,omitempty"` + // InterNodeCommunication - This imposes restrictions on which nodes can be assigned to the pool. Enabling this value can reduce the chance of the requested number of nodes to be allocated in the pool. If not specified, this value defaults to 'Disabled'. Possible values include: 'Enabled', 'Disabled' + InterNodeCommunication InterNodeCommunicationState `json:"interNodeCommunication,omitempty"` + NetworkConfiguration *NetworkConfiguration `json:"networkConfiguration,omitempty"` + // TaskSlotsPerNode - The default value is 1. The maximum value is the smaller of 4 times the number of cores of the vmSize of the pool or 256. + TaskSlotsPerNode *int32 `json:"taskSlotsPerNode,omitempty"` + // TaskSchedulingPolicy - If not specified, the default is spread. + TaskSchedulingPolicy *TaskSchedulingPolicy `json:"taskSchedulingPolicy,omitempty"` + UserAccounts *[]UserAccount `json:"userAccounts,omitempty"` + // Metadata - The Batch service does not assign any meaning to metadata; it is solely for the use of user code. + Metadata *[]MetadataItem `json:"metadata,omitempty"` + // StartTask - In an PATCH (update) operation, this property can be set to an empty object to remove the start task from the pool. + StartTask *StartTask `json:"startTask,omitempty"` + // Certificates - For Windows compute nodes, the Batch service installs the certificates to the specified certificate store and location. For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. + Certificates *[]CertificateReference `json:"certificates,omitempty"` + // ApplicationPackages - Changes to application package references affect all new compute nodes joining the pool, but do not affect compute nodes that are already in the pool until they are rebooted or reimaged. There is a maximum of 10 application package references on any given pool. + ApplicationPackages *[]ApplicationPackageReference `json:"applicationPackages,omitempty"` + // ApplicationLicenses - The list of application licenses must be a subset of available Batch service application licenses. If a license is requested which is not supported, pool creation will fail. + ApplicationLicenses *[]string `json:"applicationLicenses,omitempty"` + // ResizeOperationStatus - READ-ONLY + ResizeOperationStatus *ResizeOperationStatus `json:"resizeOperationStatus,omitempty"` + // MountConfiguration - This supports Azure Files, NFS, CIFS/SMB, and Blobfuse. + MountConfiguration *[]MountConfiguration `json:"mountConfiguration,omitempty"` +} + +// MarshalJSON is the custom marshaler for PoolProperties. +func (pp PoolProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pp.DisplayName != nil { + objectMap["displayName"] = pp.DisplayName + } + if pp.VMSize != nil { + objectMap["vmSize"] = pp.VMSize + } + if pp.DeploymentConfiguration != nil { + objectMap["deploymentConfiguration"] = pp.DeploymentConfiguration + } + if pp.ScaleSettings != nil { + objectMap["scaleSettings"] = pp.ScaleSettings + } + if pp.InterNodeCommunication != "" { + objectMap["interNodeCommunication"] = pp.InterNodeCommunication + } + if pp.NetworkConfiguration != nil { + objectMap["networkConfiguration"] = pp.NetworkConfiguration + } + if pp.TaskSlotsPerNode != nil { + objectMap["taskSlotsPerNode"] = pp.TaskSlotsPerNode + } + if pp.TaskSchedulingPolicy != nil { + objectMap["taskSchedulingPolicy"] = pp.TaskSchedulingPolicy + } + if pp.UserAccounts != nil { + objectMap["userAccounts"] = pp.UserAccounts + } + if pp.Metadata != nil { + objectMap["metadata"] = pp.Metadata + } + if pp.StartTask != nil { + objectMap["startTask"] = pp.StartTask + } + if pp.Certificates != nil { + objectMap["certificates"] = pp.Certificates + } + if pp.ApplicationPackages != nil { + objectMap["applicationPackages"] = pp.ApplicationPackages + } + if pp.ApplicationLicenses != nil { + objectMap["applicationLicenses"] = pp.ApplicationLicenses + } + if pp.MountConfiguration != nil { + objectMap["mountConfiguration"] = pp.MountConfiguration + } + return json.Marshal(objectMap) +} + +// PrivateEndpoint the private endpoint of the private endpoint connection. +type PrivateEndpoint struct { + // ID - READ-ONLY + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpoint. +func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PrivateEndpointConnection contains information about a private link resource. +type PrivateEndpointConnection struct { + autorest.Response `json:"-"` + // PrivateEndpointConnectionProperties - The properties associated with the private endpoint connection. + *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.PrivateEndpointConnectionProperties != nil { + objectMap["properties"] = pec.PrivateEndpointConnectionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. +func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateEndpointConnectionProperties PrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &privateEndpointConnectionProperties) + if err != nil { + return err + } + pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pec.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pec.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pec.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + pec.Etag = &etag + } + } + } + + return nil +} + +// PrivateEndpointConnectionProperties private endpoint connection properties. +type PrivateEndpointConnectionProperties struct { + // ProvisioningState - READ-ONLY; Possible values include: 'PrivateEndpointConnectionProvisioningStateSucceeded', 'PrivateEndpointConnectionProvisioningStateUpdating', 'PrivateEndpointConnectionProvisioningStateFailed' + ProvisioningState PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. +func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pecp.PrivateEndpoint != nil { + objectMap["privateEndpoint"] = pecp.PrivateEndpoint + } + if pecp.PrivateLinkServiceConnectionState != nil { + objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState + } + return json.Marshal(objectMap) +} + +// PrivateEndpointConnectionUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateEndpointConnectionUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointConnectionClient) (PrivateEndpointConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointConnectionUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateEndpointConnectionUpdateFuture.Result. +func (future *PrivateEndpointConnectionUpdateFuture) result(client PrivateEndpointConnectionClient) (pec PrivateEndpointConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pec.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("batch.PrivateEndpointConnectionUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { + pec, err = client.UpdateResponder(pec.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") + } + } + return +} + +// PrivateLinkResource contains information about a private link resource. +type PrivateLinkResource struct { + autorest.Response `json:"-"` + // PrivateLinkResourceProperties - The properties associated with the private link resource. + *PrivateLinkResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResource. +func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plr.PrivateLinkResourceProperties != nil { + objectMap["properties"] = plr.PrivateLinkResourceProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. +func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateLinkResourceProperties PrivateLinkResourceProperties + err = json.Unmarshal(*v, &privateLinkResourceProperties) + if err != nil { + return err + } + plr.PrivateLinkResourceProperties = &privateLinkResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + plr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + plr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + plr.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + plr.Etag = &etag + } + } + } + + return nil +} + +// PrivateLinkResourceProperties private link resource properties. +type PrivateLinkResourceProperties struct { + // GroupID - READ-ONLY; The group id is used to establish the private link connection. + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - READ-ONLY + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + // RequiredZoneNames - READ-ONLY + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. +func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PrivateLinkServiceConnectionState the private link service connection state of the private endpoint +// connection +type PrivateLinkServiceConnectionState struct { + // Status - Possible values include: 'PrivateLinkServiceConnectionStatusApproved', 'PrivateLinkServiceConnectionStatusPending', 'PrivateLinkServiceConnectionStatusRejected', 'PrivateLinkServiceConnectionStatusDisconnected' + Status PrivateLinkServiceConnectionStatus `json:"status,omitempty"` + Description *string `json:"description,omitempty"` + // ActionRequired - READ-ONLY + ActionRequired *string `json:"actionRequired,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionState. +func (plscs PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plscs.Status != "" { + objectMap["status"] = plscs.Status + } + if plscs.Description != nil { + objectMap["description"] = plscs.Description + } + return json.Marshal(objectMap) +} + +// ProxyResource a definition of an Azure resource. +type ProxyResource struct { + // ID - READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PublicIPAddressConfiguration the public IP Address configuration of the networking configuration of a +// Pool. +type PublicIPAddressConfiguration struct { + // Provision - The default value is BatchManaged. Possible values include: 'BatchManaged', 'UserManaged', 'NoPublicIPAddresses' + Provision IPAddressProvisioningType `json:"provision,omitempty"` + // IPAddressIds - The number of IPs specified here limits the maximum size of the Pool - 100 dedicated nodes or 100 low-priority nodes can be allocated for each public IP. For example, a pool needing 250 dedicated VMs would need at least 3 public IPs specified. Each element of this collection is of the form: /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/publicIPAddresses/{ip}. + IPAddressIds *[]string `json:"ipAddressIds,omitempty"` +} + +// ResizeError ... +type ResizeError struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + Details *[]ResizeError `json:"details,omitempty"` +} + +// ResizeOperationStatus describes either the current operation (if the pool AllocationState is Resizing) +// or the previously completed operation (if the AllocationState is Steady). +type ResizeOperationStatus struct { + TargetDedicatedNodes *int32 `json:"targetDedicatedNodes,omitempty"` + TargetLowPriorityNodes *int32 `json:"targetLowPriorityNodes,omitempty"` + // ResizeTimeout - The default value is 15 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). + ResizeTimeout *string `json:"resizeTimeout,omitempty"` + // NodeDeallocationOption - The default value is requeue. Possible values include: 'Requeue', 'Terminate', 'TaskCompletion', 'RetainedData' + NodeDeallocationOption ComputeNodeDeallocationOption `json:"nodeDeallocationOption,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + // Errors - This property is set only if an error occurred during the last pool resize, and only when the pool allocationState is Steady. + Errors *[]ResizeError `json:"errors,omitempty"` +} + +// Resource a definition of an Azure resource. +type Resource struct { + // ID - READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - READ-ONLY; The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceFile ... +type ResourceFile struct { + // AutoStorageContainerName - The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. + AutoStorageContainerName *string `json:"autoStorageContainerName,omitempty"` + // StorageContainerURL - The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. This URL must be readable and listable using anonymous access; that is, the Batch service does not present any credentials when downloading the blob. There are two ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read and list permissions on the blob, or set the ACL for the blob or its container to allow public access. + StorageContainerURL *string `json:"storageContainerUrl,omitempty"` + // HTTPURL - The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified. If the URL is Azure Blob Storage, it must be readable using anonymous access; that is, the Batch service does not present any credentials when downloading the blob. There are two ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read permissions on the blob, or set the ACL for the blob or its container to allow public access. + HTTPURL *string `json:"httpUrl,omitempty"` + // BlobPrefix - The property is valid only when autoStorageContainerName or storageContainerUrl is used. This prefix can be a partial filename or a subdirectory. If a prefix is not specified, all the files in the container will be downloaded. + BlobPrefix *string `json:"blobPrefix,omitempty"` + // FilePath - If the httpUrl property is specified, the filePath is required and describes the path which the file will be downloaded to, including the filename. Otherwise, if the autoStorageContainerName or storageContainerUrl property is specified, filePath is optional and is the directory to download the files to. In the case where filePath is used as a directory, any directory structure already associated with the input data will be retained in full and appended to the specified filePath directory. The specified relative path cannot break out of the task's working directory (for example by using '..'). + FilePath *string `json:"filePath,omitempty"` + // FileMode - This property applies only to files being downloaded to Linux compute nodes. It will be ignored if it is specified for a resourceFile which will be downloaded to a Windows node. If this property is not specified for a Linux node, then a default value of 0770 is applied to the file. + FileMode *string `json:"fileMode,omitempty"` +} + +// ScaleSettings defines the desired size of the pool. This can either be 'fixedScale' where the requested +// targetDedicatedNodes is specified, or 'autoScale' which defines a formula which is periodically +// reevaluated. If this property is not specified, the pool will have a fixed scale with 0 +// targetDedicatedNodes. +type ScaleSettings struct { + // FixedScale - This property and autoScale are mutually exclusive and one of the properties must be specified. + FixedScale *FixedScaleSettings `json:"fixedScale,omitempty"` + // AutoScale - This property and fixedScale are mutually exclusive and one of the properties must be specified. + AutoScale *AutoScaleSettings `json:"autoScale,omitempty"` +} + +// StartTask in some cases the start task may be re-run even though the node was not rebooted. Due to this, +// start tasks should be idempotent and exit gracefully if the setup they're performing has already been +// done. Special care should be taken to avoid start tasks which create breakaway process or install/launch +// services from the start task working directory, as this will block Batch from being able to re-run the +// start task. +type StartTask struct { + // CommandLine - The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. Required if any other properties of the startTask are specified. + CommandLine *string `json:"commandLine,omitempty"` + ResourceFiles *[]ResourceFile `json:"resourceFiles,omitempty"` + EnvironmentSettings *[]EnvironmentSetting `json:"environmentSettings,omitempty"` + // UserIdentity - If omitted, the task runs as a non-administrative user unique to the task. + UserIdentity *UserIdentity `json:"userIdentity,omitempty"` + // MaxTaskRetryCount - The Batch service retries a task if its exit code is nonzero. Note that this value specifically controls the number of retries. The Batch service will try the task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries the task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the task. If the maximum retry count is -1, the Batch service retries the task without limit. + MaxTaskRetryCount *int32 `json:"maxTaskRetryCount,omitempty"` + // WaitForSuccess - If true and the start task fails on a compute node, the Batch service retries the start task up to its maximum retry count (maxTaskRetryCount). If the task has still not completed successfully after all retries, then the Batch service marks the compute node unusable, and will not schedule tasks to it. This condition can be detected via the node state and scheduling error detail. If false, the Batch service will not wait for the start task to complete. In this case, other tasks can start executing on the compute node while the start task is still running; and even if the start task fails, new tasks will continue to be scheduled on the node. The default is true. + WaitForSuccess *bool `json:"waitForSuccess,omitempty"` + // ContainerSettings - When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container. + ContainerSettings *TaskContainerSettings `json:"containerSettings,omitempty"` +} + +// TaskContainerSettings ... +type TaskContainerSettings struct { + // ContainerRunOptions - These additional options are supplied as arguments to the "docker create" command, in addition to those controlled by the Batch Service. + ContainerRunOptions *string `json:"containerRunOptions,omitempty"` + // ImageName - This is the full image reference, as would be specified to "docker pull". If no tag is provided as part of the image name, the tag ":latest" is used as a default. + ImageName *string `json:"imageName,omitempty"` + // Registry - This setting can be omitted if was already provided at pool creation. + Registry *ContainerRegistry `json:"registry,omitempty"` + // WorkingDirectory - Possible values include: 'TaskWorkingDirectory', 'ContainerImageDefault' + WorkingDirectory ContainerWorkingDirectory `json:"workingDirectory,omitempty"` +} + +// TaskSchedulingPolicy ... +type TaskSchedulingPolicy struct { + // NodeFillType - Possible values include: 'Spread', 'Pack' + NodeFillType ComputeNodeFillType `json:"nodeFillType,omitempty"` +} + +// UserAccount ... +type UserAccount struct { + Name *string `json:"name,omitempty"` + Password *string `json:"password,omitempty"` + // ElevationLevel - nonAdmin - The auto user is a standard user without elevated access. admin - The auto user is a user with elevated access and operates with full Administrator permissions. The default value is nonAdmin. Possible values include: 'NonAdmin', 'Admin' + ElevationLevel ElevationLevel `json:"elevationLevel,omitempty"` + // LinuxUserConfiguration - This property is ignored if specified on a Windows pool. If not specified, the user is created with the default options. + LinuxUserConfiguration *LinuxUserConfiguration `json:"linuxUserConfiguration,omitempty"` + // WindowsUserConfiguration - This property can only be specified if the user is on a Windows pool. If not specified and on a Windows pool, the user is created with the default options. + WindowsUserConfiguration *WindowsUserConfiguration `json:"windowsUserConfiguration,omitempty"` +} + +// UserIdentity specify either the userName or autoUser property, but not both. +type UserIdentity struct { + // UserName - The userName and autoUser properties are mutually exclusive; you must specify one but not both. + UserName *string `json:"userName,omitempty"` + // AutoUser - The userName and autoUser properties are mutually exclusive; you must specify one but not both. + AutoUser *AutoUserSpecification `json:"autoUser,omitempty"` +} + +// VirtualMachineConfiguration ... +type VirtualMachineConfiguration struct { + ImageReference *ImageReference `json:"imageReference,omitempty"` + // NodeAgentSkuID - The Batch node agent is a program that runs on each node in the pool, and provides the command-and-control interface between the node and the Batch service. There are different implementations of the node agent, known as SKUs, for different operating systems. You must specify a node agent SKU which matches the selected image reference. To get the list of supported node agent SKUs along with their list of verified image references, see the 'List supported node agent SKUs' operation. + NodeAgentSkuID *string `json:"nodeAgentSkuId,omitempty"` + // WindowsConfiguration - This property must not be specified if the imageReference specifies a Linux OS image. + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` + // DataDisks - This property must be specified if the compute nodes in the pool need to have empty data disks attached to them. + DataDisks *[]DataDisk `json:"dataDisks,omitempty"` + // LicenseType - This only applies to images that contain the Windows operating system, and should only be used when you hold valid on-premises licenses for the nodes which will be deployed. If omitted, no on-premises licensing discount is applied. Values are: + // Windows_Server - The on-premises license is for Windows Server. + // Windows_Client - The on-premises license is for Windows Client. + LicenseType *string `json:"licenseType,omitempty"` + // ContainerConfiguration - If specified, setup is performed on each node in the pool to allow tasks to run in containers. All regular tasks and job manager tasks run on this pool must specify the containerSettings property, and all other tasks may specify it. + ContainerConfiguration *ContainerConfiguration `json:"containerConfiguration,omitempty"` + // DiskEncryptionConfiguration - If specified, encryption is performed on each node in the pool during node provisioning. + DiskEncryptionConfiguration *DiskEncryptionConfiguration `json:"diskEncryptionConfiguration,omitempty"` + // NodePlacementConfiguration - This configuration will specify rules on how nodes in the pool will be physically allocated. + NodePlacementConfiguration *NodePlacementConfiguration `json:"nodePlacementConfiguration,omitempty"` + // Extensions - If specified, the extensions mentioned in this configuration will be installed on each node. + Extensions *[]VMExtension `json:"extensions,omitempty"` +} + +// VirtualMachineFamilyCoreQuota a VM Family and its associated core quota for the Batch account. +type VirtualMachineFamilyCoreQuota struct { + // Name - READ-ONLY; The Virtual Machine family name. + Name *string `json:"name,omitempty"` + // CoreQuota - READ-ONLY; The core quota for the VM family for the Batch account. + CoreQuota *int32 `json:"coreQuota,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualMachineFamilyCoreQuota. +func (vmfcq VirtualMachineFamilyCoreQuota) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// VMExtension ... +type VMExtension struct { + Name *string `json:"name,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` + // AutoUpgradeMinorVersion - Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + Settings interface{} `json:"settings,omitempty"` + // ProtectedSettings - The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + ProtectedSettings interface{} `json:"protectedSettings,omitempty"` + // ProvisionAfterExtensions - Collection of extension names after which this extension needs to be provisioned. + ProvisionAfterExtensions *[]string `json:"provisionAfterExtensions,omitempty"` +} + +// WindowsConfiguration ... +type WindowsConfiguration struct { + // EnableAutomaticUpdates - If omitted, the default value is true. + EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` +} + +// WindowsUserConfiguration ... +type WindowsUserConfiguration struct { + // LoginMode - Specifies login mode for the user. The default value for VirtualMachineConfiguration pools is interactive mode and for CloudServiceConfiguration pools is batch mode. Possible values include: 'Batch', 'Interactive' + LoginMode LoginMode `json:"loginMode,omitempty"` +} diff --git a/services/batch/mgmt/2021-01-01/batch/operations.go b/services/batch/mgmt/2021-01-01/batch/operations.go new file mode 100644 index 000000000000..17cf940c1014 --- /dev/null +++ b/services/batch/mgmt/2021-01-01/batch/operations.go @@ -0,0 +1,140 @@ +package batch + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the client for the Operations methods of the Batch service. +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists available operations for the Microsoft.Batch provider +func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Batch/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/batch/mgmt/2021-01-01/batch/pool.go b/services/batch/mgmt/2021-01-01/batch/pool.go new file mode 100644 index 000000000000..e7e4b80db19b --- /dev/null +++ b/services/batch/mgmt/2021-01-01/batch/pool.go @@ -0,0 +1,790 @@ +package batch + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PoolClient is the client for the Pool methods of the Batch service. +type PoolClient struct { + BaseClient +} + +// NewPoolClient creates an instance of the PoolClient client. +func NewPoolClient(subscriptionID string) PoolClient { + return NewPoolClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPoolClientWithBaseURI creates an instance of the PoolClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewPoolClientWithBaseURI(baseURI string, subscriptionID string) PoolClient { + return PoolClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new pool inside the specified account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// poolName - the pool name. This must be unique within the account. +// parameters - additional parameters for pool creation. +// ifMatch - the entity state (ETag) version of the pool to update. A value of "*" can be used to apply the +// operation only if the pool already exists. If omitted, this operation will always be applied. +// ifNoneMatch - set to '*' to allow a new pool to be created, but to prevent updating an existing pool. Other +// values will be ignored. +func (client PoolClient) Create(ctx context.Context, resourceGroupName string, accountName string, poolName string, parameters Pool, ifMatch string, ifNoneMatch string) (result Pool, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.PoolProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.DeploymentConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.DeploymentConfiguration.CloudServiceConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.DeploymentConfiguration.CloudServiceConfiguration.OsFamily", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.PoolProperties.DeploymentConfiguration.VirtualMachineConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.DeploymentConfiguration.VirtualMachineConfiguration.ImageReference", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.PoolProperties.DeploymentConfiguration.VirtualMachineConfiguration.NodeAgentSkuID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.PoolProperties.DeploymentConfiguration.VirtualMachineConfiguration.ContainerConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.DeploymentConfiguration.VirtualMachineConfiguration.ContainerConfiguration.Type", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + }}, + {Target: "parameters.PoolProperties.ScaleSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.ScaleSettings.AutoScale", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.ScaleSettings.AutoScale.Formula", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "parameters.PoolProperties.AutoScaleRun", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.AutoScaleRun.EvaluationTime", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.PoolProperties.AutoScaleRun.Error", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.AutoScaleRun.Error.Code", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.PoolProperties.AutoScaleRun.Error.Message", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + {Target: "parameters.PoolProperties.NetworkConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.NetworkConfiguration.EndpointConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.NetworkConfiguration.EndpointConfiguration.InboundNatPools", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "parameters.PoolProperties.StartTask", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.StartTask.ContainerSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.StartTask.ContainerSettings.ImageName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.PoolProperties.StartTask.ContainerSettings.Registry", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PoolProperties.StartTask.ContainerSettings.Registry.UserName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.PoolProperties.StartTask.ContainerSettings.Registry.Password", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("batch.PoolClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, poolName, parameters, ifMatch, ifNoneMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client PoolClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, parameters Pool, ifMatch string, ifNoneMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client PoolClient) CreateResponder(resp *http.Response) (result Pool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified pool. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// poolName - the pool name. This must be unique within the account. +func (client PoolClient) Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result PoolDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.PoolClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, poolName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PoolClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) DeleteSender(req *http.Request) (future PoolDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PoolClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DisableAutoScale disables automatic scaling for a pool. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// poolName - the pool name. This must be unique within the account. +func (client PoolClient) DisableAutoScale(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result Pool, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.DisableAutoScale") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.PoolClient", "DisableAutoScale", err.Error()) + } + + req, err := client.DisableAutoScalePreparer(ctx, resourceGroupName, accountName, poolName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "DisableAutoScale", nil, "Failure preparing request") + return + } + + resp, err := client.DisableAutoScaleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.PoolClient", "DisableAutoScale", resp, "Failure sending request") + return + } + + result, err = client.DisableAutoScaleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "DisableAutoScale", resp, "Failure responding to request") + return + } + + return +} + +// DisableAutoScalePreparer prepares the DisableAutoScale request. +func (client PoolClient) DisableAutoScalePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/disableAutoScale", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DisableAutoScaleSender sends the DisableAutoScale request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) DisableAutoScaleSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DisableAutoScaleResponder handles the response to the DisableAutoScale request. The method always +// closes the http.Response Body. +func (client PoolClient) DisableAutoScaleResponder(resp *http.Response) (result Pool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets information about the specified pool. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// poolName - the pool name. This must be unique within the account. +func (client PoolClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result Pool, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.PoolClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, poolName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PoolClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PoolClient) GetResponder(resp *http.Response) (result Pool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByBatchAccount lists all of the pools in the specified account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// maxresults - the maximum number of items to return in the response. +// selectParameter - comma separated list of properties that should be returned. e.g. +// "properties/provisioningState". Only top level properties under properties/ are valid for selection. +// filter - oData filter expression. Valid properties for filtering are: +// +// name +// properties/allocationState +// properties/allocationStateTransitionTime +// properties/creationTime +// properties/provisioningState +// properties/provisioningStateTransitionTime +// properties/lastModified +// properties/vmSize +// properties/interNodeCommunication +// properties/scaleSettings/autoScale +// properties/scaleSettings/fixedScale +func (client PoolClient) ListByBatchAccount(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (result ListPoolsResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.ListByBatchAccount") + defer func() { + sc := -1 + if result.lpr.Response.Response != nil { + sc = result.lpr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.PoolClient", "ListByBatchAccount", err.Error()) + } + + result.fn = client.listByBatchAccountNextResults + req, err := client.ListByBatchAccountPreparer(ctx, resourceGroupName, accountName, maxresults, selectParameter, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "ListByBatchAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByBatchAccountSender(req) + if err != nil { + result.lpr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.PoolClient", "ListByBatchAccount", resp, "Failure sending request") + return + } + + result.lpr, err = client.ListByBatchAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "ListByBatchAccount", resp, "Failure responding to request") + return + } + if result.lpr.hasNextLink() && result.lpr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByBatchAccountPreparer prepares the ListByBatchAccount request. +func (client PoolClient) ListByBatchAccountPreparer(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByBatchAccountSender sends the ListByBatchAccount request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) ListByBatchAccountSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByBatchAccountResponder handles the response to the ListByBatchAccount request. The method always +// closes the http.Response Body. +func (client PoolClient) ListByBatchAccountResponder(resp *http.Response) (result ListPoolsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByBatchAccountNextResults retrieves the next set of results, if any. +func (client PoolClient) listByBatchAccountNextResults(ctx context.Context, lastResults ListPoolsResult) (result ListPoolsResult, err error) { + req, err := lastResults.listPoolsResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.PoolClient", "listByBatchAccountNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByBatchAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.PoolClient", "listByBatchAccountNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByBatchAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "listByBatchAccountNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByBatchAccountComplete enumerates all values, automatically crossing page boundaries as required. +func (client PoolClient) ListByBatchAccountComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32, selectParameter string, filter string) (result ListPoolsResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.ListByBatchAccount") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByBatchAccount(ctx, resourceGroupName, accountName, maxresults, selectParameter, filter) + return +} + +// StopResize this does not restore the pool to its previous state before the resize operation: it only stops any +// further changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the +// number of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state +// changes first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this +// API can also be used to halt the initial sizing of the pool when it is created. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// poolName - the pool name. This must be unique within the account. +func (client PoolClient) StopResize(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result Pool, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.StopResize") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.PoolClient", "StopResize", err.Error()) + } + + req, err := client.StopResizePreparer(ctx, resourceGroupName, accountName, poolName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "StopResize", nil, "Failure preparing request") + return + } + + resp, err := client.StopResizeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.PoolClient", "StopResize", resp, "Failure sending request") + return + } + + result, err = client.StopResizeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "StopResize", resp, "Failure responding to request") + return + } + + return +} + +// StopResizePreparer prepares the StopResize request. +func (client PoolClient) StopResizePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/stopResize", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopResizeSender sends the StopResize request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) StopResizeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// StopResizeResponder handles the response to the StopResize request. The method always +// closes the http.Response Body. +func (client PoolClient) StopResizeResponder(resp *http.Response) (result Pool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates the properties of an existing pool. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// poolName - the pool name. This must be unique within the account. +// parameters - pool properties that should be updated. Properties that are supplied will be updated, any +// property not supplied will be unchanged. +// ifMatch - the entity state (ETag) version of the pool to update. This value can be omitted or set to "*" to +// apply the operation unconditionally. +func (client PoolClient) Update(ctx context.Context, resourceGroupName string, accountName string, poolName string, parameters Pool, ifMatch string) (result Pool, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PoolClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: poolName, + Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.PoolClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, poolName, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client PoolClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, parameters Pool, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "poolName": autorest.Encode("path", poolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client PoolClient) UpdateResponder(resp *http.Response) (result Pool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/batch/mgmt/2021-01-01/batch/privateendpointconnection.go b/services/batch/mgmt/2021-01-01/batch/privateendpointconnection.go new file mode 100644 index 000000000000..2f879c747ccf --- /dev/null +++ b/services/batch/mgmt/2021-01-01/batch/privateendpointconnection.go @@ -0,0 +1,357 @@ +package batch + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateEndpointConnectionClient is the client for the PrivateEndpointConnection methods of the Batch service. +type PrivateEndpointConnectionClient struct { + BaseClient +} + +// NewPrivateEndpointConnectionClient creates an instance of the PrivateEndpointConnectionClient client. +func NewPrivateEndpointConnectionClient(subscriptionID string) PrivateEndpointConnectionClient { + return NewPrivateEndpointConnectionClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateEndpointConnectionClientWithBaseURI creates an instance of the PrivateEndpointConnectionClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewPrivateEndpointConnectionClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionClient { + return PrivateEndpointConnectionClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets information about the specified private endpoint connection. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// privateEndpointConnectionName - the private endpoint connection name. This must be unique within the +// account. +func (client PrivateEndpointConnectionClient) Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: privateEndpointConnectionName, + Constraints: []validation.Constraint{{Target: "privateEndpointConnectionName", Name: validation.MaxLength, Rule: 101, Chain: nil}, + {Target: "privateEndpointConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "privateEndpointConnectionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+\.?[a-fA-F0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.PrivateEndpointConnectionClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateEndpointConnectionClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByBatchAccount lists all of the private endpoint connections in the specified account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// maxresults - the maximum number of items to return in the response. +func (client PrivateEndpointConnectionClient) ListByBatchAccount(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result ListPrivateEndpointConnectionsResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionClient.ListByBatchAccount") + defer func() { + sc := -1 + if result.lpecr.Response.Response != nil { + sc = result.lpecr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.PrivateEndpointConnectionClient", "ListByBatchAccount", err.Error()) + } + + result.fn = client.listByBatchAccountNextResults + req, err := client.ListByBatchAccountPreparer(ctx, resourceGroupName, accountName, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "ListByBatchAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByBatchAccountSender(req) + if err != nil { + result.lpecr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "ListByBatchAccount", resp, "Failure sending request") + return + } + + result.lpecr, err = client.ListByBatchAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "ListByBatchAccount", resp, "Failure responding to request") + return + } + if result.lpecr.hasNextLink() && result.lpecr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByBatchAccountPreparer prepares the ListByBatchAccount request. +func (client PrivateEndpointConnectionClient) ListByBatchAccountPreparer(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByBatchAccountSender sends the ListByBatchAccount request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionClient) ListByBatchAccountSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByBatchAccountResponder handles the response to the ListByBatchAccount request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionClient) ListByBatchAccountResponder(resp *http.Response) (result ListPrivateEndpointConnectionsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByBatchAccountNextResults retrieves the next set of results, if any. +func (client PrivateEndpointConnectionClient) listByBatchAccountNextResults(ctx context.Context, lastResults ListPrivateEndpointConnectionsResult) (result ListPrivateEndpointConnectionsResult, err error) { + req, err := lastResults.listPrivateEndpointConnectionsResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "listByBatchAccountNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByBatchAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "listByBatchAccountNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByBatchAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "listByBatchAccountNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByBatchAccountComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateEndpointConnectionClient) ListByBatchAccountComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result ListPrivateEndpointConnectionsResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionClient.ListByBatchAccount") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByBatchAccount(ctx, resourceGroupName, accountName, maxresults) + return +} + +// Update updates the properties of an existing private endpoint connection. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// privateEndpointConnectionName - the private endpoint connection name. This must be unique within the +// account. +// parameters - privateEndpointConnection properties that should be updated. Properties that are supplied will +// be updated, any property not supplied will be unchanged. +// ifMatch - the state (ETag) version of the private endpoint connection to update. This value can be omitted +// or set to "*" to apply the operation unconditionally. +func (client PrivateEndpointConnectionClient) Update(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, ifMatch string) (result PrivateEndpointConnectionUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: privateEndpointConnectionName, + Constraints: []validation.Constraint{{Target: "privateEndpointConnectionName", Name: validation.MaxLength, Rule: 101, Chain: nil}, + {Target: "privateEndpointConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "privateEndpointConnectionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+\.?[a-fA-F0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.PrivateEndpointConnectionClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateEndpointConnectionClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client PrivateEndpointConnectionClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionClient) UpdateSender(req *http.Request) (future PrivateEndpointConnectionUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionClient) UpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/batch/mgmt/2021-01-01/batch/privatelinkresource.go b/services/batch/mgmt/2021-01-01/batch/privatelinkresource.go new file mode 100644 index 000000000000..69e38d29269f --- /dev/null +++ b/services/batch/mgmt/2021-01-01/batch/privatelinkresource.go @@ -0,0 +1,253 @@ +package batch + +// 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. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateLinkResourceClient is the client for the PrivateLinkResource methods of the Batch service. +type PrivateLinkResourceClient struct { + BaseClient +} + +// NewPrivateLinkResourceClient creates an instance of the PrivateLinkResourceClient client. +func NewPrivateLinkResourceClient(subscriptionID string) PrivateLinkResourceClient { + return NewPrivateLinkResourceClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateLinkResourceClientWithBaseURI creates an instance of the PrivateLinkResourceClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewPrivateLinkResourceClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourceClient { + return PrivateLinkResourceClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets information about the specified private link resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// privateLinkResourceName - the private link resource name. This must be unique within the account. +func (client PrivateLinkResourceClient) Get(ctx context.Context, resourceGroupName string, accountName string, privateLinkResourceName string) (result PrivateLinkResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: privateLinkResourceName, + Constraints: []validation.Constraint{{Target: "privateLinkResourceName", Name: validation.MaxLength, Rule: 101, Chain: nil}, + {Target: "privateLinkResourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "privateLinkResourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9_-]+\.?[a-fA-F0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.PrivateLinkResourceClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, privateLinkResourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateLinkResourceClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, privateLinkResourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "privateLinkResourceName": autorest.Encode("path", privateLinkResourceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources/{privateLinkResourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkResourceClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PrivateLinkResourceClient) GetResponder(resp *http.Response) (result PrivateLinkResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByBatchAccount lists all of the private link resources in the specified account. +// Parameters: +// resourceGroupName - the name of the resource group that contains the Batch account. +// accountName - the name of the Batch account. +// maxresults - the maximum number of items to return in the response. +func (client PrivateLinkResourceClient) ListByBatchAccount(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result ListPrivateLinkResourcesResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceClient.ListByBatchAccount") + defer func() { + sc := -1 + if result.lplrr.Response.Response != nil { + sc = result.lplrr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.PrivateLinkResourceClient", "ListByBatchAccount", err.Error()) + } + + result.fn = client.listByBatchAccountNextResults + req, err := client.ListByBatchAccountPreparer(ctx, resourceGroupName, accountName, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "ListByBatchAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByBatchAccountSender(req) + if err != nil { + result.lplrr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "ListByBatchAccount", resp, "Failure sending request") + return + } + + result.lplrr, err = client.ListByBatchAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "ListByBatchAccount", resp, "Failure responding to request") + return + } + if result.lplrr.hasNextLink() && result.lplrr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByBatchAccountPreparer prepares the ListByBatchAccount request. +func (client PrivateLinkResourceClient) ListByBatchAccountPreparer(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByBatchAccountSender sends the ListByBatchAccount request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkResourceClient) ListByBatchAccountSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByBatchAccountResponder handles the response to the ListByBatchAccount request. The method always +// closes the http.Response Body. +func (client PrivateLinkResourceClient) ListByBatchAccountResponder(resp *http.Response) (result ListPrivateLinkResourcesResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByBatchAccountNextResults retrieves the next set of results, if any. +func (client PrivateLinkResourceClient) listByBatchAccountNextResults(ctx context.Context, lastResults ListPrivateLinkResourcesResult) (result ListPrivateLinkResourcesResult, err error) { + req, err := lastResults.listPrivateLinkResourcesResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "listByBatchAccountNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByBatchAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "listByBatchAccountNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByBatchAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PrivateLinkResourceClient", "listByBatchAccountNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByBatchAccountComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateLinkResourceClient) ListByBatchAccountComplete(ctx context.Context, resourceGroupName string, accountName string, maxresults *int32) (result ListPrivateLinkResourcesResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceClient.ListByBatchAccount") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByBatchAccount(ctx, resourceGroupName, accountName, maxresults) + return +} diff --git a/services/batch/mgmt/2021-01-01/batch/version.go b/services/batch/mgmt/2021-01-01/batch/version.go new file mode 100644 index 000000000000..3afd40df385d --- /dev/null +++ b/services/batch/mgmt/2021-01-01/batch/version.go @@ -0,0 +1,19 @@ +package batch + +import "github.com/Azure/azure-sdk-for-go/version" + +// 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. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " batch/2021-01-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +}