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