Debian Codegraph @

storage/2020-08-04/file/shares/create.go

raw symbols SCIP
1 package sharesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/
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
9 "github.com/Azure/go-autorest/autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/"
10 "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`/"
11 "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`/"
12 "github.com/tombuildsstuff/giovanni/storage/internal/endpointsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/endpoints`/"
13 "github.com/tombuildsstuff/giovanni/storage/internal/metadatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/metadata`/"
14 )
15
16 type AccessTierscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/AccessTier# string
17
18 const (
19 TransactionOptimizedAccessTierscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/TransactionOptimizedAccessTier. AccessTierscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/AccessTier# = "TransactionOptimized"
20 HotAccessTierscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/HotAccessTier. AccessTierscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/AccessTier# = "Hot"
21 CoolAccessTierscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/CoolAccessTier. AccessTierscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/AccessTier# = "Cool"
22 PremiumAccessTierscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/PremiumAccessTier. AccessTierscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/AccessTier# = "Premium"
23 )
24
25 type CreateInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/CreateInput# struct {
26 // Specifies the maximum size of the share, in gigabytes.
27 // Must be greater than 0, and less than or equal to 5TB (5120).
28 QuotaInGBscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/CreateInput#QuotaInGB. int
29
30 // Specifies the enabled protocols on the share. If not specified, the default is SMB.
31 EnabledProtocolscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/CreateInput#EnabledProtocol. ShareProtocolscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/ShareProtocol#
32
33 MetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/CreateInput#MetaData. map[string]string
34
35 // Specifies the access tier of the share.
36 AccessTierscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/CreateInput#AccessTier. *AccessTierscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/AccessTier#
37 }
38
39 // Create creates the specified Storage Share within the specified Storage Account
40 func (client Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/Client#) Createscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/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 string, input CreateInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/CreateInput#) (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) {
41 if accountName == "" {
42 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().("shares.Client", "Create", "`accountName` cannot be an empty string.")
43 }
44 if shareName == "" {
45 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().("shares.Client", "Create", "`shareName` cannot be an empty string.")
46 }
47 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 {
48 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().("shares.Client", "Create", "`shareName` must be a lower-cased string.")
49 }
50 if input.QuotaInGBscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/CreateInput#QuotaInGB. <= 0 || input.QuotaInGBscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/CreateInput#QuotaInGB. > 102400 {
51 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().("shares.Client", "Create", "`input.QuotaInGB` must be greater than 0, and less than/equal to 100TB (102400 GB)")
52 }
53 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/2020-08-04/file/shares`/CreateInput#MetaData.); err != nil {
54 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().("shares.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().("`input.MetaData` is not valid: %s.", err))
55 }
56
57 req, err := client.CreatePreparerscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/Client#CreatePreparer().(ctx, accountName, shareName, input)
58 if err != nil {
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, "shares.Client", "Create", nil, "Failure preparing request")
60 return
61 }
62
63 resp, err := client.CreateSenderscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/Client#CreateSender().(req)
64 if err != nil {
65 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}
66 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, "shares.Client", "Create", resp, "Failure sending request")
67 return
68 }
69
70 result, err = client.CreateResponderscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/Client#CreateResponder().(resp)
71 if err != nil {
72 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, "shares.Client", "Create", resp, "Failure responding to request")
73 return
74 }
75
76 return
77 }
78
79 // CreatePreparer prepares the Create request.
80 func (client Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/Client#) CreatePreparerscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/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 string, input CreateInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/CreateInput#) (*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) {
81 pathParameters := map[string]interface{}{
82 "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),
83 }
84
85 queryParameters := map[string]interface{}{
86 "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().("path", "share"),
87 }
88
89 headers := map[string]interface{}{
90 "x-ms-version": APIVersionscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/APIVersion.,
91 "x-ms-share-quota": input.QuotaInGBscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/CreateInput#QuotaInGB.,
92 }
93
94 protocol := SMBscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/SMB.
95 if input.EnabledProtocolscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/CreateInput#EnabledProtocol. != "" {
96 protocol = input.EnabledProtocolscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/CreateInput#EnabledProtocol.
97 }
98 headers["x-ms-enabled-protocols"] = protocol
99
100 if input.AccessTierscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/CreateInput#AccessTier. != nil {
101 headers["x-ms-access-tier"] = string(*input.AccessTierscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/CreateInput#AccessTier.)
102 }
103
104 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/2020-08-04/file/shares`/CreateInput#MetaData.)
105
106 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().(
107 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"),
108 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().(),
109 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/2020-08-04/file/shares`/Client#BaseURI., accountName)),
110 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}", pathParameters),
111 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),
112 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))
113 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))
114 }
115
116 // CreateSender sends the Create request. The method will close the
117 // http.Response Body if it receives an error.
118 func (client Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/Client#) CreateSenderscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/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) {
119 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,
120 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/2020-08-04/file/shares`/Client#Client.))
121 }
122
123 // CreateResponder handles the response to the Create request. The method always
124 // closes the http.Response Body.
125 func (client Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/Client#) CreateResponderscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2020-08-04/file/shares`/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) {
126 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().(
127 resp,
128 client.ByInspectingscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Client#ByInspecting().(),
129 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.),
130 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().())
131 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}
132
133 return
134 }