Create a provider to use Azure Batch (#133)
* Started work on provider * WIP Adding batch provider * Working basic call into pool client. Need to parameterize the baseurl * Fixed job creation by manipulating the content-type * WIP Kicking off containers. Dirty * [wip] More meat around scheduling simple containers. * Working on basic task wrapper to co-schedule pods * WIP on task wrapper * WIP * Working pod minimal wrapper for batch * Integrate pod template code into provider * Cleaning up * Move to docker without gpu * WIP batch integration * partially working * Working logs * Tidy code * WIP: Testing and readme * Added readme and terraform deployment for GPU Azure Batch pool. * Update to enable low priority nodes for gpu * Fix log formatting bug. Return node logs when container not yet started * Moved to golang v1.10 * Fix cri test * Fix up minor docs Issue. Add provider to readme. Add var for vk image.
This commit is contained in:
committed by
Robbie Zhang
parent
1ad6fb434e
commit
d6e8b3daf7
202
vendor/github.com/Azure/azure-sdk-for-go/LICENSE
generated
vendored
Normal file
202
vendor/github.com/Azure/azure-sdk-for-go/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2016 Microsoft Corporation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
5
vendor/github.com/Azure/azure-sdk-for-go/NOTICE
generated
vendored
Normal file
5
vendor/github.com/Azure/azure-sdk-for-go/NOTICE
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
Microsoft Azure-SDK-for-Go
|
||||
Copyright 2014-2017 Microsoft
|
||||
|
||||
This product includes software developed at
|
||||
the Microsoft Corporation (https://www.microsoft.com).
|
||||
175
vendor/github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch/account.go
generated
vendored
Normal file
175
vendor/github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch/account.go
generated
vendored
Normal file
@@ -0,0 +1,175 @@
|
||||
package batch
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/date"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"github.com/satori/go.uuid"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// AccountClient is the a client for issuing REST requests to the Azure Batch service.
|
||||
type AccountClient struct {
|
||||
BaseClient
|
||||
}
|
||||
|
||||
// NewAccountClient creates an instance of the AccountClient client.
|
||||
func NewAccountClient() AccountClient {
|
||||
return NewAccountClientWithBaseURI(DefaultBaseURI)
|
||||
}
|
||||
|
||||
// NewAccountClientWithBaseURI creates an instance of the AccountClient client.
|
||||
func NewAccountClientWithBaseURI(baseURI string) AccountClient {
|
||||
return AccountClient{NewWithBaseURI(baseURI)}
|
||||
}
|
||||
|
||||
// ListNodeAgentSkus sends the list node agent skus request.
|
||||
//
|
||||
// filter is an OData $filter clause. For more information on constructing this filter, see
|
||||
// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-node-agent-skus. 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-09-01.6.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
|
||||
}
|
||||
264
vendor/github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch/application.go
generated
vendored
Normal file
264
vendor/github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch/application.go
generated
vendored
Normal file
@@ -0,0 +1,264 @@
|
||||
package batch
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/date"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"github.com/satori/go.uuid"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// ApplicationClient is the a client for issuing REST requests to the Azure Batch service.
|
||||
type ApplicationClient struct {
|
||||
BaseClient
|
||||
}
|
||||
|
||||
// NewApplicationClient creates an instance of the ApplicationClient client.
|
||||
func NewApplicationClient() ApplicationClient {
|
||||
return NewApplicationClientWithBaseURI(DefaultBaseURI)
|
||||
}
|
||||
|
||||
// NewApplicationClientWithBaseURI creates an instance of the ApplicationClient client.
|
||||
func NewApplicationClientWithBaseURI(baseURI string) ApplicationClient {
|
||||
return ApplicationClient{NewWithBaseURI(baseURI)}
|
||||
}
|
||||
|
||||
// Get 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.
|
||||
//
|
||||
// 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
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// 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-09-01.6.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))
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// 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.
|
||||
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())
|
||||
}
|
||||
|
||||
result.fn = client.listNextResults
|
||||
req, err := client.ListPreparer(ctx, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.alr.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result.alr, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// 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-09-01.6.0"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if maxResults != nil {
|
||||
queryParameters["maxresults"] = autorest.Encode("query", *maxResults)
|
||||
} else {
|
||||
queryParameters["maxresults"] = autorest.Encode("query", 1000)
|
||||
}
|
||||
if timeout != nil {
|
||||
queryParameters["timeout"] = autorest.Encode("query", *timeout)
|
||||
} else {
|
||||
queryParameters["timeout"] = autorest.Encode("query", 30)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.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))
|
||||
}
|
||||
|
||||
// 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...))
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
557
vendor/github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch/certificate.go
generated
vendored
Normal file
557
vendor/github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch/certificate.go
generated
vendored
Normal file
@@ -0,0 +1,557 @@
|
||||
package batch
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/date"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"github.com/satori/go.uuid"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// CertificateClient is the a client for issuing REST requests to the Azure Batch service.
|
||||
type CertificateClient struct {
|
||||
BaseClient
|
||||
}
|
||||
|
||||
// NewCertificateClient creates an instance of the CertificateClient client.
|
||||
func NewCertificateClient() CertificateClient {
|
||||
return NewCertificateClientWithBaseURI(DefaultBaseURI)
|
||||
}
|
||||
|
||||
// NewCertificateClientWithBaseURI creates an instance of the CertificateClient client.
|
||||
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.
|
||||
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-09-01.6.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.
|
||||
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-09-01.6.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
|
||||
// certificate is not installed on any compute nodes (even if you remove a certificate from a pool, it is not removed
|
||||
// from existing compute nodes in that pool until they restart), and no running tasks depend on the certificate. If you
|
||||
// try to delete a certificate that is in use, the deletion fails. The certificate status changes to deleteFailed. You
|
||||
// can use Cancel Delete Certificate to set the status back to active if you decide that you want to continue using the
|
||||
// certificate.
|
||||
//
|
||||
// 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-09-01.6.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.
|
||||
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-09-01.6.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. For more information on constructing this filter, see
|
||||
// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-certificates. 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-09-01.6.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
|
||||
}
|
||||
49
vendor/github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch/client.go
generated
vendored
Normal file
49
vendor/github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch/client.go
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
// Package batch implements the Azure ARM Batch service API version 2017-09-01.6.0.
|
||||
//
|
||||
// A client for issuing REST requests to the Azure Batch service.
|
||||
package batch
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
)
|
||||
|
||||
const (
|
||||
// DefaultBaseURI is the default URI used for the service Batch
|
||||
DefaultBaseURI = "https://batch.core.windows.net"
|
||||
)
|
||||
|
||||
// BaseClient is the base client for Batch.
|
||||
type BaseClient struct {
|
||||
autorest.Client
|
||||
BaseURI string
|
||||
}
|
||||
|
||||
// New creates an instance of the BaseClient client.
|
||||
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,
|
||||
}
|
||||
}
|
||||
1124
vendor/github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch/computenode.go
generated
vendored
Normal file
1124
vendor/github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch/computenode.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
946
vendor/github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch/file.go
generated
vendored
Normal file
946
vendor/github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch/file.go
generated
vendored
Normal file
@@ -0,0 +1,946 @@
|
||||
package batch
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/date"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"github.com/satori/go.uuid"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// FileClient is the a client for issuing REST requests to the Azure Batch service.
|
||||
type FileClient struct {
|
||||
BaseClient
|
||||
}
|
||||
|
||||
// NewFileClient creates an instance of the FileClient client.
|
||||
func NewFileClient() FileClient {
|
||||
return NewFileClientWithBaseURI(DefaultBaseURI)
|
||||
}
|
||||
|
||||
// NewFileClientWithBaseURI creates an instance of the FileClient client.
|
||||
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 or directory 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-09-01.6.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 or directory 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-09-01.6.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.
|
||||
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-09-01.6.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.
|
||||
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-09-01.6.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.
|
||||
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-09-01.6.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.
|
||||
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-09-01.6.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. For more information on constructing this filter, see
|
||||
// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-compute-node-files. recursive
|
||||
// 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-09-01.6.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. For more information on constructing this filter, see
|
||||
// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-task-files. recursive is
|
||||
// whether to list children of the task directory. This parameter can be used in combination with the filter
|
||||
// parameter to list specific type of files. maxResults 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-09-01.6.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
|
||||
}
|
||||
1660
vendor/github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch/job.go
generated
vendored
Normal file
1660
vendor/github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch/job.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1324
vendor/github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch/jobschedule.go
generated
vendored
Normal file
1324
vendor/github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch/jobschedule.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3418
vendor/github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch/models.go
generated
vendored
Normal file
3418
vendor/github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch/models.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1897
vendor/github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch/pool.go
generated
vendored
Normal file
1897
vendor/github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch/pool.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1081
vendor/github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch/task.go
generated
vendored
Normal file
1081
vendor/github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch/task.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
30
vendor/github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch/version.go
generated
vendored
Normal file
30
vendor/github.com/Azure/azure-sdk-for-go/services/batch/2017-09-01.6.0/batch/version.go
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
package batch
|
||||
|
||||
import "github.com/Azure/azure-sdk-for-go/version"
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// 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-09-01.6.0"
|
||||
}
|
||||
|
||||
// Version returns the semantic version (see http://semver.org) of the client.
|
||||
func Version() string {
|
||||
return version.Number
|
||||
}
|
||||
21
vendor/github.com/Azure/azure-sdk-for-go/version/version.go
generated
vendored
Normal file
21
vendor/github.com/Azure/azure-sdk-for-go/version/version.go
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
package version
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
// Number contains the semantic version of this SDK.
|
||||
const Number = "v15.1.1"
|
||||
Reference in New Issue
Block a user