| 1 | package directoriesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/directories`/ |
| 2 | |
| 3 | import ( |
| 4 | "contextscip-go gomod github.com/golang/go/src go1.13 context/" |
| 5 | "fmtscip-go gomod github.com/golang/go/src go1.13 fmt/" |
| 6 | "net/httpscip-go gomod github.com/golang/go/src go1.13 `net/http`/" |
| 7 | "stringsscip-go gomod github.com/golang/go/src go1.13 strings/" |
| 8 | "timescip-go gomod github.com/golang/go/src go1.13 time/" |
| 9 | |
| 10 | "github.com/Azure/go-autorest/autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/" |
| 11 | "github.com/Azure/go-autorest/autorest/azurescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/" |
| 12 | "github.com/Azure/go-autorest/autorest/validationscip-go gomod github.com/Azure/go-autorest/autorest/validation v0.3.1 `github.com/Azure/go-autorest/autorest/validation`/" |
| 13 | "github.com/tombuildsstuff/giovanni/storage/internal/endpointsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/endpoints`/" |
| 14 | "github.com/tombuildsstuff/giovanni/storage/internal/metadatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/metadata`/" |
| 15 | ) |
| 16 | |
| 17 | type CreateDirectoryInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/directories`/CreateDirectoryInput# struct { |
| 18 | // The time at which this file was created at - if omitted, this'll be set to "now" |
| 19 | // This maps to the `x-ms-file-creation-time` field. |
| 20 | // ... Yes I know it says File not Directory, I didn't design the API. |
| 21 | CreatedAtscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/directories`/CreateDirectoryInput#CreatedAt. *timescip-go gomod github.com/golang/go/src go1.13 time/.Timescip-go gomod github.com/golang/go/src go1.13 time/Time# |
| 22 | |
| 23 | // The time at which this file was last modified - if omitted, this'll be set to "now" |
| 24 | // This maps to the `x-ms-file-last-write-time` field. |
| 25 | // ... Yes I know it says File not Directory, I didn't design the API. |
| 26 | LastModifiedscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/directories`/CreateDirectoryInput#LastModified. *timescip-go gomod github.com/golang/go/src go1.13 time/.Timescip-go gomod github.com/golang/go/src go1.13 time/Time# |
| 27 | |
| 28 | // MetaData is a mapping of key value pairs which should be assigned to this directory |
| 29 | MetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/directories`/CreateDirectoryInput#MetaData. map[string]string |
| 30 | } |
| 31 | |
| 32 | // Create creates a new directory under the specified share or parent directory. |
| 33 | func (client Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/directories`/Client#) Createscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/directories`/Client#Create().(ctx contextscip-go gomod github.com/golang/go/src go1.13 context/.Contextscip-go gomod github.com/golang/go/src go1.13 context/Context#, accountName, shareName, path string, input CreateDirectoryInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/directories`/CreateDirectoryInput#) (result autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.Responsescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Response#, err error) { |
| 34 | if accountName == "" { |
| 35 | return result, validationscip-go gomod github.com/Azure/go-autorest/autorest/validation v0.3.1 `github.com/Azure/go-autorest/autorest/validation`/.NewErrorscip-go gomod github.com/Azure/go-autorest/autorest/validation v0.3.1 `github.com/Azure/go-autorest/autorest/validation`/NewError().("directories.Client", "Create", "`accountName` cannot be an empty string.") |
| 36 | } |
| 37 | if shareName == "" { |
| 38 | return result, validationscip-go gomod github.com/Azure/go-autorest/autorest/validation v0.3.1 `github.com/Azure/go-autorest/autorest/validation`/.NewErrorscip-go gomod github.com/Azure/go-autorest/autorest/validation v0.3.1 `github.com/Azure/go-autorest/autorest/validation`/NewError().("directories.Client", "Create", "`shareName` cannot be an empty string.") |
| 39 | } |
| 40 | if stringsscip-go gomod github.com/golang/go/src go1.13 strings/.ToLowerscip-go gomod github.com/golang/go/src go1.13 strings/ToLower().(shareName) != shareName { |
| 41 | return result, validationscip-go gomod github.com/Azure/go-autorest/autorest/validation v0.3.1 `github.com/Azure/go-autorest/autorest/validation`/.NewErrorscip-go gomod github.com/Azure/go-autorest/autorest/validation v0.3.1 `github.com/Azure/go-autorest/autorest/validation`/NewError().("directories.Client", "Create", "`shareName` must be a lower-cased string.") |
| 42 | } |
| 43 | if path == "" { |
| 44 | return result, validationscip-go gomod github.com/Azure/go-autorest/autorest/validation v0.3.1 `github.com/Azure/go-autorest/autorest/validation`/.NewErrorscip-go gomod github.com/Azure/go-autorest/autorest/validation v0.3.1 `github.com/Azure/go-autorest/autorest/validation`/NewError().("directories.Client", "Create", "`path` cannot be an empty string.") |
| 45 | } |
| 46 | if err := metadatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/metadata`/.Validatescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/metadata`/Validate().(input.MetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/directories`/CreateDirectoryInput#MetaData.); err != nil { |
| 47 | return result, validationscip-go gomod github.com/Azure/go-autorest/autorest/validation v0.3.1 `github.com/Azure/go-autorest/autorest/validation`/.NewErrorscip-go gomod github.com/Azure/go-autorest/autorest/validation v0.3.1 `github.com/Azure/go-autorest/autorest/validation`/NewError().("directories.Client", "Create", fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("`metadata` is not valid: %s.", err)) |
| 48 | } |
| 49 | |
| 50 | req, err := client.CreatePreparerscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/directories`/Client#CreatePreparer().(ctx, accountName, shareName, path, input) |
| 51 | if err != nil { |
| 52 | err = autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.NewErrorWithErrorscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/NewErrorWithError().(err, "directories.Client", "Create", nil, "Failure preparing request") |
| 53 | return |
| 54 | } |
| 55 | |
| 56 | resp, err := client.CreateSenderscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/directories`/Client#CreateSender().(req) |
| 57 | if err != nil { |
| 58 | result = autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.Responsescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Response#{Responsescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Response#Response.: resp} |
| 59 | err = autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.NewErrorWithErrorscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/NewErrorWithError().(err, "directories.Client", "Create", resp, "Failure sending request") |
| 60 | return |
| 61 | } |
| 62 | |
| 63 | result, err = client.CreateResponderscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/directories`/Client#CreateResponder().(resp) |
| 64 | if err != nil { |
| 65 | err = autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.NewErrorWithErrorscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/NewErrorWithError().(err, "directories.Client", "Create", resp, "Failure responding to request") |
| 66 | return |
| 67 | } |
| 68 | |
| 69 | return |
| 70 | } |
| 71 | |
| 72 | // CreatePreparer prepares the Create request. |
| 73 | func (client Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/directories`/Client#) CreatePreparerscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/directories`/Client#CreatePreparer().(ctx contextscip-go gomod github.com/golang/go/src go1.13 context/.Contextscip-go gomod github.com/golang/go/src go1.13 context/Context#, accountName, shareName, path string, input CreateDirectoryInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/directories`/CreateDirectoryInput#) (*httpscip-go gomod github.com/golang/go/src go1.13 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.13 `net/http`/Request#, error) { |
| 74 | pathParameters := map[string]interface{}{ |
| 75 | "shareName": autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.Encodescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Encode().("path", shareName), |
| 76 | "directory": autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.Encodescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Encode().("path", path), |
| 77 | } |
| 78 | |
| 79 | queryParameters := map[string]interface{}{ |
| 80 | "restype": autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.Encodescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Encode().("query", "directory"), |
| 81 | } |
| 82 | |
| 83 | var coalesceDate = func(input *timescip-go gomod github.com/golang/go/src go1.13 time/.Timescip-go gomod github.com/golang/go/src go1.13 time/Time#, defaultVal string) string { |
| 84 | if input == nil { |
| 85 | return defaultVal |
| 86 | } |
| 87 | |
| 88 | return input.Formatscip-go gomod github.com/golang/go/src go1.13 time/Time#Format().(timescip-go gomod github.com/golang/go/src go1.13 time/.RFC1123scip-go gomod github.com/golang/go/src go1.13 time/RFC1123.) |
| 89 | } |
| 90 | |
| 91 | headers := map[string]interface{}{ |
| 92 | "x-ms-version": APIVersionscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/directories`/APIVersion., |
| 93 | |
| 94 | // ... Yes I know these say File not Directory, I didn't design the API. |
| 95 | "x-ms-file-permission": "inherit", // TODO: expose this in future |
| 96 | "x-ms-file-attributes": "None", // TODO: expose this in future |
| 97 | "x-ms-file-creation-time": coalesceDate(input.CreatedAtscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/directories`/CreateDirectoryInput#CreatedAt., "now"), |
| 98 | "x-ms-file-last-write-time": coalesceDate(input.LastModifiedscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/directories`/CreateDirectoryInput#LastModified., "now"), |
| 99 | } |
| 100 | |
| 101 | headers = metadatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/metadata`/.SetIntoHeadersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/metadata`/SetIntoHeaders().(headers, input.MetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/directories`/CreateDirectoryInput#MetaData.) |
| 102 | |
| 103 | preparer := autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.CreatePreparerscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/CreatePreparer().( |
| 104 | autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.AsContentTypescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/AsContentType().("application/xml; charset=utf-8"), |
| 105 | autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.AsPutscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/AsPut().(), |
| 106 | autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.WithBaseURLscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/WithBaseURL().(endpointsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/endpoints`/.GetFileEndpointscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/endpoints`/GetFileEndpoint().(client.BaseURIscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/directories`/Client#BaseURI., accountName)), |
| 107 | autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.WithPathParametersscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/WithPathParameters().("/{shareName}/{directory}", pathParameters), |
| 108 | autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.WithQueryParametersscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/WithQueryParameters().(queryParameters), |
| 109 | autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.WithHeadersscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/WithHeaders().(headers)) |
| 110 | return preparer.Preparescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Preparer#Prepare().((&httpscip-go gomod github.com/golang/go/src go1.13 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.13 `net/http`/Request#{}).WithContextscip-go gomod github.com/golang/go/src go1.13 `net/http`/Request#WithContext().(ctx)) |
| 111 | } |
| 112 | |
| 113 | // CreateSender sends the Create request. The method will close the |
| 114 | // http.Response Body if it receives an error. |
| 115 | func (client Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/directories`/Client#) CreateSenderscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/directories`/Client#CreateSender().(req *httpscip-go gomod github.com/golang/go/src go1.13 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.13 `net/http`/Request#) (*httpscip-go gomod github.com/golang/go/src go1.13 `net/http`/.Responsescip-go gomod github.com/golang/go/src go1.13 `net/http`/Response#, error) { |
| 116 | return autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.SendWithSenderscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/SendWithSender().(client, req, |
| 117 | azurescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/.DoRetryWithRegistrationscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/DoRetryWithRegistration().(client.Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/directories`/Client#Client.)) |
| 118 | } |
| 119 | |
| 120 | // CreateResponder handles the response to the Create request. The method always |
| 121 | // closes the http.Response Body. |
| 122 | func (client Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/directories`/Client#) CreateResponderscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2019-12-12/file/directories`/Client#CreateResponder().(resp *httpscip-go gomod github.com/golang/go/src go1.13 `net/http`/.Responsescip-go gomod github.com/golang/go/src go1.13 `net/http`/Response#) (result autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.Responsescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Response#, err error) { |
| 123 | err = autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.Respondscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Respond().( |
| 124 | resp, |
| 125 | client.ByInspectingscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Client#ByInspecting().(), |
| 126 | azurescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/.WithErrorUnlessStatusCodescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest/azure`/WithErrorUnlessStatusCode().(httpscip-go gomod github.com/golang/go/src go1.13 `net/http`/.StatusCreatedscip-go gomod github.com/golang/go/src go1.13 `net/http`/StatusCreated.), |
| 127 | autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.ByClosingscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/ByClosing().()) |
| 128 | result = autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.Responsescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Response#{Responsescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Response#Response.: resp} |
| 129 | |
| 130 | return |
| 131 | } |