Permalink
Cannot retrieve contributors at this time
Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign up
Find file
Copy path
azure-sdk-for-go/services/batch/2018-08-01.7.0/batch/file.go
Find file
Copy path
Fetching contributors…

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/Azure/go-autorest/tracing" | |
"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. | |
// Parameters: | |
// poolID - the ID of the pool that contains the compute node. | |
// nodeID - the ID of the compute node from which you want to delete the file. | |
// filePath - the path to the file or directory that you want to delete. | |
// recursive - whether to delete children of a directory. If the filePath parameter represents a directory | |
// instead of a file, you can set recursive to true to delete the directory and all of the files and | |
// subdirectories in it. If recursive is false then the directory must be empty or deletion will fail. | |
// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 | |
// seconds. | |
// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as | |
// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. | |
// returnClientRequestID - whether the server should return the client-request-id in the response. | |
// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock | |
// time; set it explicitly if you are calling the REST API directly. | |
func (client FileClient) DeleteFromComputeNode(ctx context.Context, poolID string, nodeID string, filePath string, recursive *bool, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) { | |
if tracing.IsEnabled() { | |
ctx = tracing.StartSpan(ctx, fqdn+"/FileClient.DeleteFromComputeNode") | |
defer func() { | |
sc := -1 | |
if result.Response != nil { | |
sc = result.Response.StatusCode | |
} | |
tracing.EndSpan(ctx, sc, err) | |
}() | |
} | |
req, err := client.DeleteFromComputeNodePreparer(ctx, poolID, nodeID, filePath, recursive, timeout, clientRequestID, returnClientRequestID, ocpDate) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "DeleteFromComputeNode", nil, "Failure preparing request") | |
return | |
} | |
resp, err := client.DeleteFromComputeNodeSender(req) | |
if err != nil { | |
result.Response = resp | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "DeleteFromComputeNode", resp, "Failure sending request") | |
return | |
} | |
result, err = client.DeleteFromComputeNodeResponder(resp) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "DeleteFromComputeNode", resp, "Failure responding to request") | |
} | |
return | |
} | |
// 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 = "2018-08-01.7.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) { | |
sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) | |
return autorest.SendWithSender(client, req, sd...) | |
} | |
// 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. | |
// Parameters: | |
// jobID - the ID of the job that contains the task. | |
// taskID - the ID of the task whose file you want to delete. | |
// filePath - the path to the task file or directory that you want to delete. | |
// recursive - whether to delete children of a directory. If the filePath parameter represents a directory | |
// instead of a file, you can set recursive to true to delete the directory and all of the files and | |
// subdirectories in it. If recursive is false then the directory must be empty or deletion will fail. | |
// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 | |
// seconds. | |
// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as | |
// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. | |
// returnClientRequestID - whether the server should return the client-request-id in the response. | |
// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock | |
// time; set it explicitly if you are calling the REST API directly. | |
func (client FileClient) DeleteFromTask(ctx context.Context, jobID string, taskID string, filePath string, recursive *bool, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result autorest.Response, err error) { | |
if tracing.IsEnabled() { | |
ctx = tracing.StartSpan(ctx, fqdn+"/FileClient.DeleteFromTask") | |
defer func() { | |
sc := -1 | |
if result.Response != nil { | |
sc = result.Response.StatusCode | |
} | |
tracing.EndSpan(ctx, sc, err) | |
}() | |
} | |
req, err := client.DeleteFromTaskPreparer(ctx, jobID, taskID, filePath, recursive, timeout, clientRequestID, returnClientRequestID, ocpDate) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "DeleteFromTask", nil, "Failure preparing request") | |
return | |
} | |
resp, err := client.DeleteFromTaskSender(req) | |
if err != nil { | |
result.Response = resp | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "DeleteFromTask", resp, "Failure sending request") | |
return | |
} | |
result, err = client.DeleteFromTaskResponder(resp) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "DeleteFromTask", resp, "Failure responding to request") | |
} | |
return | |
} | |
// 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 = "2018-08-01.7.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) { | |
sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) | |
return autorest.SendWithSender(client, req, sd...) | |
} | |
// 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. | |
// Parameters: | |
// poolID - the ID of the pool that contains the compute node. | |
// nodeID - the ID of the compute node that contains the file. | |
// filePath - the path to the compute node file that you want to get the content of. | |
// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 | |
// seconds. | |
// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as | |
// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. | |
// returnClientRequestID - whether the server should return the client-request-id in the response. | |
// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock | |
// time; set it explicitly if you are calling the REST API directly. | |
// ocpRange - the byte range to be retrieved. The default is to retrieve the entire file. The format is | |
// bytes=startRange-endRange. | |
// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The | |
// operation will be performed only if the resource on the service has been modified since the specified time. | |
// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The | |
// operation will be performed only if the resource on the service has not been modified since the specified | |
// time. | |
func (client FileClient) GetFromComputeNode(ctx context.Context, poolID string, nodeID string, filePath string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ocpRange string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result ReadCloser, err error) { | |
if tracing.IsEnabled() { | |
ctx = tracing.StartSpan(ctx, fqdn+"/FileClient.GetFromComputeNode") | |
defer func() { | |
sc := -1 | |
if result.Response.Response != nil { | |
sc = result.Response.Response.StatusCode | |
} | |
tracing.EndSpan(ctx, sc, err) | |
}() | |
} | |
req, err := client.GetFromComputeNodePreparer(ctx, poolID, nodeID, filePath, timeout, clientRequestID, returnClientRequestID, ocpDate, ocpRange, ifModifiedSince, ifUnmodifiedSince) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "GetFromComputeNode", nil, "Failure preparing request") | |
return | |
} | |
resp, err := client.GetFromComputeNodeSender(req) | |
if err != nil { | |
result.Response = autorest.Response{Response: resp} | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "GetFromComputeNode", resp, "Failure sending request") | |
return | |
} | |
result, err = client.GetFromComputeNodeResponder(resp) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "GetFromComputeNode", resp, "Failure responding to request") | |
} | |
return | |
} | |
// 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 = "2018-08-01.7.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) { | |
sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) | |
return autorest.SendWithSender(client, req, sd...) | |
} | |
// 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. | |
// Parameters: | |
// jobID - the ID of the job that contains the task. | |
// taskID - the ID of the task whose file you want to retrieve. | |
// filePath - the path to the task file that you want to get the content of. | |
// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 | |
// seconds. | |
// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as | |
// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. | |
// returnClientRequestID - whether the server should return the client-request-id in the response. | |
// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock | |
// time; set it explicitly if you are calling the REST API directly. | |
// ocpRange - the byte range to be retrieved. The default is to retrieve the entire file. The format is | |
// bytes=startRange-endRange. | |
// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The | |
// operation will be performed only if the resource on the service has been modified since the specified time. | |
// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The | |
// operation will be performed only if the resource on the service has not been modified since the specified | |
// time. | |
func (client FileClient) GetFromTask(ctx context.Context, jobID string, taskID string, filePath string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ocpRange string, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result ReadCloser, err error) { | |
if tracing.IsEnabled() { | |
ctx = tracing.StartSpan(ctx, fqdn+"/FileClient.GetFromTask") | |
defer func() { | |
sc := -1 | |
if result.Response.Response != nil { | |
sc = result.Response.Response.StatusCode | |
} | |
tracing.EndSpan(ctx, sc, err) | |
}() | |
} | |
req, err := client.GetFromTaskPreparer(ctx, jobID, taskID, filePath, timeout, clientRequestID, returnClientRequestID, ocpDate, ocpRange, ifModifiedSince, ifUnmodifiedSince) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "GetFromTask", nil, "Failure preparing request") | |
return | |
} | |
resp, err := client.GetFromTaskSender(req) | |
if err != nil { | |
result.Response = autorest.Response{Response: resp} | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "GetFromTask", resp, "Failure sending request") | |
return | |
} | |
result, err = client.GetFromTaskResponder(resp) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "GetFromTask", resp, "Failure responding to request") | |
} | |
return | |
} | |
// 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 = "2018-08-01.7.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) { | |
sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) | |
return autorest.SendWithSender(client, req, sd...) | |
} | |
// 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. | |
// Parameters: | |
// poolID - the ID of the pool that contains the compute node. | |
// nodeID - the ID of the compute node that contains the file. | |
// filePath - the path to the compute node file that you want to get the properties of. | |
// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 | |
// seconds. | |
// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as | |
// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. | |
// returnClientRequestID - whether the server should return the client-request-id in the response. | |
// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock | |
// time; set it explicitly if you are calling the REST API directly. | |
// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The | |
// operation will be performed only if the resource on the service has been modified since the specified time. | |
// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The | |
// operation will be performed only if the resource on the service has not been modified since the specified | |
// time. | |
func (client FileClient) GetPropertiesFromComputeNode(ctx context.Context, poolID string, nodeID string, filePath string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { | |
if tracing.IsEnabled() { | |
ctx = tracing.StartSpan(ctx, fqdn+"/FileClient.GetPropertiesFromComputeNode") | |
defer func() { | |
sc := -1 | |
if result.Response != nil { | |
sc = result.Response.StatusCode | |
} | |
tracing.EndSpan(ctx, sc, err) | |
}() | |
} | |
req, err := client.GetPropertiesFromComputeNodePreparer(ctx, poolID, nodeID, filePath, timeout, clientRequestID, returnClientRequestID, ocpDate, ifModifiedSince, ifUnmodifiedSince) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "GetPropertiesFromComputeNode", nil, "Failure preparing request") | |
return | |
} | |
resp, err := client.GetPropertiesFromComputeNodeSender(req) | |
if err != nil { | |
result.Response = resp | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "GetPropertiesFromComputeNode", resp, "Failure sending request") | |
return | |
} | |
result, err = client.GetPropertiesFromComputeNodeResponder(resp) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "GetPropertiesFromComputeNode", resp, "Failure responding to request") | |
} | |
return | |
} | |
// 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 = "2018-08-01.7.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) { | |
sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) | |
return autorest.SendWithSender(client, req, sd...) | |
} | |
// 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. | |
// Parameters: | |
// jobID - the ID of the job that contains the task. | |
// taskID - the ID of the task whose file you want to get the properties of. | |
// filePath - the path to the task file that you want to get the properties of. | |
// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 | |
// seconds. | |
// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as | |
// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. | |
// returnClientRequestID - whether the server should return the client-request-id in the response. | |
// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock | |
// time; set it explicitly if you are calling the REST API directly. | |
// ifModifiedSince - a timestamp indicating the last modified time of the resource known to the client. The | |
// operation will be performed only if the resource on the service has been modified since the specified time. | |
// ifUnmodifiedSince - a timestamp indicating the last modified time of the resource known to the client. The | |
// operation will be performed only if the resource on the service has not been modified since the specified | |
// time. | |
func (client FileClient) GetPropertiesFromTask(ctx context.Context, jobID string, taskID string, filePath string, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123, ifModifiedSince *date.TimeRFC1123, ifUnmodifiedSince *date.TimeRFC1123) (result autorest.Response, err error) { | |
if tracing.IsEnabled() { | |
ctx = tracing.StartSpan(ctx, fqdn+"/FileClient.GetPropertiesFromTask") | |
defer func() { | |
sc := -1 | |
if result.Response != nil { | |
sc = result.Response.StatusCode | |
} | |
tracing.EndSpan(ctx, sc, err) | |
}() | |
} | |
req, err := client.GetPropertiesFromTaskPreparer(ctx, jobID, taskID, filePath, timeout, clientRequestID, returnClientRequestID, ocpDate, ifModifiedSince, ifUnmodifiedSince) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "GetPropertiesFromTask", nil, "Failure preparing request") | |
return | |
} | |
resp, err := client.GetPropertiesFromTaskSender(req) | |
if err != nil { | |
result.Response = resp | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "GetPropertiesFromTask", resp, "Failure sending request") | |
return | |
} | |
result, err = client.GetPropertiesFromTaskResponder(resp) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "GetPropertiesFromTask", resp, "Failure responding to request") | |
} | |
return | |
} | |
// 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 = "2018-08-01.7.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) { | |
sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) | |
return autorest.SendWithSender(client, req, sd...) | |
} | |
// 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. | |
// Parameters: | |
// poolID - the ID of the pool that contains the compute node. | |
// nodeID - the ID of the compute node whose files you want to list. | |
// filter - an OData $filter clause. For more information on constructing this filter, see | |
// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-compute-node-files. | |
// recursive - whether to list children of a directory. | |
// maxResults - the maximum number of items to return in the response. A maximum of 1000 files can be returned. | |
// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 | |
// seconds. | |
// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as | |
// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. | |
// returnClientRequestID - whether the server should return the client-request-id in the response. | |
// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock | |
// time; set it explicitly if you are calling the REST API directly. | |
func (client FileClient) ListFromComputeNode(ctx context.Context, poolID string, nodeID string, filter string, recursive *bool, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result NodeFileListResultPage, err error) { | |
if tracing.IsEnabled() { | |
ctx = tracing.StartSpan(ctx, fqdn+"/FileClient.ListFromComputeNode") | |
defer func() { | |
sc := -1 | |
if result.nflr.Response.Response != nil { | |
sc = result.nflr.Response.Response.StatusCode | |
} | |
tracing.EndSpan(ctx, sc, err) | |
}() | |
} | |
if err := validation.Validate([]validation.Validation{ | |
{TargetValue: maxResults, | |
Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false, | |
Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, | |
{Target: "maxResults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, | |
}}}}}); err != nil { | |
return result, validation.NewError("batch.FileClient", "ListFromComputeNode", err.Error()) | |
} | |
result.fn = client.listFromComputeNodeNextResults | |
req, err := client.ListFromComputeNodePreparer(ctx, poolID, nodeID, filter, recursive, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "ListFromComputeNode", nil, "Failure preparing request") | |
return | |
} | |
resp, err := client.ListFromComputeNodeSender(req) | |
if err != nil { | |
result.nflr.Response = autorest.Response{Response: resp} | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "ListFromComputeNode", resp, "Failure sending request") | |
return | |
} | |
result.nflr, err = client.ListFromComputeNodeResponder(resp) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "ListFromComputeNode", resp, "Failure responding to request") | |
} | |
return | |
} | |
// 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 = "2018-08-01.7.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) { | |
sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) | |
return autorest.SendWithSender(client, req, sd...) | |
} | |
// 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(ctx context.Context, lastResults NodeFileListResult) (result NodeFileListResult, err error) { | |
req, err := lastResults.nodeFileListResultPreparer(ctx) | |
if err != nil { | |
return result, autorest.NewErrorWithError(err, "batch.FileClient", "listFromComputeNodeNextResults", nil, "Failure preparing next results request") | |
} | |
if req == nil { | |
return | |
} | |
resp, err := client.ListFromComputeNodeSender(req) | |
if err != nil { | |
result.Response = autorest.Response{Response: resp} | |
return result, autorest.NewErrorWithError(err, "batch.FileClient", "listFromComputeNodeNextResults", resp, "Failure sending next results request") | |
} | |
result, err = client.ListFromComputeNodeResponder(resp) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "listFromComputeNodeNextResults", resp, "Failure responding to next results request") | |
} | |
return | |
} | |
// ListFromComputeNodeComplete enumerates all values, automatically crossing page boundaries as required. | |
func (client FileClient) ListFromComputeNodeComplete(ctx context.Context, poolID string, nodeID string, filter string, recursive *bool, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result NodeFileListResultIterator, err error) { | |
if tracing.IsEnabled() { | |
ctx = tracing.StartSpan(ctx, fqdn+"/FileClient.ListFromComputeNode") | |
defer func() { | |
sc := -1 | |
if result.Response().Response.Response != nil { | |
sc = result.page.Response().Response.Response.StatusCode | |
} | |
tracing.EndSpan(ctx, sc, err) | |
}() | |
} | |
result.page, err = client.ListFromComputeNode(ctx, poolID, nodeID, filter, recursive, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) | |
return | |
} | |
// ListFromTask sends the list from task request. | |
// Parameters: | |
// jobID - the ID of the job that contains the task. | |
// taskID - the ID of the task whose files you want to list. | |
// filter - an OData $filter clause. For more information on constructing this filter, see | |
// https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-task-files. | |
// recursive - whether to list children of the task directory. This parameter can be used in combination with | |
// the filter parameter to list specific type of files. | |
// maxResults - the maximum number of items to return in the response. A maximum of 1000 files can be returned. | |
// timeout - the maximum time that the server can spend processing the request, in seconds. The default is 30 | |
// seconds. | |
// clientRequestID - the caller-generated request identity, in the form of a GUID with no decoration such as | |
// curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. | |
// returnClientRequestID - whether the server should return the client-request-id in the response. | |
// ocpDate - the time the request was issued. Client libraries typically set this to the current system clock | |
// time; set it explicitly if you are calling the REST API directly. | |
func (client FileClient) ListFromTask(ctx context.Context, jobID string, taskID string, filter string, recursive *bool, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result NodeFileListResultPage, err error) { | |
if tracing.IsEnabled() { | |
ctx = tracing.StartSpan(ctx, fqdn+"/FileClient.ListFromTask") | |
defer func() { | |
sc := -1 | |
if result.nflr.Response.Response != nil { | |
sc = result.nflr.Response.Response.StatusCode | |
} | |
tracing.EndSpan(ctx, sc, err) | |
}() | |
} | |
if err := validation.Validate([]validation.Validation{ | |
{TargetValue: maxResults, | |
Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false, | |
Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, | |
{Target: "maxResults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, | |
}}}}}); err != nil { | |
return result, validation.NewError("batch.FileClient", "ListFromTask", err.Error()) | |
} | |
result.fn = client.listFromTaskNextResults | |
req, err := client.ListFromTaskPreparer(ctx, jobID, taskID, filter, recursive, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "ListFromTask", nil, "Failure preparing request") | |
return | |
} | |
resp, err := client.ListFromTaskSender(req) | |
if err != nil { | |
result.nflr.Response = autorest.Response{Response: resp} | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "ListFromTask", resp, "Failure sending request") | |
return | |
} | |
result.nflr, err = client.ListFromTaskResponder(resp) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "ListFromTask", resp, "Failure responding to request") | |
} | |
return | |
} | |
// 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 = "2018-08-01.7.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) { | |
sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) | |
return autorest.SendWithSender(client, req, sd...) | |
} | |
// 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(ctx context.Context, lastResults NodeFileListResult) (result NodeFileListResult, err error) { | |
req, err := lastResults.nodeFileListResultPreparer(ctx) | |
if err != nil { | |
return result, autorest.NewErrorWithError(err, "batch.FileClient", "listFromTaskNextResults", nil, "Failure preparing next results request") | |
} | |
if req == nil { | |
return | |
} | |
resp, err := client.ListFromTaskSender(req) | |
if err != nil { | |
result.Response = autorest.Response{Response: resp} | |
return result, autorest.NewErrorWithError(err, "batch.FileClient", "listFromTaskNextResults", resp, "Failure sending next results request") | |
} | |
result, err = client.ListFromTaskResponder(resp) | |
if err != nil { | |
err = autorest.NewErrorWithError(err, "batch.FileClient", "listFromTaskNextResults", resp, "Failure responding to next results request") | |
} | |
return | |
} | |
// ListFromTaskComplete enumerates all values, automatically crossing page boundaries as required. | |
func (client FileClient) ListFromTaskComplete(ctx context.Context, jobID string, taskID string, filter string, recursive *bool, maxResults *int32, timeout *int32, clientRequestID *uuid.UUID, returnClientRequestID *bool, ocpDate *date.TimeRFC1123) (result NodeFileListResultIterator, err error) { | |
if tracing.IsEnabled() { | |
ctx = tracing.StartSpan(ctx, fqdn+"/FileClient.ListFromTask") | |
defer func() { | |
sc := -1 | |
if result.Response().Response.Response != nil { | |
sc = result.page.Response().Response.Response.StatusCode | |
} | |
tracing.EndSpan(ctx, sc, err) | |
}() | |
} | |
result.page, err = client.ListFromTask(ctx, jobID, taskID, filter, recursive, maxResults, timeout, clientRequestID, returnClientRequestID, ocpDate) | |
return | |
} |