From b0caa4082ee8f18f005f23a026488ef1a2460a0e Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 16 Mar 2018 21:25:55 +0000 Subject: [PATCH] Generated from fe0d6c7ba9732ae117300296e10286838a5757c1 Merge branch 'master' into keyvault_preview --- .../batch/2017-05-01.5.0/batch/account.go | 280 +- .../batch/2017-05-01.5.0/batch/application.go | 412 +- .../batch/2017-05-01.5.0/batch/certificate.go | 998 +-- services/batch/2017-05-01.5.0/batch/client.go | 26 +- .../batch/2017-05-01.5.0/batch/computenode.go | 2102 +++--- services/batch/2017-05-01.5.0/batch/file.go | 1774 ++--- services/batch/2017-05-01.5.0/batch/job.go | 2866 ++++---- .../batch/2017-05-01.5.0/batch/jobschedule.go | 2392 ++++--- services/batch/2017-05-01.5.0/batch/models.go | 6016 +++++++++-------- services/batch/2017-05-01.5.0/batch/pool.go | 3529 +++++----- services/batch/2017-05-01.5.0/batch/task.go | 1993 +++--- .../batch/2017-05-01.5.0/batch/version.go | 5 +- 12 files changed, 11233 insertions(+), 11160 deletions(-) diff --git a/services/batch/2017-05-01.5.0/batch/account.go b/services/batch/2017-05-01.5.0/batch/account.go index d760b0d7adab..bf652fdc7259 100644 --- a/services/batch/2017-05-01.5.0/batch/account.go +++ b/services/batch/2017-05-01.5.0/batch/account.go @@ -18,157 +18,157 @@ package batch // Changes may cause incorrect behavior and will be lost if the code is regenerated. import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" - "context" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/satori/go.uuid" - "github.com/Azure/go-autorest/autorest/date" + "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/satori/go.uuid" + "net/http" ) // AccountClient is the a client for issuing REST requests to the Azure Batch service. type AccountClient struct { - BaseClient + BaseClient } + // NewAccountClient creates an instance of the AccountClient client. func NewAccountClient() AccountClient { - return NewAccountClientWithBaseURI(DefaultBaseURI, ) + return NewAccountClientWithBaseURI(DefaultBaseURI) } // NewAccountClientWithBaseURI creates an instance of the AccountClient client. - func NewAccountClientWithBaseURI(baseURI string, ) AccountClient { - return AccountClient{ NewWithBaseURI(baseURI, )} - } +func NewAccountClientWithBaseURI(baseURI string) AccountClient { + return AccountClient{NewWithBaseURI(baseURI)} +} // ListNodeAgentSkus sends the list node agent skus request. - // - // filter is an OData $filter clause. maxResults is the maximum number of items to return in the response. A - // maximum of 1000 results will be returned. timeout is the maximum time that the server can spend processing the - // request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the client-request-id in the response. ocpDate is 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. +// +// filter is an OData $filter clause. maxResults is the maximum number of items to return in the response. A +// maximum of 1000 results will be returned. timeout is the maximum time that the server can spend processing the +// request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the client-request-id in the response. ocpDate is 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) ListNodeAgentSkus(ctx context.Context, filter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result AccountListNodeAgentSkusResultPage, err error) { - 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: 1000, Chain: nil }, - {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil }, - }}}}}); err != nil { - return result, validation.NewError("batch.AccountClient", "ListNodeAgentSkus", err.Error()) - } - - result.fn = client.listNodeAgentSkusNextResults - req, err := client.ListNodeAgentSkusPreparer(ctx, filter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListNodeAgentSkus", nil , "Failure preparing request") - return - } - - resp, err := client.ListNodeAgentSkusSender(req) - if err != nil { - result.alnasr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListNodeAgentSkus", resp, "Failure sending request") - return - } - - result.alnasr, err = client.ListNodeAgentSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListNodeAgentSkus", resp, "Failure responding to request") - } - - return - } - - // ListNodeAgentSkusPreparer prepares the ListNodeAgentSkus request. - func (client AccountClient) ListNodeAgentSkusPreparer(ctx context.Context, filter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - autorest.WithPath("/nodeagentskus"), - 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)) - } - - // ListNodeAgentSkusSender sends the ListNodeAgentSkus request. The method will close the - // http.Response Body if it receives an error. - func (client AccountClient) ListNodeAgentSkusSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - } - - // ListNodeAgentSkusResponder handles the response to the ListNodeAgentSkus request. The method always - // closes the http.Response Body. - func (client AccountClient) ListNodeAgentSkusResponder(resp *http.Response) (result AccountListNodeAgentSkusResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return - } - - // listNodeAgentSkusNextResults retrieves the next set of results, if any. - func (client AccountClient) listNodeAgentSkusNextResults(lastResults AccountListNodeAgentSkusResult) (result AccountListNodeAgentSkusResult, err error) { - req, err := lastResults.accountListNodeAgentSkusResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listNodeAgentSkusNextResults", nil , "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListNodeAgentSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listNodeAgentSkusNextResults", resp, "Failure sending next results request") - } - result, err = client.ListNodeAgentSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "listNodeAgentSkusNextResults", resp, "Failure responding to next results request") - } - return - } - - // ListNodeAgentSkusComplete enumerates all values, automatically crossing page boundaries as required. - func (client AccountClient) ListNodeAgentSkusComplete(ctx context.Context, filter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result AccountListNodeAgentSkusResultIterator, err error) { - result.page, err = client.ListNodeAgentSkus(ctx, filter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) - return - } + 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: 1000, Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("batch.AccountClient", "ListNodeAgentSkus", err.Error()) + } + + result.fn = client.listNodeAgentSkusNextResults + req, err := client.ListNodeAgentSkusPreparer(ctx, filter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListNodeAgentSkus", nil, "Failure preparing request") + return + } + + resp, err := client.ListNodeAgentSkusSender(req) + if err != nil { + result.alnasr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListNodeAgentSkus", resp, "Failure sending request") + return + } + + result.alnasr, err = client.ListNodeAgentSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListNodeAgentSkus", resp, "Failure responding to request") + } + + return +} +// ListNodeAgentSkusPreparer prepares the ListNodeAgentSkus request. +func (client AccountClient) ListNodeAgentSkusPreparer(ctx context.Context, filter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (*http.Request, error) { + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + autorest.WithPath("/nodeagentskus"), + 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)) +} + +// ListNodeAgentSkusSender sends the ListNodeAgentSkus request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) ListNodeAgentSkusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListNodeAgentSkusResponder handles the response to the ListNodeAgentSkus request. The method always +// closes the http.Response Body. +func (client AccountClient) ListNodeAgentSkusResponder(resp *http.Response) (result AccountListNodeAgentSkusResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNodeAgentSkusNextResults retrieves the next set of results, if any. +func (client AccountClient) listNodeAgentSkusNextResults(lastResults AccountListNodeAgentSkusResult) (result AccountListNodeAgentSkusResult, err error) { + req, err := lastResults.accountListNodeAgentSkusResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listNodeAgentSkusNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListNodeAgentSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "listNodeAgentSkusNextResults", resp, "Failure sending next results request") + } + result, err = client.ListNodeAgentSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "listNodeAgentSkusNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListNodeAgentSkusComplete enumerates all values, automatically crossing page boundaries as required. +func (client AccountClient) ListNodeAgentSkusComplete(ctx context.Context, filter string, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result AccountListNodeAgentSkusResultIterator, err error) { + result.page, err = client.ListNodeAgentSkus(ctx, filter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + return +} diff --git a/services/batch/2017-05-01.5.0/batch/application.go b/services/batch/2017-05-01.5.0/batch/application.go index 5b74659ee795..78369878794f 100644 --- a/services/batch/2017-05-01.5.0/batch/application.go +++ b/services/batch/2017-05-01.5.0/batch/application.go @@ -18,245 +18,245 @@ package batch // Changes may cause incorrect behavior and will be lost if the code is regenerated. import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" - "context" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/satori/go.uuid" - "github.com/Azure/go-autorest/autorest/date" + "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/satori/go.uuid" + "net/http" ) // ApplicationClient is the a client for issuing REST requests to the Azure Batch service. type ApplicationClient struct { - BaseClient + BaseClient } + // NewApplicationClient creates an instance of the ApplicationClient client. func NewApplicationClient() ApplicationClient { - return NewApplicationClientWithBaseURI(DefaultBaseURI, ) + return NewApplicationClientWithBaseURI(DefaultBaseURI) } // NewApplicationClientWithBaseURI creates an instance of the ApplicationClient client. - func NewApplicationClientWithBaseURI(baseURI string, ) ApplicationClient { - return ApplicationClient{ NewWithBaseURI(baseURI, )} - } +func NewApplicationClientWithBaseURI(baseURI string) ApplicationClient { + return ApplicationClient{NewWithBaseURI(baseURI)} +} // Get sends the get request. - // - // applicationID is the ID of the application. timeout is the maximum time that the server can spend processing the - // request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the client-request-id in the response. ocpDate is 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. +// +// applicationID is the ID of the application. timeout is the maximum time that the server can spend processing the +// request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the client-request-id in the response. ocpDate is 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) { - 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 - } + 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 - } + 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") - } + 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) { - pathParameters := map[string]interface{} { - "applicationId": autorest.Encode("path",applicationID), - } +// 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) { + pathParameters := map[string]interface{}{ + "applicationId": autorest.Encode("path", applicationID), + } - const APIVersion = "2017-05-01.5.0" - queryParameters := map[string]interface{} { - "api-version": APIVersion, - } - if timeout != nil { - queryParameters["timeout"] = autorest.Encode("query",*timeout) - } else { - queryParameters["timeout"] = autorest.Encode("query",30) - } + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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)) - } + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - } +// 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return - } +// 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, + client.ByInspecting(), + 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 application 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. - // - // maxResults is the maximum number of items to return in the response. A maximum of 1000 applications can be - // returned. timeout is the maximum time that the server can spend processing the request, in seconds. The default - // is 30 seconds. clientRequestID is 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 is whether the - // server should return the client-request-id in the response. ocpDate is 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. +// +// maxResults is the maximum number of items to return in the response. A maximum of 1000 applications can be +// returned. timeout is the maximum time that the server can spend processing the request, in seconds. The default +// is 30 seconds. clientRequestID is 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 is whether the +// server should return the client-request-id in the response. ocpDate is 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 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: 1000, Chain: nil }, - {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil }, - }}}}}); err != nil { - return result, validation.NewError("batch.ApplicationClient", "List", err.Error()) - } + 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: 1000, Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 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 - } + 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 - } + 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") - } + result.alr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", resp, "Failure responding to request") + } - 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) { - const APIVersion = "2017-05-01.5.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) - } + return +} - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - 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)) - } +// 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) { + const APIVersion = "2017-05-01.5.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) + } - // 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 autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - } + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + 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)) +} - // 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return - } +// 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 autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} - // listNextResults retrieves the next set of results, if any. - func (client ApplicationClient) listNextResults(lastResults ApplicationListResult) (result ApplicationListResult, err error) { - req, err := lastResults.applicationListResultPreparer() - 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 - } +// 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + 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) { - result.page, err = client.List(ctx, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) - return - } +// listNextResults retrieves the next set of results, if any. +func (client ApplicationClient) listNextResults(lastResults ApplicationListResult) (result ApplicationListResult, err error) { + req, err := lastResults.applicationListResultPreparer() + 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) { + result.page, err = client.List(ctx, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + return +} diff --git a/services/batch/2017-05-01.5.0/batch/certificate.go b/services/batch/2017-05-01.5.0/batch/certificate.go index 1b0f457cbd16..97f79b4a1bf2 100644 --- a/services/batch/2017-05-01.5.0/batch/certificate.go +++ b/services/batch/2017-05-01.5.0/batch/certificate.go @@ -18,216 +18,217 @@ package batch // Changes may cause incorrect behavior and will be lost if the code is regenerated. import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" - "context" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/satori/go.uuid" - "github.com/Azure/go-autorest/autorest/date" + "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/satori/go.uuid" + "net/http" ) // CertificateClient is the a client for issuing REST requests to the Azure Batch service. type CertificateClient struct { - BaseClient + BaseClient } + // NewCertificateClient creates an instance of the CertificateClient client. func NewCertificateClient() CertificateClient { - return NewCertificateClientWithBaseURI(DefaultBaseURI, ) + return NewCertificateClientWithBaseURI(DefaultBaseURI) } // NewCertificateClientWithBaseURI creates an instance of the CertificateClient client. - func NewCertificateClientWithBaseURI(baseURI string, ) CertificateClient { - return CertificateClient{ NewWithBaseURI(baseURI, )} - } +func NewCertificateClientWithBaseURI(baseURI string) CertificateClient { + return CertificateClient{NewWithBaseURI(baseURI)} +} // Add sends the add request. - // - // certificate is the certificate to be added. timeout is the maximum time that the server can spend processing the - // request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the client-request-id in the response. ocpDate is 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. +// +// certificate is the certificate to be added. timeout is the maximum time that the server can spend processing the +// request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the client-request-id in the response. ocpDate is 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 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 - } - - // 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) { - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusCreated), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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. - // - // thumbprintAlgorithm is the algorithm used to derive the thumbprint parameter. This must be sha1. thumbprint is - // the thumbprint of the certificate being deleted. timeout is the maximum time that the server can spend - // processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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. +// +// thumbprintAlgorithm is the algorithm used to derive the thumbprint parameter. This must be sha1. thumbprint is +// the thumbprint of the certificate being deleted. timeout is the maximum time that the server can spend +// processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "thumbprint": autorest.Encode("path",thumbprint), - "thumbprintAlgorithm": autorest.Encode("path",thumbprintAlgorithm), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "thumbprint": autorest.Encode("path", thumbprint), + "thumbprintAlgorithm": autorest.Encode("path", thumbprintAlgorithm), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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 @@ -236,320 +237,319 @@ func (client CertificateClient) CancelDeletion(ctx context.Context, thumbprintAl // 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. - // - // thumbprintAlgorithm is the algorithm used to derive the thumbprint parameter. This must be sha1. thumbprint is - // the thumbprint of the certificate to be deleted. timeout is the maximum time that the server can spend - // processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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. +// +// thumbprintAlgorithm is the algorithm used to derive the thumbprint parameter. This must be sha1. thumbprint is +// the thumbprint of the certificate to be deleted. timeout is the maximum time that the server can spend +// processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "thumbprint": autorest.Encode("path",thumbprint), - "thumbprintAlgorithm": autorest.Encode("path",thumbprintAlgorithm), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "thumbprint": autorest.Encode("path", thumbprint), + "thumbprintAlgorithm": autorest.Encode("path", thumbprintAlgorithm), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} // Get gets information about the specified certificate. - // - // thumbprintAlgorithm is the algorithm used to derive the thumbprint parameter. This must be sha1. thumbprint is - // the thumbprint of the certificate to get. selectParameter is an OData $select clause. timeout is the maximum - // time that the server can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is - // 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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. +// +// thumbprintAlgorithm is the algorithm used to derive the thumbprint parameter. This must be sha1. thumbprint is +// the thumbprint of the certificate to get. selectParameter is an OData $select clause. timeout is the maximum +// time that the server can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is +// 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "thumbprint": autorest.Encode("path",thumbprint), - "thumbprintAlgorithm": autorest.Encode("path",thumbprintAlgorithm), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "thumbprint": autorest.Encode("path", thumbprint), + "thumbprintAlgorithm": autorest.Encode("path", thumbprintAlgorithm), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} // List sends the list request. - // - // filter is an OData $filter clause. selectParameter is an OData $select clause. maxResults is the maximum number - // of items to return in the response. A maximum of 1000 certificates can be returned. timeout is the maximum time - // that the server can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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. +// +// filter is an OData $filter clause. selectParameter is an OData $select clause. maxResults is the maximum number +// of items to return in the response. A maximum of 1000 certificates can be returned. timeout is the maximum time +// that the server can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 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: 1000, Chain: nil }, - {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 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 - } - - // 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) { - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - 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(lastResults CertificateListResult) (result CertificateListResult, err error) { - req, err := lastResults.certificateListResultPreparer() - 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) { - result.page, err = client.List(ctx, filter, selectParameter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) - return - } + 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: 1000, Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 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 +} + +// 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) { + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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(lastResults CertificateListResult) (result CertificateListResult, err error) { + req, err := lastResults.certificateListResultPreparer() + 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) { + result.page, err = client.List(ctx, filter, selectParameter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + return +} diff --git a/services/batch/2017-05-01.5.0/batch/client.go b/services/batch/2017-05-01.5.0/batch/client.go index c5b63e8f4d38..a1a30e37bd8b 100644 --- a/services/batch/2017-05-01.5.0/batch/client.go +++ b/services/batch/2017-05-01.5.0/batch/client.go @@ -21,29 +21,29 @@ package batch // Changes may cause incorrect behavior and will be lost if the code is regenerated. import ( - "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest" ) const ( -// DefaultBaseURI is the default URI used for the service Batch -DefaultBaseURI = "https://batch.core.windows.net") + // DefaultBaseURI is the default URI used for the service Batch + DefaultBaseURI = "https://batch.core.windows.net" +) // BaseClient is the base client for Batch. type BaseClient struct { - autorest.Client - BaseURI string + autorest.Client + BaseURI string } // New creates an instance of the BaseClient client. -func New()BaseClient { - return NewWithBaseURI(DefaultBaseURI, ) +func New() BaseClient { + return NewWithBaseURI(DefaultBaseURI) } // NewWithBaseURI creates an instance of the BaseClient client. -func NewWithBaseURI(baseURI string, ) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - } +func NewWithBaseURI(baseURI string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + } } - diff --git a/services/batch/2017-05-01.5.0/batch/computenode.go b/services/batch/2017-05-01.5.0/batch/computenode.go index 3169dc4c53b2..aa92f1e7fefe 100644 --- a/services/batch/2017-05-01.5.0/batch/computenode.go +++ b/services/batch/2017-05-01.5.0/batch/computenode.go @@ -18,1104 +18,1104 @@ package batch // Changes may cause incorrect behavior and will be lost if the code is regenerated. import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" - "context" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/satori/go.uuid" - "github.com/Azure/go-autorest/autorest/date" + "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/satori/go.uuid" + "net/http" ) // ComputeNodeClient is the a client for issuing REST requests to the Azure Batch service. type ComputeNodeClient struct { - BaseClient + BaseClient } + // NewComputeNodeClient creates an instance of the ComputeNodeClient client. func NewComputeNodeClient() ComputeNodeClient { - return NewComputeNodeClientWithBaseURI(DefaultBaseURI, ) + return NewComputeNodeClientWithBaseURI(DefaultBaseURI) } // NewComputeNodeClientWithBaseURI creates an instance of the ComputeNodeClient client. - func NewComputeNodeClientWithBaseURI(baseURI string, ) ComputeNodeClient { - return ComputeNodeClient{ NewWithBaseURI(baseURI, )} - } +func NewComputeNodeClientWithBaseURI(baseURI string) ComputeNodeClient { + return ComputeNodeClient{NewWithBaseURI(baseURI)} +} // AddUser you can add a user account to a node only when it is in the idle or running state. - // - // poolID is the ID of the pool that contains the compute node. nodeID is the ID of the machine on which you want - // to create a user account. userParameter is the user account to be created. timeout is the maximum time that the - // server can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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. +// +// poolID is the ID of the pool that contains the compute node. nodeID is the ID of the machine on which you want +// to create a user account. userParameter is the user account to be created. timeout is the maximum time that the +// server can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "nodeId": autorest.Encode("path",nodeID), - "poolId": autorest.Encode("path",poolID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusCreated), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByClosing()) + result.Response = resp + return +} // DeleteUser you can delete a user account to a node only when it is in the idle or running state. - // - // poolID is the ID of the pool that contains the compute node. nodeID is the ID of the machine on which you want - // to delete a user account. userName is the name of the user account to delete. timeout is the maximum time that - // the server can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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. +// +// poolID is the ID of the pool that contains the compute node. nodeID is the ID of the machine on which you want +// to delete a user account. userName is the name of the user account to delete. timeout is the maximum time that +// the server can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "nodeId": autorest.Encode("path",nodeID), - "poolId": autorest.Encode("path",poolID), - "userName": autorest.Encode("path",userName), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} // DisableScheduling sends the disable scheduling request. - // - // poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node on which you - // want to disable task scheduling. nodeDisableSchedulingParameter is the parameters for the request. timeout is - // the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. - // clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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. +// +// poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node on which you +// want to disable task scheduling. nodeDisableSchedulingParameter is the parameters for the request. timeout is +// the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. +// clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "nodeId": autorest.Encode("path",nodeID), - "poolId": autorest.Encode("path",poolID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} // EnableScheduling sends the enable scheduling request. - // - // poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node on which you - // want to enable task scheduling. timeout is the maximum time that the server can spend processing the request, in - // seconds. The default is 30 seconds. clientRequestID is 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 - // is whether the server should return the client-request-id in the response. ocpDate is 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. +// +// poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node on which you +// want to enable task scheduling. timeout is the maximum time that the server can spend processing the request, in +// seconds. The default is 30 seconds. clientRequestID is 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 +// is whether the server should return the client-request-id in the response. ocpDate is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "nodeId": autorest.Encode("path",nodeID), - "poolId": autorest.Encode("path",poolID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} // Get sends the get request. - // - // poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node that you want - // to get information about. selectParameter is an OData $select clause. timeout is the maximum time that the - // server can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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. +// +// poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node that you want +// to get information about. selectParameter is an OData $select clause. timeout is the maximum time that the +// server can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "nodeId": autorest.Encode("path",nodeID), - "poolId": autorest.Encode("path",poolID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} // GetRemoteDesktop before you can access a node by using the RDP file, you must create a user account on the node. // This API can only be invoked on pools created with the cloud service configuration property. - // - // poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node for which you - // want to get the Remote Desktop Protocol file. timeout is the maximum time that the server can spend processing - // the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the client-request-id in the response. ocpDate is 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. +// +// poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node for which you +// want to get the Remote Desktop Protocol file. timeout is the maximum time that the server can spend processing +// the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the client-request-id in the response. ocpDate is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "nodeId": autorest.Encode("path",nodeID), - "poolId": autorest.Encode("path",poolID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} // GetRemoteLoginSettings before you can remotely login to a node using the remote login settings, you must create a // user account on the node. This API can be invoked only on pools created with the virtual machine configuration // property. - // - // poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node for which to - // obtain the remote login settings. timeout is the maximum time that the server can spend processing the request, - // in seconds. The default is 30 seconds. clientRequestID is 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 - // is whether the server should return the client-request-id in the response. ocpDate is 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. +// +// poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node for which to +// obtain the remote login settings. timeout is the maximum time that the server can spend processing the request, +// in seconds. The default is 30 seconds. clientRequestID is 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 +// is whether the server should return the client-request-id in the response. ocpDate is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "nodeId": autorest.Encode("path",nodeID), - "poolId": autorest.Encode("path",poolID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} // List sends the list request. - // - // poolID is the ID of the pool from which you want to list nodes. filter is an OData $filter clause.. - // selectParameter is an OData $select clause. maxResults is the maximum number of items to return in the response. - // A maximum of 1000 nodes can be returned. timeout is the maximum time that the server can spend processing the - // request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the client-request-id in the response. ocpDate is 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. +// +// poolID is the ID of the pool from which you want to list nodes. filter is an OData $filter clause.. +// selectParameter is an OData $select clause. maxResults is the maximum number of items to return in the response. +// A maximum of 1000 nodes can be returned. timeout is the maximum time that the server can spend processing the +// request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the client-request-id in the response. ocpDate is 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 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: 1000, Chain: nil }, - {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "poolId": autorest.Encode("path",poolID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - 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(lastResults ComputeNodeListResult) (result ComputeNodeListResult, err error) { - req, err := lastResults.computeNodeListResultPreparer() - 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) { - result.page, err = client.List(ctx, poolID, filter, selectParameter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) - return - } + 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: 1000, Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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(lastResults ComputeNodeListResult) (result ComputeNodeListResult, err error) { + req, err := lastResults.computeNodeListResultPreparer() + 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) { + result.page, err = client.List(ctx, poolID, filter, selectParameter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + return +} // Reboot you can restart a node only if it is in an idle or running state. - // - // poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node that you want - // to restart. nodeRebootParameter is the parameters for the request. timeout is the maximum time that the server - // can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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. +// +// poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node that you want +// to restart. nodeRebootParameter is the parameters for the request. timeout is the maximum time that the server +// can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "nodeId": autorest.Encode("path",nodeID), - "poolId": autorest.Encode("path",poolID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} // Reimage you can reinstall the operating system on a 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. - // - // poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node that you want - // to restart. nodeReimageParameter is the parameters for the request. timeout is the maximum time that the server - // can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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. +// +// poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node that you want +// to restart. nodeReimageParameter is the parameters for the request. timeout is the maximum time that the server +// can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "nodeId": autorest.Encode("path",nodeID), - "poolId": autorest.Encode("path",poolID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} // UpdateUser this operation replaces of all the updateable 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 node only when it is in the idle or running state. - // - // poolID is the ID of the pool that contains the compute node. nodeID is the ID of the machine on which you want - // to update a user account. userName is the name of the user account to update. nodeUpdateUserParameter is the - // parameters for the request. timeout is the maximum time that the server can spend processing the request, in - // seconds. The default is 30 seconds. clientRequestID is 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 - // is whether the server should return the client-request-id in the response. ocpDate is 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. +// +// poolID is the ID of the pool that contains the compute node. nodeID is the ID of the machine on which you want +// to update a user account. userName is the name of the user account to update. nodeUpdateUserParameter is the +// parameters for the request. timeout is the maximum time that the server can spend processing the request, in +// seconds. The default is 30 seconds. clientRequestID is 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 +// is whether the server should return the client-request-id in the response. ocpDate is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "nodeId": autorest.Encode("path",nodeID), - "poolId": autorest.Encode("path",poolID), - "userName": autorest.Encode("path",userName), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} +// 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) { + pathParameters := map[string]interface{}{ + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/batch/2017-05-01.5.0/batch/file.go b/services/batch/2017-05-01.5.0/batch/file.go index 0f39b46ef6a1..ffaa3c700b1a 100644 --- a/services/batch/2017-05-01.5.0/batch/file.go +++ b/services/batch/2017-05-01.5.0/batch/file.go @@ -18,925 +18,925 @@ package batch // Changes may cause incorrect behavior and will be lost if the code is regenerated. import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" - "context" - "github.com/satori/go.uuid" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/validation" + "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/satori/go.uuid" + "net/http" ) // FileClient is the a client for issuing REST requests to the Azure Batch service. type FileClient struct { - BaseClient + BaseClient } + // NewFileClient creates an instance of the FileClient client. func NewFileClient() FileClient { - return NewFileClientWithBaseURI(DefaultBaseURI, ) + return NewFileClientWithBaseURI(DefaultBaseURI) } // NewFileClientWithBaseURI creates an instance of the FileClient client. - func NewFileClientWithBaseURI(baseURI string, ) FileClient { - return FileClient{ NewWithBaseURI(baseURI, )} - } +func NewFileClientWithBaseURI(baseURI string) FileClient { + return FileClient{NewWithBaseURI(baseURI)} +} // DeleteFromComputeNode sends the delete from compute node request. - // - // poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node from which you - // want to delete the file. filePath is the path to the file that you want to delete. recursive is 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 is the maximum time that the server can spend - // processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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. +// +// poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node from which you +// want to delete the file. filePath is the path to the file that you want to delete. recursive is 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 is the maximum time that the server can spend +// processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "filePath": autorest.Encode("path",filePath), - "nodeId": autorest.Encode("path",nodeID), - "poolId": autorest.Encode("path",poolID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "filePath": autorest.Encode("path", filePath), + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} // DeleteFromTask sends the delete from task request. - // - // jobID is the ID of the job that contains the task. taskID is the ID of the task whose file you want to delete. - // filePath is the path to the task file that you want to delete. recursive is 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 is the maximum time that the server can spend processing the - // request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the client-request-id in the response. ocpDate is 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. +// +// jobID is the ID of the job that contains the task. taskID is the ID of the task whose file you want to delete. +// filePath is the path to the task file that you want to delete. recursive is 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 is the maximum time that the server can spend processing the +// request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the client-request-id in the response. ocpDate is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "filePath": autorest.Encode("path",filePath), - "jobId": autorest.Encode("path",jobID), - "taskId": autorest.Encode("path",taskID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "filePath": autorest.Encode("path", filePath), + "jobId": autorest.Encode("path", jobID), + "taskId": autorest.Encode("path", taskID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} // GetFromComputeNode returns the content of the specified compute node file. - // - // poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node that contains - // the file. filePath is the path to the compute node file that you want to get the content of. timeout is the - // maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. - // clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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 is - // the byte range to be retrieved. The default is to retrieve the entire file. The format is - // bytes=startRange-endRange. ifModifiedSince is 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 is 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. +// +// poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node that contains +// the file. filePath is the path to the compute node file that you want to get the content of. timeout is the +// maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. +// clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 is +// the byte range to be retrieved. The default is to retrieve the entire file. The format is +// bytes=startRange-endRange. ifModifiedSince is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "filePath": autorest.Encode("path",filePath), - "nodeId": autorest.Encode("path",nodeID), - "poolId": autorest.Encode("path",poolID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "filePath": autorest.Encode("path", filePath), + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} // GetFromTask returns the content of the specified task file. - // - // jobID is the ID of the job that contains the task. taskID is the ID of the task whose file you want to retrieve. - // filePath is the path to the task file that you want to get the content of. timeout is the maximum time that the - // server can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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 is - // the byte range to be retrieved. The default is to retrieve the entire file. The format is - // bytes=startRange-endRange. ifModifiedSince is 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 is 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. +// +// jobID is the ID of the job that contains the task. taskID is the ID of the task whose file you want to retrieve. +// filePath is the path to the task file that you want to get the content of. timeout is the maximum time that the +// server can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 is +// the byte range to be retrieved. The default is to retrieve the entire file. The format is +// bytes=startRange-endRange. ifModifiedSince is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "filePath": autorest.Encode("path",filePath), - "jobId": autorest.Encode("path",jobID), - "taskId": autorest.Encode("path",taskID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "filePath": autorest.Encode("path", filePath), + "jobId": autorest.Encode("path", jobID), + "taskId": autorest.Encode("path", taskID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} // GetPropertiesFromComputeNode gets the properties of the specified compute node file. - // - // poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node that contains - // the file. filePath is the path to the compute node file that you want to get the properties of. timeout is the - // maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. - // clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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 is 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 is 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. +// +// poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node that contains +// the file. filePath is the path to the compute node file that you want to get the properties of. timeout is the +// maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. +// clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "filePath": autorest.Encode("path",filePath), - "nodeId": autorest.Encode("path",nodeID), - "poolId": autorest.Encode("path",poolID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "filePath": autorest.Encode("path", filePath), + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} // GetPropertiesFromTask gets the properties of the specified task file. - // - // jobID is the ID of the job that contains the task. taskID is the ID of the task whose file you want to get the - // properties of. filePath is the path to the task file that you want to get the properties of. timeout is the - // maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. - // clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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 is 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 is 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. +// +// jobID is the ID of the job that contains the task. taskID is the ID of the task whose file you want to get the +// properties of. filePath is the path to the task file that you want to get the properties of. timeout is the +// maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. +// clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "filePath": autorest.Encode("path",filePath), - "jobId": autorest.Encode("path",jobID), - "taskId": autorest.Encode("path",taskID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "filePath": autorest.Encode("path", filePath), + "jobId": autorest.Encode("path", jobID), + "taskId": autorest.Encode("path", taskID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} // ListFromComputeNode sends the list from compute node request. - // - // poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node whose files - // you want to list. filter is an OData $filter clause. recursive is whether to list children of a directory. - // maxResults is the maximum number of items to return in the response. A maximum of 1000 files can be returned. - // timeout is the maximum time that the server can spend processing the request, in seconds. The default is 30 - // seconds. clientRequestID is 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 is whether the server should - // return the client-request-id in the response. ocpDate is 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. +// +// poolID is the ID of the pool that contains the compute node. nodeID is the ID of the compute node whose files +// you want to list. filter is an OData $filter clause. recursive is whether to list children of a directory. +// maxResults is the maximum number of items to return in the response. A maximum of 1000 files can be returned. +// timeout is the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. clientRequestID is 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 is whether the server should +// return the client-request-id in the response. ocpDate is 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 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: 1000, Chain: nil }, - {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "nodeId": autorest.Encode("path",nodeID), - "poolId": autorest.Encode("path",poolID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - 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(lastResults NodeFileListResult) (result NodeFileListResult, err error) { - req, err := lastResults.nodeFileListResultPreparer() - 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) { - result.page, err = client.ListFromComputeNode(ctx, poolID, nodeID, filter, recursive, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) - return - } + 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: 1000, Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "nodeId": autorest.Encode("path", nodeID), + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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(lastResults NodeFileListResult) (result NodeFileListResult, err error) { + req, err := lastResults.nodeFileListResultPreparer() + 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) { + result.page, err = client.ListFromComputeNode(ctx, poolID, nodeID, filter, recursive, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + return +} // ListFromTask sends the list from task request. - // - // jobID is the ID of the job that contains the task. taskID is the ID of the task whose files you want to list. - // filter is an OData $filter clause. recursive is whether to list children of a directory. This parameter can be - // used in combination with the filter parameter to list specific type of files. maxResults is the maximum number - // of items to return in the response. A maximum of 1000 files can be returned. timeout is the maximum time that - // the server can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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. +// +// jobID is the ID of the job that contains the task. taskID is the ID of the task whose files you want to list. +// filter is an OData $filter clause. recursive is whether to list children of a directory. This parameter can be +// used in combination with the filter parameter to list specific type of files. maxResults is the maximum number +// of items to return in the response. A maximum of 1000 files can be returned. timeout is the maximum time that +// the server can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 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: 1000, Chain: nil }, - {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobId": autorest.Encode("path",jobID), - "taskId": autorest.Encode("path",taskID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - 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(lastResults NodeFileListResult) (result NodeFileListResult, err error) { - req, err := lastResults.nodeFileListResultPreparer() - 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) { - result.page, err = client.ListFromTask(ctx, jobID, taskID, filter, recursive, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) - return - } + 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: 1000, Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 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 +} +// 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) { + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + "taskId": autorest.Encode("path", taskID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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(lastResults NodeFileListResult) (result NodeFileListResult, err error) { + req, err := lastResults.nodeFileListResultPreparer() + 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) { + result.page, err = client.ListFromTask(ctx, jobID, taskID, filter, recursive, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + return +} diff --git a/services/batch/2017-05-01.5.0/batch/job.go b/services/batch/2017-05-01.5.0/batch/job.go index c6506f4baf87..0494c311fefa 100644 --- a/services/batch/2017-05-01.5.0/batch/job.go +++ b/services/batch/2017-05-01.5.0/batch/job.go @@ -18,28 +18,29 @@ package batch // Changes may cause incorrect behavior and will be lost if the code is regenerated. import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" - "context" - "github.com/satori/go.uuid" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/validation" + "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/satori/go.uuid" + "net/http" ) // JobClient is the a client for issuing REST requests to the Azure Batch service. type JobClient struct { - BaseClient + BaseClient } + // NewJobClient creates an instance of the JobClient client. func NewJobClient() JobClient { - return NewJobClientWithBaseURI(DefaultBaseURI, ) + return NewJobClientWithBaseURI(DefaultBaseURI) } // NewJobClientWithBaseURI creates an instance of the JobClient client. - func NewJobClientWithBaseURI(baseURI string, ) JobClient { - return JobClient{ NewWithBaseURI(baseURI, )} - } +func NewJobClientWithBaseURI(baseURI string) JobClient { + return JobClient{NewWithBaseURI(baseURI)} +} // 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 @@ -47,244 +48,239 @@ func NewJobClient() JobClient { // 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. - // - // job is the job to be added. timeout is the maximum time that the server can spend processing the request, in - // seconds. The default is 30 seconds. clientRequestID is 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 - // is whether the server should return the client-request-id in the response. ocpDate is 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. +// +// job is the job to be added. timeout is the maximum time that the server can spend processing the request, in +// seconds. The default is 30 seconds. clientRequestID is 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 +// is whether the server should return the client-request-id in the response. ocpDate is 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 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.JobPreparationTask", Name: validation.Null, Rule: false , - Chain: []validation.Constraint{ {Target: "job.JobPreparationTask.CommandLine", 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.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: false , - Chain: []validation.Constraint{ {Target: "job.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Publisher", Name: validation.Null, Rule: true, Chain: nil }, - {Target: "job.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Offer", Name: validation.Null, Rule: true, Chain: nil }, - {Target: "job.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Sku", Name: validation.Null, Rule: true, Chain: nil }, - }}, - {Target: "job.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.OsDisk", Name: validation.Null, Rule: false , - Chain: []validation.Constraint{ {Target: "job.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.OsDisk.ImageUris", 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.StartTask", Name: validation.Null, Rule: false , - Chain: []validation.Constraint{ {Target: "job.PoolInfo.AutoPoolSpecification.Pool.StartTask.CommandLine", 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 - } - - // 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) { - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusCreated), - autorest.ByClosing()) - result.Response = resp - return - } + 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.JobPreparationTask", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "job.JobPreparationTask.CommandLine", 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.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: false, + Chain: []validation.Constraint{{Target: "job.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Publisher", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "job.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Offer", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "job.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Sku", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "job.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.OsDisk", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "job.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.OsDisk.ImageUris", 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.StartTask", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "job.PoolInfo.AutoPoolSpecification.Pool.StartTask.CommandLine", 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 +} + +// 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) { + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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. - // - // jobID is the ID of the job to delete. timeout is the maximum time that the server can spend processing the - // request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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. +// +// jobID is the ID of the job to delete. timeout is the maximum time that the server can spend processing the +// request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobId": autorest.Encode("path",jobID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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 @@ -292,1236 +288,1232 @@ func (client JobClient) Delete(ctx context.Context, jobID string, timeout *int32 // 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. - // - // jobID is the ID of the job to disable. jobDisableParameter is the parameters for the request. timeout is the - // maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. - // clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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 is 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 is - // 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 is 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 is 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. +// +// jobID is the ID of the job to disable. jobDisableParameter is the parameters for the request. timeout is the +// maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. +// clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 is 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 is +// 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobId": autorest.Encode("path",jobID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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 7 days. Therefore, if you enable a job // containing active tasks which were added more than 7 days ago, those tasks will not run. - // - // jobID is the ID of the job to enable. timeout is the maximum time that the server can spend processing the - // request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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. +// +// jobID is the ID of the job to enable. timeout is the maximum time that the server can spend processing the +// request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobId": autorest.Encode("path",jobID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} // Get sends the get request. - // - // jobID is the ID of the job. selectParameter is an OData $select clause. expand is an OData $expand clause. - // timeout is the maximum time that the server can spend processing the request, in seconds. The default is 30 - // seconds. clientRequestID is 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 is whether the server should - // return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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. +// +// jobID is the ID of the job. selectParameter is an OData $select clause. expand is an OData $expand clause. +// timeout is the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. clientRequestID is 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 is whether the server should +// return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobId": autorest.Encode("path",jobID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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. - // - // timeout is the maximum time that the server can spend processing the request, in seconds. The default is 30 - // seconds. clientRequestID is 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 is whether the server should - // return the client-request-id in the response. ocpDate is 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. +// +// timeout is the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. clientRequestID is 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 is whether the server should +// return the client-request-id in the response. ocpDate is 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) { - 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 - } - - // 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) { - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return - } + 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 +} + +// 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) { + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} // List sends the list request. - // - // filter is an OData $filter clause. selectParameter is an OData $select clause. expand is an OData $expand - // clause. maxResults is the maximum number of items to return in the response. A maximum of 1000 jobs can be - // returned. timeout is the maximum time that the server can spend processing the request, in seconds. The default - // is 30 seconds. clientRequestID is 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 is whether the - // server should return the client-request-id in the response. ocpDate is 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. +// +// filter is an OData $filter clause. selectParameter is an OData $select clause. expand is an OData $expand +// clause. maxResults is the maximum number of items to return in the response. A maximum of 1000 jobs can be +// returned. timeout is the maximum time that the server can spend processing the request, in seconds. The default +// is 30 seconds. clientRequestID is 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 is whether the +// server should return the client-request-id in the response. ocpDate is 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 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: 1000, Chain: nil }, - {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 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 - } - - // 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) { - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - 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(lastResults CloudJobListResult) (result CloudJobListResult, err error) { - req, err := lastResults.cloudJobListResultPreparer() - 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) { - result.page, err = client.List(ctx, filter, selectParameter, expand, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) - return - } + 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: 1000, Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 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 +} + +// 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) { + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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(lastResults CloudJobListResult) (result CloudJobListResult, err error) { + req, err := lastResults.cloudJobListResultPreparer() + 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) { + result.page, err = client.List(ctx, filter, selectParameter, expand, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) + return +} // ListFromJobSchedule sends the list from job schedule request. - // - // jobScheduleID is the ID of the job schedule from which you want to get a list of jobs. filter is an OData - // $filter clause. selectParameter is an OData $select clause. expand is an OData $expand clause. maxResults is the - // maximum number of items to return in the response. A maximum of 1000 jobs can be returned. timeout is the - // maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. - // clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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. +// +// jobScheduleID is the ID of the job schedule from which you want to get a list of jobs. filter is an OData +// $filter clause. selectParameter is an OData $select clause. expand is an OData $expand clause. maxResults is the +// maximum number of items to return in the response. A maximum of 1000 jobs can be returned. timeout is the +// maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. +// clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 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: 1000, Chain: nil }, - {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobScheduleId": autorest.Encode("path",jobScheduleID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - 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(lastResults CloudJobListResult) (result CloudJobListResult, err error) { - req, err := lastResults.cloudJobListResultPreparer() - 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) { - result.page, err = client.ListFromJobSchedule(ctx, jobScheduleID, filter, selectParameter, expand, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) - return - } + 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: 1000, Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "jobScheduleId": autorest.Encode("path", jobScheduleID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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(lastResults CloudJobListResult) (result CloudJobListResult, err error) { + req, err := lastResults.cloudJobListResultPreparer() + 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) { + 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 nodes which have since been removed from // the pool. - // - // jobID is the ID of the job. filter is an OData $filter clause. selectParameter is an OData $select clause. - // maxResults is the maximum number of items to return in the response. A maximum of 1000 tasks can be returned. - // timeout is the maximum time that the server can spend processing the request, in seconds. The default is 30 - // seconds. clientRequestID is 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 is whether the server should - // return the client-request-id in the response. ocpDate is 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. +// +// jobID is the ID of the job. filter is an OData $filter clause. selectParameter is an OData $select clause. +// maxResults is the maximum number of items to return in the response. A maximum of 1000 tasks can be returned. +// timeout is the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. clientRequestID is 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 is whether the server should +// return the client-request-id in the response. ocpDate is 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 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: 1000, Chain: nil }, - {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobId": autorest.Encode("path",jobID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - 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(lastResults CloudJobListPreparationAndReleaseTaskStatusResult) (result CloudJobListPreparationAndReleaseTaskStatusResult, err error) { - req, err := lastResults.cloudJobListPreparationAndReleaseTaskStatusResultPreparer() - 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) { - result.page, err = client.ListPreparationAndReleaseTaskStatus(ctx, jobID, filter, selectParameter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) - return - } + 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: 1000, Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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(lastResults CloudJobListPreparationAndReleaseTaskStatusResult) (result CloudJobListPreparationAndReleaseTaskStatusResult, err error) { + req, err := lastResults.cloudJobListPreparationAndReleaseTaskStatusResultPreparer() + 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) { + 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. - // - // jobID is the ID of the job whose properties you want to update. jobPatchParameter is the parameters for the - // request. timeout is the maximum time that the server can spend processing the request, in seconds. The default - // is 30 seconds. clientRequestID is 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 is whether the - // server should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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. +// +// jobID is the ID of the job whose properties you want to update. jobPatchParameter is the parameters for the +// request. timeout is the maximum time that the server can spend processing the request, in seconds. The default +// is 30 seconds. clientRequestID is 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 is whether the +// server should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobId": autorest.Encode("path",jobID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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 active or running tasks associated with the job, and runs any required Job Release // tasks. The job then moves into the completed state. - // - // jobID is the ID of the job to terminate. jobTerminateParameter is the parameters for the request. timeout is the - // maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. - // clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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 is 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 is - // 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 is 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 is 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. +// +// jobID is the ID of the job to terminate. jobTerminateParameter is the parameters for the request. timeout is the +// maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. +// clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 is 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 is +// 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobId": autorest.Encode("path",jobID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} // Update this fully replaces all the updateable 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. - // - // jobID is the ID of the job whose properties you want to update. jobUpdateParameter is the parameters for the - // request. timeout is the maximum time that the server can spend processing the request, in seconds. The default - // is 30 seconds. clientRequestID is 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 is whether the - // server should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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. +// +// jobID is the ID of the job whose properties you want to update. jobUpdateParameter is the parameters for the +// request. timeout is the maximum time that the server can spend processing the request, in seconds. The default +// is 30 seconds. clientRequestID is 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 is whether the +// server should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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 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: false , - Chain: []validation.Constraint{ {Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Publisher", Name: validation.Null, Rule: true, Chain: nil }, - {Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Offer", Name: validation.Null, Rule: true, Chain: nil }, - {Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Sku", Name: validation.Null, Rule: true, Chain: nil }, - }}, - {Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.OsDisk", Name: validation.Null, Rule: false , - Chain: []validation.Constraint{ {Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.OsDisk.ImageUris", 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.StartTask", Name: validation.Null, Rule: false , - Chain: []validation.Constraint{ {Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.StartTask.CommandLine", 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobId": autorest.Encode("path",jobID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return - } + 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: false, + Chain: []validation.Constraint{{Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Publisher", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Offer", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Sku", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.OsDisk", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.OsDisk.ImageUris", 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.StartTask", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobUpdateParameter.PoolInfo.AutoPoolSpecification.Pool.StartTask.CommandLine", 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/batch/2017-05-01.5.0/batch/jobschedule.go b/services/batch/2017-05-01.5.0/batch/jobschedule.go index b30a944abbb8..46a3df5741bf 100644 --- a/services/batch/2017-05-01.5.0/batch/jobschedule.go +++ b/services/batch/2017-05-01.5.0/batch/jobschedule.go @@ -18,1254 +18,1244 @@ package batch // Changes may cause incorrect behavior and will be lost if the code is regenerated. import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" - "context" - "github.com/satori/go.uuid" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/validation" + "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/satori/go.uuid" + "net/http" ) // JobScheduleClient is the a client for issuing REST requests to the Azure Batch service. type JobScheduleClient struct { - BaseClient + BaseClient } + // NewJobScheduleClient creates an instance of the JobScheduleClient client. func NewJobScheduleClient() JobScheduleClient { - return NewJobScheduleClientWithBaseURI(DefaultBaseURI, ) + return NewJobScheduleClientWithBaseURI(DefaultBaseURI) } // NewJobScheduleClientWithBaseURI creates an instance of the JobScheduleClient client. - func NewJobScheduleClientWithBaseURI(baseURI string, ) JobScheduleClient { - return JobScheduleClient{ NewWithBaseURI(baseURI, )} - } +func NewJobScheduleClientWithBaseURI(baseURI string) JobScheduleClient { + return JobScheduleClient{NewWithBaseURI(baseURI)} +} // Add sends the add request. - // - // cloudJobSchedule is the job schedule to be added. timeout is the maximum time that the server can spend - // processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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. +// +// cloudJobSchedule is the job schedule to be added. timeout is the maximum time that the server can spend +// processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 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.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.JobPreparationTask", Name: validation.Null, Rule: false , - Chain: []validation.Constraint{ {Target: "cloudJobSchedule.JobSpecification.JobPreparationTask.CommandLine", 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.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: false , - Chain: []validation.Constraint{ {Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Publisher", Name: validation.Null, Rule: true, Chain: nil }, - {Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Offer", Name: validation.Null, Rule: true, Chain: nil }, - {Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Sku", Name: validation.Null, Rule: true, Chain: nil }, - }}, - {Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.OsDisk", Name: validation.Null, Rule: false , - Chain: []validation.Constraint{ {Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.OsDisk.ImageUris", 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.StartTask", Name: validation.Null, Rule: false , - Chain: []validation.Constraint{ {Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.StartTask.CommandLine", 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 - } - - // 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) { - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusCreated), - autorest.ByClosing()) - result.Response = resp - return - } + 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.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.JobPreparationTask", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.JobPreparationTask.CommandLine", 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.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: false, + Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Publisher", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Offer", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Sku", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.OsDisk", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.OsDisk.ImageUris", 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.StartTask", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cloudJobSchedule.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.StartTask.CommandLine", 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 +} + +// 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) { + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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. - // - // jobScheduleID is the ID of the job schedule to delete. timeout is the maximum time that the server can spend - // processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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 is 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 is - // 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 is 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 is 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. +// +// jobScheduleID is the ID of the job schedule to delete. timeout is the maximum time that the server can spend +// processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 is 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 is +// 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobScheduleId": autorest.Encode("path",jobScheduleID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "jobScheduleId": autorest.Encode("path", jobScheduleID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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. - // - // jobScheduleID is the ID of the job schedule to disable. timeout is the maximum time that the server can spend - // processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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 is 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 is - // 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 is 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 is 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. +// +// jobScheduleID is the ID of the job schedule to disable. timeout is the maximum time that the server can spend +// processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 is 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 is +// 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobScheduleId": autorest.Encode("path",jobScheduleID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "jobScheduleId": autorest.Encode("path", jobScheduleID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} // Enable sends the enable request. - // - // jobScheduleID is the ID of the job schedule to enable. timeout is the maximum time that the server can spend - // processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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 is 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 is - // 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 is 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 is 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. +// +// jobScheduleID is the ID of the job schedule to enable. timeout is the maximum time that the server can spend +// processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 is 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 is +// 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobScheduleId": autorest.Encode("path",jobScheduleID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "jobScheduleId": autorest.Encode("path", jobScheduleID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} // Exists sends the exists request. - // - // jobScheduleID is the ID of the job schedule which you want to check. timeout is the maximum time that the server - // can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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 is 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 is - // 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 is 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 is 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. +// +// jobScheduleID is the ID of the job schedule which you want to check. timeout is the maximum time that the server +// can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 is 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 is +// 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobScheduleId": autorest.Encode("path",jobScheduleID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "jobScheduleId": autorest.Encode("path", jobScheduleID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} // Get gets information about the specified job schedule. - // - // jobScheduleID is the ID of the job schedule to get. selectParameter is an OData $select clause. expand is an - // OData $expand clause. timeout is the maximum time that the server can spend processing the request, in seconds. - // The default is 30 seconds. clientRequestID is 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 is whether - // the server should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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. +// +// jobScheduleID is the ID of the job schedule to get. selectParameter is an OData $select clause. expand is an +// OData $expand clause. timeout is the maximum time that the server can spend processing the request, in seconds. +// The default is 30 seconds. clientRequestID is 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 is whether +// the server should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobScheduleId": autorest.Encode("path",jobScheduleID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "jobScheduleId": autorest.Encode("path", jobScheduleID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} // List sends the list request. - // - // filter is an OData $filter clause. selectParameter is an OData $select clause. expand is an OData $expand - // clause. maxResults is the maximum number of items to return in the response. A maximum of 1000 job schedules can - // be returned. timeout is the maximum time that the server can spend processing the request, in seconds. The - // default is 30 seconds. clientRequestID is 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 is whether the - // server should return the client-request-id in the response. ocpDate is 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. +// +// filter is an OData $filter clause. selectParameter is an OData $select clause. expand is an OData $expand +// clause. maxResults is the maximum number of items to return in the response. A maximum of 1000 job schedules can +// be returned. timeout is the maximum time that the server can spend processing the request, in seconds. The +// default is 30 seconds. clientRequestID is 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 is whether the +// server should return the client-request-id in the response. ocpDate is 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 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: 1000, Chain: nil }, - {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 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 - } - - // 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) { - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - 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(lastResults CloudJobScheduleListResult) (result CloudJobScheduleListResult, err error) { - req, err := lastResults.cloudJobScheduleListResultPreparer() - 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) { - result.page, err = client.List(ctx, filter, selectParameter, expand, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) - return - } + 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: 1000, Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 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 +} + +// 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) { + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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(lastResults CloudJobScheduleListResult) (result CloudJobScheduleListResult, err error) { + req, err := lastResults.cloudJobScheduleListResultPreparer() + 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) { + 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. - // - // jobScheduleID is the ID of the job schedule to update. jobSchedulePatchParameter is the parameters for the - // request. timeout is the maximum time that the server can spend processing the request, in seconds. The default - // is 30 seconds. clientRequestID is 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 is whether the - // server should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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. +// +// jobScheduleID is the ID of the job schedule to update. jobSchedulePatchParameter is the parameters for the +// request. timeout is the maximum time that the server can spend processing the request, in seconds. The default +// is 30 seconds. clientRequestID is 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 is whether the +// server should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobScheduleId": autorest.Encode("path",jobScheduleID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "jobScheduleId": autorest.Encode("path", jobScheduleID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} // Terminate sends the terminate request. - // - // jobScheduleID is the ID of the job schedule to terminates. timeout is the maximum time that the server can spend - // processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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 is 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 is - // 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 is 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 is 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. +// +// jobScheduleID is the ID of the job schedule to terminates. timeout is the maximum time that the server can spend +// processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 is 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 is +// 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobScheduleId": autorest.Encode("path",jobScheduleID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "jobScheduleId": autorest.Encode("path", jobScheduleID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} // Update this fully replaces all the updateable 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. - // - // jobScheduleID is the ID of the job schedule to update. jobScheduleUpdateParameter is the parameters for the - // request. timeout is the maximum time that the server can spend processing the request, in seconds. The default - // is 30 seconds. clientRequestID is 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 is whether the - // server should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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. +// +// jobScheduleID is the ID of the job schedule to update. jobScheduleUpdateParameter is the parameters for the +// request. timeout is the maximum time that the server can spend processing the request, in seconds. The default +// is 30 seconds. clientRequestID is 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 is whether the +// server should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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 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.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.JobPreparationTask", Name: validation.Null, Rule: false , - Chain: []validation.Constraint{ {Target: "jobScheduleUpdateParameter.JobSpecification.JobPreparationTask.CommandLine", 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.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: false , - Chain: []validation.Constraint{ {Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Publisher", Name: validation.Null, Rule: true, Chain: nil }, - {Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Offer", Name: validation.Null, Rule: true, Chain: nil }, - {Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Sku", Name: validation.Null, Rule: true, Chain: nil }, - }}, - {Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.OsDisk", Name: validation.Null, Rule: false , - Chain: []validation.Constraint{ {Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.OsDisk.ImageUris", 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.StartTask", Name: validation.Null, Rule: false , - Chain: []validation.Constraint{ {Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.StartTask.CommandLine", 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobScheduleId": autorest.Encode("path",jobScheduleID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return - } + 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.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.JobPreparationTask", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.JobPreparationTask.CommandLine", 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.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: false, + Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Publisher", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Offer", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.ImageReference.Sku", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.OsDisk", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.VirtualMachineConfiguration.OsDisk.ImageUris", 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.StartTask", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobScheduleUpdateParameter.JobSpecification.PoolInfo.AutoPoolSpecification.Pool.StartTask.CommandLine", 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 +} +// 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) { + pathParameters := map[string]interface{}{ + "jobScheduleId": autorest.Encode("path", jobScheduleID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/batch/2017-05-01.5.0/batch/models.go b/services/batch/2017-05-01.5.0/batch/models.go index e9ab180ab17e..c9ac3764f541 100644 --- a/services/batch/2017-05-01.5.0/batch/models.go +++ b/services/batch/2017-05-01.5.0/batch/models.go @@ -18,2964 +18,3064 @@ package batch // Changes may cause incorrect behavior and will be lost if the code is regenerated. import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "io" - "net/http" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "io" + "net/http" ) - // AccessScope enumerates the values for access scope. - type AccessScope string - - const ( - // Job ... - 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 ... - Resizing AllocationState = "resizing" - // Steady ... - Steady AllocationState = "steady" - // Stopping ... - 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 ... - Pool AutoUserScope = "pool" - // 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 ... - None CachingType = "none" - // ReadOnly ... - ReadOnly CachingType = "readOnly" - // ReadWrite ... - 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 ... - Cer CertificateFormat = "cer" - // Pfx ... - 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 ... - Active CertificateState = "active" - // DeleteFailed ... - DeleteFailed CertificateState = "deleteFailed" - // Deleting ... - 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 ... - CurrentUser CertificateStoreLocation = "currentUser" - // LocalMachine ... - 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 ... - CertificateVisibilityRemoteUser CertificateVisibility = "remoteUser" - // CertificateVisibilityStartTask ... - CertificateVisibilityStartTask CertificateVisibility = "startTask" - // CertificateVisibilityTask ... - 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 ... - Requeue ComputeNodeDeallocationOption = "requeue" - // RetainedData ... - RetainedData ComputeNodeDeallocationOption = "retainedData" - // TaskCompletion ... - TaskCompletion ComputeNodeDeallocationOption = "taskCompletion" - // Terminate ... - 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 ... - Pack ComputeNodeFillType = "pack" - // Spread ... - 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 ... - ComputeNodeRebootOptionRequeue ComputeNodeRebootOption = "requeue" - // ComputeNodeRebootOptionRetainedData ... - ComputeNodeRebootOptionRetainedData ComputeNodeRebootOption = "retainedData" - // ComputeNodeRebootOptionTaskCompletion ... - ComputeNodeRebootOptionTaskCompletion ComputeNodeRebootOption = "taskCompletion" - // ComputeNodeRebootOptionTerminate ... - 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 ... - ComputeNodeReimageOptionRequeue ComputeNodeReimageOption = "requeue" - // ComputeNodeReimageOptionRetainedData ... - ComputeNodeReimageOptionRetainedData ComputeNodeReimageOption = "retainedData" - // ComputeNodeReimageOptionTaskCompletion ... - ComputeNodeReimageOptionTaskCompletion ComputeNodeReimageOption = "taskCompletion" - // ComputeNodeReimageOptionTerminate ... - 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 ... - Creating ComputeNodeState = "creating" - // Idle ... - Idle ComputeNodeState = "idle" - // LeavingPool ... - LeavingPool ComputeNodeState = "leavingPool" - // Offline ... - Offline ComputeNodeState = "offline" - // Preempted ... - Preempted ComputeNodeState = "preempted" - // Rebooting ... - Rebooting ComputeNodeState = "rebooting" - // Reimaging ... - Reimaging ComputeNodeState = "reimaging" - // Running ... - Running ComputeNodeState = "running" - // Starting ... - Starting ComputeNodeState = "starting" - // StartTaskFailed ... - StartTaskFailed ComputeNodeState = "startTaskFailed" - // Unknown ... - Unknown ComputeNodeState = "unknown" - // Unusable ... - Unusable ComputeNodeState = "unusable" - // WaitingForStartTask ... - 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} - } - - // DependencyAction enumerates the values for dependency action. - type DependencyAction string - - const ( - // Block ... - Block DependencyAction = "block" - // Satisfy ... - Satisfy DependencyAction = "satisfy" - ) - // PossibleDependencyActionValues returns an array of possible values for the DependencyAction const type. - func PossibleDependencyActionValues() []DependencyAction { - return []DependencyAction{Block,Satisfy} - } - - // DisableComputeNodeSchedulingOption enumerates the values for disable compute node scheduling option. - type DisableComputeNodeSchedulingOption string - - const ( - // DisableComputeNodeSchedulingOptionRequeue ... - DisableComputeNodeSchedulingOptionRequeue DisableComputeNodeSchedulingOption = "requeue" - // DisableComputeNodeSchedulingOptionTaskCompletion ... - DisableComputeNodeSchedulingOptionTaskCompletion DisableComputeNodeSchedulingOption = "taskCompletion" - // DisableComputeNodeSchedulingOptionTerminate ... - 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 ... - DisableJobOptionRequeue DisableJobOption = "requeue" - // DisableJobOptionTerminate ... - DisableJobOptionTerminate DisableJobOption = "terminate" - // DisableJobOptionWait ... - DisableJobOptionWait DisableJobOption = "wait" - ) - // PossibleDisableJobOptionValues returns an array of possible values for the DisableJobOption const type. - func PossibleDisableJobOptionValues() []DisableJobOption { - return []DisableJobOption{DisableJobOptionRequeue,DisableJobOptionTerminate,DisableJobOptionWait} - } - - // ElevationLevel enumerates the values for elevation level. - type ElevationLevel string - - const ( - // Admin ... - Admin ElevationLevel = "admin" - // NonAdmin ... - 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 ... - ServerError ErrorCategory = "serverError" - // UserError ... - UserError ErrorCategory = "userError" - ) - // PossibleErrorCategoryValues returns an array of possible values for the ErrorCategory const type. - func PossibleErrorCategoryValues() []ErrorCategory { - return []ErrorCategory{ServerError,UserError} - } - - // JobAction enumerates the values for job action. - type JobAction string - - const ( - // JobActionDisable ... - JobActionDisable JobAction = "disable" - // JobActionNone ... - JobActionNone JobAction = "none" - // JobActionTerminate ... - 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 ... - JobPreparationTaskStateCompleted JobPreparationTaskState = "completed" - // JobPreparationTaskStateRunning ... - 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 ... - JobReleaseTaskStateCompleted JobReleaseTaskState = "completed" - // JobReleaseTaskStateRunning ... - 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 ... - JobScheduleStateActive JobScheduleState = "active" - // JobScheduleStateCompleted ... - JobScheduleStateCompleted JobScheduleState = "completed" - // JobScheduleStateDeleting ... - JobScheduleStateDeleting JobScheduleState = "deleting" - // JobScheduleStateDisabled ... - JobScheduleStateDisabled JobScheduleState = "disabled" - // JobScheduleStateTerminating ... - 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 ... - JobStateActive JobState = "active" - // JobStateCompleted ... - JobStateCompleted JobState = "completed" - // JobStateDeleting ... - JobStateDeleting JobState = "deleting" - // JobStateDisabled ... - JobStateDisabled JobState = "disabled" - // JobStateDisabling ... - JobStateDisabling JobState = "disabling" - // JobStateEnabling ... - JobStateEnabling JobState = "enabling" - // JobStateTerminating ... - 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} - } - - // OnAllTasksComplete enumerates the values for on all tasks complete. - type OnAllTasksComplete string - - const ( - // NoAction ... - NoAction OnAllTasksComplete = "noAction" - // TerminateJob ... - 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 ... - OnTaskFailureNoAction OnTaskFailure = "noAction" - // OnTaskFailurePerformExitOptionsJobAction ... - 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 ... - Linux OSType = "linux" - // Windows ... - 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 ... - OutputFileUploadConditionTaskCompletion OutputFileUploadCondition = "taskCompletion" - // OutputFileUploadConditionTaskFailure ... - OutputFileUploadConditionTaskFailure OutputFileUploadCondition = "taskFailure" - // OutputFileUploadConditionTaskSuccess ... - OutputFileUploadConditionTaskSuccess OutputFileUploadCondition = "taskSuccess" - ) - // PossibleOutputFileUploadConditionValues returns an array of possible values for the OutputFileUploadCondition const type. - func PossibleOutputFileUploadConditionValues() []OutputFileUploadCondition { - return []OutputFileUploadCondition{OutputFileUploadConditionTaskCompletion,OutputFileUploadConditionTaskFailure,OutputFileUploadConditionTaskSuccess} - } - - // PoolLifetimeOption enumerates the values for pool lifetime option. - type PoolLifetimeOption string - - const ( - // PoolLifetimeOptionJob ... - PoolLifetimeOptionJob PoolLifetimeOption = "job" - // PoolLifetimeOptionJobSchedule ... - 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 ... - PoolStateActive PoolState = "active" - // PoolStateDeleting ... - PoolStateDeleting PoolState = "deleting" - // PoolStateUpgrading ... - PoolStateUpgrading PoolState = "upgrading" - ) - // PossiblePoolStateValues returns an array of possible values for the PoolState const type. - func PossiblePoolStateValues() []PoolState { - return []PoolState{PoolStateActive,PoolStateDeleting,PoolStateUpgrading} - } - - // SchedulingState enumerates the values for scheduling state. - type SchedulingState string - - const ( - // Disabled ... - Disabled SchedulingState = "disabled" - // Enabled ... - 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 ... - StartTaskStateCompleted StartTaskState = "completed" - // StartTaskStateRunning ... - StartTaskStateRunning StartTaskState = "running" - ) - // PossibleStartTaskStateValues returns an array of possible values for the StartTaskState const type. - func PossibleStartTaskStateValues() []StartTaskState { - return []StartTaskState{StartTaskStateCompleted,StartTaskStateRunning} - } - - // SubtaskState enumerates the values for subtask state. - type SubtaskState string - - const ( - // SubtaskStateCompleted ... - SubtaskStateCompleted SubtaskState = "completed" - // SubtaskStatePreparing ... - SubtaskStatePreparing SubtaskState = "preparing" - // SubtaskStateRunning ... - 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 ... - TaskAddStatusClientError TaskAddStatus = "clientError" - // TaskAddStatusServerError ... - TaskAddStatusServerError TaskAddStatus = "serverError" - // TaskAddStatusSuccess ... - 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 ... - Failure TaskExecutionResult = "failure" - // Success ... - 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 ... - TaskStateActive TaskState = "active" - // TaskStateCompleted ... - TaskStateCompleted TaskState = "completed" - // TaskStatePreparing ... - TaskStatePreparing TaskState = "preparing" - // TaskStateRunning ... - TaskStateRunning TaskState = "running" - ) - // PossibleTaskStateValues returns an array of possible values for the TaskState const type. - func PossibleTaskStateValues() []TaskState { - return []TaskState{TaskStateActive,TaskStateCompleted,TaskStatePreparing,TaskStateRunning} - } - - // AccountListNodeAgentSkusResult ... - type AccountListNodeAgentSkusResult struct { - autorest.Response `json:"-"` - Value *[]NodeAgentSku `json:"value,omitempty"` - OdataNextLink *string `json:"odata.nextLink,omitempty"` - } - - // AccountListNodeAgentSkusResultIterator provides access to a complete listing of NodeAgentSku values. - type AccountListNodeAgentSkusResultIterator struct { - i int - page AccountListNodeAgentSkusResultPage - } - // Next 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 * AccountListNodeAgentSkusResultIterator) Next() error { - iter.i++ - if iter.i < len(iter. page.Values()) { - return nil - } - err := iter.page.Next() - if err != nil { - iter. i-- - return err - } - iter.i = 0 - return nil - } - // NotDone returns true if the enumeration should be started or is not yet complete. - func (iter AccountListNodeAgentSkusResultIterator) 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 AccountListNodeAgentSkusResultIterator) Response() AccountListNodeAgentSkusResult { - 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 AccountListNodeAgentSkusResultIterator) Value() NodeAgentSku { - if !iter.page.NotDone() { - return NodeAgentSku{} - } - return iter.page.Values()[iter.i] - } - - - // IsEmpty returns true if the ListResult contains no values. - func (alnasr AccountListNodeAgentSkusResult) IsEmpty() bool { - return alnasr.Value == nil || len(*alnasr.Value) == 0 - } - - // accountListNodeAgentSkusResultPreparer prepares a request to retrieve the next set of results. - // It returns nil if no more results exist. - func (alnasr AccountListNodeAgentSkusResult) accountListNodeAgentSkusResultPreparer() (*http.Request, error) { - if alnasr.OdataNextLink == nil || len(to.String(alnasr.OdataNextLink)) < 1 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String( alnasr.OdataNextLink))); - } - - // AccountListNodeAgentSkusResultPage contains a page of NodeAgentSku values. - type AccountListNodeAgentSkusResultPage struct { - fn func(AccountListNodeAgentSkusResult) (AccountListNodeAgentSkusResult, error) - alnasr AccountListNodeAgentSkusResult - } - - // 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. - func (page * AccountListNodeAgentSkusResultPage) Next() error { - next, err := page.fn(page.alnasr) - if err != nil { - return err - } - page.alnasr = next - return nil - } - // NotDone returns true if the page enumeration should be started or is not yet complete. - func (page AccountListNodeAgentSkusResultPage) NotDone() bool { - return !page.alnasr.IsEmpty() - } - // Response returns the raw server response from the last page request. - func (page AccountListNodeAgentSkusResultPage) Response() AccountListNodeAgentSkusResult { - return page.alnasr - } - // Values returns the slice of values for the current page or nil if there are no values. - func (page AccountListNodeAgentSkusResultPage) Values() []NodeAgentSku { - if page.alnasr.IsEmpty() { - return nil - } - return *page.alnasr.Value - } - - // AffinityInformation ... - type AffinityInformation struct { - // AffinityID - You can pass the affinityId of a compute node or task to indicate that this task needs to be placed close to the node or task. - 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 - } - // Next 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) Next() error { - iter.i++ - if iter.i < len(iter. page.Values()) { - return nil - } - err := iter.page.Next() - if err != nil { - iter. i-- - return err - } - iter.i = 0 - return nil - } - // 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] - } - - - // IsEmpty returns true if the ListResult contains no values. - func (alr ApplicationListResult) IsEmpty() bool { - return alr.Value == nil || len(*alr.Value) == 0 - } - - // applicationListResultPreparer prepares a request to retrieve the next set of results. - // It returns nil if no more results exist. - func (alr ApplicationListResult) applicationListResultPreparer() (*http.Request, error) { - if alr.OdataNextLink == nil || len(to.String(alr.OdataNextLink)) < 1 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String( alr.OdataNextLink))); - } - - // ApplicationListResultPage contains a page of ApplicationSummary values. - type ApplicationListResultPage struct { - fn func(ApplicationListResult) (ApplicationListResult, error) - alr ApplicationListResult - } - - // 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. - func (page * ApplicationListResultPage) Next() error { - next, err := page.fn(page.alr) - if err != nil { - return err - } - page.alr = next - return nil - } - // 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 - } - - // ApplicationPackageReference ... - type ApplicationPackageReference struct { - ApplicationID *string `json:"applicationId,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"` - } - - // 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 - When the pool lifetime scope is jobSchedule level, the Batch service keeps track of the last autopool created for the job schedule, and deletes that pool when the job schedule completes. Batch will also delete this pool if the user updates the auto pool specification in a way that changes this lifetime. 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 - pool - specifies that the task runs as the common auto user account which is created on every node in a pool. task - specifies that the service should create a new user for the task. The default value is task. Possible values include: 'Task', 'Pool' - Scope AutoUserScope `json:"scope,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"` - } - - // 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 is required if the certificate format is pfx. It should 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 - } - // Next 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) Next() error { - iter.i++ - if iter.i < len(iter. page.Values()) { - return nil - } - err := iter.page.Next() - if err != nil { - iter. i-- - return err - } - iter.i = 0 - return nil - } - // 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] - } - - - // IsEmpty returns true if the ListResult contains no values. - func (clr CertificateListResult) IsEmpty() bool { - return clr.Value == nil || len(*clr.Value) == 0 - } - - // certificateListResultPreparer prepares a request to retrieve the next set of results. - // It returns nil if no more results exist. - func (clr CertificateListResult) certificateListResultPreparer() (*http.Request, error) { - if clr.OdataNextLink == nil || len(to.String(clr.OdataNextLink)) < 1 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String( clr.OdataNextLink))); - } - - // CertificateListResultPage contains a page of Certificate values. - type CertificateListResultPage struct { - fn func(CertificateListResult) (CertificateListResult, error) - clr CertificateListResult - } - - // 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. - func (page * CertificateListResultPage) Next() error { - next, err := page.fn(page.clr) - if err != nil { - return err - } - page.clr = next - return nil - } - // 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 - } - - // 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 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 - The default value is My. This property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). - StoreName *string `json:"storeName,omitempty"` - // Visibility - The default is all accounts. - Visibility *[]CertificateVisibility `json:"visibility,omitempty"` - } - - // CloudJob ... - type CloudJob 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. It is common to use a GUID for the id. - 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"` - Constraints *JobConstraints `json:"constraints,omitempty"` - JobManagerTask *JobManagerTask `json:"jobManagerTask,omitempty"` - // JobPreparationTask - The Job Preparation task is a special task run on each 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 node that has run any other task of the job. - JobReleaseTask *JobReleaseTask `json:"jobReleaseTask,omitempty"` - CommonEnvironmentSettings *[]EnvironmentSetting `json:"commonEnvironmentSettings,omitempty"` - PoolInfo *PoolInformation `json:"poolInfo,omitempty"` - // OnAllTasksComplete - noAction - do nothing. The job remains active unless terminated or disabled by some other means. terminateJob - terminate the job. The job's terminateReason is set to 'AllTasksComplete'. The default is noAction. Possible values include: 'NoAction', 'TerminateJob' - OnAllTasksComplete OnAllTasksComplete `json:"onAllTasksComplete,omitempty"` - // OnTaskFailure - noAction - do nothing. performExitOptionsJobAction - 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.) 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"` - ExecutionInfo *JobExecutionInformation `json:"executionInfo,omitempty"` - 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 - } - // Next 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) Next() error { - iter.i++ - if iter.i < len(iter. page.Values()) { - return nil - } - err := iter.page.Next() - if err != nil { - iter. i-- - return err - } - iter.i = 0 - return nil - } - // 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] - } - - - // IsEmpty returns true if the ListResult contains no values. - func (cjlpartsr CloudJobListPreparationAndReleaseTaskStatusResult) IsEmpty() bool { - return cjlpartsr.Value == nil || len(*cjlpartsr.Value) == 0 - } - - // cloudJobListPreparationAndReleaseTaskStatusResultPreparer prepares a request to retrieve the next set of results. - // It returns nil if no more results exist. - func (cjlpartsr CloudJobListPreparationAndReleaseTaskStatusResult) cloudJobListPreparationAndReleaseTaskStatusResultPreparer() (*http.Request, error) { - if cjlpartsr.OdataNextLink == nil || len(to.String(cjlpartsr.OdataNextLink)) < 1 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String( cjlpartsr.OdataNextLink))); - } - - // CloudJobListPreparationAndReleaseTaskStatusResultPage contains a page of - // JobPreparationAndReleaseTaskExecutionInformation values. - type CloudJobListPreparationAndReleaseTaskStatusResultPage struct { - fn func(CloudJobListPreparationAndReleaseTaskStatusResult) (CloudJobListPreparationAndReleaseTaskStatusResult, error) - cjlpartsr CloudJobListPreparationAndReleaseTaskStatusResult - } - - // 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. - func (page * CloudJobListPreparationAndReleaseTaskStatusResultPage) Next() error { - next, err := page.fn(page.cjlpartsr) - if err != nil { - return err - } - page.cjlpartsr = next - return nil - } - // 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 - } - - // 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 - } - // Next 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) Next() error { - iter.i++ - if iter.i < len(iter. page.Values()) { - return nil - } - err := iter.page.Next() - if err != nil { - iter. i-- - return err - } - iter.i = 0 - return nil - } - // 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] - } - - - // IsEmpty returns true if the ListResult contains no values. - func (cjlr CloudJobListResult) IsEmpty() bool { - return cjlr.Value == nil || len(*cjlr.Value) == 0 - } - - // cloudJobListResultPreparer prepares a request to retrieve the next set of results. - // It returns nil if no more results exist. - func (cjlr CloudJobListResult) cloudJobListResultPreparer() (*http.Request, error) { - if cjlr.OdataNextLink == nil || len(to.String(cjlr.OdataNextLink)) < 1 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String( cjlr.OdataNextLink))); - } - - // CloudJobListResultPage contains a page of CloudJob values. - type CloudJobListResultPage struct { - fn func(CloudJobListResult) (CloudJobListResult, error) - cjlr CloudJobListResult - } - - // 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. - func (page * CloudJobListResultPage) Next() error { - next, err := page.fn(page.cjlr) - if err != nil { - return err - } - page.cjlr = next - return nil - } - // 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 - } - - // CloudJobSchedule ... - type CloudJobSchedule struct { - autorest.Response `json:"-"` - // ID - It is common to use a GUID for the id. - 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 - } - // Next 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) Next() error { - iter.i++ - if iter.i < len(iter. page.Values()) { - return nil - } - err := iter.page.Next() - if err != nil { - iter. i-- - return err - } - iter.i = 0 - return nil - } - // 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] - } - - - // IsEmpty returns true if the ListResult contains no values. - func (cjslr CloudJobScheduleListResult) IsEmpty() bool { - return cjslr.Value == nil || len(*cjslr.Value) == 0 - } - - // cloudJobScheduleListResultPreparer prepares a request to retrieve the next set of results. - // It returns nil if no more results exist. - func (cjslr CloudJobScheduleListResult) cloudJobScheduleListResultPreparer() (*http.Request, error) { - if cjslr.OdataNextLink == nil || len(to.String(cjslr.OdataNextLink)) < 1 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String( cjslr.OdataNextLink))); - } - - // CloudJobScheduleListResultPage contains a page of CloudJobSchedule values. - type CloudJobScheduleListResultPage struct { - fn func(CloudJobScheduleListResult) (CloudJobScheduleListResult, error) - cjslr CloudJobScheduleListResult - } - - // 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. - func (page * CloudJobScheduleListResultPage) Next() error { - next, err := page.fn(page.cjslr) - if err != nil { - return err - } - page.cjslr = next - return nil - } - // 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 - } - - // 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. It is common to use a GUID for the id. - 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 - active - The pool is available to run tasks subject to the availability of compute nodes. deleting - The user has requested that the pool be deleted, but the delete operation has not yet completed. upgrading - The user has requested that the operating system of the pool's nodes be upgraded, but the upgrade operation has not yet completed (that is, some nodes in the pool have not yet been upgraded). While upgrading, the pool may be able to run tasks (with reduced capacity) but this is not guaranteed. Possible values include: 'PoolStateActive', 'PoolStateDeleting', 'PoolStateUpgrading' - State PoolState `json:"state,omitempty"` - StateTransitionTime *date.Time `json:"stateTransitionTime,omitempty"` - // AllocationState - 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 dedicated nodes. resizing - The pool is resizing; that is, compute nodes are being added to or removed from the pool. stopping - The pool was resizing, but the user has requested that the resize be stopped, but the stop request has not yet been completed. 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 for Cloud Services pools (pools created with cloudServiceConfiguration), see Sizes for Cloud Services (http://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 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 targetDedicateNodes 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 nodes can be assigned to the pool. Specifying this value can reduce the chance of the requested number of 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 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. - CertificateReferences *[]CertificateReference `json:"certificateReferences,omitempty"` - 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"` - MaxTasksPerNode *int32 `json:"maxTasksPerNode,omitempty"` - TaskSchedulingPolicy *TaskSchedulingPolicy `json:"taskSchedulingPolicy,omitempty"` - UserAccounts *[]UserAccount `json:"userAccounts,omitempty"` - Metadata *[]MetadataItem `json:"metadata,omitempty"` - Stats *PoolStatistics `json:"stats,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 - } - // Next 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) Next() error { - iter.i++ - if iter.i < len(iter. page.Values()) { - return nil - } - err := iter.page.Next() - if err != nil { - iter. i-- - return err - } - iter.i = 0 - return nil - } - // 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] - } - - - // IsEmpty returns true if the ListResult contains no values. - func (cplr CloudPoolListResult) IsEmpty() bool { - return cplr.Value == nil || len(*cplr.Value) == 0 - } - - // cloudPoolListResultPreparer prepares a request to retrieve the next set of results. - // It returns nil if no more results exist. - func (cplr CloudPoolListResult) cloudPoolListResultPreparer() (*http.Request, error) { - if cplr.OdataNextLink == nil || len(to.String(cplr.OdataNextLink)) < 1 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String( cplr.OdataNextLink))); - } - - // CloudPoolListResultPage contains a page of CloudPool values. - type CloudPoolListResultPage struct { - fn func(CloudPoolListResult) (CloudPoolListResult, error) - cplr CloudPoolListResult - } - - // 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. - func (page * CloudPoolListResultPage) Next() error { - next, err := page.fn(page.cplr) - if err != nil { - return err - } - page.cplr = next - return nil - } - // 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 - } - - // 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. 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"` - // TargetOSVersion - The default value is * which specifies the latest operating system version for the specified OS family. - TargetOSVersion *string `json:"targetOSVersion,omitempty"` - // CurrentOSVersion - This may differ from targetOSVersion if the pool state is Upgrading. In this case some virtual machines may be on the targetOSVersion and some may be on the currentOSVersion during the upgrade process. Once all virtual machines have upgraded, currentOSVersion is updated to be the same as targetOSVersion. - CurrentOSVersion *string `json:"currentOSVersion,omitempty"` - } - - // CloudTask ... - 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. - CommandLine *string `json:"commandLine,omitempty"` - // ResourceFiles - For multi-instance tasks, the resource files will only be downloaded to the compute node on which the primary task is executed. - 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"` - // 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 *[]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 - } - // Next 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) Next() error { - iter.i++ - if iter.i < len(iter. page.Values()) { - return nil - } - err := iter.page.Next() - if err != nil { - iter. i-- - return err - } - iter.i = 0 - return nil - } - // 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] - } - - - // IsEmpty returns true if the ListResult contains no values. - func (ctlr CloudTaskListResult) IsEmpty() bool { - return ctlr.Value == nil || len(*ctlr.Value) == 0 - } - - // cloudTaskListResultPreparer prepares a request to retrieve the next set of results. - // It returns nil if no more results exist. - func (ctlr CloudTaskListResult) cloudTaskListResultPreparer() (*http.Request, error) { - if ctlr.OdataNextLink == nil || len(to.String(ctlr.OdataNextLink)) < 1 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String( ctlr.OdataNextLink))); - } - - // CloudTaskListResultPage contains a page of CloudTask values. - type CloudTaskListResultPage struct { - fn func(CloudTaskListResult) (CloudTaskListResult, error) - ctlr CloudTaskListResult - } - - // 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. - func (page * CloudTaskListResultPage) Next() error { - next, err := page.fn(page.ctlr) - if err != nil { - return err - } - page.ctlr = next - return nil - } - // 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 - } - - // CloudTaskListSubtasksResult ... - type CloudTaskListSubtasksResult struct { - autorest.Response `json:"-"` - Value *[]SubtaskInformation `json:"value,omitempty"` - } - - // ComputeNode ... - type ComputeNode struct { - autorest.Response `json:"-"` - // ID - Every node that is added to a pool is assigned a unique ID. Whenever a node is removed from a pool, all of its local files are deleted, and the ID is reclaimed and could be reused for new nodes. - ID *string `json:"id,omitempty"` - URL *string `json:"url,omitempty"` - // State - Possible values include: 'Idle', 'Rebooting', 'Reimaging', 'Running', 'Unusable', 'Creating', 'Starting', 'WaitingForStartTask', 'StartTaskFailed', 'Unknown', 'LeavingPool', 'Offline', 'Preempted' - State ComputeNodeState `json:"state,omitempty"` - // SchedulingState - enabled - Tasks can be scheduled on the node. disabled - No new tasks will be scheduled on the node. Tasks already running on the node may still run to completion. All nodes start with scheduling enabled. 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 node state is unusable. - LastBootTime *date.Time `json:"lastBootTime,omitempty"` - AllocationTime *date.Time `json:"allocationTime,omitempty"` - // IPAddress - Every node that is added to a pool is assigned a unique IP address. Whenever a 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 nodes. - IPAddress *string `json:"ipAddress,omitempty"` - AffinityID *string `json:"affinityId,omitempty"` - // VMSize - For information about available sizes of virtual machines for Cloud Services pools (pools created with cloudServiceConfiguration), see Sizes for Cloud Services (http://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"` - TotalTasksRun *int32 `json:"totalTasksRun,omitempty"` - RunningTasksCount *int32 `json:"runningTasksCount,omitempty"` - TotalTasksSucceeded *int32 `json:"totalTasksSucceeded,omitempty"` - RecentTasks *[]TaskInformation `json:"recentTasks,omitempty"` - StartTask *StartTask `json:"startTask,omitempty"` - StartTaskInfo *StartTaskInformation `json:"startTaskInfo,omitempty"` - // CertificateReferences - 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. - CertificateReferences *[]CertificateReference `json:"certificateReferences,omitempty"` - Errors *[]ComputeNodeError `json:"errors,omitempty"` - IsDedicated *bool `json:"isDedicated,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"` - } - - // 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 - } - // Next 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) Next() error { - iter.i++ - if iter.i < len(iter. page.Values()) { - return nil - } - err := iter.page.Next() - if err != nil { - iter. i-- - return err - } - iter.i = 0 - return nil - } - // 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] - } - - - // IsEmpty returns true if the ListResult contains no values. - func (cnlr ComputeNodeListResult) IsEmpty() bool { - return cnlr.Value == nil || len(*cnlr.Value) == 0 - } - - // computeNodeListResultPreparer prepares a request to retrieve the next set of results. - // It returns nil if no more results exist. - func (cnlr ComputeNodeListResult) computeNodeListResultPreparer() (*http.Request, error) { - if cnlr.OdataNextLink == nil || len(to.String(cnlr.OdataNextLink)) < 1 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String( cnlr.OdataNextLink))); - } - - // ComputeNodeListResultPage contains a page of ComputeNode values. - type ComputeNodeListResultPage struct { - fn func(ComputeNodeListResult) (ComputeNodeListResult, error) - cnlr ComputeNodeListResult - } - - // 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. - func (page * ComputeNodeListResultPage) Next() error { - next, err := page.fn(page.cnlr) - if err != nil { - return err - } - page.cnlr = next - return nil - } - // 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 - } - - // 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 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 nodes. If this is specified for a Windows 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"` - } - - // 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 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"` - } - - // 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 behaviour 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 specify this property returns an error. 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 - The default is 'satisfy' for exit code 0, and 'block' for all other exit conditions. If the job's usesTaskDependencies property is set to false, then specifying the dependencyAction property returns an error. 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: '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"` - } - - // 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, 14.04.0-LTS or 2012-R2-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"` - } - - // 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. It is common to use a GUID for the id. - 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"` - // 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 compute 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 compute 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 *[]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. Permitted values are: noAction - do nothing. The job remains active unless terminated or disabled by some other means. terminateJob - terminate the job. The job's terminateReason is set to 'AllTasksComplete'. The default is noAction. Possible values include: 'NoAction', 'TerminateJob' - OnAllTasksComplete OnAllTasksComplete `json:"onAllTasksComplete,omitempty"` - // OnTaskFailure - noAction - do nothing. performExitOptionsJobAction - 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.) 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"` - } - - // 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 - requeue - Terminate running tasks and requeue them. The tasks will run again when the job is enabled. terminate - Terminate running tasks. The tasks will not run again. wait - Allow currently running tasks to complete. 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 ... - 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. - CommandLine *string `json:"commandLine,omitempty"` - // ResourceFiles - Files listed under this element are located in the task's working directory. - ResourceFiles *[]ResourceFile `json:"resourceFiles,omitempty"` - OutputFiles *[]OutputFile `json:"outputFiles,omitempty"` - EnvironmentSettings *[]EnvironmentSetting `json:"environmentSettings,omitempty"` - Constraints *TaskConstraints `json:"constraints,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 compute 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 node's concurrent task limit, so this is only relevant if the 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 directory. Therefore, if a referenced 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 with a scheduling error. This property is currently not supported on jobs running on pools created using the virtualMachineConfiguration (IaaS) property. If a task specifying applicationPackageReferences runs on such a pool, it fails with a scheduling error with code TaskSchedulingConstraintFailed. - 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 false. - AllowLowPriorityNode *bool `json:"allowLowPriorityNode,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"` - // 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 specification in the poolInfo, only the keepAlive property can be updated, and then only if the auto pool has a poolLifetimeOption of job. 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 node. - JobReleaseTaskExecutionInfo *JobReleaseTaskExecutionInformation `json:"jobReleaseTaskExecutionInfo,omitempty"` - } - - // JobPreparationTask ... - 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. - CommandLine *string `json:"commandLine,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"` - Constraints *TaskConstraints `json:"constraints,omitempty"` - // WaitForSuccess - If true and the Job Preparation task fails on a compute 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 compute node. The compute 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 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. - 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 - Note that every time the task is restarted, this value is updated. - 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 - running - the task is currently running (including retrying). completed - 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 scheduling errors. 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"` - // FailureInfo - This property is set only if the task is in the completed state and encountered a failure. - FailureInfo *TaskFailureInformation `json:"failureInfo,omitempty"` - 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 ... - 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. - CommandLine *string `json:"commandLine,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 infinite, i.e. the task directory will be retained until the compute node is removed or reimaged. - 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 *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 - running - the task is currently running (including retrying). completed - the task has exited, or the Batch service was unable to start the task due to scheduling errors. 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"` - // 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"` - // 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"` - 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 compute 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 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. 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 *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 specification in the poolInfo, only the keepAlive property can be updated, and then only if the auto pool has a poolLifetimeOption of job. - 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. 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 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"` - } - - // 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"` - } - - // MultiInstanceSettings multi-instance tasks are commonly used to support MPI tasks. - type MultiInstanceSettings struct { - 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. - 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 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 Batch service principal, named 'Microsoft Azure Batch' or 'MicrosoftAzureBatch', 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. For pools created via virtualMachineConfiguration the Batch account must have poolAllocationMode userSubscription in order to use a VNet. - SubnetID *string `json:"subnetId,omitempty"` - } - - // NodeAgentSku 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. - type NodeAgentSku struct { - ID *string `json:"id,omitempty"` - // VerifiedImageReferences - This collection is not exhaustive (the node agent may be compatible with other images). - VerifiedImageReferences *[]ImageReference `json:"verifiedImageReferences,omitempty"` - // OsType - Possible values include: 'Linux', 'Windows' - OsType OSType `json:"osType,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 - } - // Next 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) Next() error { - iter.i++ - if iter.i < len(iter. page.Values()) { - return nil - } - err := iter.page.Next() - if err != nil { - iter. i-- - return err - } - iter.i = 0 - return nil - } - // 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] - } - - - // IsEmpty returns true if the ListResult contains no values. - func (nflr NodeFileListResult) IsEmpty() bool { - return nflr.Value == nil || len(*nflr.Value) == 0 - } - - // nodeFileListResultPreparer prepares a request to retrieve the next set of results. - // It returns nil if no more results exist. - func (nflr NodeFileListResult) nodeFileListResultPreparer() (*http.Request, error) { - if nflr.OdataNextLink == nil || len(to.String(nflr.OdataNextLink)) < 1 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String( nflr.OdataNextLink))); - } - - // NodeFileListResultPage contains a page of NodeFile values. - type NodeFileListResultPage struct { - fn func(NodeFileListResult) (NodeFileListResult, error) - nflr NodeFileListResult - } - - // 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. - func (page * NodeFileListResultPage) Next() error { - next, err := page.fn(page.nflr) - if err != nil { - return err - } - page.nflr = next - return nil - } - // 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 - } - - // 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 *[]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 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 nodes. If this is specified for a Windows 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"` - } - - // OSDisk ... - type OSDisk struct { - // ImageUris - All the VHDs must be identical and must reside in an Azure Storage account within the same subscription and same region as the Batch account. For best performance, it is recommended that each VHD resides in a separate Azure Storage account. Each VHD can serve upto 20 Windows compute nodes or 40 Linux compute nodes. You must supply enough VHD URIs to satisfy the 'targetDedicated' property of the pool. If you do not supply enough VHD URIs, the pool will partially allocate compute nodes, and a resize error will occur. - ImageUris *[]string `json:"imageUris,omitempty"` - // Caching - 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"` - } - - // OutputFile ... - type OutputFile struct { - // FilePattern - Both relative and absolute paths are supported. Relative paths are relative to the task working directory. For wildcards, use * to match any character and ** to match any directory. For example, **\*.txt matches any file ending in .txt in the task working directory or any subdirectory. Note that \ and / are treated interchangeably and mapped to the correct directory separator on the compute node operating system. - 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 - The URL must include a Shared Access Signature (SAS) granting write permissions to the container. - ContainerURL *string `json:"containerUrl,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 (http://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 targetDedicateNodes 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 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 node is added to the pool or when the node is restarted. - StartTask *StartTask `json:"startTask,omitempty"` - // CertificateReferences - 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. - CertificateReferences *[]CertificateReference `json:"certificateReferences,omitempty"` - // ApplicationPackageReferences - This property is currently not supported on pools created using the virtualMachineConfiguration (IaaS) property. - 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"` - // MaxTasksPerNode - The default value is 1. The maximum value of this setting depends on the size of the compute nodes in the pool (the vmSize setting). - MaxTasksPerNode *int32 `json:"maxTasksPerNode,omitempty"` - 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"` - } - - // 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"` - } - - // 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"` - } - - // 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 - } - // Next 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) Next() error { - iter.i++ - if iter.i < len(iter. page.Values()) { - return nil - } - err := iter.page.Next() - if err != nil { - iter. i-- - return err - } - iter.i = 0 - return nil - } - // 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] - } - - - // IsEmpty returns true if the ListResult contains no values. - func (plumr PoolListUsageMetricsResult) IsEmpty() bool { - return plumr.Value == nil || len(*plumr.Value) == 0 - } - - // poolListUsageMetricsResultPreparer prepares a request to retrieve the next set of results. - // It returns nil if no more results exist. - func (plumr PoolListUsageMetricsResult) poolListUsageMetricsResultPreparer() (*http.Request, error) { - if plumr.OdataNextLink == nil || len(to.String(plumr.OdataNextLink)) < 1 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String( plumr.OdataNextLink))); - } - - // PoolListUsageMetricsResultPage contains a page of PoolUsageMetrics values. - type PoolListUsageMetricsResultPage struct { - fn func(PoolListUsageMetricsResult) (PoolListUsageMetricsResult, error) - plumr PoolListUsageMetricsResult - } - - // 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. - func (page * PoolListUsageMetricsResultPage) Next() error { - next, err := page.fn(page.plumr) - if err != nil { - return err - } - page.plumr = next - return nil - } - // 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 - } - - // PoolPatchParameter ... - type PoolPatchParameter struct { - // StartTask - If omitted, any existing start task is left unchanged. - StartTask *StartTask `json:"startTask,omitempty"` - // CertificateReferences - If omitted, any existing certificate references are left unchanged. 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. - CertificateReferences *[]CertificateReference `json:"certificateReferences,omitempty"` - // ApplicationPackageReferences - 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. If this element is present, it replaces any existing application package references. If you specify an empty collection, then all application package references are removed from the pool. If omitted, any existing application 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 for Cloud Services pools (pools created with cloudServiceConfiguration), see Sizes for Cloud Services (http://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 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"` - // MaxTasksPerNode - The default value is 1. The maximum value of this setting depends on the size of the compute nodes in the pool (the vmSize setting). - MaxTasksPerNode *int32 `json:"maxTasksPerNode,omitempty"` - // TaskSchedulingPolicy - How tasks are distributed among compute nodes in the pool. - 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 targetDedicateNodes 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 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 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. - CertificateReferences *[]CertificateReference `json:"certificateReferences,omitempty"` - // ApplicationPackageReferences - This property is currently not supported on auto pools created with the virtualMachineConfiguration (IaaS) property. - 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"` - 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"` - } - - // 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 start task. If omitted, any existing start task is removed from the pool. - StartTask *StartTask `json:"startTask,omitempty"` - // CertificateReferences - If you specify an empty collection, any existing certificate references are removed from the pool. 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. - CertificateReferences *[]CertificateReference `json:"certificateReferences,omitempty"` - // ApplicationPackageReferences - 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. The list replaces any existing application package references. If omitted, or if you specify an empty collection, any existing application packages references are removed from the 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"` - } - - // PoolUpgradeOSParameter ... - type PoolUpgradeOSParameter struct { - TargetOSVersion *string `json:"targetOSVersion,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 for Cloud Services pools (pools created with cloudServiceConfiguration), see Sizes for Cloud Services (http://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"` - TotalCoreHours *float64 `json:"totalCoreHours,omitempty"` - DataIngressGiB *float64 `json:"dataIngressGiB,omitempty"` - DataEgressGiB *float64 `json:"dataEgressGiB,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 { - // BlobSource - This URL 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. - BlobSource *string `json:"blobSource,omitempty"` - 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"` - } - - // 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 ... - 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. - 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 false. - WaitForSuccess *bool `json:"waitForSuccess,omitempty"` - } - - // StartTaskInformation ... - type StartTaskInformation struct { - // State - running - The start task is currently running. completed - The start task has exited with exit code 0, or the start task has failed and the retry limit has reached, or the start task process did not run due to scheduling errors. 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 start task started running). - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - This is the end time of the most recent run of the start task, if that run has completed (even if that run failed and a retry is pending). This element is not present if the start task is currently running. - EndTime *date.Time `json:"endTime,omitempty"` - // ExitCode - This property is set only if the start 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 start task (due to timeout, or user termination via the API) you may see an operating system-defined exit code. - ExitCode *int32 `json:"exitCode,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 - The number of times the task has been retried by the Batch service. 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"` - // 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 *[]TaskAddParameter `json:"value,omitempty"` - } - - // TaskAddCollectionResult ... - type TaskAddCollectionResult struct { - autorest.Response `json:"-"` - Value *[]TaskAddResult `json:"value,omitempty"` - } - - // TaskAddParameter ... - 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. - CommandLine *string `json:"commandLine,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. - 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, and the maxWallClockTime and retentionTime are infinite. - Constraints *TaskConstraints `json:"constraints,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 *[]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 *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 infinite, i.e. the task directory will be retained until the compute node is removed or reimaged. - RetentionTime *string `json:"retentionTime,omitempty"` - // MaxTaskRetryCount - 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"` - } - - // TaskDependencies ... - type TaskDependencies struct { - 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 application 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"` - // FailureInfo - This property is set only if the task is in the completed state and encountered a failure. - FailureInfo *TaskFailureInformation `json:"failureInfo,omitempty"` - // RetryCount - The number of times the task has been retried by the Batch service. 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 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 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 - Possible values include: 'Spread', 'Pack' - NodeFillType ComputeNodeFillType `json:"nodeFillType,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. - Constraints *TaskConstraints `json:"constraints,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 - 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"` - } - - // 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 - This property and osDisk are mutually exclusive and one of the properties must be specified. - ImageReference *ImageReference `json:"imageReference,omitempty"` - // OsDisk - This property can be specified only if the Batch account was created with its poolAllocationMode property set to 'UserSubscription'. This property and imageReference are mutually exclusive and one of the properties must be specified. - OsDisk *OSDisk `json:"osDisk,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 or osDisk property specifies a Linux OS image. - WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` - } - - // WindowsConfiguration ... - type WindowsConfiguration struct { - // EnableAutomaticUpdates - If omitted, the default value is true. - EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` - } +// AccessScope enumerates the values for access scope. +type AccessScope string +const ( + // Job ... + 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 ... + Resizing AllocationState = "resizing" + // Steady ... + Steady AllocationState = "steady" + // Stopping ... + 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 ... + Pool AutoUserScope = "pool" + // 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 ... + None CachingType = "none" + // ReadOnly ... + ReadOnly CachingType = "readOnly" + // ReadWrite ... + 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 ... + Cer CertificateFormat = "cer" + // Pfx ... + 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 ... + Active CertificateState = "active" + // DeleteFailed ... + DeleteFailed CertificateState = "deleteFailed" + // Deleting ... + 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 ... + CurrentUser CertificateStoreLocation = "currentUser" + // LocalMachine ... + 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 ... + CertificateVisibilityRemoteUser CertificateVisibility = "remoteUser" + // CertificateVisibilityStartTask ... + CertificateVisibilityStartTask CertificateVisibility = "startTask" + // CertificateVisibilityTask ... + 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 ... + Requeue ComputeNodeDeallocationOption = "requeue" + // RetainedData ... + RetainedData ComputeNodeDeallocationOption = "retainedData" + // TaskCompletion ... + TaskCompletion ComputeNodeDeallocationOption = "taskCompletion" + // Terminate ... + 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 ... + Pack ComputeNodeFillType = "pack" + // Spread ... + 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 ... + ComputeNodeRebootOptionRequeue ComputeNodeRebootOption = "requeue" + // ComputeNodeRebootOptionRetainedData ... + ComputeNodeRebootOptionRetainedData ComputeNodeRebootOption = "retainedData" + // ComputeNodeRebootOptionTaskCompletion ... + ComputeNodeRebootOptionTaskCompletion ComputeNodeRebootOption = "taskCompletion" + // ComputeNodeRebootOptionTerminate ... + 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 ... + ComputeNodeReimageOptionRequeue ComputeNodeReimageOption = "requeue" + // ComputeNodeReimageOptionRetainedData ... + ComputeNodeReimageOptionRetainedData ComputeNodeReimageOption = "retainedData" + // ComputeNodeReimageOptionTaskCompletion ... + ComputeNodeReimageOptionTaskCompletion ComputeNodeReimageOption = "taskCompletion" + // ComputeNodeReimageOptionTerminate ... + 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 ... + Creating ComputeNodeState = "creating" + // Idle ... + Idle ComputeNodeState = "idle" + // LeavingPool ... + LeavingPool ComputeNodeState = "leavingPool" + // Offline ... + Offline ComputeNodeState = "offline" + // Preempted ... + Preempted ComputeNodeState = "preempted" + // Rebooting ... + Rebooting ComputeNodeState = "rebooting" + // Reimaging ... + Reimaging ComputeNodeState = "reimaging" + // Running ... + Running ComputeNodeState = "running" + // Starting ... + Starting ComputeNodeState = "starting" + // StartTaskFailed ... + StartTaskFailed ComputeNodeState = "startTaskFailed" + // Unknown ... + Unknown ComputeNodeState = "unknown" + // Unusable ... + Unusable ComputeNodeState = "unusable" + // WaitingForStartTask ... + 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} +} + +// DependencyAction enumerates the values for dependency action. +type DependencyAction string + +const ( + // Block ... + Block DependencyAction = "block" + // Satisfy ... + Satisfy DependencyAction = "satisfy" +) + +// PossibleDependencyActionValues returns an array of possible values for the DependencyAction const type. +func PossibleDependencyActionValues() []DependencyAction { + return []DependencyAction{Block, Satisfy} +} + +// DisableComputeNodeSchedulingOption enumerates the values for disable compute node scheduling option. +type DisableComputeNodeSchedulingOption string + +const ( + // DisableComputeNodeSchedulingOptionRequeue ... + DisableComputeNodeSchedulingOptionRequeue DisableComputeNodeSchedulingOption = "requeue" + // DisableComputeNodeSchedulingOptionTaskCompletion ... + DisableComputeNodeSchedulingOptionTaskCompletion DisableComputeNodeSchedulingOption = "taskCompletion" + // DisableComputeNodeSchedulingOptionTerminate ... + 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 ... + DisableJobOptionRequeue DisableJobOption = "requeue" + // DisableJobOptionTerminate ... + DisableJobOptionTerminate DisableJobOption = "terminate" + // DisableJobOptionWait ... + DisableJobOptionWait DisableJobOption = "wait" +) + +// PossibleDisableJobOptionValues returns an array of possible values for the DisableJobOption const type. +func PossibleDisableJobOptionValues() []DisableJobOption { + return []DisableJobOption{DisableJobOptionRequeue, DisableJobOptionTerminate, DisableJobOptionWait} +} + +// ElevationLevel enumerates the values for elevation level. +type ElevationLevel string + +const ( + // Admin ... + Admin ElevationLevel = "admin" + // NonAdmin ... + 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 ... + ServerError ErrorCategory = "serverError" + // UserError ... + UserError ErrorCategory = "userError" +) + +// PossibleErrorCategoryValues returns an array of possible values for the ErrorCategory const type. +func PossibleErrorCategoryValues() []ErrorCategory { + return []ErrorCategory{ServerError, UserError} +} + +// JobAction enumerates the values for job action. +type JobAction string + +const ( + // JobActionDisable ... + JobActionDisable JobAction = "disable" + // JobActionNone ... + JobActionNone JobAction = "none" + // JobActionTerminate ... + 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 ... + JobPreparationTaskStateCompleted JobPreparationTaskState = "completed" + // JobPreparationTaskStateRunning ... + 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 ... + JobReleaseTaskStateCompleted JobReleaseTaskState = "completed" + // JobReleaseTaskStateRunning ... + 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 ... + JobScheduleStateActive JobScheduleState = "active" + // JobScheduleStateCompleted ... + JobScheduleStateCompleted JobScheduleState = "completed" + // JobScheduleStateDeleting ... + JobScheduleStateDeleting JobScheduleState = "deleting" + // JobScheduleStateDisabled ... + JobScheduleStateDisabled JobScheduleState = "disabled" + // JobScheduleStateTerminating ... + 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 ... + JobStateActive JobState = "active" + // JobStateCompleted ... + JobStateCompleted JobState = "completed" + // JobStateDeleting ... + JobStateDeleting JobState = "deleting" + // JobStateDisabled ... + JobStateDisabled JobState = "disabled" + // JobStateDisabling ... + JobStateDisabling JobState = "disabling" + // JobStateEnabling ... + JobStateEnabling JobState = "enabling" + // JobStateTerminating ... + 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} +} + +// OnAllTasksComplete enumerates the values for on all tasks complete. +type OnAllTasksComplete string + +const ( + // NoAction ... + NoAction OnAllTasksComplete = "noAction" + // TerminateJob ... + 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 ... + OnTaskFailureNoAction OnTaskFailure = "noAction" + // OnTaskFailurePerformExitOptionsJobAction ... + 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 ... + Linux OSType = "linux" + // Windows ... + 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 ... + OutputFileUploadConditionTaskCompletion OutputFileUploadCondition = "taskCompletion" + // OutputFileUploadConditionTaskFailure ... + OutputFileUploadConditionTaskFailure OutputFileUploadCondition = "taskFailure" + // OutputFileUploadConditionTaskSuccess ... + OutputFileUploadConditionTaskSuccess OutputFileUploadCondition = "taskSuccess" +) + +// PossibleOutputFileUploadConditionValues returns an array of possible values for the OutputFileUploadCondition const type. +func PossibleOutputFileUploadConditionValues() []OutputFileUploadCondition { + return []OutputFileUploadCondition{OutputFileUploadConditionTaskCompletion, OutputFileUploadConditionTaskFailure, OutputFileUploadConditionTaskSuccess} +} + +// PoolLifetimeOption enumerates the values for pool lifetime option. +type PoolLifetimeOption string + +const ( + // PoolLifetimeOptionJob ... + PoolLifetimeOptionJob PoolLifetimeOption = "job" + // PoolLifetimeOptionJobSchedule ... + 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 ... + PoolStateActive PoolState = "active" + // PoolStateDeleting ... + PoolStateDeleting PoolState = "deleting" + // PoolStateUpgrading ... + PoolStateUpgrading PoolState = "upgrading" +) + +// PossiblePoolStateValues returns an array of possible values for the PoolState const type. +func PossiblePoolStateValues() []PoolState { + return []PoolState{PoolStateActive, PoolStateDeleting, PoolStateUpgrading} +} + +// SchedulingState enumerates the values for scheduling state. +type SchedulingState string + +const ( + // Disabled ... + Disabled SchedulingState = "disabled" + // Enabled ... + 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 ... + StartTaskStateCompleted StartTaskState = "completed" + // StartTaskStateRunning ... + StartTaskStateRunning StartTaskState = "running" +) + +// PossibleStartTaskStateValues returns an array of possible values for the StartTaskState const type. +func PossibleStartTaskStateValues() []StartTaskState { + return []StartTaskState{StartTaskStateCompleted, StartTaskStateRunning} +} + +// SubtaskState enumerates the values for subtask state. +type SubtaskState string + +const ( + // SubtaskStateCompleted ... + SubtaskStateCompleted SubtaskState = "completed" + // SubtaskStatePreparing ... + SubtaskStatePreparing SubtaskState = "preparing" + // SubtaskStateRunning ... + 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 ... + TaskAddStatusClientError TaskAddStatus = "clientError" + // TaskAddStatusServerError ... + TaskAddStatusServerError TaskAddStatus = "serverError" + // TaskAddStatusSuccess ... + 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 ... + Failure TaskExecutionResult = "failure" + // Success ... + 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 ... + TaskStateActive TaskState = "active" + // TaskStateCompleted ... + TaskStateCompleted TaskState = "completed" + // TaskStatePreparing ... + TaskStatePreparing TaskState = "preparing" + // TaskStateRunning ... + TaskStateRunning TaskState = "running" +) + +// PossibleTaskStateValues returns an array of possible values for the TaskState const type. +func PossibleTaskStateValues() []TaskState { + return []TaskState{TaskStateActive, TaskStateCompleted, TaskStatePreparing, TaskStateRunning} +} + +// AccountListNodeAgentSkusResult ... +type AccountListNodeAgentSkusResult struct { + autorest.Response `json:"-"` + Value *[]NodeAgentSku `json:"value,omitempty"` + OdataNextLink *string `json:"odata.nextLink,omitempty"` +} + +// AccountListNodeAgentSkusResultIterator provides access to a complete listing of NodeAgentSku values. +type AccountListNodeAgentSkusResultIterator struct { + i int + page AccountListNodeAgentSkusResultPage +} + +// Next 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 *AccountListNodeAgentSkusResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AccountListNodeAgentSkusResultIterator) 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 AccountListNodeAgentSkusResultIterator) Response() AccountListNodeAgentSkusResult { + 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 AccountListNodeAgentSkusResultIterator) Value() NodeAgentSku { + if !iter.page.NotDone() { + return NodeAgentSku{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (alnasr AccountListNodeAgentSkusResult) IsEmpty() bool { + return alnasr.Value == nil || len(*alnasr.Value) == 0 +} + +// accountListNodeAgentSkusResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (alnasr AccountListNodeAgentSkusResult) accountListNodeAgentSkusResultPreparer() (*http.Request, error) { + if alnasr.OdataNextLink == nil || len(to.String(alnasr.OdataNextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(alnasr.OdataNextLink))) +} + +// AccountListNodeAgentSkusResultPage contains a page of NodeAgentSku values. +type AccountListNodeAgentSkusResultPage struct { + fn func(AccountListNodeAgentSkusResult) (AccountListNodeAgentSkusResult, error) + alnasr AccountListNodeAgentSkusResult +} + +// 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. +func (page *AccountListNodeAgentSkusResultPage) Next() error { + next, err := page.fn(page.alnasr) + if err != nil { + return err + } + page.alnasr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AccountListNodeAgentSkusResultPage) NotDone() bool { + return !page.alnasr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AccountListNodeAgentSkusResultPage) Response() AccountListNodeAgentSkusResult { + return page.alnasr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AccountListNodeAgentSkusResultPage) Values() []NodeAgentSku { + if page.alnasr.IsEmpty() { + return nil + } + return *page.alnasr.Value +} + +// AffinityInformation ... +type AffinityInformation struct { + // AffinityID - You can pass the affinityId of a compute node or task to indicate that this task needs to be placed close to the node or task. + 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 +} + +// Next 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) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// 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] +} + +// IsEmpty returns true if the ListResult contains no values. +func (alr ApplicationListResult) IsEmpty() bool { + return alr.Value == nil || len(*alr.Value) == 0 +} + +// applicationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (alr ApplicationListResult) applicationListResultPreparer() (*http.Request, error) { + if alr.OdataNextLink == nil || len(to.String(alr.OdataNextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(alr.OdataNextLink))) +} + +// ApplicationListResultPage contains a page of ApplicationSummary values. +type ApplicationListResultPage struct { + fn func(ApplicationListResult) (ApplicationListResult, error) + alr ApplicationListResult +} + +// 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. +func (page *ApplicationListResultPage) Next() error { + next, err := page.fn(page.alr) + if err != nil { + return err + } + page.alr = next + return nil +} + +// 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 +} + +// ApplicationPackageReference ... +type ApplicationPackageReference struct { + ApplicationID *string `json:"applicationId,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"` +} + +// 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 - When the pool lifetime scope is jobSchedule level, the Batch service keeps track of the last autopool created for the job schedule, and deletes that pool when the job schedule completes. Batch will also delete this pool if the user updates the auto pool specification in a way that changes this lifetime. 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 - pool - specifies that the task runs as the common auto user account which is created on every node in a pool. task - specifies that the service should create a new user for the task. The default value is task. Possible values include: 'Task', 'Pool' + Scope AutoUserScope `json:"scope,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"` +} + +// 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 is required if the certificate format is pfx. It should 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 +} + +// Next 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) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// 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] +} + +// IsEmpty returns true if the ListResult contains no values. +func (clr CertificateListResult) IsEmpty() bool { + return clr.Value == nil || len(*clr.Value) == 0 +} + +// certificateListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (clr CertificateListResult) certificateListResultPreparer() (*http.Request, error) { + if clr.OdataNextLink == nil || len(to.String(clr.OdataNextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(clr.OdataNextLink))) +} + +// CertificateListResultPage contains a page of Certificate values. +type CertificateListResultPage struct { + fn func(CertificateListResult) (CertificateListResult, error) + clr CertificateListResult +} + +// 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. +func (page *CertificateListResultPage) Next() error { + next, err := page.fn(page.clr) + if err != nil { + return err + } + page.clr = next + return nil +} + +// 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 +} + +// 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 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 - The default value is My. This property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). + StoreName *string `json:"storeName,omitempty"` + // Visibility - The default is all accounts. + Visibility *[]CertificateVisibility `json:"visibility,omitempty"` +} + +// CloudJob ... +type CloudJob 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. It is common to use a GUID for the id. + 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"` + Constraints *JobConstraints `json:"constraints,omitempty"` + JobManagerTask *JobManagerTask `json:"jobManagerTask,omitempty"` + // JobPreparationTask - The Job Preparation task is a special task run on each 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 node that has run any other task of the job. + JobReleaseTask *JobReleaseTask `json:"jobReleaseTask,omitempty"` + CommonEnvironmentSettings *[]EnvironmentSetting `json:"commonEnvironmentSettings,omitempty"` + PoolInfo *PoolInformation `json:"poolInfo,omitempty"` + // OnAllTasksComplete - noAction - do nothing. The job remains active unless terminated or disabled by some other means. terminateJob - terminate the job. The job's terminateReason is set to 'AllTasksComplete'. The default is noAction. Possible values include: 'NoAction', 'TerminateJob' + OnAllTasksComplete OnAllTasksComplete `json:"onAllTasksComplete,omitempty"` + // OnTaskFailure - noAction - do nothing. performExitOptionsJobAction - 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.) 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"` + ExecutionInfo *JobExecutionInformation `json:"executionInfo,omitempty"` + 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 +} + +// Next 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) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// 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] +} + +// IsEmpty returns true if the ListResult contains no values. +func (cjlpartsr CloudJobListPreparationAndReleaseTaskStatusResult) IsEmpty() bool { + return cjlpartsr.Value == nil || len(*cjlpartsr.Value) == 0 +} + +// cloudJobListPreparationAndReleaseTaskStatusResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cjlpartsr CloudJobListPreparationAndReleaseTaskStatusResult) cloudJobListPreparationAndReleaseTaskStatusResultPreparer() (*http.Request, error) { + if cjlpartsr.OdataNextLink == nil || len(to.String(cjlpartsr.OdataNextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cjlpartsr.OdataNextLink))) +} + +// CloudJobListPreparationAndReleaseTaskStatusResultPage contains a page of +// JobPreparationAndReleaseTaskExecutionInformation values. +type CloudJobListPreparationAndReleaseTaskStatusResultPage struct { + fn func(CloudJobListPreparationAndReleaseTaskStatusResult) (CloudJobListPreparationAndReleaseTaskStatusResult, error) + cjlpartsr CloudJobListPreparationAndReleaseTaskStatusResult +} + +// 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. +func (page *CloudJobListPreparationAndReleaseTaskStatusResultPage) Next() error { + next, err := page.fn(page.cjlpartsr) + if err != nil { + return err + } + page.cjlpartsr = next + return nil +} + +// 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 +} + +// 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 +} + +// Next 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) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// 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] +} + +// IsEmpty returns true if the ListResult contains no values. +func (cjlr CloudJobListResult) IsEmpty() bool { + return cjlr.Value == nil || len(*cjlr.Value) == 0 +} + +// cloudJobListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cjlr CloudJobListResult) cloudJobListResultPreparer() (*http.Request, error) { + if cjlr.OdataNextLink == nil || len(to.String(cjlr.OdataNextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cjlr.OdataNextLink))) +} + +// CloudJobListResultPage contains a page of CloudJob values. +type CloudJobListResultPage struct { + fn func(CloudJobListResult) (CloudJobListResult, error) + cjlr CloudJobListResult +} + +// 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. +func (page *CloudJobListResultPage) Next() error { + next, err := page.fn(page.cjlr) + if err != nil { + return err + } + page.cjlr = next + return nil +} + +// 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 +} + +// CloudJobSchedule ... +type CloudJobSchedule struct { + autorest.Response `json:"-"` + // ID - It is common to use a GUID for the id. + 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 +} + +// Next 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) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// 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] +} + +// IsEmpty returns true if the ListResult contains no values. +func (cjslr CloudJobScheduleListResult) IsEmpty() bool { + return cjslr.Value == nil || len(*cjslr.Value) == 0 +} + +// cloudJobScheduleListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cjslr CloudJobScheduleListResult) cloudJobScheduleListResultPreparer() (*http.Request, error) { + if cjslr.OdataNextLink == nil || len(to.String(cjslr.OdataNextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cjslr.OdataNextLink))) +} + +// CloudJobScheduleListResultPage contains a page of CloudJobSchedule values. +type CloudJobScheduleListResultPage struct { + fn func(CloudJobScheduleListResult) (CloudJobScheduleListResult, error) + cjslr CloudJobScheduleListResult +} + +// 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. +func (page *CloudJobScheduleListResultPage) Next() error { + next, err := page.fn(page.cjslr) + if err != nil { + return err + } + page.cjslr = next + return nil +} + +// 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 +} + +// 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. It is common to use a GUID for the id. + 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 - active - The pool is available to run tasks subject to the availability of compute nodes. deleting - The user has requested that the pool be deleted, but the delete operation has not yet completed. upgrading - The user has requested that the operating system of the pool's nodes be upgraded, but the upgrade operation has not yet completed (that is, some nodes in the pool have not yet been upgraded). While upgrading, the pool may be able to run tasks (with reduced capacity) but this is not guaranteed. Possible values include: 'PoolStateActive', 'PoolStateDeleting', 'PoolStateUpgrading' + State PoolState `json:"state,omitempty"` + StateTransitionTime *date.Time `json:"stateTransitionTime,omitempty"` + // AllocationState - 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 dedicated nodes. resizing - The pool is resizing; that is, compute nodes are being added to or removed from the pool. stopping - The pool was resizing, but the user has requested that the resize be stopped, but the stop request has not yet been completed. 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 for Cloud Services pools (pools created with cloudServiceConfiguration), see Sizes for Cloud Services (http://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 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 targetDedicateNodes 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 nodes can be assigned to the pool. Specifying this value can reduce the chance of the requested number of 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 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. + CertificateReferences *[]CertificateReference `json:"certificateReferences,omitempty"` + 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"` + MaxTasksPerNode *int32 `json:"maxTasksPerNode,omitempty"` + TaskSchedulingPolicy *TaskSchedulingPolicy `json:"taskSchedulingPolicy,omitempty"` + UserAccounts *[]UserAccount `json:"userAccounts,omitempty"` + Metadata *[]MetadataItem `json:"metadata,omitempty"` + Stats *PoolStatistics `json:"stats,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 +} + +// Next 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) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// 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] +} + +// IsEmpty returns true if the ListResult contains no values. +func (cplr CloudPoolListResult) IsEmpty() bool { + return cplr.Value == nil || len(*cplr.Value) == 0 +} + +// cloudPoolListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cplr CloudPoolListResult) cloudPoolListResultPreparer() (*http.Request, error) { + if cplr.OdataNextLink == nil || len(to.String(cplr.OdataNextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cplr.OdataNextLink))) +} + +// CloudPoolListResultPage contains a page of CloudPool values. +type CloudPoolListResultPage struct { + fn func(CloudPoolListResult) (CloudPoolListResult, error) + cplr CloudPoolListResult +} + +// 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. +func (page *CloudPoolListResultPage) Next() error { + next, err := page.fn(page.cplr) + if err != nil { + return err + } + page.cplr = next + return nil +} + +// 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 +} + +// 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. 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"` + // TargetOSVersion - The default value is * which specifies the latest operating system version for the specified OS family. + TargetOSVersion *string `json:"targetOSVersion,omitempty"` + // CurrentOSVersion - This may differ from targetOSVersion if the pool state is Upgrading. In this case some virtual machines may be on the targetOSVersion and some may be on the currentOSVersion during the upgrade process. Once all virtual machines have upgraded, currentOSVersion is updated to be the same as targetOSVersion. + CurrentOSVersion *string `json:"currentOSVersion,omitempty"` +} + +// CloudTask ... +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. + CommandLine *string `json:"commandLine,omitempty"` + // ResourceFiles - For multi-instance tasks, the resource files will only be downloaded to the compute node on which the primary task is executed. + 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"` + // 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 *[]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 +} + +// Next 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) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// 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] +} + +// IsEmpty returns true if the ListResult contains no values. +func (ctlr CloudTaskListResult) IsEmpty() bool { + return ctlr.Value == nil || len(*ctlr.Value) == 0 +} + +// cloudTaskListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ctlr CloudTaskListResult) cloudTaskListResultPreparer() (*http.Request, error) { + if ctlr.OdataNextLink == nil || len(to.String(ctlr.OdataNextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ctlr.OdataNextLink))) +} + +// CloudTaskListResultPage contains a page of CloudTask values. +type CloudTaskListResultPage struct { + fn func(CloudTaskListResult) (CloudTaskListResult, error) + ctlr CloudTaskListResult +} + +// 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. +func (page *CloudTaskListResultPage) Next() error { + next, err := page.fn(page.ctlr) + if err != nil { + return err + } + page.ctlr = next + return nil +} + +// 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 +} + +// CloudTaskListSubtasksResult ... +type CloudTaskListSubtasksResult struct { + autorest.Response `json:"-"` + Value *[]SubtaskInformation `json:"value,omitempty"` +} + +// ComputeNode ... +type ComputeNode struct { + autorest.Response `json:"-"` + // ID - Every node that is added to a pool is assigned a unique ID. Whenever a node is removed from a pool, all of its local files are deleted, and the ID is reclaimed and could be reused for new nodes. + ID *string `json:"id,omitempty"` + URL *string `json:"url,omitempty"` + // State - Possible values include: 'Idle', 'Rebooting', 'Reimaging', 'Running', 'Unusable', 'Creating', 'Starting', 'WaitingForStartTask', 'StartTaskFailed', 'Unknown', 'LeavingPool', 'Offline', 'Preempted' + State ComputeNodeState `json:"state,omitempty"` + // SchedulingState - enabled - Tasks can be scheduled on the node. disabled - No new tasks will be scheduled on the node. Tasks already running on the node may still run to completion. All nodes start with scheduling enabled. 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 node state is unusable. + LastBootTime *date.Time `json:"lastBootTime,omitempty"` + AllocationTime *date.Time `json:"allocationTime,omitempty"` + // IPAddress - Every node that is added to a pool is assigned a unique IP address. Whenever a 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 nodes. + IPAddress *string `json:"ipAddress,omitempty"` + AffinityID *string `json:"affinityId,omitempty"` + // VMSize - For information about available sizes of virtual machines for Cloud Services pools (pools created with cloudServiceConfiguration), see Sizes for Cloud Services (http://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"` + TotalTasksRun *int32 `json:"totalTasksRun,omitempty"` + RunningTasksCount *int32 `json:"runningTasksCount,omitempty"` + TotalTasksSucceeded *int32 `json:"totalTasksSucceeded,omitempty"` + RecentTasks *[]TaskInformation `json:"recentTasks,omitempty"` + StartTask *StartTask `json:"startTask,omitempty"` + StartTaskInfo *StartTaskInformation `json:"startTaskInfo,omitempty"` + // CertificateReferences - 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. + CertificateReferences *[]CertificateReference `json:"certificateReferences,omitempty"` + Errors *[]ComputeNodeError `json:"errors,omitempty"` + IsDedicated *bool `json:"isDedicated,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"` +} + +// 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 +} + +// Next 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) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// 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] +} + +// IsEmpty returns true if the ListResult contains no values. +func (cnlr ComputeNodeListResult) IsEmpty() bool { + return cnlr.Value == nil || len(*cnlr.Value) == 0 +} + +// computeNodeListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cnlr ComputeNodeListResult) computeNodeListResultPreparer() (*http.Request, error) { + if cnlr.OdataNextLink == nil || len(to.String(cnlr.OdataNextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cnlr.OdataNextLink))) +} + +// ComputeNodeListResultPage contains a page of ComputeNode values. +type ComputeNodeListResultPage struct { + fn func(ComputeNodeListResult) (ComputeNodeListResult, error) + cnlr ComputeNodeListResult +} + +// 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. +func (page *ComputeNodeListResultPage) Next() error { + next, err := page.fn(page.cnlr) + if err != nil { + return err + } + page.cnlr = next + return nil +} + +// 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 +} + +// 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 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 nodes. If this is specified for a Windows 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"` +} + +// 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 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"` +} + +// 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 behaviour 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 specify this property returns an error. 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 - The default is 'satisfy' for exit code 0, and 'block' for all other exit conditions. If the job's usesTaskDependencies property is set to false, then specifying the dependencyAction property returns an error. 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: '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"` +} + +// 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, 14.04.0-LTS or 2012-R2-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"` +} + +// 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. It is common to use a GUID for the id. + 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"` + // 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 compute 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 compute 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 *[]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. Permitted values are: noAction - do nothing. The job remains active unless terminated or disabled by some other means. terminateJob - terminate the job. The job's terminateReason is set to 'AllTasksComplete'. The default is noAction. Possible values include: 'NoAction', 'TerminateJob' + OnAllTasksComplete OnAllTasksComplete `json:"onAllTasksComplete,omitempty"` + // OnTaskFailure - noAction - do nothing. performExitOptionsJobAction - 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.) 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"` +} + +// 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 - requeue - Terminate running tasks and requeue them. The tasks will run again when the job is enabled. terminate - Terminate running tasks. The tasks will not run again. wait - Allow currently running tasks to complete. 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 ... +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. + CommandLine *string `json:"commandLine,omitempty"` + // ResourceFiles - Files listed under this element are located in the task's working directory. + ResourceFiles *[]ResourceFile `json:"resourceFiles,omitempty"` + OutputFiles *[]OutputFile `json:"outputFiles,omitempty"` + EnvironmentSettings *[]EnvironmentSetting `json:"environmentSettings,omitempty"` + Constraints *TaskConstraints `json:"constraints,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 compute 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 node's concurrent task limit, so this is only relevant if the 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 directory. Therefore, if a referenced 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 with a scheduling error. This property is currently not supported on jobs running on pools created using the virtualMachineConfiguration (IaaS) property. If a task specifying applicationPackageReferences runs on such a pool, it fails with a scheduling error with code TaskSchedulingConstraintFailed. + 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 false. + AllowLowPriorityNode *bool `json:"allowLowPriorityNode,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"` + // 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 specification in the poolInfo, only the keepAlive property can be updated, and then only if the auto pool has a poolLifetimeOption of job. 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 node. + JobReleaseTaskExecutionInfo *JobReleaseTaskExecutionInformation `json:"jobReleaseTaskExecutionInfo,omitempty"` +} + +// JobPreparationTask ... +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. + CommandLine *string `json:"commandLine,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"` + Constraints *TaskConstraints `json:"constraints,omitempty"` + // WaitForSuccess - If true and the Job Preparation task fails on a compute 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 compute node. The compute 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 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. + 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 - Note that every time the task is restarted, this value is updated. + 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 - running - the task is currently running (including retrying). completed - 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 scheduling errors. 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"` + // FailureInfo - This property is set only if the task is in the completed state and encountered a failure. + FailureInfo *TaskFailureInformation `json:"failureInfo,omitempty"` + 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 ... +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. + CommandLine *string `json:"commandLine,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 infinite, i.e. the task directory will be retained until the compute node is removed or reimaged. + 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 *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 - running - the task is currently running (including retrying). completed - the task has exited, or the Batch service was unable to start the task due to scheduling errors. 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"` + // 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"` + // 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"` + 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 compute 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 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. 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 *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 specification in the poolInfo, only the keepAlive property can be updated, and then only if the auto pool has a poolLifetimeOption of job. + 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. 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 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"` +} + +// 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"` +} + +// MultiInstanceSettings multi-instance tasks are commonly used to support MPI tasks. +type MultiInstanceSettings struct { + 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. + 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 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 Batch service principal, named 'Microsoft Azure Batch' or 'MicrosoftAzureBatch', 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. For pools created via virtualMachineConfiguration the Batch account must have poolAllocationMode userSubscription in order to use a VNet. + SubnetID *string `json:"subnetId,omitempty"` +} + +// NodeAgentSku 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. +type NodeAgentSku struct { + ID *string `json:"id,omitempty"` + // VerifiedImageReferences - This collection is not exhaustive (the node agent may be compatible with other images). + VerifiedImageReferences *[]ImageReference `json:"verifiedImageReferences,omitempty"` + // OsType - Possible values include: 'Linux', 'Windows' + OsType OSType `json:"osType,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 +} + +// Next 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) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// 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] +} + +// IsEmpty returns true if the ListResult contains no values. +func (nflr NodeFileListResult) IsEmpty() bool { + return nflr.Value == nil || len(*nflr.Value) == 0 +} + +// nodeFileListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (nflr NodeFileListResult) nodeFileListResultPreparer() (*http.Request, error) { + if nflr.OdataNextLink == nil || len(to.String(nflr.OdataNextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(nflr.OdataNextLink))) +} + +// NodeFileListResultPage contains a page of NodeFile values. +type NodeFileListResultPage struct { + fn func(NodeFileListResult) (NodeFileListResult, error) + nflr NodeFileListResult +} + +// 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. +func (page *NodeFileListResultPage) Next() error { + next, err := page.fn(page.nflr) + if err != nil { + return err + } + page.nflr = next + return nil +} + +// 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 +} + +// 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 *[]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 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 nodes. If this is specified for a Windows 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"` +} + +// OSDisk ... +type OSDisk struct { + // ImageUris - All the VHDs must be identical and must reside in an Azure Storage account within the same subscription and same region as the Batch account. For best performance, it is recommended that each VHD resides in a separate Azure Storage account. Each VHD can serve upto 20 Windows compute nodes or 40 Linux compute nodes. You must supply enough VHD URIs to satisfy the 'targetDedicated' property of the pool. If you do not supply enough VHD URIs, the pool will partially allocate compute nodes, and a resize error will occur. + ImageUris *[]string `json:"imageUris,omitempty"` + // Caching - 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"` +} + +// OutputFile ... +type OutputFile struct { + // FilePattern - Both relative and absolute paths are supported. Relative paths are relative to the task working directory. For wildcards, use * to match any character and ** to match any directory. For example, **\*.txt matches any file ending in .txt in the task working directory or any subdirectory. Note that \ and / are treated interchangeably and mapped to the correct directory separator on the compute node operating system. + 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 - The URL must include a Shared Access Signature (SAS) granting write permissions to the container. + ContainerURL *string `json:"containerUrl,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 (http://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 targetDedicateNodes 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 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 node is added to the pool or when the node is restarted. + StartTask *StartTask `json:"startTask,omitempty"` + // CertificateReferences - 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. + CertificateReferences *[]CertificateReference `json:"certificateReferences,omitempty"` + // ApplicationPackageReferences - This property is currently not supported on pools created using the virtualMachineConfiguration (IaaS) property. + 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"` + // MaxTasksPerNode - The default value is 1. The maximum value of this setting depends on the size of the compute nodes in the pool (the vmSize setting). + MaxTasksPerNode *int32 `json:"maxTasksPerNode,omitempty"` + 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"` +} + +// 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"` +} + +// 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"` +} + +// 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 +} + +// Next 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) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// 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] +} + +// IsEmpty returns true if the ListResult contains no values. +func (plumr PoolListUsageMetricsResult) IsEmpty() bool { + return plumr.Value == nil || len(*plumr.Value) == 0 +} + +// poolListUsageMetricsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (plumr PoolListUsageMetricsResult) poolListUsageMetricsResultPreparer() (*http.Request, error) { + if plumr.OdataNextLink == nil || len(to.String(plumr.OdataNextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(plumr.OdataNextLink))) +} + +// PoolListUsageMetricsResultPage contains a page of PoolUsageMetrics values. +type PoolListUsageMetricsResultPage struct { + fn func(PoolListUsageMetricsResult) (PoolListUsageMetricsResult, error) + plumr PoolListUsageMetricsResult +} + +// 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. +func (page *PoolListUsageMetricsResultPage) Next() error { + next, err := page.fn(page.plumr) + if err != nil { + return err + } + page.plumr = next + return nil +} + +// 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 +} + +// PoolPatchParameter ... +type PoolPatchParameter struct { + // StartTask - If omitted, any existing start task is left unchanged. + StartTask *StartTask `json:"startTask,omitempty"` + // CertificateReferences - If omitted, any existing certificate references are left unchanged. 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. + CertificateReferences *[]CertificateReference `json:"certificateReferences,omitempty"` + // ApplicationPackageReferences - 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. If this element is present, it replaces any existing application package references. If you specify an empty collection, then all application package references are removed from the pool. If omitted, any existing application 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 for Cloud Services pools (pools created with cloudServiceConfiguration), see Sizes for Cloud Services (http://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 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"` + // MaxTasksPerNode - The default value is 1. The maximum value of this setting depends on the size of the compute nodes in the pool (the vmSize setting). + MaxTasksPerNode *int32 `json:"maxTasksPerNode,omitempty"` + // TaskSchedulingPolicy - How tasks are distributed among compute nodes in the pool. + 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 targetDedicateNodes 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 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 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. + CertificateReferences *[]CertificateReference `json:"certificateReferences,omitempty"` + // ApplicationPackageReferences - This property is currently not supported on auto pools created with the virtualMachineConfiguration (IaaS) property. + 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"` + 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"` +} + +// 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 start task. If omitted, any existing start task is removed from the pool. + StartTask *StartTask `json:"startTask,omitempty"` + // CertificateReferences - If you specify an empty collection, any existing certificate references are removed from the pool. 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. + CertificateReferences *[]CertificateReference `json:"certificateReferences,omitempty"` + // ApplicationPackageReferences - 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. The list replaces any existing application package references. If omitted, or if you specify an empty collection, any existing application packages references are removed from the 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"` +} + +// PoolUpgradeOSParameter ... +type PoolUpgradeOSParameter struct { + TargetOSVersion *string `json:"targetOSVersion,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 for Cloud Services pools (pools created with cloudServiceConfiguration), see Sizes for Cloud Services (http://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"` + TotalCoreHours *float64 `json:"totalCoreHours,omitempty"` + DataIngressGiB *float64 `json:"dataIngressGiB,omitempty"` + DataEgressGiB *float64 `json:"dataEgressGiB,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 { + // BlobSource - This URL 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. + BlobSource *string `json:"blobSource,omitempty"` + 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"` +} + +// 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 ... +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. + 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 false. + WaitForSuccess *bool `json:"waitForSuccess,omitempty"` +} + +// StartTaskInformation ... +type StartTaskInformation struct { + // State - running - The start task is currently running. completed - The start task has exited with exit code 0, or the start task has failed and the retry limit has reached, or the start task process did not run due to scheduling errors. 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 start task started running). + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - This is the end time of the most recent run of the start task, if that run has completed (even if that run failed and a retry is pending). This element is not present if the start task is currently running. + EndTime *date.Time `json:"endTime,omitempty"` + // ExitCode - This property is set only if the start 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 start task (due to timeout, or user termination via the API) you may see an operating system-defined exit code. + ExitCode *int32 `json:"exitCode,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 - The number of times the task has been retried by the Batch service. 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"` + // 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 *[]TaskAddParameter `json:"value,omitempty"` +} + +// TaskAddCollectionResult ... +type TaskAddCollectionResult struct { + autorest.Response `json:"-"` + Value *[]TaskAddResult `json:"value,omitempty"` +} + +// TaskAddParameter ... +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. + CommandLine *string `json:"commandLine,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. + 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, and the maxWallClockTime and retentionTime are infinite. + Constraints *TaskConstraints `json:"constraints,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 *[]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 *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 infinite, i.e. the task directory will be retained until the compute node is removed or reimaged. + RetentionTime *string `json:"retentionTime,omitempty"` + // MaxTaskRetryCount - 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"` +} + +// TaskDependencies ... +type TaskDependencies struct { + 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 application 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"` + // FailureInfo - This property is set only if the task is in the completed state and encountered a failure. + FailureInfo *TaskFailureInformation `json:"failureInfo,omitempty"` + // RetryCount - The number of times the task has been retried by the Batch service. 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 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 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 - Possible values include: 'Spread', 'Pack' + NodeFillType ComputeNodeFillType `json:"nodeFillType,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. + Constraints *TaskConstraints `json:"constraints,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 - 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"` +} + +// 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 - This property and osDisk are mutually exclusive and one of the properties must be specified. + ImageReference *ImageReference `json:"imageReference,omitempty"` + // OsDisk - This property can be specified only if the Batch account was created with its poolAllocationMode property set to 'UserSubscription'. This property and imageReference are mutually exclusive and one of the properties must be specified. + OsDisk *OSDisk `json:"osDisk,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 or osDisk property specifies a Linux OS image. + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` +} + +// WindowsConfiguration ... +type WindowsConfiguration struct { + // EnableAutomaticUpdates - If omitted, the default value is true. + EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` +} diff --git a/services/batch/2017-05-01.5.0/batch/pool.go b/services/batch/2017-05-01.5.0/batch/pool.go index 30aea39fcb14..40f53f20c20f 100644 --- a/services/batch/2017-05-01.5.0/batch/pool.go +++ b/services/batch/2017-05-01.5.0/batch/pool.go @@ -18,139 +18,137 @@ package batch // Changes may cause incorrect behavior and will be lost if the code is regenerated. import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" - "context" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/autorest/date" - "github.com/satori/go.uuid" + "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/satori/go.uuid" + "net/http" ) // PoolClient is the a client for issuing REST requests to the Azure Batch service. type PoolClient struct { - BaseClient + BaseClient } + // NewPoolClient creates an instance of the PoolClient client. func NewPoolClient() PoolClient { - return NewPoolClientWithBaseURI(DefaultBaseURI, ) + return NewPoolClientWithBaseURI(DefaultBaseURI) } // NewPoolClientWithBaseURI creates an instance of the PoolClient client. - func NewPoolClientWithBaseURI(baseURI string, ) PoolClient { - return PoolClient{ NewWithBaseURI(baseURI, )} - } +func NewPoolClientWithBaseURI(baseURI string) PoolClient { + return PoolClient{NewWithBaseURI(baseURI)} +} // 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. - // - // pool is the pool to be added. timeout is the maximum time that the server can spend processing the request, in - // seconds. The default is 30 seconds. clientRequestID is 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 - // is whether the server should return the client-request-id in the response. ocpDate is 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. +// +// pool is the pool to be added. timeout is the maximum time that the server can spend processing the request, in +// seconds. The default is 30 seconds. clientRequestID is 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 +// is whether the server should return the client-request-id in the response. ocpDate is 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 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: false , - Chain: []validation.Constraint{ {Target: "pool.VirtualMachineConfiguration.ImageReference.Publisher", Name: validation.Null, Rule: true, Chain: nil }, - {Target: "pool.VirtualMachineConfiguration.ImageReference.Offer", Name: validation.Null, Rule: true, Chain: nil }, - {Target: "pool.VirtualMachineConfiguration.ImageReference.Sku", Name: validation.Null, Rule: true, Chain: nil }, - }}, - {Target: "pool.VirtualMachineConfiguration.OsDisk", Name: validation.Null, Rule: false , - Chain: []validation.Constraint{ {Target: "pool.VirtualMachineConfiguration.OsDisk.ImageUris", Name: validation.Null, Rule: true, Chain: nil }, - }}, - {Target: "pool.VirtualMachineConfiguration.NodeAgentSKUID", 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 }, - }}}}}); 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 - } - - // 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) { - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusCreated), - autorest.ByClosing()) - result.Response = resp - return - } + 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: false, + Chain: []validation.Constraint{{Target: "pool.VirtualMachineConfiguration.ImageReference.Publisher", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "pool.VirtualMachineConfiguration.ImageReference.Offer", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "pool.VirtualMachineConfiguration.ImageReference.Sku", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "pool.VirtualMachineConfiguration.OsDisk", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "pool.VirtualMachineConfiguration.OsDisk.ImageUris", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "pool.VirtualMachineConfiguration.NodeAgentSKUID", 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}}}}}}); 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 +} + +// 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) { + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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 nodes; any @@ -160,1594 +158,1592 @@ func (client PoolClient) Add(ctx context.Context, pool PoolAddParameter, timeout // 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. - // - // poolID is the ID of the pool to delete. timeout is the maximum time that the server can spend processing the - // request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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. +// +// poolID is the ID of the pool to delete. timeout is the maximum time that the server can spend processing the +// request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "poolId": autorest.Encode("path",poolID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} // DisableAutoScale sends the disable auto scale request. - // - // poolID is the ID of the pool on which to disable automatic scaling. timeout is the maximum time that the server - // can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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. +// +// poolID is the ID of the pool on which to disable automatic scaling. timeout is the maximum time that the server +// can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "poolId": autorest.Encode("path",poolID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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. - // - // poolID is the ID of the pool on which to enable automatic scaling. poolEnableAutoScaleParameter is the - // parameters for the request. timeout is the maximum time that the server can spend processing the request, in - // seconds. The default is 30 seconds. clientRequestID is 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 - // is whether the server should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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. +// +// poolID is the ID of the pool on which to enable automatic scaling. poolEnableAutoScaleParameter is the +// parameters for the request. timeout is the maximum time that the server can spend processing the request, in +// seconds. The default is 30 seconds. clientRequestID is 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 +// is whether the server should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "poolId": autorest.Encode("path",poolID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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. - // - // poolID is the ID of the pool on which to evaluate the automatic scaling formula. poolEvaluateAutoScaleParameter - // is the parameters for the request. timeout is the maximum time that the server can spend processing the request, - // in seconds. The default is 30 seconds. clientRequestID is 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 - // is whether the server should return the client-request-id in the response. ocpDate is 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. +// +// poolID is the ID of the pool on which to evaluate the automatic scaling formula. poolEvaluateAutoScaleParameter +// is the parameters for the request. timeout is the maximum time that the server can spend processing the request, +// in seconds. The default is 30 seconds. clientRequestID is 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 +// is whether the server should return the client-request-id in the response. ocpDate is 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 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "poolId": autorest.Encode("path",poolID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} // Exists gets basic properties of a pool. - // - // poolID is the ID of the pool to get. timeout is the maximum time that the server can spend processing the - // request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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. +// +// poolID is the ID of the pool to get. timeout is the maximum time that the server can spend processing the +// request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "poolId": autorest.Encode("path",poolID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} // Get gets information about the specified pool. - // - // poolID is the ID of the pool to get. selectParameter is an OData $select clause. expand is an OData $expand - // clause. timeout is the maximum time that the server can spend processing the request, in seconds. The default is - // 30 seconds. clientRequestID is 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 is whether the server - // should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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. +// +// poolID is the ID of the pool to get. selectParameter is an OData $select clause. expand is an OData $expand +// clause. timeout is the maximum time that the server can spend processing the request, in seconds. The default is +// 30 seconds. clientRequestID is 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 is whether the server +// should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "poolId": autorest.Encode("path",poolID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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. - // - // timeout is the maximum time that the server can spend processing the request, in seconds. The default is 30 - // seconds. clientRequestID is 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 is whether the server should - // return the client-request-id in the response. ocpDate is 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. +// +// timeout is the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. clientRequestID is 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 is whether the server should +// return the client-request-id in the response. ocpDate is 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) { - 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 - } - - // 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) { - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return - } + 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 +} + +// 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) { + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} // List sends the list request. - // - // filter is an OData $filter clause. selectParameter is an OData $select clause. expand is an OData $expand - // clause. maxResults is the maximum number of items to return in the response. A maximum of 1000 pools can be - // returned. timeout is the maximum time that the server can spend processing the request, in seconds. The default - // is 30 seconds. clientRequestID is 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 is whether the - // server should return the client-request-id in the response. ocpDate is 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. +// +// filter is an OData $filter clause. selectParameter is an OData $select clause. expand is an OData $expand +// clause. maxResults is the maximum number of items to return in the response. A maximum of 1000 pools can be +// returned. timeout is the maximum time that the server can spend processing the request, in seconds. The default +// is 30 seconds. clientRequestID is 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 is whether the +// server should return the client-request-id in the response. ocpDate is 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 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: 1000, Chain: nil }, - {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 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 - } - - // 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) { - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - 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(lastResults CloudPoolListResult) (result CloudPoolListResult, err error) { - req, err := lastResults.cloudPoolListResultPreparer() - 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) { - result.page, err = client.List(ctx, filter, selectParameter, expand, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) - return - } + 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: 1000, Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 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 +} + +// 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) { + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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(lastResults CloudPoolListResult) (result CloudPoolListResult, err error) { + req, err := lastResults.cloudPoolListResultPreparer() + 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) { + 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. - // - // startTime is 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 is 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 is an OData $filter clause. If this is not specified the response includes all pools that - // existed in the account in the time range of the returned aggregation intervals. maxResults is the maximum number - // of items to return in the response. A maximum of 1000 results will be returned. timeout is the maximum time that - // the server can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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. +// +// startTime is 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 is 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 is an OData $filter clause. If this is not specified the response includes all pools that +// existed in the account in the time range of the returned aggregation intervals. maxResults is the maximum number +// of items to return in the response. A maximum of 1000 results will be returned. timeout is the maximum time that +// the server can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 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: 1000, Chain: nil }, - {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 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 - } - - // 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) { - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - 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(lastResults PoolListUsageMetricsResult) (result PoolListUsageMetricsResult, err error) { - req, err := lastResults.poolListUsageMetricsResultPreparer() - 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) { - result.page, err = client.ListUsageMetrics(ctx, startTime, endTime, filter, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) - return - } + 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: 1000, Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 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 +} + +// 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) { + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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(lastResults PoolListUsageMetricsResult) (result PoolListUsageMetricsResult, err error) { + req, err := lastResults.poolListUsageMetricsResultPreparer() + 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) { + 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 start task // associated with it, and a request does not specify a start task element, then the pool keeps the existing start // task. - // - // poolID is the ID of the pool to update. poolPatchParameter is the parameters for the request. timeout is the - // maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. - // clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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 is 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 is - // 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 is 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 is 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. +// +// poolID is the ID of the pool to update. poolPatchParameter is the parameters for the request. timeout is the +// maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. +// clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 is 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 is +// 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "poolId": autorest.Encode("path",poolID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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. - // - // poolID is the ID of the pool from which you want to remove nodes. nodeRemoveParameter is the parameters for the - // request. timeout is the maximum time that the server can spend processing the request, in seconds. The default - // is 30 seconds. clientRequestID is 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 is whether the - // server should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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. +// +// poolID is the ID of the pool from which you want to remove nodes. nodeRemoveParameter is the parameters for the +// request. timeout is the maximum time that the server can spend processing the request, in seconds. The default +// is 30 seconds. clientRequestID is 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 is whether the +// server should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "poolId": autorest.Encode("path",poolID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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 nodes to remove. To remove specific // nodes, use the pool remove nodes API instead. - // - // poolID is the ID of the pool to resize. poolResizeParameter is the parameters for the request. timeout is the - // maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. - // clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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 is 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 is - // 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 is 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 is 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. +// +// poolID is the ID of the pool to resize. poolResizeParameter is the parameters for the request. timeout is the +// maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. +// clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 is 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 is +// 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "poolId": autorest.Encode("path",poolID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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. 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. - // - // poolID is the ID of the pool whose resizing you want to stop. timeout is the maximum time that the server can - // spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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 is 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 is - // 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 is 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 is 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. +// +// poolID is the ID of the pool whose resizing you want to stop. timeout is the maximum time that the server can +// spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 is 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 is +// 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "poolId": autorest.Encode("path",poolID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} // UpdateProperties this fully replaces all the updateable properties of the pool. For example, if the pool has a start // task associated with it and if start task is not specified with this request, then the Batch service will remove the // existing start task. - // - // poolID is the ID of the pool to update. poolUpdatePropertiesParameter is the parameters for the request. timeout - // is the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. - // clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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. +// +// poolID is the ID of the pool to update. poolUpdatePropertiesParameter is the parameters for the request. timeout +// is the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. +// clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 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.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 - } - - // 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) { - pathParameters := map[string]interface{} { - "poolId": autorest.Encode("path",poolID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return - } + 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.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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} // UpgradeOS during an upgrade, the Batch service upgrades each compute node in the pool. When a compute node is chosen // for upgrade, any tasks running on that node are removed from the node and returned to the queue to be rerun later @@ -1756,122 +1752,121 @@ func (client PoolClient) UpdateProperties(ctx context.Context, poolID string, po // tries to avoid upgrading all compute nodes at the same time, it does not guarantee to do this (particularly on small // pools); therefore, the pool may be temporarily unavailable to run tasks. When this operation runs, the pool state // changes to upgrading. When all compute nodes have finished upgrading, the pool state returns to active. - // - // poolID is the ID of the pool to upgrade. poolUpgradeOSParameter is the parameters for the request. timeout is - // the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. - // clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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 is 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 is - // 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 is 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 is 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. +// +// poolID is the ID of the pool to upgrade. poolUpgradeOSParameter is the parameters for the request. timeout is +// the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. +// clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 is 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 is +// 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 is 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 is 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) UpgradeOS(ctx context.Context, poolID string, poolUpgradeOSParameter PoolUpgradeOSParameter, 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 err := validation.Validate([]validation.Validation{ - { TargetValue: poolUpgradeOSParameter, - Constraints: []validation.Constraint{ {Target: "poolUpgradeOSParameter.TargetOSVersion", Name: validation.Null, Rule: true, Chain: nil }}}}); err != nil { - return result, validation.NewError("batch.PoolClient", "UpgradeOS", err.Error()) - } - - req, err := client.UpgradeOSPreparer(ctx, poolID, poolUpgradeOSParameter, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "UpgradeOS", nil , "Failure preparing request") - return - } - - resp, err := client.UpgradeOSSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "batch.PoolClient", "UpgradeOS", resp, "Failure sending request") - return - } - - result, err = client.UpgradeOSResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.PoolClient", "UpgradeOS", resp, "Failure responding to request") - } - - return - } - - // UpgradeOSPreparer prepares the UpgradeOS request. - func (client PoolClient) UpgradeOSPreparer(ctx context.Context, poolID string, poolUpgradeOSParameter PoolUpgradeOSParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { - pathParameters := map[string]interface{} { - "poolId": autorest.Encode("path",poolID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/pools/{poolId}/upgradeos",pathParameters), - autorest.WithJSON(poolUpgradeOSParameter), - 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)) - } - - // UpgradeOSSender sends the UpgradeOS request. The method will close the - // http.Response Body if it receives an error. - func (client PoolClient) UpgradeOSSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - } - - // UpgradeOSResponder handles the response to the UpgradeOS request. The method always - // closes the http.Response Body. - func (client PoolClient) UpgradeOSResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return - } + if err := validation.Validate([]validation.Validation{ + {TargetValue: poolUpgradeOSParameter, + Constraints: []validation.Constraint{{Target: "poolUpgradeOSParameter.TargetOSVersion", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("batch.PoolClient", "UpgradeOS", err.Error()) + } + + req, err := client.UpgradeOSPreparer(ctx, poolID, poolUpgradeOSParameter, timeout, clientRequestID, returnClientRequestID, ocpDate, ifMatch, ifNoneMatch, ifModifiedSince, ifUnmodifiedSince) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "UpgradeOS", nil, "Failure preparing request") + return + } + + resp, err := client.UpgradeOSSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.PoolClient", "UpgradeOS", resp, "Failure sending request") + return + } + + result, err = client.UpgradeOSResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.PoolClient", "UpgradeOS", resp, "Failure responding to request") + } + + return +} + +// UpgradeOSPreparer prepares the UpgradeOS request. +func (client PoolClient) UpgradeOSPreparer(ctx context.Context, poolID string, poolUpgradeOSParameter PoolUpgradeOSParameter, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifMatch string, ifNoneMatch string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "poolId": autorest.Encode("path", poolID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/pools/{poolId}/upgradeos", pathParameters), + autorest.WithJSON(poolUpgradeOSParameter), + 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)) +} + +// UpgradeOSSender sends the UpgradeOS request. The method will close the +// http.Response Body if it receives an error. +func (client PoolClient) UpgradeOSSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} +// UpgradeOSResponder handles the response to the UpgradeOS request. The method always +// closes the http.Response Body. +func (client PoolClient) UpgradeOSResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/batch/2017-05-01.5.0/batch/task.go b/services/batch/2017-05-01.5.0/batch/task.go index be53fe9b9d61..a381e6b694d4 100644 --- a/services/batch/2017-05-01.5.0/batch/task.go +++ b/services/batch/2017-05-01.5.0/batch/task.go @@ -18,131 +18,130 @@ package batch // Changes may cause incorrect behavior and will be lost if the code is regenerated. import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" - "context" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/satori/go.uuid" - "github.com/Azure/go-autorest/autorest/date" + "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/satori/go.uuid" + "net/http" ) // TaskClient is the a client for issuing REST requests to the Azure Batch service. type TaskClient struct { - BaseClient + BaseClient } + // NewTaskClient creates an instance of the TaskClient client. func NewTaskClient() TaskClient { - return NewTaskClientWithBaseURI(DefaultBaseURI, ) + return NewTaskClientWithBaseURI(DefaultBaseURI) } // NewTaskClientWithBaseURI creates an instance of the TaskClient client. - func NewTaskClientWithBaseURI(baseURI string, ) TaskClient { - return TaskClient{ NewWithBaseURI(baseURI, )} - } +func NewTaskClientWithBaseURI(baseURI string) TaskClient { + return TaskClient{NewWithBaseURI(baseURI)} +} // Add sends the add request. - // - // jobID is the ID of the job to which the task is to be added. task is the task to be added. timeout is the - // maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. - // clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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. +// +// jobID is the ID of the job to which the task is to be added. task is the task to be added. timeout is the +// maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. +// clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 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.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.NumberOfInstances", 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobId": autorest.Encode("path",jobID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusCreated), - autorest.ByClosing()) - result.Response = resp - return - } + 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.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.NumberOfInstances", 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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 @@ -150,922 +149,920 @@ func (client TaskClient) Add(ctx context.Context, jobID string, task TaskAddPara // 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. - // - // jobID is the ID of the job to which the task collection is to be added. taskCollection is the tasks to be added. - // timeout is the maximum time that the server can spend processing the request, in seconds. The default is 30 - // seconds. clientRequestID is 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 is whether the server should - // return the client-request-id in the response. ocpDate is 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. +// +// jobID is the ID of the job to which the task collection is to be added. taskCollection is the tasks to be added. +// timeout is the maximum time that the server can spend processing the request, in seconds. The default is 30 +// seconds. clientRequestID is 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 is whether the server should +// return the client-request-id in the response. ocpDate is 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 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobId": autorest.Encode("path",jobID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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. - // - // jobID is the ID of the job from which to delete the task. taskID is the ID of the task to delete. timeout is the - // maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. - // clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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 is 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 is - // 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 is 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 is 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. +// +// jobID is the ID of the job from which to delete the task. taskID is the ID of the task to delete. timeout is the +// maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. +// clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 is 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 is +// 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobId": autorest.Encode("path",jobID), - "taskId": autorest.Encode("path",taskID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + "taskId": autorest.Encode("path", taskID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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. - // - // jobID is the ID of the job that contains the task. taskID is the ID of the task to get information about. - // selectParameter is an OData $select clause. expand is an OData $expand clause. timeout is the maximum time that - // the server can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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 is 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 is - // 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 is 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 is 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. +// +// jobID is the ID of the job that contains the task. taskID is the ID of the task to get information about. +// selectParameter is an OData $select clause. expand is an OData $expand clause. timeout is the maximum time that +// the server can spend processing the request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 is 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 is +// 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobId": autorest.Encode("path",jobID), - "taskId": autorest.Encode("path",taskID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + "taskId": autorest.Encode("path", taskID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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. - // - // jobID is the ID of the job. filter is an OData $filter clause. selectParameter is an OData $select clause. - // expand is an OData $expand clause. maxResults is the maximum number of items to return in the response. A - // maximum of 1000 tasks can be returned. timeout is the maximum time that the server can spend processing the - // request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the client-request-id in the response. ocpDate is 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. +// +// jobID is the ID of the job. filter is an OData $filter clause. selectParameter is an OData $select clause. +// expand is an OData $expand clause. maxResults is the maximum number of items to return in the response. A +// maximum of 1000 tasks can be returned. timeout is the maximum time that the server can spend processing the +// request, in seconds. The default is 30 seconds. clientRequestID is 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 is whether the server should return the client-request-id in the response. ocpDate is 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 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: 1000, Chain: nil }, - {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobId": autorest.Encode("path",jobID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - 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(lastResults CloudTaskListResult) (result CloudTaskListResult, err error) { - req, err := lastResults.cloudTaskListResultPreparer() - 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) { - result.page, err = client.List(ctx, jobID, filter, selectParameter, expand, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) - return - } + 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: 1000, Chain: nil}, + {Target: "maxResults", Name: validation.InclusiveMinimum, Rule: 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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(lastResults CloudTaskListResult) (result CloudTaskListResult, err error) { + req, err := lastResults.cloudTaskListResultPreparer() + 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) { + 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. - // - // jobID is the ID of the job. taskID is the ID of the task. selectParameter is an OData $select clause. timeout is - // the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. - // clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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. +// +// jobID is the ID of the job. taskID is the ID of the task. selectParameter is an OData $select clause. timeout is +// the maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. +// clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobId": autorest.Encode("path",jobID), - "taskId": autorest.Encode("path",taskID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + "taskId": autorest.Encode("path", taskID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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 scheduling error is no // longer available after reactivation. This will fail for tasks that are not completed or that previously completed // successfully (with an exit code of 0). Additionally, this will fail if the job has completed (or is terminating or // deleting). - // - // jobID is the ID of the job containing the task. taskID is the ID of the task to reactivate. timeout is the - // maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. - // clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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 is 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 is - // 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 is 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 is 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. +// +// jobID is the ID of the job containing the task. taskID is the ID of the task to reactivate. timeout is the +// maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. +// clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 is 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 is +// 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobId": autorest.Encode("path",jobID), - "taskId": autorest.Encode("path",taskID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + "taskId": autorest.Encode("path", taskID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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. - // - // jobID is the ID of the job containing the task. taskID is the ID of the task to terminate. timeout is the - // maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. - // clientRequestID is 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 is whether the server should return the - // client-request-id in the response. ocpDate is 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 is 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 is - // 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 is 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 is 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. +// +// jobID is the ID of the job containing the task. taskID is the ID of the task to terminate. timeout is the +// maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. +// clientRequestID is 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 is whether the server should return the +// client-request-id in the response. ocpDate is 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 is 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 is +// 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobId": autorest.Encode("path",jobID), - "taskId": autorest.Encode("path",taskID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK,http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} + +// 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) { + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + "taskId": autorest.Encode("path", taskID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} // Update updates the properties of the specified task. - // - // jobID is the ID of the job containing the task. taskID is the ID of the task to update. taskUpdateParameter is - // the parameters for the request. timeout is the maximum time that the server can spend processing the request, in - // seconds. The default is 30 seconds. clientRequestID is 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 - // is whether the server should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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. +// +// jobID is the ID of the job containing the task. taskID is the ID of the task to update. taskUpdateParameter is +// the parameters for the request. timeout is the maximum time that the server can spend processing the request, in +// seconds. The default is 30 seconds. clientRequestID is 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 +// is whether the server should return the client-request-id in the response. ocpDate is 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 is 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 is 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 is 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 is 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) { - 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 - } - - // 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) { - pathParameters := map[string]interface{} { - "jobId": autorest.Encode("path",jobID), - "taskId": autorest.Encode("path",taskID), - } - - const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), - 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 autorest.SendWithSender(client, 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, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return - } + 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 +} +// 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) { + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + "taskId": autorest.Encode("path", taskID), + } + + const APIVersion = "2017-05-01.5.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.WithBaseURL(client.BaseURI), + 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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/batch/2017-05-01.5.0/batch/version.go b/services/batch/2017-05-01.5.0/batch/version.go index 8aba682adbf3..4ee8ddcd9437 100644 --- a/services/batch/2017-05-01.5.0/batch/version.go +++ b/services/batch/2017-05-01.5.0/batch/version.go @@ -19,13 +19,12 @@ import "github.com/Azure/azure-sdk-for-go/version" // 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.Number + " batch/2017-05-01.5.0" + return "Azure-SDK-For-Go/" + version.Number + " batch/2017-05-01.5.0" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - return version.Number + return version.Number }