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 {Target: "createUpdateGremlinDatabaseParameters.GremlinDatabaseCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil},
68 }}}}}); err != nil {
69 return result, validation.NewError("documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", err.Error())
70 }
71
72 req, err := client.CreateUpdateGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters)
73 if err != nil {
74 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", nil, "Failure preparing request")
75 return
76 }
77
78 result, err = client.CreateUpdateGremlinDatabaseSender(req)
79 if err != nil {
80 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinDatabase", result.Response(), "Failure sending request")
81 return
82 }
83
84 return
85 }
86
87
88 func (client GremlinResourcesClient) CreateUpdateGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters GremlinDatabaseCreateUpdateParameters) (*http.Request, error) {
89 pathParameters := map[string]interface{}{
90 "accountName": autorest.Encode("path", accountName),
91 "databaseName": autorest.Encode("path", databaseName),
92 "resourceGroupName": autorest.Encode("path", resourceGroupName),
93 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
94 }
95
96 const APIVersion = "2019-08-01"
97 queryParameters := map[string]interface{}{
98 "api-version": APIVersion,
99 }
100
101 preparer := autorest.CreatePreparer(
102 autorest.AsContentType("application/json; charset=utf-8"),
103 autorest.AsPut(),
104 autorest.WithBaseURL(client.BaseURI),
105 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters),
106 autorest.WithJSON(createUpdateGremlinDatabaseParameters),
107 autorest.WithQueryParameters(queryParameters))
108 return preparer.Prepare((&http.Request{}).WithContext(ctx))
109 }
110
111
112
113 func (client GremlinResourcesClient) CreateUpdateGremlinDatabaseSender(req *http.Request) (future GremlinResourcesCreateUpdateGremlinDatabaseFuture, err error) {
114 var resp *http.Response
115 future.FutureAPI = &azure.Future{}
116 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
117 if err != nil {
118 return
119 }
120 var azf azure.Future
121 azf, err = azure.NewFutureFromResponse(resp)
122 future.FutureAPI = &azf
123 future.Result = future.result
124 return
125 }
126
127
128
129 func (client GremlinResourcesClient) CreateUpdateGremlinDatabaseResponder(resp *http.Response) (result GremlinDatabaseGetResults, err error) {
130 err = autorest.Respond(
131 resp,
132 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
133 autorest.ByUnmarshallingJSON(&result),
134 autorest.ByClosing())
135 result.Response = autorest.Response{Response: resp}
136 return
137 }
138
139
140
141
142
143
144
145
146 func (client GremlinResourcesClient) CreateUpdateGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters GremlinGraphCreateUpdateParameters) (result GremlinResourcesCreateUpdateGremlinGraphFuture, err error) {
147 if tracing.IsEnabled() {
148 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.CreateUpdateGremlinGraph")
149 defer func() {
150 sc := -1
151 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
152 sc = result.FutureAPI.Response().StatusCode
153 }
154 tracing.EndSpan(ctx, sc, err)
155 }()
156 }
157 if err := validation.Validate([]validation.Validation{
158 {TargetValue: client.SubscriptionID,
159 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
160 {TargetValue: resourceGroupName,
161 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
162 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
163 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
164 {TargetValue: accountName,
165 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
166 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
167 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}},
168 {TargetValue: createUpdateGremlinGraphParameters,
169 Constraints: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties", Name: validation.Null, Rule: true,
170 Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource", Name: validation.Null, Rule: true,
171 Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.ID", Name: validation.Null, Rule: true, Chain: nil},
172 {Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey", Name: validation.Null, Rule: false,
173 Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.Null, Rule: false,
174 Chain: []validation.Constraint{{Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMaximum, Rule: int64(2), Chain: nil},
175 {Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Resource.PartitionKey.Version", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil},
176 }},
177 }},
178 }},
179 {Target: "createUpdateGremlinGraphParameters.GremlinGraphCreateUpdateProperties.Options", Name: validation.Null, Rule: true, Chain: nil},
180 }}}}}); err != nil {
181 return result, validation.NewError("documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", err.Error())
182 }
183
184 req, err := client.CreateUpdateGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters)
185 if err != nil {
186 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", nil, "Failure preparing request")
187 return
188 }
189
190 result, err = client.CreateUpdateGremlinGraphSender(req)
191 if err != nil {
192 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "CreateUpdateGremlinGraph", result.Response(), "Failure sending request")
193 return
194 }
195
196 return
197 }
198
199
200 func (client GremlinResourcesClient) CreateUpdateGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters GremlinGraphCreateUpdateParameters) (*http.Request, error) {
201 pathParameters := map[string]interface{}{
202 "accountName": autorest.Encode("path", accountName),
203 "databaseName": autorest.Encode("path", databaseName),
204 "graphName": autorest.Encode("path", graphName),
205 "resourceGroupName": autorest.Encode("path", resourceGroupName),
206 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
207 }
208
209 const APIVersion = "2019-08-01"
210 queryParameters := map[string]interface{}{
211 "api-version": APIVersion,
212 }
213
214 preparer := autorest.CreatePreparer(
215 autorest.AsContentType("application/json; charset=utf-8"),
216 autorest.AsPut(),
217 autorest.WithBaseURL(client.BaseURI),
218 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters),
219 autorest.WithJSON(createUpdateGremlinGraphParameters),
220 autorest.WithQueryParameters(queryParameters))
221 return preparer.Prepare((&http.Request{}).WithContext(ctx))
222 }
223
224
225
226 func (client GremlinResourcesClient) CreateUpdateGremlinGraphSender(req *http.Request) (future GremlinResourcesCreateUpdateGremlinGraphFuture, err error) {
227 var resp *http.Response
228 future.FutureAPI = &azure.Future{}
229 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
230 if err != nil {
231 return
232 }
233 var azf azure.Future
234 azf, err = azure.NewFutureFromResponse(resp)
235 future.FutureAPI = &azf
236 future.Result = future.result
237 return
238 }
239
240
241
242 func (client GremlinResourcesClient) CreateUpdateGremlinGraphResponder(resp *http.Response) (result GremlinGraphGetResults, err error) {
243 err = autorest.Respond(
244 resp,
245 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
246 autorest.ByUnmarshallingJSON(&result),
247 autorest.ByClosing())
248 result.Response = autorest.Response{Response: resp}
249 return
250 }
251
252
253
254
255
256
257 func (client GremlinResourcesClient) DeleteGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinResourcesDeleteGremlinDatabaseFuture, err error) {
258 if tracing.IsEnabled() {
259 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.DeleteGremlinDatabase")
260 defer func() {
261 sc := -1
262 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
263 sc = result.FutureAPI.Response().StatusCode
264 }
265 tracing.EndSpan(ctx, sc, err)
266 }()
267 }
268 if err := validation.Validate([]validation.Validation{
269 {TargetValue: client.SubscriptionID,
270 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
271 {TargetValue: resourceGroupName,
272 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
273 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
274 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
275 {TargetValue: accountName,
276 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
277 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
278 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
279 return result, validation.NewError("documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", err.Error())
280 }
281
282 req, err := client.DeleteGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName)
283 if err != nil {
284 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", nil, "Failure preparing request")
285 return
286 }
287
288 result, err = client.DeleteGremlinDatabaseSender(req)
289 if err != nil {
290 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinDatabase", result.Response(), "Failure sending request")
291 return
292 }
293
294 return
295 }
296
297
298 func (client GremlinResourcesClient) DeleteGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) {
299 pathParameters := map[string]interface{}{
300 "accountName": autorest.Encode("path", accountName),
301 "databaseName": autorest.Encode("path", databaseName),
302 "resourceGroupName": autorest.Encode("path", resourceGroupName),
303 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
304 }
305
306 const APIVersion = "2019-08-01"
307 queryParameters := map[string]interface{}{
308 "api-version": APIVersion,
309 }
310
311 preparer := autorest.CreatePreparer(
312 autorest.AsDelete(),
313 autorest.WithBaseURL(client.BaseURI),
314 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters),
315 autorest.WithQueryParameters(queryParameters))
316 return preparer.Prepare((&http.Request{}).WithContext(ctx))
317 }
318
319
320
321 func (client GremlinResourcesClient) DeleteGremlinDatabaseSender(req *http.Request) (future GremlinResourcesDeleteGremlinDatabaseFuture, err error) {
322 var resp *http.Response
323 future.FutureAPI = &azure.Future{}
324 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
325 if err != nil {
326 return
327 }
328 var azf azure.Future
329 azf, err = azure.NewFutureFromResponse(resp)
330 future.FutureAPI = &azf
331 future.Result = future.result
332 return
333 }
334
335
336
337 func (client GremlinResourcesClient) DeleteGremlinDatabaseResponder(resp *http.Response) (result autorest.Response, err error) {
338 err = autorest.Respond(
339 resp,
340 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
341 autorest.ByClosing())
342 result.Response = resp
343 return
344 }
345
346
347
348
349
350
351
352 func (client GremlinResourcesClient) DeleteGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinResourcesDeleteGremlinGraphFuture, err error) {
353 if tracing.IsEnabled() {
354 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.DeleteGremlinGraph")
355 defer func() {
356 sc := -1
357 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
358 sc = result.FutureAPI.Response().StatusCode
359 }
360 tracing.EndSpan(ctx, sc, err)
361 }()
362 }
363 if err := validation.Validate([]validation.Validation{
364 {TargetValue: client.SubscriptionID,
365 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
366 {TargetValue: resourceGroupName,
367 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
368 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
369 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
370 {TargetValue: accountName,
371 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
372 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
373 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
374 return result, validation.NewError("documentdb.GremlinResourcesClient", "DeleteGremlinGraph", err.Error())
375 }
376
377 req, err := client.DeleteGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName)
378 if err != nil {
379 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinGraph", nil, "Failure preparing request")
380 return
381 }
382
383 result, err = client.DeleteGremlinGraphSender(req)
384 if err != nil {
385 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "DeleteGremlinGraph", result.Response(), "Failure sending request")
386 return
387 }
388
389 return
390 }
391
392
393 func (client GremlinResourcesClient) DeleteGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) {
394 pathParameters := map[string]interface{}{
395 "accountName": autorest.Encode("path", accountName),
396 "databaseName": autorest.Encode("path", databaseName),
397 "graphName": autorest.Encode("path", graphName),
398 "resourceGroupName": autorest.Encode("path", resourceGroupName),
399 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
400 }
401
402 const APIVersion = "2019-08-01"
403 queryParameters := map[string]interface{}{
404 "api-version": APIVersion,
405 }
406
407 preparer := autorest.CreatePreparer(
408 autorest.AsDelete(),
409 autorest.WithBaseURL(client.BaseURI),
410 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters),
411 autorest.WithQueryParameters(queryParameters))
412 return preparer.Prepare((&http.Request{}).WithContext(ctx))
413 }
414
415
416
417 func (client GremlinResourcesClient) DeleteGremlinGraphSender(req *http.Request) (future GremlinResourcesDeleteGremlinGraphFuture, err error) {
418 var resp *http.Response
419 future.FutureAPI = &azure.Future{}
420 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
421 if err != nil {
422 return
423 }
424 var azf azure.Future
425 azf, err = azure.NewFutureFromResponse(resp)
426 future.FutureAPI = &azf
427 future.Result = future.result
428 return
429 }
430
431
432
433 func (client GremlinResourcesClient) DeleteGremlinGraphResponder(resp *http.Response) (result autorest.Response, err error) {
434 err = autorest.Respond(
435 resp,
436 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
437 autorest.ByClosing())
438 result.Response = resp
439 return
440 }
441
442
443
444
445
446
447
448 func (client GremlinResourcesClient) GetGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinDatabaseGetResults, err error) {
449 if tracing.IsEnabled() {
450 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinDatabase")
451 defer func() {
452 sc := -1
453 if result.Response.Response != nil {
454 sc = result.Response.Response.StatusCode
455 }
456 tracing.EndSpan(ctx, sc, err)
457 }()
458 }
459 if err := validation.Validate([]validation.Validation{
460 {TargetValue: client.SubscriptionID,
461 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
462 {TargetValue: resourceGroupName,
463 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
464 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
465 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
466 {TargetValue: accountName,
467 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
468 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
469 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
470 return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinDatabase", err.Error())
471 }
472
473 req, err := client.GetGremlinDatabasePreparer(ctx, resourceGroupName, accountName, databaseName)
474 if err != nil {
475 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", nil, "Failure preparing request")
476 return
477 }
478
479 resp, err := client.GetGremlinDatabaseSender(req)
480 if err != nil {
481 result.Response = autorest.Response{Response: resp}
482 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", resp, "Failure sending request")
483 return
484 }
485
486 result, err = client.GetGremlinDatabaseResponder(resp)
487 if err != nil {
488 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabase", resp, "Failure responding to request")
489 return
490 }
491
492 return
493 }
494
495
496 func (client GremlinResourcesClient) GetGremlinDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) {
497 pathParameters := map[string]interface{}{
498 "accountName": autorest.Encode("path", accountName),
499 "databaseName": autorest.Encode("path", databaseName),
500 "resourceGroupName": autorest.Encode("path", resourceGroupName),
501 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
502 }
503
504 const APIVersion = "2019-08-01"
505 queryParameters := map[string]interface{}{
506 "api-version": APIVersion,
507 }
508
509 preparer := autorest.CreatePreparer(
510 autorest.AsGet(),
511 autorest.WithBaseURL(client.BaseURI),
512 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", pathParameters),
513 autorest.WithQueryParameters(queryParameters))
514 return preparer.Prepare((&http.Request{}).WithContext(ctx))
515 }
516
517
518
519 func (client GremlinResourcesClient) GetGremlinDatabaseSender(req *http.Request) (*http.Response, error) {
520 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
521 }
522
523
524
525 func (client GremlinResourcesClient) GetGremlinDatabaseResponder(resp *http.Response) (result GremlinDatabaseGetResults, err error) {
526 err = autorest.Respond(
527 resp,
528 azure.WithErrorUnlessStatusCode(http.StatusOK),
529 autorest.ByUnmarshallingJSON(&result),
530 autorest.ByClosing())
531 result.Response = autorest.Response{Response: resp}
532 return
533 }
534
535
536
537
538
539
540
541 func (client GremlinResourcesClient) GetGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) {
542 if tracing.IsEnabled() {
543 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinDatabaseThroughput")
544 defer func() {
545 sc := -1
546 if result.Response.Response != nil {
547 sc = result.Response.Response.StatusCode
548 }
549 tracing.EndSpan(ctx, sc, err)
550 }()
551 }
552 if err := validation.Validate([]validation.Validation{
553 {TargetValue: client.SubscriptionID,
554 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
555 {TargetValue: resourceGroupName,
556 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
557 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
558 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
559 {TargetValue: accountName,
560 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
561 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
562 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
563 return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", err.Error())
564 }
565
566 req, err := client.GetGremlinDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName)
567 if err != nil {
568 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", nil, "Failure preparing request")
569 return
570 }
571
572 resp, err := client.GetGremlinDatabaseThroughputSender(req)
573 if err != nil {
574 result.Response = autorest.Response{Response: resp}
575 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", resp, "Failure sending request")
576 return
577 }
578
579 result, err = client.GetGremlinDatabaseThroughputResponder(resp)
580 if err != nil {
581 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinDatabaseThroughput", resp, "Failure responding to request")
582 return
583 }
584
585 return
586 }
587
588
589 func (client GremlinResourcesClient) GetGremlinDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) {
590 pathParameters := map[string]interface{}{
591 "accountName": autorest.Encode("path", accountName),
592 "databaseName": autorest.Encode("path", databaseName),
593 "resourceGroupName": autorest.Encode("path", resourceGroupName),
594 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
595 }
596
597 const APIVersion = "2019-08-01"
598 queryParameters := map[string]interface{}{
599 "api-version": APIVersion,
600 }
601
602 preparer := autorest.CreatePreparer(
603 autorest.AsGet(),
604 autorest.WithBaseURL(client.BaseURI),
605 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default", pathParameters),
606 autorest.WithQueryParameters(queryParameters))
607 return preparer.Prepare((&http.Request{}).WithContext(ctx))
608 }
609
610
611
612 func (client GremlinResourcesClient) GetGremlinDatabaseThroughputSender(req *http.Request) (*http.Response, error) {
613 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
614 }
615
616
617
618 func (client GremlinResourcesClient) GetGremlinDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
619 err = autorest.Respond(
620 resp,
621 azure.WithErrorUnlessStatusCode(http.StatusOK),
622 autorest.ByUnmarshallingJSON(&result),
623 autorest.ByClosing())
624 result.Response = autorest.Response{Response: resp}
625 return
626 }
627
628
629
630
631
632
633
634 func (client GremlinResourcesClient) GetGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result GremlinGraphGetResults, err error) {
635 if tracing.IsEnabled() {
636 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinGraph")
637 defer func() {
638 sc := -1
639 if result.Response.Response != nil {
640 sc = result.Response.Response.StatusCode
641 }
642 tracing.EndSpan(ctx, sc, err)
643 }()
644 }
645 if err := validation.Validate([]validation.Validation{
646 {TargetValue: client.SubscriptionID,
647 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
648 {TargetValue: resourceGroupName,
649 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
650 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
651 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
652 {TargetValue: accountName,
653 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
654 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
655 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
656 return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinGraph", err.Error())
657 }
658
659 req, err := client.GetGremlinGraphPreparer(ctx, resourceGroupName, accountName, databaseName, graphName)
660 if err != nil {
661 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", nil, "Failure preparing request")
662 return
663 }
664
665 resp, err := client.GetGremlinGraphSender(req)
666 if err != nil {
667 result.Response = autorest.Response{Response: resp}
668 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", resp, "Failure sending request")
669 return
670 }
671
672 result, err = client.GetGremlinGraphResponder(resp)
673 if err != nil {
674 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraph", resp, "Failure responding to request")
675 return
676 }
677
678 return
679 }
680
681
682 func (client GremlinResourcesClient) GetGremlinGraphPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) {
683 pathParameters := map[string]interface{}{
684 "accountName": autorest.Encode("path", accountName),
685 "databaseName": autorest.Encode("path", databaseName),
686 "graphName": autorest.Encode("path", graphName),
687 "resourceGroupName": autorest.Encode("path", resourceGroupName),
688 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
689 }
690
691 const APIVersion = "2019-08-01"
692 queryParameters := map[string]interface{}{
693 "api-version": APIVersion,
694 }
695
696 preparer := autorest.CreatePreparer(
697 autorest.AsGet(),
698 autorest.WithBaseURL(client.BaseURI),
699 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", pathParameters),
700 autorest.WithQueryParameters(queryParameters))
701 return preparer.Prepare((&http.Request{}).WithContext(ctx))
702 }
703
704
705
706 func (client GremlinResourcesClient) GetGremlinGraphSender(req *http.Request) (*http.Response, error) {
707 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
708 }
709
710
711
712 func (client GremlinResourcesClient) GetGremlinGraphResponder(resp *http.Response) (result GremlinGraphGetResults, err error) {
713 err = autorest.Respond(
714 resp,
715 azure.WithErrorUnlessStatusCode(http.StatusOK),
716 autorest.ByUnmarshallingJSON(&result),
717 autorest.ByClosing())
718 result.Response = autorest.Response{Response: resp}
719 return
720 }
721
722
723
724
725
726
727
728
729 func (client GremlinResourcesClient) GetGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (result ThroughputSettingsGetResults, err error) {
730 if tracing.IsEnabled() {
731 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.GetGremlinGraphThroughput")
732 defer func() {
733 sc := -1
734 if result.Response.Response != nil {
735 sc = result.Response.Response.StatusCode
736 }
737 tracing.EndSpan(ctx, sc, err)
738 }()
739 }
740 if err := validation.Validate([]validation.Validation{
741 {TargetValue: client.SubscriptionID,
742 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
743 {TargetValue: resourceGroupName,
744 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
745 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
746 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
747 {TargetValue: accountName,
748 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
749 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
750 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
751 return result, validation.NewError("documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", err.Error())
752 }
753
754 req, err := client.GetGremlinGraphThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, graphName)
755 if err != nil {
756 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", nil, "Failure preparing request")
757 return
758 }
759
760 resp, err := client.GetGremlinGraphThroughputSender(req)
761 if err != nil {
762 result.Response = autorest.Response{Response: resp}
763 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", resp, "Failure sending request")
764 return
765 }
766
767 result, err = client.GetGremlinGraphThroughputResponder(resp)
768 if err != nil {
769 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "GetGremlinGraphThroughput", resp, "Failure responding to request")
770 return
771 }
772
773 return
774 }
775
776
777 func (client GremlinResourcesClient) GetGremlinGraphThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string) (*http.Request, error) {
778 pathParameters := map[string]interface{}{
779 "accountName": autorest.Encode("path", accountName),
780 "databaseName": autorest.Encode("path", databaseName),
781 "graphName": autorest.Encode("path", graphName),
782 "resourceGroupName": autorest.Encode("path", resourceGroupName),
783 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
784 }
785
786 const APIVersion = "2019-08-01"
787 queryParameters := map[string]interface{}{
788 "api-version": APIVersion,
789 }
790
791 preparer := autorest.CreatePreparer(
792 autorest.AsGet(),
793 autorest.WithBaseURL(client.BaseURI),
794 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default", pathParameters),
795 autorest.WithQueryParameters(queryParameters))
796 return preparer.Prepare((&http.Request{}).WithContext(ctx))
797 }
798
799
800
801 func (client GremlinResourcesClient) GetGremlinGraphThroughputSender(req *http.Request) (*http.Response, error) {
802 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
803 }
804
805
806
807 func (client GremlinResourcesClient) GetGremlinGraphThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
808 err = autorest.Respond(
809 resp,
810 azure.WithErrorUnlessStatusCode(http.StatusOK),
811 autorest.ByUnmarshallingJSON(&result),
812 autorest.ByClosing())
813 result.Response = autorest.Response{Response: resp}
814 return
815 }
816
817
818
819
820
821 func (client GremlinResourcesClient) ListGremlinDatabases(ctx context.Context, resourceGroupName string, accountName string) (result GremlinDatabaseListResult, err error) {
822 if tracing.IsEnabled() {
823 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.ListGremlinDatabases")
824 defer func() {
825 sc := -1
826 if result.Response.Response != nil {
827 sc = result.Response.Response.StatusCode
828 }
829 tracing.EndSpan(ctx, sc, err)
830 }()
831 }
832 if err := validation.Validate([]validation.Validation{
833 {TargetValue: client.SubscriptionID,
834 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
835 {TargetValue: resourceGroupName,
836 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
837 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
838 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
839 {TargetValue: accountName,
840 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
841 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
842 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
843 return result, validation.NewError("documentdb.GremlinResourcesClient", "ListGremlinDatabases", err.Error())
844 }
845
846 req, err := client.ListGremlinDatabasesPreparer(ctx, resourceGroupName, accountName)
847 if err != nil {
848 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", nil, "Failure preparing request")
849 return
850 }
851
852 resp, err := client.ListGremlinDatabasesSender(req)
853 if err != nil {
854 result.Response = autorest.Response{Response: resp}
855 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", resp, "Failure sending request")
856 return
857 }
858
859 result, err = client.ListGremlinDatabasesResponder(resp)
860 if err != nil {
861 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinDatabases", resp, "Failure responding to request")
862 return
863 }
864
865 return
866 }
867
868
869 func (client GremlinResourcesClient) ListGremlinDatabasesPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) {
870 pathParameters := map[string]interface{}{
871 "accountName": autorest.Encode("path", accountName),
872 "resourceGroupName": autorest.Encode("path", resourceGroupName),
873 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
874 }
875
876 const APIVersion = "2019-08-01"
877 queryParameters := map[string]interface{}{
878 "api-version": APIVersion,
879 }
880
881 preparer := autorest.CreatePreparer(
882 autorest.AsGet(),
883 autorest.WithBaseURL(client.BaseURI),
884 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases", pathParameters),
885 autorest.WithQueryParameters(queryParameters))
886 return preparer.Prepare((&http.Request{}).WithContext(ctx))
887 }
888
889
890
891 func (client GremlinResourcesClient) ListGremlinDatabasesSender(req *http.Request) (*http.Response, error) {
892 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
893 }
894
895
896
897 func (client GremlinResourcesClient) ListGremlinDatabasesResponder(resp *http.Response) (result GremlinDatabaseListResult, err error) {
898 err = autorest.Respond(
899 resp,
900 azure.WithErrorUnlessStatusCode(http.StatusOK),
901 autorest.ByUnmarshallingJSON(&result),
902 autorest.ByClosing())
903 result.Response = autorest.Response{Response: resp}
904 return
905 }
906
907
908
909
910
911
912 func (client GremlinResourcesClient) ListGremlinGraphs(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result GremlinGraphListResult, err error) {
913 if tracing.IsEnabled() {
914 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.ListGremlinGraphs")
915 defer func() {
916 sc := -1
917 if result.Response.Response != nil {
918 sc = result.Response.Response.StatusCode
919 }
920 tracing.EndSpan(ctx, sc, err)
921 }()
922 }
923 if err := validation.Validate([]validation.Validation{
924 {TargetValue: client.SubscriptionID,
925 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
926 {TargetValue: resourceGroupName,
927 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
928 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
929 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
930 {TargetValue: accountName,
931 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
932 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
933 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil {
934 return result, validation.NewError("documentdb.GremlinResourcesClient", "ListGremlinGraphs", err.Error())
935 }
936
937 req, err := client.ListGremlinGraphsPreparer(ctx, resourceGroupName, accountName, databaseName)
938 if err != nil {
939 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", nil, "Failure preparing request")
940 return
941 }
942
943 resp, err := client.ListGremlinGraphsSender(req)
944 if err != nil {
945 result.Response = autorest.Response{Response: resp}
946 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", resp, "Failure sending request")
947 return
948 }
949
950 result, err = client.ListGremlinGraphsResponder(resp)
951 if err != nil {
952 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "ListGremlinGraphs", resp, "Failure responding to request")
953 return
954 }
955
956 return
957 }
958
959
960 func (client GremlinResourcesClient) ListGremlinGraphsPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) {
961 pathParameters := map[string]interface{}{
962 "accountName": autorest.Encode("path", accountName),
963 "databaseName": autorest.Encode("path", databaseName),
964 "resourceGroupName": autorest.Encode("path", resourceGroupName),
965 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
966 }
967
968 const APIVersion = "2019-08-01"
969 queryParameters := map[string]interface{}{
970 "api-version": APIVersion,
971 }
972
973 preparer := autorest.CreatePreparer(
974 autorest.AsGet(),
975 autorest.WithBaseURL(client.BaseURI),
976 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs", pathParameters),
977 autorest.WithQueryParameters(queryParameters))
978 return preparer.Prepare((&http.Request{}).WithContext(ctx))
979 }
980
981
982
983 func (client GremlinResourcesClient) ListGremlinGraphsSender(req *http.Request) (*http.Response, error) {
984 return client.Send(req, azure.DoRetryWithRegistration(client.Client))
985 }
986
987
988
989 func (client GremlinResourcesClient) ListGremlinGraphsResponder(resp *http.Response) (result GremlinGraphListResult, err error) {
990 err = autorest.Respond(
991 resp,
992 azure.WithErrorUnlessStatusCode(http.StatusOK),
993 autorest.ByUnmarshallingJSON(&result),
994 autorest.ByClosing())
995 result.Response = autorest.Response{Response: resp}
996 return
997 }
998
999
1000
1001
1002
1003
1004
1005
1006 func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result GremlinResourcesUpdateGremlinDatabaseThroughputFuture, err error) {
1007 if tracing.IsEnabled() {
1008 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.UpdateGremlinDatabaseThroughput")
1009 defer func() {
1010 sc := -1
1011 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
1012 sc = result.FutureAPI.Response().StatusCode
1013 }
1014 tracing.EndSpan(ctx, sc, err)
1015 }()
1016 }
1017 if err := validation.Validate([]validation.Validation{
1018 {TargetValue: client.SubscriptionID,
1019 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
1020 {TargetValue: resourceGroupName,
1021 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
1022 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
1023 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
1024 {TargetValue: accountName,
1025 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
1026 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
1027 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}},
1028 {TargetValue: updateThroughputParameters,
1029 Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true,
1030 Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true,
1031 Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.Throughput", Name: validation.Null, Rule: true, Chain: nil}}},
1032 }}}}}); err != nil {
1033 return result, validation.NewError("documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", err.Error())
1034 }
1035
1036 req, err := client.UpdateGremlinDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters)
1037 if err != nil {
1038 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", nil, "Failure preparing request")
1039 return
1040 }
1041
1042 result, err = client.UpdateGremlinDatabaseThroughputSender(req)
1043 if err != nil {
1044 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinDatabaseThroughput", result.Response(), "Failure sending request")
1045 return
1046 }
1047
1048 return
1049 }
1050
1051
1052 func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) {
1053 pathParameters := map[string]interface{}{
1054 "accountName": autorest.Encode("path", accountName),
1055 "databaseName": autorest.Encode("path", databaseName),
1056 "resourceGroupName": autorest.Encode("path", resourceGroupName),
1057 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
1058 }
1059
1060 const APIVersion = "2019-08-01"
1061 queryParameters := map[string]interface{}{
1062 "api-version": APIVersion,
1063 }
1064
1065 preparer := autorest.CreatePreparer(
1066 autorest.AsContentType("application/json; charset=utf-8"),
1067 autorest.AsPut(),
1068 autorest.WithBaseURL(client.BaseURI),
1069 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default", pathParameters),
1070 autorest.WithJSON(updateThroughputParameters),
1071 autorest.WithQueryParameters(queryParameters))
1072 return preparer.Prepare((&http.Request{}).WithContext(ctx))
1073 }
1074
1075
1076
1077 func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputSender(req *http.Request) (future GremlinResourcesUpdateGremlinDatabaseThroughputFuture, err error) {
1078 var resp *http.Response
1079 future.FutureAPI = &azure.Future{}
1080 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1081 if err != nil {
1082 return
1083 }
1084 var azf azure.Future
1085 azf, err = azure.NewFutureFromResponse(resp)
1086 future.FutureAPI = &azf
1087 future.Result = future.result
1088 return
1089 }
1090
1091
1092
1093 func (client GremlinResourcesClient) UpdateGremlinDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
1094 err = autorest.Respond(
1095 resp,
1096 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1097 autorest.ByUnmarshallingJSON(&result),
1098 autorest.ByClosing())
1099 result.Response = autorest.Response{Response: resp}
1100 return
1101 }
1102
1103
1104
1105
1106
1107
1108
1109
1110 func (client GremlinResourcesClient) UpdateGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (result GremlinResourcesUpdateGremlinGraphThroughputFuture, err error) {
1111 if tracing.IsEnabled() {
1112 ctx = tracing.StartSpan(ctx, fqdn+"/GremlinResourcesClient.UpdateGremlinGraphThroughput")
1113 defer func() {
1114 sc := -1
1115 if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
1116 sc = result.FutureAPI.Response().StatusCode
1117 }
1118 tracing.EndSpan(ctx, sc, err)
1119 }()
1120 }
1121 if err := validation.Validate([]validation.Validation{
1122 {TargetValue: client.SubscriptionID,
1123 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
1124 {TargetValue: resourceGroupName,
1125 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
1126 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
1127 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
1128 {TargetValue: accountName,
1129 Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil},
1130 {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil},
1131 {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}},
1132 {TargetValue: updateThroughputParameters,
1133 Constraints: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties", Name: validation.Null, Rule: true,
1134 Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource", Name: validation.Null, Rule: true,
1135 Chain: []validation.Constraint{{Target: "updateThroughputParameters.ThroughputSettingsUpdateProperties.Resource.Throughput", Name: validation.Null, Rule: true, Chain: nil}}},
1136 }}}}}); err != nil {
1137 return result, validation.NewError("documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", err.Error())
1138 }
1139
1140 req, err := client.UpdateGremlinGraphThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters)
1141 if err != nil {
1142 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", nil, "Failure preparing request")
1143 return
1144 }
1145
1146 result, err = client.UpdateGremlinGraphThroughputSender(req)
1147 if err != nil {
1148 err = autorest.NewErrorWithError(err, "documentdb.GremlinResourcesClient", "UpdateGremlinGraphThroughput", result.Response(), "Failure sending request")
1149 return
1150 }
1151
1152 return
1153 }
1154
1155
1156 func (client GremlinResourcesClient) UpdateGremlinGraphThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters ThroughputSettingsUpdateParameters) (*http.Request, error) {
1157 pathParameters := map[string]interface{}{
1158 "accountName": autorest.Encode("path", accountName),
1159 "databaseName": autorest.Encode("path", databaseName),
1160 "graphName": autorest.Encode("path", graphName),
1161 "resourceGroupName": autorest.Encode("path", resourceGroupName),
1162 "subscriptionId": autorest.Encode("path", client.SubscriptionID),
1163 }
1164
1165 const APIVersion = "2019-08-01"
1166 queryParameters := map[string]interface{}{
1167 "api-version": APIVersion,
1168 }
1169
1170 preparer := autorest.CreatePreparer(
1171 autorest.AsContentType("application/json; charset=utf-8"),
1172 autorest.AsPut(),
1173 autorest.WithBaseURL(client.BaseURI),
1174 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default", pathParameters),
1175 autorest.WithJSON(updateThroughputParameters),
1176 autorest.WithQueryParameters(queryParameters))
1177 return preparer.Prepare((&http.Request{}).WithContext(ctx))
1178 }
1179
1180
1181
1182 func (client GremlinResourcesClient) UpdateGremlinGraphThroughputSender(req *http.Request) (future GremlinResourcesUpdateGremlinGraphThroughputFuture, err error) {
1183 var resp *http.Response
1184 future.FutureAPI = &azure.Future{}
1185 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1186 if err != nil {
1187 return
1188 }
1189 var azf azure.Future
1190 azf, err = azure.NewFutureFromResponse(resp)
1191 future.FutureAPI = &azf
1192 future.Result = future.result
1193 return
1194 }
1195
1196
1197
1198 func (client GremlinResourcesClient) UpdateGremlinGraphThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) {
1199 err = autorest.Respond(
1200 resp,
1201 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1202 autorest.ByUnmarshallingJSON(&result),
1203 autorest.ByClosing())
1204 result.Response = autorest.Response{Response: resp}
1205 return
1206 }
1207
View as plain text