1 package documentdb
2
3
4
5
6
7
8
9 import (
10 "context"
11 "github.com/Azure/go-autorest/autorest"
12 "github.com/Azure/go-autorest/autorest/azure"
13 "github.com/Azure/go-autorest/autorest/validation"
14 "github.com/Azure/go-autorest/tracing"
15 "net/http"
16 )
17
18
19 type GremlinResourcesClient struct {
20 BaseClient
21 }
22
23
24 func NewGremlinResourcesClient(subscriptionID string) GremlinResourcesClient {
25 return NewGremlinResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID)
26 }
27
28
29
30
31 func NewGremlinResourcesClientWithBaseURI(baseURI string, subscriptionID string) GremlinResourcesClient {
32 return GremlinResourcesClient{NewWithBaseURI(baseURI, subscriptionID)}
33 }
34
35
36
37
38
39
40
41 func (client GremlinResourcesClient) CreateUpdateGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters GremlinDatabaseCreateUpdateParameters) (result GremlinResourcesCreateUpdateGremlinDatabaseFuture, err error) {
42 if tracing.IsEnabled() {
43 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.CreateUpdateGremlinDatabase")
44 defer func() {
45 sc := -1
46 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
47 sc = result.FutureAPI.Response().StatusCode
48 }
49 tracing.EndSpan(ctx, sc, err)
50 }()
51 }
52 if err := validation.Validate([]validation.Validation{
53 {TargetValue: client.SubscriptionID,
54 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
55 {TargetValue: resourceGroupName,
56 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
57 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
58 {TargetValue: accountName,
59 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
60 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
61 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}},
62 {TargetValue: createUpdateGremlinDatabaseParameters,
63 Constraints: []validation.Constraint{{Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties", Name: validation.Null, Rule: true,
64 Chain: []validation.Constraint{{Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties.Resource", Name: validation.Null, Rule: true,
65 Chain: []validation.Constraint{{Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil}}},
66 }}}}}); err != nil {
67 return result, validation.NewError("documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", err.Error())
68 }
69
70 req, err := client.CreateUpdateGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters)
71 if err != nil {
72 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", nil, "Failure preparing request")
73 return
74 }
75
76 result, err = client.CreateUpdateGremlinDatabaseSender(req)
77 if err != nil {
78 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", result.Response(), "Failure sending request")
79 return
80 }
81
82 return
83 }
84
85
86 func (client GremlinResourcesClient) CreateUpdateGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters GremlinDatabaseCreateUpdateParameters) (*http.Request, error) {
87 pathParameters := map[string]interface{}{
88 "accountName": autorest.Encode("path", accountName),
89 "databaseName": autorest.Encode("path", databaseName),
90 "resourceGroupName": autorest.Encode("path", resourceGroupName),
91 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
92 }
93
94 const APIVersion = "2021-06-15"
95 queryParameters := map[string]interface{}{
96 "api-version": APIVersion,
97 }
98
99 preparer := autorest.CreatePreparer(
100 autorest.AsContentType("application/json; charset=utf-8"),
101 autorest.AsPut(),
102 autorest.WithBaseURL(client.BaseURI),
103 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters),
104 autorest.WithJSON(createUpdateGremlinDatabaseParameters),
105 autorest.WithQueryParameters(queryParameters))
106 return preparer.Prepare((&http.Request{}).WithContext(ctx))
107 }
108
109
110
111 func (client GremlinResourcesClient) CreateUpdateGremlinDatabaseSender(req *http.Request) (future GremlinResourcesCreateUpdateGremlinDatabaseFuture, err error) {
112 var resp *http.Response
113 future.FutureAPI = &azure.Future{}
114 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
115 if err != nil {
116 return
117 }
118 var azf azure.Future
119 azf, err = azure.NewFutureFromResponse(resp)
120 future.FutureAPI = &azf
121 future.Result = future.result
122 return
123 }
124
125
126
127 func (client GremlinResourcesClient) CreateUpdateGremlinDatabaseResponder(resp *http.Response) (result GremlinDatabaseGetResults, err error) {
128 err = autorest.Respond(
129 resp,
130 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
131 autorest.ByUnmarshallingJSON(&result),
132 autorest.ByClosing())
133 result.Response = autorest.Response{Response: resp}
134 return
135 }
136
137
138
139
140
141
142
143
144 func (client GremlinResourcesClient) CreateUpdateGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters GremlinGraphCreateUpdateParameters) (result GremlinResourcesCreateUpdateGremlinGraphFuture, err error) {
145 if tracing.IsEnabled() {
146 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.CreateUpdateGremlinGraph")
147 defer func() {
148 sc := -1
149 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
150 sc = result.FutureAPI.Response().StatusCode
151 }
152 tracing.EndSpan(ctx, sc, err)
153 }()
154 }
155 if err := validation.Validate([]validation.Validation{
156 {TargetValue: client.SubscriptionID,
157 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
158 {TargetValue: resourceGroupName,
159 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
160 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
161 {TargetValue: accountName,
162 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
163 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
164 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}},
165 {TargetValue: createUpdateGremlinGraphParameters,
166 Constraints: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties", Name: validation.Null, Rule: true,
167 Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource", Name: validation.Null, Rule: true,
168 Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil},
169 {Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey", Name: validation.Null, Rule: false,
170 Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.Null, Rule: false,
171 Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMaximum, Rule: int64(2), Chain: nil},
172 {Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil},
173 }},
174 }},
175 }},
176 }}}}}); err != nil {
177 return result, validation.NewError("documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", err.Error())
178 }
179
180 req, err := client.CreateUpdateGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters)
181 if err != nil {
182 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", nil, "Failure preparing request")
183 return
184 }
185
186 result, err = client.CreateUpdateGremlinGraphSender(req)
187 if err != nil {
188 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", result.Response(), "Failure sending request")
189 return
190 }
191
192 return
193 }
194
195
196 func (client GremlinResourcesClient) CreateUpdateGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters GremlinGraphCreateUpdateParameters) (*http.Request, error) {
197 pathParameters := map[string]interface{}{
198 "accountName": autorest.Encode("path", accountName),
199 "databaseName": autorest.Encode("path", databaseName),
200 "graphName": autorest.Encode("path", graphName),
201 "resourceGroupName": autorest.Encode("path", resourceGroupName),
202 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
203 }
204
205 const APIVersion = "2021-06-15"
206 queryParameters := map[string]interface{}{
207 "api-version": APIVersion,
208 }
209
210 preparer := autorest.CreatePreparer(
211 autorest.AsContentType("application/json; charset=utf-8"),
212 autorest.AsPut(),
213 autorest.WithBaseURL(client.BaseURI),
214 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters),
215 autorest.WithJSON(createUpdateGremlinGraphParameters),
216 autorest.WithQueryParameters(queryParameters))
217 return preparer.Prepare((&http.Request{}).WithContext(ctx))
218 }
219
220
221
222 func (client GremlinResourcesClient) CreateUpdateGremlinGraphSender(req *http.Request) (future GremlinResourcesCreateUpdateGremlinGraphFuture, err error) {
223 var resp *http.Response
224 future.FutureAPI = &azure.Future{}
225 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
226 if err != nil {
227 return
228 }
229 var azf azure.Future
230 azf, err = azure.NewFutureFromResponse(resp)
231 future.FutureAPI = &azf
232 future.Result = future.result
233 return
234 }
235
236
237
238 func (client GremlinResourcesClient) CreateUpdateGremlinGraphResponder(resp *http.Response) (result GremlinGraphGetResults, err error) {
239 err = autorest.Respond(
240 resp,
241 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
242 autorest.ByUnmarshallingJSON(&result),
243 autorest.ByClosing())
244 result.Response = autorest.Response{Response: resp}
245 return
246 }
247
248
249
250
251
252
253 func (client GremlinResourcesClient) DeleteGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinResourcesDeleteGremlinDatabaseFuture, err error) {
254 if tracing.IsEnabled() {
255 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.DeleteGremlinDatabase")
256 defer func() {
257 sc := -1
258 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
259 sc = result.FutureAPI.Response().StatusCode
260 }
261 tracing.EndSpan(ctx, sc, err)
262 }()
263 }
264 if err := validation.Validate([]validation.Validation{
265 {TargetValue: client.SubscriptionID,
266 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
267 {TargetValue: resourceGroupName,
268 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
269 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
270 {TargetValue: accountName,
271 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
272 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
273 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
274 return result, validation.NewError("documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", err.Error())
275 }
276
277 req, err := client.DeleteGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName)
278 if err != nil {
279 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", nil, "Failure preparing request")
280 return
281 }
282
283 result, err = client.DeleteGremlinDatabaseSender(req)
284 if err != nil {
285 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", result.Response(), "Failure sending request")
286 return
287 }
288
289 return
290 }
291
292
293 func (client GremlinResourcesClient) DeleteGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) {
294 pathParameters := map[string]interface{}{
295 "accountName": autorest.Encode("path", accountName),
296 "databaseName": autorest.Encode("path", databaseName),
297 "resourceGroupName": autorest.Encode("path", resourceGroupName),
298 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
299 }
300
301 const APIVersion = "2021-06-15"
302 queryParameters := map[string]interface{}{
303 "api-version": APIVersion,
304 }
305
306 preparer := autorest.CreatePreparer(
307 autorest.AsDelete(),
308 autorest.WithBaseURL(client.BaseURI),
309 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters),
310 autorest.WithQueryParameters(queryParameters))
311 return preparer.Prepare((&http.Request{}).WithContext(ctx))
312 }
313
314
315
316 func (client GremlinResourcesClient) DeleteGremlinDatabaseSender(req *http.Request) (future GremlinResourcesDeleteGremlinDatabaseFuture, err error) {
317 var resp *http.Response
318 future.FutureAPI = &azure.Future{}
319 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
320 if err != nil {
321 return
322 }
323 var azf azure.Future
324 azf, err = azure.NewFutureFromResponse(resp)
325 future.FutureAPI = &azf
326 future.Result = future.result
327 return
328 }
329
330
331
332 func (client GremlinResourcesClient) DeleteGremlinDatabaseResponder(resp *http.Response) (result autorest.Response, err error) {
333 err = autorest.Respond(
334 resp,
335 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
336 autorest.ByClosing())
337 result.Response = resp
338 return
339 }
340
341
342
343
344
345
346
347 func (client GremlinResourcesClient) DeleteGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinResourcesDeleteGremlinGraphFuture, err error) {
348 if tracing.IsEnabled() {
349 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.DeleteGremlinGraph")
350 defer func() {
351 sc := -1
352 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
353 sc = result.FutureAPI.Response().StatusCode
354 }
355 tracing.EndSpan(ctx, sc, err)
356 }()
357 }
358 if err := validation.Validate([]validation.Validation{
359 {TargetValue: client.SubscriptionID,
360 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
361 {TargetValue: resourceGroupName,
362 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
363 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
364 {TargetValue: accountName,
365 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
366 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
367 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
368 return result, validation.NewError("documentdb.GremlinResourcesClient", "DeleteGremlinGraph", err.Error())
369 }
370
371 req, err := client.DeleteGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName)
372 if err != nil {
373 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinGraph", nil, "Failure preparing request")
374 return
375 }
376
377 result, err = client.DeleteGremlinGraphSender(req)
378 if err != nil {
379 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinGraph", result.Response(), "Failure sending request")
380 return
381 }
382
383 return
384 }
385
386
387 func (client GremlinResourcesClient) DeleteGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) {
388 pathParameters := map[string]interface{}{
389 "accountName": autorest.Encode("path", accountName),
390 "databaseName": autorest.Encode("path", databaseName),
391 "graphName": autorest.Encode("path", graphName),
392 "resourceGroupName": autorest.Encode("path", resourceGroupName),
393 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
394 }
395
396 const APIVersion = "2021-06-15"
397 queryParameters := map[string]interface{}{
398 "api-version": APIVersion,
399 }
400
401 preparer := autorest.CreatePreparer(
402 autorest.AsDelete(),
403 autorest.WithBaseURL(client.BaseURI),
404 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters),
405 autorest.WithQueryParameters(queryParameters))
406 return preparer.Prepare((&http.Request{}).WithContext(ctx))
407 }
408
409
410
411 func (client GremlinResourcesClient) DeleteGremlinGraphSender(req *http.Request) (future GremlinResourcesDeleteGremlinGraphFuture, err error) {
412 var resp *http.Response
413 future.FutureAPI = &azure.Future{}
414 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
415 if err != nil {
416 return
417 }
418 var azf azure.Future
419 azf, err = azure.NewFutureFromResponse(resp)
420 future.FutureAPI = &azf
421 future.Result = future.result
422 return
423 }
424
425
426
427 func (client GremlinResourcesClient) DeleteGremlinGraphResponder(resp *http.Response) (result autorest.Response, err error) {
428 err = autorest.Respond(
429 resp,
430 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
431 autorest.ByClosing())
432 result.Response = resp
433 return
434 }
435
436
437
438
439
440
441
442 func (client GremlinResourcesClient) GetGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinDatabaseGetResults, err error) {
443 if tracing.IsEnabled() {
444 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinDatabase")
445 defer func() {
446 sc := -1
447 if result.Response.Response != nil {
448 sc = result.Response.Response.StatusCode
449 }
450 tracing.EndSpan(ctx, sc, err)
451 }()
452 }
453 if err := validation.Validate([]validation.Validation{
454 {TargetValue: client.SubscriptionID,
455 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
456 {TargetValue: resourceGroupName,
457 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
458 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
459 {TargetValue: accountName,
460 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
461 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
462 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
463 return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinDatabase", err.Error())
464 }
465
466 req, err := client.GetGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName)
467 if err != nil {
468 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", nil, "Failure preparing request")
469 return
470 }
471
472 resp, err := client.GetGremlinDatabaseSender(req)
473 if err != nil {
474 result.Response = autorest.Response{Response: resp}
475 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", resp, "Failure sending request")
476 return
477 }
478
479 result, err = client.GetGremlinDatabaseResponder(resp)
480 if err != nil {
481 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", resp, "Failure responding to request")
482 return
483 }
484
485 return
486 }
487
488
489 func (client GremlinResourcesClient) GetGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) {
490 pathParameters := map[string]interface{}{
491 "accountName": autorest.Encode("path", accountName),
492 "databaseName": autorest.Encode("path", databaseName),
493 "resourceGroupName": autorest.Encode("path", resourceGroupName),
494 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
495 }
496
497 const APIVersion = "2021-06-15"
498 queryParameters := map[string]interface{}{
499 "api-version": APIVersion,
500 }
501
502 preparer := autorest.CreatePreparer(
503 autorest.AsGet(),
504 autorest.WithBaseURL(client.BaseURI),
505 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters),
506 autorest.WithQueryParameters(queryParameters))
507 return preparer.Prepare((&http.Request{}).WithContext(ctx))
508 }
509
510
511
512 func (client GremlinResourcesClient) GetGremlinDatabaseSender(req *http.Request) (*http.Response, error) {
513 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
514 }
515
516
517
518 func (client GremlinResourcesClient) GetGremlinDatabaseResponder(resp *http.Response) (result GremlinDatabaseGetResults, err error) {
519 err = autorest.Respond(
520 resp,
521 azure.WithErrorUnlessStatusCode(http.StatusOK),
522 autorest.ByUnmarshallingJSON(&result),
523 autorest.ByClosing())
524 result.Response = autorest.Response{Response: resp}
525 return
526 }
527
528
529
530
531
532
533
534 func (client GremlinResourcesClient) GetGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) {
535 if tracing.IsEnabled() {
536 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinDatabaseThroughput")
537 defer func() {
538 sc := -1
539 if result.Response.Response != nil {
540 sc = result.Response.Response.StatusCode
541 }
542 tracing.EndSpan(ctx, sc, err)
543 }()
544 }
545 if err := validation.Validate([]validation.Validation{
546 {TargetValue: client.SubscriptionID,
547 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
548 {TargetValue: resourceGroupName,
549 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
550 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
551 {TargetValue: accountName,
552 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
553 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
554 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
555 return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", err.Error())
556 }
557
558 req, err := client.GetGremlinDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName)
559 if err != nil {
560 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", nil, "Failure preparing request")
561 return
562 }
563
564 resp, err := client.GetGremlinDatabaseThroughputSender(req)
565 if err != nil {
566 result.Response = autorest.Response{Response: resp}
567 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", resp, "Failure sending request")
568 return
569 }
570
571 result, err = client.GetGremlinDatabaseThroughputResponder(resp)
572 if err != nil {
573 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", resp, "Failure responding to request")
574 return
575 }
576
577 return
578 }
579
580
581 func (client GremlinResourcesClient) GetGremlinDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) {
582 pathParameters := map[string]interface{}{
583 "accountName": autorest.Encode("path", accountName),
584 "databaseName": autorest.Encode("path", databaseName),
585 "resourceGroupName": autorest.Encode("path", resourceGroupName),
586 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
587 }
588
589 const APIVersion = "2021-06-15"
590 queryParameters := map[string]interface{}{
591 "api-version": APIVersion,
592 }
593
594 preparer := autorest.CreatePreparer(
595 autorest.AsGet(),
596 autorest.WithBaseURL(client.BaseURI),
597 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default", pathParameters),
598 autorest.WithQueryParameters(queryParameters))
599 return preparer.Prepare((&http.Request{}).WithContext(ctx))
600 }
601
602
603
604 func (client GremlinResourcesClient) GetGremlinDatabaseThroughputSender(req *http.Request) (*http.Response, error) {
605 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
606 }
607
608
609
610 func (client GremlinResourcesClient) GetGremlinDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
611 err = autorest.Respond(
612 resp,
613 azure.WithErrorUnlessStatusCode(http.StatusOK),
614 autorest.ByUnmarshallingJSON(&result),
615 autorest.ByClosing())
616 result.Response = autorest.Response{Response: resp}
617 return
618 }
619
620
621
622
623
624
625
626 func (client GremlinResourcesClient) GetGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinGraphGetResults, err error) {
627 if tracing.IsEnabled() {
628 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinGraph")
629 defer func() {
630 sc := -1
631 if result.Response.Response != nil {
632 sc = result.Response.Response.StatusCode
633 }
634 tracing.EndSpan(ctx, sc, err)
635 }()
636 }
637 if err := validation.Validate([]validation.Validation{
638 {TargetValue: client.SubscriptionID,
639 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
640 {TargetValue: resourceGroupName,
641 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
642 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
643 {TargetValue: accountName,
644 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
645 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
646 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
647 return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinGraph", err.Error())
648 }
649
650 req, err := client.GetGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName)
651 if err != nil {
652 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", nil, "Failure preparing request")
653 return
654 }
655
656 resp, err := client.GetGremlinGraphSender(req)
657 if err != nil {
658 result.Response = autorest.Response{Response: resp}
659 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", resp, "Failure sending request")
660 return
661 }
662
663 result, err = client.GetGremlinGraphResponder(resp)
664 if err != nil {
665 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", resp, "Failure responding to request")
666 return
667 }
668
669 return
670 }
671
672
673 func (client GremlinResourcesClient) GetGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) {
674 pathParameters := map[string]interface{}{
675 "accountName": autorest.Encode("path", accountName),
676 "databaseName": autorest.Encode("path", databaseName),
677 "graphName": autorest.Encode("path", graphName),
678 "resourceGroupName": autorest.Encode("path", resourceGroupName),
679 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
680 }
681
682 const APIVersion = "2021-06-15"
683 queryParameters := map[string]interface{}{
684 "api-version": APIVersion,
685 }
686
687 preparer := autorest.CreatePreparer(
688 autorest.AsGet(),
689 autorest.WithBaseURL(client.BaseURI),
690 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters),
691 autorest.WithQueryParameters(queryParameters))
692 return preparer.Prepare((&http.Request{}).WithContext(ctx))
693 }
694
695
696
697 func (client GremlinResourcesClient) GetGremlinGraphSender(req *http.Request) (*http.Response, error) {
698 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
699 }
700
701
702
703 func (client GremlinResourcesClient) GetGremlinGraphResponder(resp *http.Response) (result GremlinGraphGetResults, err error) {
704 err = autorest.Respond(
705 resp,
706 azure.WithErrorUnlessStatusCode(http.StatusOK),
707 autorest.ByUnmarshallingJSON(&result),
708 autorest.ByClosing())
709 result.Response = autorest.Response{Response: resp}
710 return
711 }
712
713
714
715
716
717
718
719
720 func (client GremlinResourcesClient) GetGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result ThroughputSettingsGetResults, err error) {
721 if tracing.IsEnabled() {
722 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinGraphThroughput")
723 defer func() {
724 sc := -1
725 if result.Response.Response != nil {
726 sc = result.Response.Response.StatusCode
727 }
728 tracing.EndSpan(ctx, sc, err)
729 }()
730 }
731 if err := validation.Validate([]validation.Validation{
732 {TargetValue: client.SubscriptionID,
733 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
734 {TargetValue: resourceGroupName,
735 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
736 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
737 {TargetValue: accountName,
738 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
739 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
740 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
741 return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", err.Error())
742 }
743
744 req, err := client.GetGremlinGraphThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, graphName)
745 if err != nil {
746 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", nil, "Failure preparing request")
747 return
748 }
749
750 resp, err := client.GetGremlinGraphThroughputSender(req)
751 if err != nil {
752 result.Response = autorest.Response{Response: resp}
753 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", resp, "Failure sending request")
754 return
755 }
756
757 result, err = client.GetGremlinGraphThroughputResponder(resp)
758 if err != nil {
759 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", resp, "Failure responding to request")
760 return
761 }
762
763 return
764 }
765
766
767 func (client GremlinResourcesClient) GetGremlinGraphThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) {
768 pathParameters := map[string]interface{}{
769 "accountName": autorest.Encode("path", accountName),
770 "databaseName": autorest.Encode("path", databaseName),
771 "graphName": autorest.Encode("path", graphName),
772 "resourceGroupName": autorest.Encode("path", resourceGroupName),
773 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
774 }
775
776 const APIVersion = "2021-06-15"
777 queryParameters := map[string]interface{}{
778 "api-version": APIVersion,
779 }
780
781 preparer := autorest.CreatePreparer(
782 autorest.AsGet(),
783 autorest.WithBaseURL(client.BaseURI),
784 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default", pathParameters),
785 autorest.WithQueryParameters(queryParameters))
786 return preparer.Prepare((&http.Request{}).WithContext(ctx))
787 }
788
789
790
791 func (client GremlinResourcesClient) GetGremlinGraphThroughputSender(req *http.Request) (*http.Response, error) {
792 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
793 }
794
795
796
797 func (client GremlinResourcesClient) GetGremlinGraphThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
798 err = autorest.Respond(
799 resp,
800 azure.WithErrorUnlessStatusCode(http.StatusOK),
801 autorest.ByUnmarshallingJSON(&result),
802 autorest.ByClosing())
803 result.Response = autorest.Response{Response: resp}
804 return
805 }
806
807
808
809
810
811 func (client GremlinResourcesClient) ListGremlinDatabases(ctx context.Context, resourceGroupName string, accountName string) (result GremlinDatabaseListResult, err error) {
812 if tracing.IsEnabled() {
813 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.ListGremlinDatabases")
814 defer func() {
815 sc := -1
816 if result.Response.Response != nil {
817 sc = result.Response.Response.StatusCode
818 }
819 tracing.EndSpan(ctx, sc, err)
820 }()
821 }
822 if err := validation.Validate([]validation.Validation{
823 {TargetValue: client.SubscriptionID,
824 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
825 {TargetValue: resourceGroupName,
826 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
827 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
828 {TargetValue: accountName,
829 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
830 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
831 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
832 return result, validation.NewError("documentdb.GremlinResourcesClient", "ListGremlinDatabases", err.Error())
833 }
834
835 req, err := client.ListGremlinDatabasesPreparer(ctx, resourceGroupName, accountName)
836 if err != nil {
837 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", nil, "Failure preparing request")
838 return
839 }
840
841 resp, err := client.ListGremlinDatabasesSender(req)
842 if err != nil {
843 result.Response = autorest.Response{Response: resp}
844 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", resp, "Failure sending request")
845 return
846 }
847
848 result, err = client.ListGremlinDatabasesResponder(resp)
849 if err != nil {
850 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", resp, "Failure responding to request")
851 return
852 }
853
854 return
855 }
856
857
858 func (client GremlinResourcesClient) ListGremlinDatabasesPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) {
859 pathParameters := map[string]interface{}{
860 "accountName": autorest.Encode("path", accountName),
861 "resourceGroupName": autorest.Encode("path", resourceGroupName),
862 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
863 }
864
865 const APIVersion = "2021-06-15"
866 queryParameters := map[string]interface{}{
867 "api-version": APIVersion,
868 }
869
870 preparer := autorest.CreatePreparer(
871 autorest.AsGet(),
872 autorest.WithBaseURL(client.BaseURI),
873 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases", pathParameters),
874 autorest.WithQueryParameters(queryParameters))
875 return preparer.Prepare((&http.Request{}).WithContext(ctx))
876 }
877
878
879
880 func (client GremlinResourcesClient) ListGremlinDatabasesSender(req *http.Request) (*http.Response, error) {
881 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
882 }
883
884
885
886 func (client GremlinResourcesClient) ListGremlinDatabasesResponder(resp *http.Response) (result GremlinDatabaseListResult, err error) {
887 err = autorest.Respond(
888 resp,
889 azure.WithErrorUnlessStatusCode(http.StatusOK),
890 autorest.ByUnmarshallingJSON(&result),
891 autorest.ByClosing())
892 result.Response = autorest.Response{Response: resp}
893 return
894 }
895
896
897
898
899
900
901 func (client GremlinResourcesClient) ListGremlinGraphs(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinGraphListResult, err error) {
902 if tracing.IsEnabled() {
903 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.ListGremlinGraphs")
904 defer func() {
905 sc := -1
906 if result.Response.Response != nil {
907 sc = result.Response.Response.StatusCode
908 }
909 tracing.EndSpan(ctx, sc, err)
910 }()
911 }
912 if err := validation.Validate([]validation.Validation{
913 {TargetValue: client.SubscriptionID,
914 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
915 {TargetValue: resourceGroupName,
916 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
917 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
918 {TargetValue: accountName,
919 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
920 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
921 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
922 return result, validation.NewError("documentdb.GremlinResourcesClient", "ListGremlinGraphs", err.Error())
923 }
924
925 req, err := client.ListGremlinGraphsPreparer(ctx, resourceGroupName, accountName, databaseName)
926 if err != nil {
927 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", nil, "Failure preparing request")
928 return
929 }
930
931 resp, err := client.ListGremlinGraphsSender(req)
932 if err != nil {
933 result.Response = autorest.Response{Response: resp}
934 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", resp, "Failure sending request")
935 return
936 }
937
938 result, err = client.ListGremlinGraphsResponder(resp)
939 if err != nil {
940 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", resp, "Failure responding to request")
941 return
942 }
943
944 return
945 }
946
947
948 func (client GremlinResourcesClient) ListGremlinGraphsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) {
949 pathParameters := map[string]interface{}{
950 "accountName": autorest.Encode("path", accountName),
951 "databaseName": autorest.Encode("path", databaseName),
952 "resourceGroupName": autorest.Encode("path", resourceGroupName),
953 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
954 }
955
956 const APIVersion = "2021-06-15"
957 queryParameters := map[string]interface{}{
958 "api-version": APIVersion,
959 }
960
961 preparer := autorest.CreatePreparer(
962 autorest.AsGet(),
963 autorest.WithBaseURL(client.BaseURI),
964 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs", pathParameters),
965 autorest.WithQueryParameters(queryParameters))
966 return preparer.Prepare((&http.Request{}).WithContext(ctx))
967 }
968
969
970
971 func (client GremlinResourcesClient) ListGremlinGraphsSender(req *http.Request) (*http.Response, error) {
972 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
973 }
974
975
976
977 func (client GremlinResourcesClient) ListGremlinGraphsResponder(resp *http.Response) (result GremlinGraphListResult, err error) {
978 err = autorest.Respond(
979 resp,
980 azure.WithErrorUnlessStatusCode(http.StatusOK),
981 autorest.ByUnmarshallingJSON(&result),
982 autorest.ByClosing())
983 result.Response = autorest.Response{Response: resp}
984 return
985 }
986
987
988
989
990
991
992 func (client GremlinResourcesClient) MigrateGremlinDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture, err error) {
993 if tracing.IsEnabled() {
994 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.MigrateGremlinDatabaseToAutoscale")
995 defer func() {
996 sc := -1
997 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
998 sc = result.FutureAPI.Response().StatusCode
999 }
1000 tracing.EndSpan(ctx, sc, err)
1001 }()
1002 }
1003 if err := validation.Validate([]validation.Validation{
1004 {TargetValue: client.SubscriptionID,
1005 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
1006 {TargetValue: resourceGroupName,
1007 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
1008 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
1009 {TargetValue: accountName,
1010 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
1011 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
1012 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
1013 return result, validation.NewError("documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToAutoscale", err.Error())
1014 }
1015
1016 req, err := client.MigrateGremlinDatabaseToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName)
1017 if err != nil {
1018 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToAutoscale", nil, "Failure preparing request")
1019 return
1020 }
1021
1022 result, err = client.MigrateGremlinDatabaseToAutoscaleSender(req)
1023 if err != nil {
1024 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToAutoscale", result.Response(), "Failure sending request")
1025 return
1026 }
1027
1028 return
1029 }
1030
1031
1032 func (client GremlinResourcesClient) MigrateGremlinDatabaseToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) {
1033 pathParameters := map[string]interface{}{
1034 "accountName": autorest.Encode("path", accountName),
1035 "databaseName": autorest.Encode("path", databaseName),
1036 "resourceGroupName": autorest.Encode("path", resourceGroupName),
1037 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
1038 }
1039
1040 const APIVersion = "2021-06-15"
1041 queryParameters := map[string]interface{}{
1042 "api-version": APIVersion,
1043 }
1044
1045 preparer := autorest.CreatePreparer(
1046 autorest.AsPost(),
1047 autorest.WithBaseURL(client.BaseURI),
1048 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale", pathParameters),
1049 autorest.WithQueryParameters(queryParameters))
1050 return preparer.Prepare((&http.Request{}).WithContext(ctx))
1051 }
1052
1053
1054
1055 func (client GremlinResourcesClient) MigrateGremlinDatabaseToAutoscaleSender(req *http.Request) (future GremlinResourcesMigrateGremlinDatabaseToAutoscaleFuture, err error) {
1056 var resp *http.Response
1057 future.FutureAPI = &azure.Future{}
1058 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1059 if err != nil {
1060 return
1061 }
1062 var azf azure.Future
1063 azf, err = azure.NewFutureFromResponse(resp)
1064 future.FutureAPI = &azf
1065 future.Result = future.result
1066 return
1067 }
1068
1069
1070
1071 func (client GremlinResourcesClient) MigrateGremlinDatabaseToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
1072 err = autorest.Respond(
1073 resp,
1074 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1075 autorest.ByUnmarshallingJSON(&result),
1076 autorest.ByClosing())
1077 result.Response = autorest.Response{Response: resp}
1078 return
1079 }
1080
1081
1082
1083
1084
1085
1086
1087 func (client GremlinResourcesClient) MigrateGremlinDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture, err error) {
1088 if tracing.IsEnabled() {
1089 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.MigrateGremlinDatabaseToManualThroughput")
1090 defer func() {
1091 sc := -1
1092 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
1093 sc = result.FutureAPI.Response().StatusCode
1094 }
1095 tracing.EndSpan(ctx, sc, err)
1096 }()
1097 }
1098 if err := validation.Validate([]validation.Validation{
1099 {TargetValue: client.SubscriptionID,
1100 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
1101 {TargetValue: resourceGroupName,
1102 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
1103 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
1104 {TargetValue: accountName,
1105 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
1106 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
1107 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
1108 return result, validation.NewError("documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToManualThroughput", err.Error())
1109 }
1110
1111 req, err := client.MigrateGremlinDatabaseToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName)
1112 if err != nil {
1113 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToManualThroughput", nil, "Failure preparing request")
1114 return
1115 }
1116
1117 result, err = client.MigrateGremlinDatabaseToManualThroughputSender(req)
1118 if err != nil {
1119 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinDatabaseToManualThroughput", result.Response(), "Failure sending request")
1120 return
1121 }
1122
1123 return
1124 }
1125
1126
1127 func (client GremlinResourcesClient) MigrateGremlinDatabaseToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) {
1128 pathParameters := map[string]interface{}{
1129 "accountName": autorest.Encode("path", accountName),
1130 "databaseName": autorest.Encode("path", databaseName),
1131 "resourceGroupName": autorest.Encode("path", resourceGroupName),
1132 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
1133 }
1134
1135 const APIVersion = "2021-06-15"
1136 queryParameters := map[string]interface{}{
1137 "api-version": APIVersion,
1138 }
1139
1140 preparer := autorest.CreatePreparer(
1141 autorest.AsPost(),
1142 autorest.WithBaseURL(client.BaseURI),
1143 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput", pathParameters),
1144 autorest.WithQueryParameters(queryParameters))
1145 return preparer.Prepare((&http.Request{}).WithContext(ctx))
1146 }
1147
1148
1149
1150 func (client GremlinResourcesClient) MigrateGremlinDatabaseToManualThroughputSender(req *http.Request) (future GremlinResourcesMigrateGremlinDatabaseToManualThroughputFuture, err error) {
1151 var resp *http.Response
1152 future.FutureAPI = &azure.Future{}
1153 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1154 if err != nil {
1155 return
1156 }
1157 var azf azure.Future
1158 azf, err = azure.NewFutureFromResponse(resp)
1159 future.FutureAPI = &azf
1160 future.Result = future.result
1161 return
1162 }
1163
1164
1165
1166 func (client GremlinResourcesClient) MigrateGremlinDatabaseToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
1167 err = autorest.Respond(
1168 resp,
1169 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1170 autorest.ByUnmarshallingJSON(&result),
1171 autorest.ByClosing())
1172 result.Response = autorest.Response{Response: resp}
1173 return
1174 }
1175
1176
1177
1178
1179
1180
1181
1182 func (client GremlinResourcesClient) MigrateGremlinGraphToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinResourcesMigrateGremlinGraphToAutoscaleFuture, err error) {
1183 if tracing.IsEnabled() {
1184 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.MigrateGremlinGraphToAutoscale")
1185 defer func() {
1186 sc := -1
1187 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
1188 sc = result.FutureAPI.Response().StatusCode
1189 }
1190 tracing.EndSpan(ctx, sc, err)
1191 }()
1192 }
1193 if err := validation.Validate([]validation.Validation{
1194 {TargetValue: client.SubscriptionID,
1195 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
1196 {TargetValue: resourceGroupName,
1197 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
1198 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
1199 {TargetValue: accountName,
1200 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
1201 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
1202 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
1203 return result, validation.NewError("documentdb.GremlinResourcesClient", "MigrateGremlinGraphToAutoscale", err.Error())
1204 }
1205
1206 req, err := client.MigrateGremlinGraphToAutoscalePreparer(ctx, resourceGroupName, accountName, databaseName, graphName)
1207 if err != nil {
1208 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinGraphToAutoscale", nil, "Failure preparing request")
1209 return
1210 }
1211
1212 result, err = client.MigrateGremlinGraphToAutoscaleSender(req)
1213 if err != nil {
1214 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinGraphToAutoscale", result.Response(), "Failure sending request")
1215 return
1216 }
1217
1218 return
1219 }
1220
1221
1222 func (client GremlinResourcesClient) MigrateGremlinGraphToAutoscalePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) {
1223 pathParameters := map[string]interface{}{
1224 "accountName": autorest.Encode("path", accountName),
1225 "databaseName": autorest.Encode("path", databaseName),
1226 "graphName": autorest.Encode("path", graphName),
1227 "resourceGroupName": autorest.Encode("path", resourceGroupName),
1228 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
1229 }
1230
1231 const APIVersion = "2021-06-15"
1232 queryParameters := map[string]interface{}{
1233 "api-version": APIVersion,
1234 }
1235
1236 preparer := autorest.CreatePreparer(
1237 autorest.AsPost(),
1238 autorest.WithBaseURL(client.BaseURI),
1239 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToAutoscale", pathParameters),
1240 autorest.WithQueryParameters(queryParameters))
1241 return preparer.Prepare((&http.Request{}).WithContext(ctx))
1242 }
1243
1244
1245
1246 func (client GremlinResourcesClient) MigrateGremlinGraphToAutoscaleSender(req *http.Request) (future GremlinResourcesMigrateGremlinGraphToAutoscaleFuture, err error) {
1247 var resp *http.Response
1248 future.FutureAPI = &azure.Future{}
1249 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1250 if err != nil {
1251 return
1252 }
1253 var azf azure.Future
1254 azf, err = azure.NewFutureFromResponse(resp)
1255 future.FutureAPI = &azf
1256 future.Result = future.result
1257 return
1258 }
1259
1260
1261
1262 func (client GremlinResourcesClient) MigrateGremlinGraphToAutoscaleResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
1263 err = autorest.Respond(
1264 resp,
1265 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1266 autorest.ByUnmarshallingJSON(&result),
1267 autorest.ByClosing())
1268 result.Response = autorest.Response{Response: resp}
1269 return
1270 }
1271
1272
1273
1274
1275
1276
1277
1278 func (client GremlinResourcesClient) MigrateGremlinGraphToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinResourcesMigrateGremlinGraphToManualThroughputFuture, err error) {
1279 if tracing.IsEnabled() {
1280 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.MigrateGremlinGraphToManualThroughput")
1281 defer func() {
1282 sc := -1
1283 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
1284 sc = result.FutureAPI.Response().StatusCode
1285 }
1286 tracing.EndSpan(ctx, sc, err)
1287 }()
1288 }
1289 if err := validation.Validate([]validation.Validation{
1290 {TargetValue: client.SubscriptionID,
1291 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
1292 {TargetValue: resourceGroupName,
1293 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
1294 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
1295 {TargetValue: accountName,
1296 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
1297 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
1298 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
1299 return result, validation.NewError("documentdb.GremlinResourcesClient", "MigrateGremlinGraphToManualThroughput", err.Error())
1300 }
1301
1302 req, err := client.MigrateGremlinGraphToManualThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, graphName)
1303 if err != nil {
1304 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinGraphToManualThroughput", nil, "Failure preparing request")
1305 return
1306 }
1307
1308 result, err = client.MigrateGremlinGraphToManualThroughputSender(req)
1309 if err != nil {
1310 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "MigrateGremlinGraphToManualThroughput", result.Response(), "Failure sending request")
1311 return
1312 }
1313
1314 return
1315 }
1316
1317
1318 func (client GremlinResourcesClient) MigrateGremlinGraphToManualThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) {
1319 pathParameters := map[string]interface{}{
1320 "accountName": autorest.Encode("path", accountName),
1321 "databaseName": autorest.Encode("path", databaseName),
1322 "graphName": autorest.Encode("path", graphName),
1323 "resourceGroupName": autorest.Encode("path", resourceGroupName),
1324 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
1325 }
1326
1327 const APIVersion = "2021-06-15"
1328 queryParameters := map[string]interface{}{
1329 "api-version": APIVersion,
1330 }
1331
1332 preparer := autorest.CreatePreparer(
1333 autorest.AsPost(),
1334 autorest.WithBaseURL(client.BaseURI),
1335 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToManualThroughput", pathParameters),
1336 autorest.WithQueryParameters(queryParameters))
1337 return preparer.Prepare((&http.Request{}).WithContext(ctx))
1338 }
1339
1340
1341
1342 func (client GremlinResourcesClient) MigrateGremlinGraphToManualThroughputSender(req *http.Request) (future GremlinResourcesMigrateGremlinGraphToManualThroughputFuture, err error) {
1343 var resp *http.Response
1344 future.FutureAPI = &azure.Future{}
1345 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1346 if err != nil {
1347 return
1348 }
1349 var azf azure.Future
1350 azf, err = azure.NewFutureFromResponse(resp)
1351 future.FutureAPI = &azf
1352 future.Result = future.result
1353 return
1354 }
1355
1356
1357
1358 func (client GremlinResourcesClient) MigrateGremlinGraphToManualThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
1359 err = autorest.Respond(
1360 resp,
1361 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1362 autorest.ByUnmarshallingJSON(&result),
1363 autorest.ByClosing())
1364 result.Response = autorest.Response{Response: resp}
1365 return
1366 }
1367
1368
1369
1370
1371
1372
1373
1374
1375 func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result GremlinResourcesUpdateGremlinDatabaseThroughputFuture, err error) {
1376 if tracing.IsEnabled() {
1377 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.UpdateGremlinDatabaseThroughput")
1378 defer func() {
1379 sc := -1
1380 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
1381 sc = result.FutureAPI.Response().StatusCode
1382 }
1383 tracing.EndSpan(ctx, sc, err)
1384 }()
1385 }
1386 if err := validation.Validate([]validation.Validation{
1387 {TargetValue: client.SubscriptionID,
1388 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
1389 {TargetValue: resourceGroupName,
1390 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
1391 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
1392 {TargetValue: accountName,
1393 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
1394 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
1395 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}},
1396 {TargetValue: updateThroughputParameters,
1397 Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true,
1398 Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true,
1399 Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false,
1400 Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}},
1401 }},
1402 }}}}}); err != nil {
1403 return result, validation.NewError("documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", err.Error())
1404 }
1405
1406 req, err := client.UpdateGremlinDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters)
1407 if err != nil {
1408 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", nil, "Failure preparing request")
1409 return
1410 }
1411
1412 result, err = client.UpdateGremlinDatabaseThroughputSender(req)
1413 if err != nil {
1414 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", result.Response(), "Failure sending request")
1415 return
1416 }
1417
1418 return
1419 }
1420
1421
1422 func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) {
1423 pathParameters := map[string]interface{}{
1424 "accountName": autorest.Encode("path", accountName),
1425 "databaseName": autorest.Encode("path", databaseName),
1426 "resourceGroupName": autorest.Encode("path", resourceGroupName),
1427 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
1428 }
1429
1430 const APIVersion = "2021-06-15"
1431 queryParameters := map[string]interface{}{
1432 "api-version": APIVersion,
1433 }
1434
1435 preparer := autorest.CreatePreparer(
1436 autorest.AsContentType("application/json; charset=utf-8"),
1437 autorest.AsPut(),
1438 autorest.WithBaseURL(client.BaseURI),
1439 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default", pathParameters),
1440 autorest.WithJSON(updateThroughputParameters),
1441 autorest.WithQueryParameters(queryParameters))
1442 return preparer.Prepare((&http.Request{}).WithContext(ctx))
1443 }
1444
1445
1446
1447 func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputSender(req *http.Request) (future GremlinResourcesUpdateGremlinDatabaseThroughputFuture, err error) {
1448 var resp *http.Response
1449 future.FutureAPI = &azure.Future{}
1450 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1451 if err != nil {
1452 return
1453 }
1454 var azf azure.Future
1455 azf, err = azure.NewFutureFromResponse(resp)
1456 future.FutureAPI = &azf
1457 future.Result = future.result
1458 return
1459 }
1460
1461
1462
1463 func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
1464 err = autorest.Respond(
1465 resp,
1466 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1467 autorest.ByUnmarshallingJSON(&result),
1468 autorest.ByClosing())
1469 result.Response = autorest.Response{Response: resp}
1470 return
1471 }
1472
1473
1474
1475
1476
1477
1478
1479
1480 func (client GremlinResourcesClient) UpdateGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result GremlinResourcesUpdateGremlinGraphThroughputFuture, err error) {
1481 if tracing.IsEnabled() {
1482 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.UpdateGremlinGraphThroughput")
1483 defer func() {
1484 sc := -1
1485 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
1486 sc = result.FutureAPI.Response().StatusCode
1487 }
1488 tracing.EndSpan(ctx, sc, err)
1489 }()
1490 }
1491 if err := validation.Validate([]validation.Validation{
1492 {TargetValue: client.SubscriptionID,
1493 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
1494 {TargetValue: resourceGroupName,
1495 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
1496 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
1497 {TargetValue: accountName,
1498 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
1499 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
1500 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}},
1501 {TargetValue: updateThroughputParameters,
1502 Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true,
1503 Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true,
1504 Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings", Name: validation.Null, Rule: false,
1505 Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.AutoscaleSettings.MaxThroughput", Name: validation.Null, Rule: true, Chain: nil}}},
1506 }},
1507 }}}}}); err != nil {
1508 return result, validation.NewError("documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", err.Error())
1509 }
1510
1511 req, err := client.UpdateGremlinGraphThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters)
1512 if err != nil {
1513 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", nil, "Failure preparing request")
1514 return
1515 }
1516
1517 result, err = client.UpdateGremlinGraphThroughputSender(req)
1518 if err != nil {
1519 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", result.Response(), "Failure sending request")
1520 return
1521 }
1522
1523 return
1524 }
1525
1526
1527 func (client GremlinResourcesClient) UpdateGremlinGraphThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) {
1528 pathParameters := map[string]interface{}{
1529 "accountName": autorest.Encode("path", accountName),
1530 "databaseName": autorest.Encode("path", databaseName),
1531 "graphName": autorest.Encode("path", graphName),
1532 "resourceGroupName": autorest.Encode("path", resourceGroupName),
1533 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
1534 }
1535
1536 const APIVersion = "2021-06-15"
1537 queryParameters := map[string]interface{}{
1538 "api-version": APIVersion,
1539 }
1540
1541 preparer := autorest.CreatePreparer(
1542 autorest.AsContentType("application/json; charset=utf-8"),
1543 autorest.AsPut(),
1544 autorest.WithBaseURL(client.BaseURI),
1545 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default", pathParameters),
1546 autorest.WithJSON(updateThroughputParameters),
1547 autorest.WithQueryParameters(queryParameters))
1548 return preparer.Prepare((&http.Request{}).WithContext(ctx))
1549 }
1550
1551
1552
1553 func (client GremlinResourcesClient) UpdateGremlinGraphThroughputSender(req *http.Request) (future GremlinResourcesUpdateGremlinGraphThroughputFuture, err error) {
1554 var resp *http.Response
1555 future.FutureAPI = &azure.Future{}
1556 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1557 if err != nil {
1558 return
1559 }
1560 var azf azure.Future
1561 azf, err = azure.NewFutureFromResponse(resp)
1562 future.FutureAPI = &azf
1563 future.Result = future.result
1564 return
1565 }
1566
1567
1568
1569 func (client GremlinResourcesClient) UpdateGremlinGraphThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
1570 err = autorest.Respond(
1571 resp,
1572 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1573 autorest.ByUnmarshallingJSON(&result),
1574 autorest.ByClosing())
1575 result.Response = autorest.Response{Response: resp}
1576 return
1577 }
1578
View as plain text