1package databox
2
3// Copyright (c) Microsoft Corporation. All rights reserved.
4// Licensed under the MIT License. See License.txt in the project root for license information.
5//
6// Code generated by Microsoft (R) AutoRest Code Generator.
7// Changes may cause incorrect behavior and will be lost if the code is regenerated.
8
9import (
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// ServiceClient is the client for the Service methods of the Databox service.
19type ServiceClient struct {
20	BaseClient
21}
22
23// NewServiceClient creates an instance of the ServiceClient client.
24func NewServiceClient(subscriptionID string) ServiceClient {
25	return NewServiceClientWithBaseURI(DefaultBaseURI, subscriptionID)
26}
27
28// NewServiceClientWithBaseURI creates an instance of the ServiceClient client using a custom endpoint.  Use this when
29// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
30func NewServiceClientWithBaseURI(baseURI string, subscriptionID string) ServiceClient {
31	return ServiceClient{NewWithBaseURI(baseURI, subscriptionID)}
32}
33
34// ListAvailableSkusByResourceGroup this method provides the list of available skus for the given subscription,
35// resource group and location.
36// Parameters:
37// resourceGroupName - the Resource Group Name
38// location - the location of the resource
39// availableSkuRequest - filters for showing the available skus.
40func (client ServiceClient) ListAvailableSkusByResourceGroup(ctx context.Context, resourceGroupName string, location string, availableSkuRequest AvailableSkuRequest) (result AvailableSkusResultPage, err error) {
41	if tracing.IsEnabled() {
42		ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.ListAvailableSkusByResourceGroup")
43		defer func() {
44			sc := -1
45			if result.asr.Response.Response != nil {
46				sc = result.asr.Response.Response.StatusCode
47			}
48			tracing.EndSpan(ctx, sc, err)
49		}()
50	}
51	if err := validation.Validate([]validation.Validation{
52		{TargetValue: availableSkuRequest,
53			Constraints: []validation.Constraint{{Target: "availableSkuRequest.Country", Name: validation.Null, Rule: true, Chain: nil},
54				{Target: "availableSkuRequest.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
55		return result, validation.NewError("databox.ServiceClient", "ListAvailableSkusByResourceGroup", err.Error())
56	}
57
58	result.fn = client.listAvailableSkusByResourceGroupNextResults
59	req, err := client.ListAvailableSkusByResourceGroupPreparer(ctx, resourceGroupName, location, availableSkuRequest)
60	if err != nil {
61		err = autorest.NewErrorWithError(err, "databox.ServiceClient", "ListAvailableSkusByResourceGroup", nil, "Failure preparing request")
62		return
63	}
64
65	resp, err := client.ListAvailableSkusByResourceGroupSender(req)
66	if err != nil {
67		result.asr.Response = autorest.Response{Response: resp}
68		err = autorest.NewErrorWithError(err, "databox.ServiceClient", "ListAvailableSkusByResourceGroup", resp, "Failure sending request")
69		return
70	}
71
72	result.asr, err = client.ListAvailableSkusByResourceGroupResponder(resp)
73	if err != nil {
74		err = autorest.NewErrorWithError(err, "databox.ServiceClient", "ListAvailableSkusByResourceGroup", resp, "Failure responding to request")
75		return
76	}
77	if result.asr.hasNextLink() && result.asr.IsEmpty() {
78		err = result.NextWithContext(ctx)
79		return
80	}
81
82	return
83}
84
85// ListAvailableSkusByResourceGroupPreparer prepares the ListAvailableSkusByResourceGroup request.
86func (client ServiceClient) ListAvailableSkusByResourceGroupPreparer(ctx context.Context, resourceGroupName string, location string, availableSkuRequest AvailableSkuRequest) (*http.Request, error) {
87	pathParameters := map[string]interface{}{
88		"location":          autorest.Encode("path", location),
89		"resourceGroupName": autorest.Encode("path", resourceGroupName),
90		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
91	}
92
93	const APIVersion = "2020-04-01"
94	queryParameters := map[string]interface{}{
95		"api-version": APIVersion,
96	}
97
98	preparer := autorest.CreatePreparer(
99		autorest.AsContentType("application/json; charset=utf-8"),
100		autorest.AsPost(),
101		autorest.WithBaseURL(client.BaseURI),
102		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus", pathParameters),
103		autorest.WithJSON(availableSkuRequest),
104		autorest.WithQueryParameters(queryParameters))
105	return preparer.Prepare((&http.Request{}).WithContext(ctx))
106}
107
108// ListAvailableSkusByResourceGroupSender sends the ListAvailableSkusByResourceGroup request. The method will close the
109// http.Response Body if it receives an error.
110func (client ServiceClient) ListAvailableSkusByResourceGroupSender(req *http.Request) (*http.Response, error) {
111	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
112}
113
114// ListAvailableSkusByResourceGroupResponder handles the response to the ListAvailableSkusByResourceGroup request. The method always
115// closes the http.Response Body.
116func (client ServiceClient) ListAvailableSkusByResourceGroupResponder(resp *http.Response) (result AvailableSkusResult, err error) {
117	err = autorest.Respond(
118		resp,
119		azure.WithErrorUnlessStatusCode(http.StatusOK),
120		autorest.ByUnmarshallingJSON(&result),
121		autorest.ByClosing())
122	result.Response = autorest.Response{Response: resp}
123	return
124}
125
126// listAvailableSkusByResourceGroupNextResults retrieves the next set of results, if any.
127func (client ServiceClient) listAvailableSkusByResourceGroupNextResults(ctx context.Context, lastResults AvailableSkusResult) (result AvailableSkusResult, err error) {
128	req, err := lastResults.availableSkusResultPreparer(ctx)
129	if err != nil {
130		return result, autorest.NewErrorWithError(err, "databox.ServiceClient", "listAvailableSkusByResourceGroupNextResults", nil, "Failure preparing next results request")
131	}
132	if req == nil {
133		return
134	}
135	resp, err := client.ListAvailableSkusByResourceGroupSender(req)
136	if err != nil {
137		result.Response = autorest.Response{Response: resp}
138		return result, autorest.NewErrorWithError(err, "databox.ServiceClient", "listAvailableSkusByResourceGroupNextResults", resp, "Failure sending next results request")
139	}
140	result, err = client.ListAvailableSkusByResourceGroupResponder(resp)
141	if err != nil {
142		err = autorest.NewErrorWithError(err, "databox.ServiceClient", "listAvailableSkusByResourceGroupNextResults", resp, "Failure responding to next results request")
143	}
144	return
145}
146
147// ListAvailableSkusByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
148func (client ServiceClient) ListAvailableSkusByResourceGroupComplete(ctx context.Context, resourceGroupName string, location string, availableSkuRequest AvailableSkuRequest) (result AvailableSkusResultIterator, err error) {
149	if tracing.IsEnabled() {
150		ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.ListAvailableSkusByResourceGroup")
151		defer func() {
152			sc := -1
153			if result.Response().Response.Response != nil {
154				sc = result.page.Response().Response.Response.StatusCode
155			}
156			tracing.EndSpan(ctx, sc, err)
157		}()
158	}
159	result.page, err = client.ListAvailableSkusByResourceGroup(ctx, resourceGroupName, location, availableSkuRequest)
160	return
161}
162
163// RegionConfiguration this API provides configuration details specific to given region/location at Subscription level.
164// Parameters:
165// location - the location of the resource
166// regionConfigurationRequest - request body to get the configuration for the region.
167func (client ServiceClient) RegionConfiguration(ctx context.Context, location string, regionConfigurationRequest RegionConfigurationRequest) (result RegionConfigurationResponse, err error) {
168	if tracing.IsEnabled() {
169		ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.RegionConfiguration")
170		defer func() {
171			sc := -1
172			if result.Response.Response != nil {
173				sc = result.Response.Response.StatusCode
174			}
175			tracing.EndSpan(ctx, sc, err)
176		}()
177	}
178	req, err := client.RegionConfigurationPreparer(ctx, location, regionConfigurationRequest)
179	if err != nil {
180		err = autorest.NewErrorWithError(err, "databox.ServiceClient", "RegionConfiguration", nil, "Failure preparing request")
181		return
182	}
183
184	resp, err := client.RegionConfigurationSender(req)
185	if err != nil {
186		result.Response = autorest.Response{Response: resp}
187		err = autorest.NewErrorWithError(err, "databox.ServiceClient", "RegionConfiguration", resp, "Failure sending request")
188		return
189	}
190
191	result, err = client.RegionConfigurationResponder(resp)
192	if err != nil {
193		err = autorest.NewErrorWithError(err, "databox.ServiceClient", "RegionConfiguration", resp, "Failure responding to request")
194		return
195	}
196
197	return
198}
199
200// RegionConfigurationPreparer prepares the RegionConfiguration request.
201func (client ServiceClient) RegionConfigurationPreparer(ctx context.Context, location string, regionConfigurationRequest RegionConfigurationRequest) (*http.Request, error) {
202	pathParameters := map[string]interface{}{
203		"location":       autorest.Encode("path", location),
204		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
205	}
206
207	const APIVersion = "2020-04-01"
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.AsPost(),
215		autorest.WithBaseURL(client.BaseURI),
216		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration", pathParameters),
217		autorest.WithJSON(regionConfigurationRequest),
218		autorest.WithQueryParameters(queryParameters))
219	return preparer.Prepare((&http.Request{}).WithContext(ctx))
220}
221
222// RegionConfigurationSender sends the RegionConfiguration request. The method will close the
223// http.Response Body if it receives an error.
224func (client ServiceClient) RegionConfigurationSender(req *http.Request) (*http.Response, error) {
225	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
226}
227
228// RegionConfigurationResponder handles the response to the RegionConfiguration request. The method always
229// closes the http.Response Body.
230func (client ServiceClient) RegionConfigurationResponder(resp *http.Response) (result RegionConfigurationResponse, err error) {
231	err = autorest.Respond(
232		resp,
233		azure.WithErrorUnlessStatusCode(http.StatusOK),
234		autorest.ByUnmarshallingJSON(&result),
235		autorest.ByClosing())
236	result.Response = autorest.Response{Response: resp}
237	return
238}
239
240// RegionConfigurationByResourceGroup this API provides configuration details specific to given region/location at
241// Resource group level.
242// Parameters:
243// resourceGroupName - the Resource Group Name
244// location - the location of the resource
245// regionConfigurationRequest - request body to get the configuration for the region at resource group level.
246func (client ServiceClient) RegionConfigurationByResourceGroup(ctx context.Context, resourceGroupName string, location string, regionConfigurationRequest RegionConfigurationRequest) (result RegionConfigurationResponse, err error) {
247	if tracing.IsEnabled() {
248		ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.RegionConfigurationByResourceGroup")
249		defer func() {
250			sc := -1
251			if result.Response.Response != nil {
252				sc = result.Response.Response.StatusCode
253			}
254			tracing.EndSpan(ctx, sc, err)
255		}()
256	}
257	req, err := client.RegionConfigurationByResourceGroupPreparer(ctx, resourceGroupName, location, regionConfigurationRequest)
258	if err != nil {
259		err = autorest.NewErrorWithError(err, "databox.ServiceClient", "RegionConfigurationByResourceGroup", nil, "Failure preparing request")
260		return
261	}
262
263	resp, err := client.RegionConfigurationByResourceGroupSender(req)
264	if err != nil {
265		result.Response = autorest.Response{Response: resp}
266		err = autorest.NewErrorWithError(err, "databox.ServiceClient", "RegionConfigurationByResourceGroup", resp, "Failure sending request")
267		return
268	}
269
270	result, err = client.RegionConfigurationByResourceGroupResponder(resp)
271	if err != nil {
272		err = autorest.NewErrorWithError(err, "databox.ServiceClient", "RegionConfigurationByResourceGroup", resp, "Failure responding to request")
273		return
274	}
275
276	return
277}
278
279// RegionConfigurationByResourceGroupPreparer prepares the RegionConfigurationByResourceGroup request.
280func (client ServiceClient) RegionConfigurationByResourceGroupPreparer(ctx context.Context, resourceGroupName string, location string, regionConfigurationRequest RegionConfigurationRequest) (*http.Request, error) {
281	pathParameters := map[string]interface{}{
282		"location":          autorest.Encode("path", location),
283		"resourceGroupName": autorest.Encode("path", resourceGroupName),
284		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
285	}
286
287	const APIVersion = "2020-04-01"
288	queryParameters := map[string]interface{}{
289		"api-version": APIVersion,
290	}
291
292	preparer := autorest.CreatePreparer(
293		autorest.AsContentType("application/json; charset=utf-8"),
294		autorest.AsPost(),
295		autorest.WithBaseURL(client.BaseURI),
296		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration", pathParameters),
297		autorest.WithJSON(regionConfigurationRequest),
298		autorest.WithQueryParameters(queryParameters))
299	return preparer.Prepare((&http.Request{}).WithContext(ctx))
300}
301
302// RegionConfigurationByResourceGroupSender sends the RegionConfigurationByResourceGroup request. The method will close the
303// http.Response Body if it receives an error.
304func (client ServiceClient) RegionConfigurationByResourceGroupSender(req *http.Request) (*http.Response, error) {
305	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
306}
307
308// RegionConfigurationByResourceGroupResponder handles the response to the RegionConfigurationByResourceGroup request. The method always
309// closes the http.Response Body.
310func (client ServiceClient) RegionConfigurationByResourceGroupResponder(resp *http.Response) (result RegionConfigurationResponse, err error) {
311	err = autorest.Respond(
312		resp,
313		azure.WithErrorUnlessStatusCode(http.StatusOK),
314		autorest.ByUnmarshallingJSON(&result),
315		autorest.ByClosing())
316	result.Response = autorest.Response{Response: resp}
317	return
318}
319
320// ValidateAddressMethod [DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer
321// shipping address and provide alternate addresses if any.
322// Parameters:
323// location - the location of the resource
324// validateAddress - shipping address of the customer.
325func (client ServiceClient) ValidateAddressMethod(ctx context.Context, location string, validateAddress ValidateAddress) (result AddressValidationOutput, err error) {
326	if tracing.IsEnabled() {
327		ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.ValidateAddressMethod")
328		defer func() {
329			sc := -1
330			if result.Response.Response != nil {
331				sc = result.Response.Response.StatusCode
332			}
333			tracing.EndSpan(ctx, sc, err)
334		}()
335	}
336	if err := validation.Validate([]validation.Validation{
337		{TargetValue: validateAddress,
338			Constraints: []validation.Constraint{{Target: "validateAddress.ShippingAddress", Name: validation.Null, Rule: true,
339				Chain: []validation.Constraint{{Target: "validateAddress.ShippingAddress.StreetAddress1", Name: validation.Null, Rule: true, Chain: nil},
340					{Target: "validateAddress.ShippingAddress.Country", Name: validation.Null, Rule: true, Chain: nil},
341					{Target: "validateAddress.ShippingAddress.PostalCode", Name: validation.Null, Rule: true, Chain: nil},
342				}}}}}); err != nil {
343		return result, validation.NewError("databox.ServiceClient", "ValidateAddressMethod", err.Error())
344	}
345
346	req, err := client.ValidateAddressMethodPreparer(ctx, location, validateAddress)
347	if err != nil {
348		err = autorest.NewErrorWithError(err, "databox.ServiceClient", "ValidateAddressMethod", nil, "Failure preparing request")
349		return
350	}
351
352	resp, err := client.ValidateAddressMethodSender(req)
353	if err != nil {
354		result.Response = autorest.Response{Response: resp}
355		err = autorest.NewErrorWithError(err, "databox.ServiceClient", "ValidateAddressMethod", resp, "Failure sending request")
356		return
357	}
358
359	result, err = client.ValidateAddressMethodResponder(resp)
360	if err != nil {
361		err = autorest.NewErrorWithError(err, "databox.ServiceClient", "ValidateAddressMethod", resp, "Failure responding to request")
362		return
363	}
364
365	return
366}
367
368// ValidateAddressMethodPreparer prepares the ValidateAddressMethod request.
369func (client ServiceClient) ValidateAddressMethodPreparer(ctx context.Context, location string, validateAddress ValidateAddress) (*http.Request, error) {
370	pathParameters := map[string]interface{}{
371		"location":       autorest.Encode("path", location),
372		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
373	}
374
375	const APIVersion = "2020-04-01"
376	queryParameters := map[string]interface{}{
377		"api-version": APIVersion,
378	}
379
380	preparer := autorest.CreatePreparer(
381		autorest.AsContentType("application/json; charset=utf-8"),
382		autorest.AsPost(),
383		autorest.WithBaseURL(client.BaseURI),
384		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress", pathParameters),
385		autorest.WithJSON(validateAddress),
386		autorest.WithQueryParameters(queryParameters))
387	return preparer.Prepare((&http.Request{}).WithContext(ctx))
388}
389
390// ValidateAddressMethodSender sends the ValidateAddressMethod request. The method will close the
391// http.Response Body if it receives an error.
392func (client ServiceClient) ValidateAddressMethodSender(req *http.Request) (*http.Response, error) {
393	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
394}
395
396// ValidateAddressMethodResponder handles the response to the ValidateAddressMethod request. The method always
397// closes the http.Response Body.
398func (client ServiceClient) ValidateAddressMethodResponder(resp *http.Response) (result AddressValidationOutput, err error) {
399	err = autorest.Respond(
400		resp,
401		azure.WithErrorUnlessStatusCode(http.StatusOK),
402		autorest.ByUnmarshallingJSON(&result),
403		autorest.ByClosing())
404	result.Response = autorest.Response{Response: resp}
405	return
406}
407
408// ValidateInputs this method does all necessary pre-job creation validation under subscription.
409// Parameters:
410// location - the location of the resource
411// validationRequest - inputs of the customer.
412func (client ServiceClient) ValidateInputs(ctx context.Context, location string, validationRequest BasicValidationRequest) (result ValidationResponse, err error) {
413	if tracing.IsEnabled() {
414		ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.ValidateInputs")
415		defer func() {
416			sc := -1
417			if result.Response.Response != nil {
418				sc = result.Response.Response.StatusCode
419			}
420			tracing.EndSpan(ctx, sc, err)
421		}()
422	}
423	if err := validation.Validate([]validation.Validation{
424		{TargetValue: validationRequest,
425			Constraints: []validation.Constraint{{Target: "validationRequest.IndividualRequestDetails", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
426		return result, validation.NewError("databox.ServiceClient", "ValidateInputs", err.Error())
427	}
428
429	req, err := client.ValidateInputsPreparer(ctx, location, validationRequest)
430	if err != nil {
431		err = autorest.NewErrorWithError(err, "databox.ServiceClient", "ValidateInputs", nil, "Failure preparing request")
432		return
433	}
434
435	resp, err := client.ValidateInputsSender(req)
436	if err != nil {
437		result.Response = autorest.Response{Response: resp}
438		err = autorest.NewErrorWithError(err, "databox.ServiceClient", "ValidateInputs", resp, "Failure sending request")
439		return
440	}
441
442	result, err = client.ValidateInputsResponder(resp)
443	if err != nil {
444		err = autorest.NewErrorWithError(err, "databox.ServiceClient", "ValidateInputs", resp, "Failure responding to request")
445		return
446	}
447
448	return
449}
450
451// ValidateInputsPreparer prepares the ValidateInputs request.
452func (client ServiceClient) ValidateInputsPreparer(ctx context.Context, location string, validationRequest BasicValidationRequest) (*http.Request, error) {
453	pathParameters := map[string]interface{}{
454		"location":       autorest.Encode("path", location),
455		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
456	}
457
458	const APIVersion = "2020-04-01"
459	queryParameters := map[string]interface{}{
460		"api-version": APIVersion,
461	}
462
463	preparer := autorest.CreatePreparer(
464		autorest.AsContentType("application/json; charset=utf-8"),
465		autorest.AsPost(),
466		autorest.WithBaseURL(client.BaseURI),
467		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs", pathParameters),
468		autorest.WithJSON(validationRequest),
469		autorest.WithQueryParameters(queryParameters))
470	return preparer.Prepare((&http.Request{}).WithContext(ctx))
471}
472
473// ValidateInputsSender sends the ValidateInputs request. The method will close the
474// http.Response Body if it receives an error.
475func (client ServiceClient) ValidateInputsSender(req *http.Request) (*http.Response, error) {
476	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
477}
478
479// ValidateInputsResponder handles the response to the ValidateInputs request. The method always
480// closes the http.Response Body.
481func (client ServiceClient) ValidateInputsResponder(resp *http.Response) (result ValidationResponse, err error) {
482	err = autorest.Respond(
483		resp,
484		azure.WithErrorUnlessStatusCode(http.StatusOK),
485		autorest.ByUnmarshallingJSON(&result),
486		autorest.ByClosing())
487	result.Response = autorest.Response{Response: resp}
488	return
489}
490
491// ValidateInputsByResourceGroup this method does all necessary pre-job creation validation under resource group.
492// Parameters:
493// resourceGroupName - the Resource Group Name
494// location - the location of the resource
495// validationRequest - inputs of the customer.
496func (client ServiceClient) ValidateInputsByResourceGroup(ctx context.Context, resourceGroupName string, location string, validationRequest BasicValidationRequest) (result ValidationResponse, err error) {
497	if tracing.IsEnabled() {
498		ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.ValidateInputsByResourceGroup")
499		defer func() {
500			sc := -1
501			if result.Response.Response != nil {
502				sc = result.Response.Response.StatusCode
503			}
504			tracing.EndSpan(ctx, sc, err)
505		}()
506	}
507	if err := validation.Validate([]validation.Validation{
508		{TargetValue: validationRequest,
509			Constraints: []validation.Constraint{{Target: "validationRequest.IndividualRequestDetails", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
510		return result, validation.NewError("databox.ServiceClient", "ValidateInputsByResourceGroup", err.Error())
511	}
512
513	req, err := client.ValidateInputsByResourceGroupPreparer(ctx, resourceGroupName, location, validationRequest)
514	if err != nil {
515		err = autorest.NewErrorWithError(err, "databox.ServiceClient", "ValidateInputsByResourceGroup", nil, "Failure preparing request")
516		return
517	}
518
519	resp, err := client.ValidateInputsByResourceGroupSender(req)
520	if err != nil {
521		result.Response = autorest.Response{Response: resp}
522		err = autorest.NewErrorWithError(err, "databox.ServiceClient", "ValidateInputsByResourceGroup", resp, "Failure sending request")
523		return
524	}
525
526	result, err = client.ValidateInputsByResourceGroupResponder(resp)
527	if err != nil {
528		err = autorest.NewErrorWithError(err, "databox.ServiceClient", "ValidateInputsByResourceGroup", resp, "Failure responding to request")
529		return
530	}
531
532	return
533}
534
535// ValidateInputsByResourceGroupPreparer prepares the ValidateInputsByResourceGroup request.
536func (client ServiceClient) ValidateInputsByResourceGroupPreparer(ctx context.Context, resourceGroupName string, location string, validationRequest BasicValidationRequest) (*http.Request, error) {
537	pathParameters := map[string]interface{}{
538		"location":          autorest.Encode("path", location),
539		"resourceGroupName": autorest.Encode("path", resourceGroupName),
540		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
541	}
542
543	const APIVersion = "2020-04-01"
544	queryParameters := map[string]interface{}{
545		"api-version": APIVersion,
546	}
547
548	preparer := autorest.CreatePreparer(
549		autorest.AsContentType("application/json; charset=utf-8"),
550		autorest.AsPost(),
551		autorest.WithBaseURL(client.BaseURI),
552		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs", pathParameters),
553		autorest.WithJSON(validationRequest),
554		autorest.WithQueryParameters(queryParameters))
555	return preparer.Prepare((&http.Request{}).WithContext(ctx))
556}
557
558// ValidateInputsByResourceGroupSender sends the ValidateInputsByResourceGroup request. The method will close the
559// http.Response Body if it receives an error.
560func (client ServiceClient) ValidateInputsByResourceGroupSender(req *http.Request) (*http.Response, error) {
561	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
562}
563
564// ValidateInputsByResourceGroupResponder handles the response to the ValidateInputsByResourceGroup request. The method always
565// closes the http.Response Body.
566func (client ServiceClient) ValidateInputsByResourceGroupResponder(resp *http.Response) (result ValidationResponse, err error) {
567	err = autorest.Respond(
568		resp,
569		azure.WithErrorUnlessStatusCode(http.StatusOK),
570		autorest.ByUnmarshallingJSON(&result),
571		autorest.ByClosing())
572	result.Response = autorest.Response{Response: resp}
573	return
574}
575