1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642
|
package storagedatalake
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"context"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"github.com/Azure/go-autorest/tracing"
"net/http"
)
// FilesystemClient is the azure Data Lake Storage provides storage for Hadoop and other big data workloads.
type FilesystemClient struct {
BaseClient
}
// NewFilesystemClient creates an instance of the FilesystemClient client.
func NewFilesystemClient(xMsVersion string, accountName string) FilesystemClient {
return FilesystemClient{New(xMsVersion, accountName)}
}
// Create create a filesystem rooted at the specified location. If the filesystem already exists, the operation fails.
// This operation does not support conditional HTTP requests.
// Parameters:
// filesystem - the filesystem identifier. The value must start and end with a letter or number and must
// contain only letters, numbers, and the dash (-) character. Consecutive dashes are not permitted. All
// letters must be lowercase. The value must have between 3 and 63 characters.
// xMsProperties - user-defined properties to be stored with the filesystem, in the format of a comma-separated
// list of name and value pairs "n1=v1, n2=v2, ...", where each value is a base64 encoded string. Note that the
// string may only contain ASCII characters in the ISO-8859-1 character set.
// xMsClientRequestID - a UUID recorded in the analytics logs for troubleshooting and correlation.
// timeout - an optional operation timeout value in seconds. The period begins when the request is received by
// the service. If the timeout value elapses before the operation completes, the operation fails.
// xMsDate - specifies the Coordinated Universal Time (UTC) for the request. This is required when using
// shared key authorization.
func (client FilesystemClient) Create(ctx context.Context, filesystem string, xMsProperties string, xMsClientRequestID string, timeout *int32, xMsDate string) (result autorest.Response, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/FilesystemClient.Create")
defer func() {
sc := -1
if result.Response != nil {
sc = result.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: filesystem,
Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
{Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
{TargetValue: xMsClientRequestID,
Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
{TargetValue: timeout,
Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
return result, validation.NewError("storagedatalake.FilesystemClient", "Create", err.Error())
}
req, err := client.CreatePreparer(ctx, filesystem, xMsProperties, xMsClientRequestID, timeout, xMsDate)
if err != nil {
err = autorest.NewErrorWithError(err, "storagedatalake.FilesystemClient", "Create", nil, "Failure preparing request")
return
}
resp, err := client.CreateSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "storagedatalake.FilesystemClient", "Create", resp, "Failure sending request")
return
}
result, err = client.CreateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "storagedatalake.FilesystemClient", "Create", resp, "Failure responding to request")
return
}
return
}
// CreatePreparer prepares the Create request.
func (client FilesystemClient) CreatePreparer(ctx context.Context, filesystem string, xMsProperties string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
urlParameters := map[string]interface{}{
"accountName": client.AccountName,
"dnsSuffix": client.DNSSuffix,
}
pathParameters := map[string]interface{}{
"filesystem": autorest.Encode("path", filesystem),
}
queryParameters := map[string]interface{}{
"resource": autorest.Encode("query", "filesystem"),
}
if timeout != nil {
queryParameters["timeout"] = autorest.Encode("query", *timeout)
}
preparer := autorest.CreatePreparer(
autorest.AsPut(),
autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
autorest.WithPathParameters("/{filesystem}", pathParameters),
autorest.WithQueryParameters(queryParameters))
if len(xMsProperties) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-properties", autorest.String(xMsProperties)))
}
if len(xMsClientRequestID) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
}
if len(xMsDate) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
}
if len(client.XMsVersion) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
}
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// CreateSender sends the Create request. The method will close the
// http.Response Body if it receives an error.
func (client FilesystemClient) CreateSender(req *http.Request) (*http.Response, error) {
return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
}
// CreateResponder handles the response to the Create request. The method always
// closes the http.Response Body.
func (client FilesystemClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByClosing())
result.Response = resp
return
}
// Delete marks the filesystem for deletion. When a filesystem is deleted, a filesystem with the same identifier
// cannot be created for at least 30 seconds. While the filesystem is being deleted, attempts to create a filesystem
// with the same identifier will fail with status code 409 (Conflict), with the service returning additional error
// information indicating that the filesystem is being deleted. All other operations, including operations on any files
// or directories within the filesystem, will fail with status code 404 (Not Found) while the filesystem is being
// deleted. This operation supports conditional HTTP requests. For more information, see [Specifying Conditional
// Headers for Blob Service
// Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations).
// Parameters:
// filesystem - the filesystem identifier. The value must start and end with a letter or number and must
// contain only letters, numbers, and the dash (-) character. Consecutive dashes are not permitted. All
// letters must be lowercase. The value must have between 3 and 63 characters.
// ifModifiedSince - optional. A date and time value. Specify this header to perform the operation only if the
// resource has been modified since the specified date and time.
// ifUnmodifiedSince - optional. A date and time value. Specify this header to perform the operation only if
// the resource has not been modified since the specified date and time.
// xMsClientRequestID - a UUID recorded in the analytics logs for troubleshooting and correlation.
// timeout - an optional operation timeout value in seconds. The period begins when the request is received by
// the service. If the timeout value elapses before the operation completes, the operation fails.
// xMsDate - specifies the Coordinated Universal Time (UTC) for the request. This is required when using
// shared key authorization.
func (client FilesystemClient) Delete(ctx context.Context, filesystem string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (result autorest.Response, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/FilesystemClient.Delete")
defer func() {
sc := -1
if result.Response != nil {
sc = result.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: filesystem,
Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
{Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
{TargetValue: xMsClientRequestID,
Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
{TargetValue: timeout,
Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
return result, validation.NewError("storagedatalake.FilesystemClient", "Delete", err.Error())
}
req, err := client.DeletePreparer(ctx, filesystem, ifModifiedSince, ifUnmodifiedSince, xMsClientRequestID, timeout, xMsDate)
if err != nil {
err = autorest.NewErrorWithError(err, "storagedatalake.FilesystemClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "storagedatalake.FilesystemClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "storagedatalake.FilesystemClient", "Delete", resp, "Failure responding to request")
return
}
return
}
// DeletePreparer prepares the Delete request.
func (client FilesystemClient) DeletePreparer(ctx context.Context, filesystem string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
urlParameters := map[string]interface{}{
"accountName": client.AccountName,
"dnsSuffix": client.DNSSuffix,
}
pathParameters := map[string]interface{}{
"filesystem": autorest.Encode("path", filesystem),
}
queryParameters := map[string]interface{}{
"resource": autorest.Encode("query", "filesystem"),
}
if timeout != nil {
queryParameters["timeout"] = autorest.Encode("query", *timeout)
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
autorest.WithPathParameters("/{filesystem}", pathParameters),
autorest.WithQueryParameters(queryParameters))
if len(ifModifiedSince) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
}
if len(ifUnmodifiedSince) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
}
if len(xMsClientRequestID) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
}
if len(xMsDate) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
}
if len(client.XMsVersion) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
}
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 FilesystemClient) DeleteSender(req *http.Request) (*http.Response, error) {
return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
}
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client FilesystemClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByClosing())
result.Response = resp
return
}
// GetProperties all system and user-defined filesystem properties are specified in the response headers.
// Parameters:
// filesystem - the filesystem identifier. The value must start and end with a letter or number and must
// contain only letters, numbers, and the dash (-) character. Consecutive dashes are not permitted. All
// letters must be lowercase. The value must have between 3 and 63 characters.
// xMsClientRequestID - a UUID recorded in the analytics logs for troubleshooting and correlation.
// timeout - an optional operation timeout value in seconds. The period begins when the request is received by
// the service. If the timeout value elapses before the operation completes, the operation fails.
// xMsDate - specifies the Coordinated Universal Time (UTC) for the request. This is required when using
// shared key authorization.
func (client FilesystemClient) GetProperties(ctx context.Context, filesystem string, xMsClientRequestID string, timeout *int32, xMsDate string) (result autorest.Response, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/FilesystemClient.GetProperties")
defer func() {
sc := -1
if result.Response != nil {
sc = result.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: filesystem,
Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
{Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
{TargetValue: xMsClientRequestID,
Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
{TargetValue: timeout,
Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
return result, validation.NewError("storagedatalake.FilesystemClient", "GetProperties", err.Error())
}
req, err := client.GetPropertiesPreparer(ctx, filesystem, xMsClientRequestID, timeout, xMsDate)
if err != nil {
err = autorest.NewErrorWithError(err, "storagedatalake.FilesystemClient", "GetProperties", nil, "Failure preparing request")
return
}
resp, err := client.GetPropertiesSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "storagedatalake.FilesystemClient", "GetProperties", resp, "Failure sending request")
return
}
result, err = client.GetPropertiesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "storagedatalake.FilesystemClient", "GetProperties", resp, "Failure responding to request")
return
}
return
}
// GetPropertiesPreparer prepares the GetProperties request.
func (client FilesystemClient) GetPropertiesPreparer(ctx context.Context, filesystem string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
urlParameters := map[string]interface{}{
"accountName": client.AccountName,
"dnsSuffix": client.DNSSuffix,
}
pathParameters := map[string]interface{}{
"filesystem": autorest.Encode("path", filesystem),
}
queryParameters := map[string]interface{}{
"resource": autorest.Encode("query", "filesystem"),
}
if timeout != nil {
queryParameters["timeout"] = autorest.Encode("query", *timeout)
}
preparer := autorest.CreatePreparer(
autorest.AsHead(),
autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
autorest.WithPathParameters("/{filesystem}", pathParameters),
autorest.WithQueryParameters(queryParameters))
if len(xMsClientRequestID) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
}
if len(xMsDate) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
}
if len(client.XMsVersion) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
}
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// GetPropertiesSender sends the GetProperties request. The method will close the
// http.Response Body if it receives an error.
func (client FilesystemClient) GetPropertiesSender(req *http.Request) (*http.Response, error) {
return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
}
// GetPropertiesResponder handles the response to the GetProperties request. The method always
// closes the http.Response Body.
func (client FilesystemClient) GetPropertiesResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByClosing())
result.Response = resp
return
}
// List list filesystems and their properties in given account.
// Parameters:
// prefix - filters results to filesystems within the specified prefix.
// continuation - the number of filesystems returned with each invocation is limited. If the number of
// filesystems to be returned exceeds this limit, a continuation token is returned in the response header
// x-ms-continuation. When a continuation token is returned in the response, it must be specified in a
// subsequent invocation of the list operation to continue listing the filesystems.
// maxResults - an optional value that specifies the maximum number of items to return. If omitted or greater
// than 5,000, the response will include up to 5,000 items.
// xMsClientRequestID - a UUID recorded in the analytics logs for troubleshooting and correlation.
// timeout - an optional operation timeout value in seconds. The period begins when the request is received by
// the service. If the timeout value elapses before the operation completes, the operation fails.
// xMsDate - specifies the Coordinated Universal Time (UTC) for the request. This is required when using
// shared key authorization.
func (client FilesystemClient) List(ctx context.Context, prefix string, continuation string, maxResults *int32, xMsClientRequestID string, timeout *int32, xMsDate string) (result FilesystemList, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/FilesystemClient.List")
defer func() {
sc := -1
if result.Response.Response != nil {
sc = result.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: maxResults,
Constraints: []validation.Constraint{{Target: "maxResults", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "maxResults", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}},
{TargetValue: xMsClientRequestID,
Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
{TargetValue: timeout,
Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
return result, validation.NewError("storagedatalake.FilesystemClient", "List", err.Error())
}
req, err := client.ListPreparer(ctx, prefix, continuation, maxResults, xMsClientRequestID, timeout, xMsDate)
if err != nil {
err = autorest.NewErrorWithError(err, "storagedatalake.FilesystemClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "storagedatalake.FilesystemClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "storagedatalake.FilesystemClient", "List", resp, "Failure responding to request")
return
}
return
}
// ListPreparer prepares the List request.
func (client FilesystemClient) ListPreparer(ctx context.Context, prefix string, continuation string, maxResults *int32, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
urlParameters := map[string]interface{}{
"accountName": client.AccountName,
"dnsSuffix": client.DNSSuffix,
}
queryParameters := map[string]interface{}{
"resource": autorest.Encode("query", "account"),
}
if len(prefix) > 0 {
queryParameters["prefix"] = autorest.Encode("query", prefix)
}
if len(continuation) > 0 {
queryParameters["continuation"] = autorest.Encode("query", continuation)
}
if maxResults != nil {
queryParameters["maxResults"] = autorest.Encode("query", *maxResults)
}
if timeout != nil {
queryParameters["timeout"] = autorest.Encode("query", *timeout)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
autorest.WithPath("/"),
autorest.WithQueryParameters(queryParameters))
if len(xMsClientRequestID) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
}
if len(xMsDate) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
}
if len(client.XMsVersion) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
}
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 FilesystemClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client FilesystemClient) ListResponder(resp *http.Response) (result FilesystemList, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// SetProperties set properties for the filesystem. This operation supports conditional HTTP requests. For more
// information, see [Specifying Conditional Headers for Blob Service
// Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations).
// Parameters:
// filesystem - the filesystem identifier. The value must start and end with a letter or number and must
// contain only letters, numbers, and the dash (-) character. Consecutive dashes are not permitted. All
// letters must be lowercase. The value must have between 3 and 63 characters.
// xMsProperties - optional. User-defined properties to be stored with the filesystem, in the format of a
// comma-separated list of name and value pairs "n1=v1, n2=v2, ...", where each value is a base64 encoded
// string. Note that the string may only contain ASCII characters in the ISO-8859-1 character set. If the
// filesystem exists, any properties not included in the list will be removed. All properties are removed if
// the header is omitted. To merge new and existing properties, first get all existing properties and the
// current E-Tag, then make a conditional request with the E-Tag and include values for all properties.
// ifModifiedSince - optional. A date and time value. Specify this header to perform the operation only if the
// resource has been modified since the specified date and time.
// ifUnmodifiedSince - optional. A date and time value. Specify this header to perform the operation only if
// the resource has not been modified since the specified date and time.
// xMsClientRequestID - a UUID recorded in the analytics logs for troubleshooting and correlation.
// timeout - an optional operation timeout value in seconds. The period begins when the request is received by
// the service. If the timeout value elapses before the operation completes, the operation fails.
// xMsDate - specifies the Coordinated Universal Time (UTC) for the request. This is required when using
// shared key authorization.
func (client FilesystemClient) SetProperties(ctx context.Context, filesystem string, xMsProperties string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (result autorest.Response, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/FilesystemClient.SetProperties")
defer func() {
sc := -1
if result.Response != nil {
sc = result.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: filesystem,
Constraints: []validation.Constraint{{Target: "filesystem", Name: validation.MaxLength, Rule: 63, Chain: nil},
{Target: "filesystem", Name: validation.MinLength, Rule: 3, Chain: nil}}},
{TargetValue: xMsClientRequestID,
Constraints: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Empty, Rule: false,
Chain: []validation.Constraint{{Target: "xMsClientRequestID", Name: validation.Pattern, Rule: `^[{(]?[0-9a-f]{8}[-]?([0-9a-f]{4}[-]?){3}[0-9a-f]{12}[)}]?$`, Chain: nil}}}}},
{TargetValue: timeout,
Constraints: []validation.Constraint{{Target: "timeout", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "timeout", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil {
return result, validation.NewError("storagedatalake.FilesystemClient", "SetProperties", err.Error())
}
req, err := client.SetPropertiesPreparer(ctx, filesystem, xMsProperties, ifModifiedSince, ifUnmodifiedSince, xMsClientRequestID, timeout, xMsDate)
if err != nil {
err = autorest.NewErrorWithError(err, "storagedatalake.FilesystemClient", "SetProperties", nil, "Failure preparing request")
return
}
resp, err := client.SetPropertiesSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "storagedatalake.FilesystemClient", "SetProperties", resp, "Failure sending request")
return
}
result, err = client.SetPropertiesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "storagedatalake.FilesystemClient", "SetProperties", resp, "Failure responding to request")
return
}
return
}
// SetPropertiesPreparer prepares the SetProperties request.
func (client FilesystemClient) SetPropertiesPreparer(ctx context.Context, filesystem string, xMsProperties string, ifModifiedSince string, ifUnmodifiedSince string, xMsClientRequestID string, timeout *int32, xMsDate string) (*http.Request, error) {
urlParameters := map[string]interface{}{
"accountName": client.AccountName,
"dnsSuffix": client.DNSSuffix,
}
pathParameters := map[string]interface{}{
"filesystem": autorest.Encode("path", filesystem),
}
queryParameters := map[string]interface{}{
"resource": autorest.Encode("query", "filesystem"),
}
if timeout != nil {
queryParameters["timeout"] = autorest.Encode("query", *timeout)
}
preparer := autorest.CreatePreparer(
autorest.AsPatch(),
autorest.WithCustomBaseURL("https://{accountName}.{dnsSuffix}", urlParameters),
autorest.WithPathParameters("/{filesystem}", pathParameters),
autorest.WithQueryParameters(queryParameters))
if len(xMsProperties) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-properties", autorest.String(xMsProperties)))
}
if len(ifModifiedSince) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Modified-Since", autorest.String(ifModifiedSince)))
}
if len(ifUnmodifiedSince) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Unmodified-Since", autorest.String(ifUnmodifiedSince)))
}
if len(xMsClientRequestID) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-client-request-id", autorest.String(xMsClientRequestID)))
}
if len(xMsDate) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-date", autorest.String(xMsDate)))
}
if len(client.XMsVersion) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-version", autorest.String(client.XMsVersion)))
}
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// SetPropertiesSender sends the SetProperties request. The method will close the
// http.Response Body if it receives an error.
func (client FilesystemClient) SetPropertiesSender(req *http.Request) (*http.Response, error) {
return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
}
// SetPropertiesResponder handles the response to the SetProperties request. The method always
// closes the http.Response Body.
func (client FilesystemClient) SetPropertiesResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByClosing())
result.Response = resp
return
}
|