1package netapp
2
3// Copyright (c) Microsoft and contributors.  All rights reserved.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13//
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
17// Code generated by Microsoft (R) AutoRest Code Generator.
18// Changes may cause incorrect behavior and will be lost if the code is regenerated.
19
20import (
21	"context"
22	"github.com/Azure/go-autorest/autorest"
23	"github.com/Azure/go-autorest/autorest/azure"
24	"github.com/Azure/go-autorest/autorest/validation"
25	"github.com/Azure/go-autorest/tracing"
26	"net/http"
27)
28
29// VolumesClient is the microsoft NetApp Azure Resource Provider specification
30type VolumesClient struct {
31	BaseClient
32}
33
34// NewVolumesClient creates an instance of the VolumesClient client.
35func NewVolumesClient(subscriptionID string) VolumesClient {
36	return NewVolumesClientWithBaseURI(DefaultBaseURI, subscriptionID)
37}
38
39// NewVolumesClientWithBaseURI creates an instance of the VolumesClient client using a custom endpoint.  Use this when
40// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
41func NewVolumesClientWithBaseURI(baseURI string, subscriptionID string) VolumesClient {
42	return VolumesClient{NewWithBaseURI(baseURI, subscriptionID)}
43}
44
45// AuthorizeReplication authorize the replication connection on the source volume
46// Parameters:
47// resourceGroupName - the name of the resource group.
48// accountName - the name of the NetApp account
49// poolName - the name of the capacity pool
50// volumeName - the name of the volume
51// body - authorize request object supplied in the body of the operation.
52func (client VolumesClient) AuthorizeReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body AuthorizeRequest) (result VolumesAuthorizeReplicationFuture, err error) {
53	if tracing.IsEnabled() {
54		ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.AuthorizeReplication")
55		defer func() {
56			sc := -1
57			if result.Response() != nil {
58				sc = result.Response().StatusCode
59			}
60			tracing.EndSpan(ctx, sc, err)
61		}()
62	}
63	if err := validation.Validate([]validation.Validation{
64		{TargetValue: resourceGroupName,
65			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
66				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
67				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
68		{TargetValue: poolName,
69			Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil},
70				{Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil},
71				{Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}},
72		{TargetValue: volumeName,
73			Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil},
74				{Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil},
75				{Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil {
76		return result, validation.NewError("netapp.VolumesClient", "AuthorizeReplication", err.Error())
77	}
78
79	req, err := client.AuthorizeReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, body)
80	if err != nil {
81		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "AuthorizeReplication", nil, "Failure preparing request")
82		return
83	}
84
85	result, err = client.AuthorizeReplicationSender(req)
86	if err != nil {
87		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "AuthorizeReplication", nil, "Failure sending request")
88		return
89	}
90
91	return
92}
93
94// AuthorizeReplicationPreparer prepares the AuthorizeReplication request.
95func (client VolumesClient) AuthorizeReplicationPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body AuthorizeRequest) (*http.Request, error) {
96	pathParameters := map[string]interface{}{
97		"accountName":       autorest.Encode("path", accountName),
98		"poolName":          autorest.Encode("path", poolName),
99		"resourceGroupName": autorest.Encode("path", resourceGroupName),
100		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
101		"volumeName":        autorest.Encode("path", volumeName),
102	}
103
104	const APIVersion = "2020-09-01"
105	queryParameters := map[string]interface{}{
106		"api-version": APIVersion,
107	}
108
109	preparer := autorest.CreatePreparer(
110		autorest.AsContentType("application/json; charset=utf-8"),
111		autorest.AsPost(),
112		autorest.WithBaseURL(client.BaseURI),
113		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication", pathParameters),
114		autorest.WithJSON(body),
115		autorest.WithQueryParameters(queryParameters))
116	return preparer.Prepare((&http.Request{}).WithContext(ctx))
117}
118
119// AuthorizeReplicationSender sends the AuthorizeReplication request. The method will close the
120// http.Response Body if it receives an error.
121func (client VolumesClient) AuthorizeReplicationSender(req *http.Request) (future VolumesAuthorizeReplicationFuture, err error) {
122	var resp *http.Response
123	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
124	if err != nil {
125		return
126	}
127	var azf azure.Future
128	azf, err = azure.NewFutureFromResponse(resp)
129	future.FutureAPI = &azf
130	future.Result = func(client VolumesClient) (ar autorest.Response, err error) {
131		var done bool
132		done, err = future.DoneWithContext(context.Background(), client)
133		if err != nil {
134			err = autorest.NewErrorWithError(err, "netapp.VolumesAuthorizeReplicationFuture", "Result", future.Response(), "Polling failure")
135			return
136		}
137		if !done {
138			err = azure.NewAsyncOpIncompleteError("netapp.VolumesAuthorizeReplicationFuture")
139			return
140		}
141		ar.Response = future.Response()
142		return
143	}
144	return
145}
146
147// AuthorizeReplicationResponder handles the response to the AuthorizeReplication request. The method always
148// closes the http.Response Body.
149func (client VolumesClient) AuthorizeReplicationResponder(resp *http.Response) (result autorest.Response, err error) {
150	err = autorest.Respond(
151		resp,
152		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
153		autorest.ByClosing())
154	result.Response = resp
155	return
156}
157
158// BreakReplication break the replication connection on the destination volume
159// Parameters:
160// resourceGroupName - the name of the resource group.
161// accountName - the name of the NetApp account
162// poolName - the name of the capacity pool
163// volumeName - the name of the volume
164// body - optional body to force break the replication.
165func (client VolumesClient) BreakReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body *BreakReplicationRequest) (result VolumesBreakReplicationFuture, err error) {
166	if tracing.IsEnabled() {
167		ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.BreakReplication")
168		defer func() {
169			sc := -1
170			if result.Response() != nil {
171				sc = result.Response().StatusCode
172			}
173			tracing.EndSpan(ctx, sc, err)
174		}()
175	}
176	if err := validation.Validate([]validation.Validation{
177		{TargetValue: resourceGroupName,
178			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
179				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
180				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
181		{TargetValue: poolName,
182			Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil},
183				{Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil},
184				{Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}},
185		{TargetValue: volumeName,
186			Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil},
187				{Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil},
188				{Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil {
189		return result, validation.NewError("netapp.VolumesClient", "BreakReplication", err.Error())
190	}
191
192	req, err := client.BreakReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, body)
193	if err != nil {
194		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "BreakReplication", nil, "Failure preparing request")
195		return
196	}
197
198	result, err = client.BreakReplicationSender(req)
199	if err != nil {
200		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "BreakReplication", nil, "Failure sending request")
201		return
202	}
203
204	return
205}
206
207// BreakReplicationPreparer prepares the BreakReplication request.
208func (client VolumesClient) BreakReplicationPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body *BreakReplicationRequest) (*http.Request, error) {
209	pathParameters := map[string]interface{}{
210		"accountName":       autorest.Encode("path", accountName),
211		"poolName":          autorest.Encode("path", poolName),
212		"resourceGroupName": autorest.Encode("path", resourceGroupName),
213		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
214		"volumeName":        autorest.Encode("path", volumeName),
215	}
216
217	const APIVersion = "2020-09-01"
218	queryParameters := map[string]interface{}{
219		"api-version": APIVersion,
220	}
221
222	preparer := autorest.CreatePreparer(
223		autorest.AsContentType("application/json; charset=utf-8"),
224		autorest.AsPost(),
225		autorest.WithBaseURL(client.BaseURI),
226		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication", pathParameters),
227		autorest.WithQueryParameters(queryParameters))
228	if body != nil {
229		preparer = autorest.DecoratePreparer(preparer,
230			autorest.WithJSON(body))
231	}
232	return preparer.Prepare((&http.Request{}).WithContext(ctx))
233}
234
235// BreakReplicationSender sends the BreakReplication request. The method will close the
236// http.Response Body if it receives an error.
237func (client VolumesClient) BreakReplicationSender(req *http.Request) (future VolumesBreakReplicationFuture, err error) {
238	var resp *http.Response
239	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
240	if err != nil {
241		return
242	}
243	var azf azure.Future
244	azf, err = azure.NewFutureFromResponse(resp)
245	future.FutureAPI = &azf
246	future.Result = func(client VolumesClient) (ar autorest.Response, err error) {
247		var done bool
248		done, err = future.DoneWithContext(context.Background(), client)
249		if err != nil {
250			err = autorest.NewErrorWithError(err, "netapp.VolumesBreakReplicationFuture", "Result", future.Response(), "Polling failure")
251			return
252		}
253		if !done {
254			err = azure.NewAsyncOpIncompleteError("netapp.VolumesBreakReplicationFuture")
255			return
256		}
257		ar.Response = future.Response()
258		return
259	}
260	return
261}
262
263// BreakReplicationResponder handles the response to the BreakReplication request. The method always
264// closes the http.Response Body.
265func (client VolumesClient) BreakReplicationResponder(resp *http.Response) (result autorest.Response, err error) {
266	err = autorest.Respond(
267		resp,
268		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
269		autorest.ByClosing())
270	result.Response = resp
271	return
272}
273
274// CreateOrUpdate create or update the specified volume within the capacity pool
275// Parameters:
276// body - volume object supplied in the body of the operation.
277// resourceGroupName - the name of the resource group.
278// accountName - the name of the NetApp account
279// poolName - the name of the capacity pool
280// volumeName - the name of the volume
281func (client VolumesClient) CreateOrUpdate(ctx context.Context, body Volume, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesCreateOrUpdateFuture, err error) {
282	if tracing.IsEnabled() {
283		ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.CreateOrUpdate")
284		defer func() {
285			sc := -1
286			if result.Response() != nil {
287				sc = result.Response().StatusCode
288			}
289			tracing.EndSpan(ctx, sc, err)
290		}()
291	}
292	if err := validation.Validate([]validation.Validation{
293		{TargetValue: body,
294			Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil},
295				{Target: "body.VolumeProperties", Name: validation.Null, Rule: true,
296					Chain: []validation.Constraint{{Target: "body.VolumeProperties.FileSystemID", Name: validation.Null, Rule: false,
297						Chain: []validation.Constraint{{Target: "body.VolumeProperties.FileSystemID", Name: validation.MaxLength, Rule: 36, Chain: nil},
298							{Target: "body.VolumeProperties.FileSystemID", Name: validation.MinLength, Rule: 36, Chain: nil},
299							{Target: "body.VolumeProperties.FileSystemID", Name: validation.Pattern, Rule: `^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$`, Chain: nil},
300						}},
301						{Target: "body.VolumeProperties.CreationToken", Name: validation.Null, Rule: true,
302							Chain: []validation.Constraint{{Target: "body.VolumeProperties.CreationToken", Name: validation.MaxLength, Rule: 80, Chain: nil},
303								{Target: "body.VolumeProperties.CreationToken", Name: validation.MinLength, Rule: 1, Chain: nil},
304								{Target: "body.VolumeProperties.CreationToken", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-]{0,79}$`, Chain: nil},
305							}},
306						{Target: "body.VolumeProperties.UsageThreshold", Name: validation.Null, Rule: true,
307							Chain: []validation.Constraint{{Target: "body.VolumeProperties.UsageThreshold", Name: validation.InclusiveMaximum, Rule: int64(109951162777600), Chain: nil},
308								{Target: "body.VolumeProperties.UsageThreshold", Name: validation.InclusiveMinimum, Rule: int64(107374182400), Chain: nil},
309							}},
310						{Target: "body.VolumeProperties.SnapshotID", Name: validation.Null, Rule: false,
311							Chain: []validation.Constraint{{Target: "body.VolumeProperties.SnapshotID", Name: validation.MaxLength, Rule: 36, Chain: nil},
312								{Target: "body.VolumeProperties.SnapshotID", Name: validation.MinLength, Rule: 36, Chain: nil},
313								{Target: "body.VolumeProperties.SnapshotID", Name: validation.Pattern, Rule: `^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}|(\\?([^\/]*[\/])*)([^\/]+)$`, Chain: nil},
314							}},
315						{Target: "body.VolumeProperties.BackupID", Name: validation.Null, Rule: false,
316							Chain: []validation.Constraint{{Target: "body.VolumeProperties.BackupID", Name: validation.MaxLength, Rule: 36, Chain: nil},
317								{Target: "body.VolumeProperties.BackupID", Name: validation.MinLength, Rule: 36, Chain: nil},
318								{Target: "body.VolumeProperties.BackupID", Name: validation.Pattern, Rule: `^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}|(\\?([^\/]*[\/])*)([^\/]+)$`, Chain: nil},
319							}},
320						{Target: "body.VolumeProperties.SubnetID", Name: validation.Null, Rule: true, Chain: nil},
321						{Target: "body.VolumeProperties.DataProtection", Name: validation.Null, Rule: false,
322							Chain: []validation.Constraint{{Target: "body.VolumeProperties.DataProtection.Replication", Name: validation.Null, Rule: false,
323								Chain: []validation.Constraint{{Target: "body.VolumeProperties.DataProtection.Replication.RemoteVolumeResourceID", Name: validation.Null, Rule: true, Chain: nil}}},
324							}},
325						{Target: "body.VolumeProperties.ThroughputMibps", Name: validation.Null, Rule: false,
326							Chain: []validation.Constraint{{Target: "body.VolumeProperties.ThroughputMibps", Name: validation.InclusiveMaximum, Rule: float64(4500), Chain: nil},
327								{Target: "body.VolumeProperties.ThroughputMibps", Name: validation.InclusiveMinimum, Rule: float64(1), Chain: nil},
328								{Target: "body.VolumeProperties.ThroughputMibps", Name: validation.MultipleOf, Rule: 0.001, Chain: nil},
329							}},
330					}}}},
331		{TargetValue: resourceGroupName,
332			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
333				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
334				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
335		{TargetValue: poolName,
336			Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil},
337				{Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil},
338				{Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}},
339		{TargetValue: volumeName,
340			Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil},
341				{Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil},
342				{Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil {
343		return result, validation.NewError("netapp.VolumesClient", "CreateOrUpdate", err.Error())
344	}
345
346	req, err := client.CreateOrUpdatePreparer(ctx, body, resourceGroupName, accountName, poolName, volumeName)
347	if err != nil {
348		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "CreateOrUpdate", nil, "Failure preparing request")
349		return
350	}
351
352	result, err = client.CreateOrUpdateSender(req)
353	if err != nil {
354		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "CreateOrUpdate", nil, "Failure sending request")
355		return
356	}
357
358	return
359}
360
361// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
362func (client VolumesClient) CreateOrUpdatePreparer(ctx context.Context, body Volume, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) {
363	pathParameters := map[string]interface{}{
364		"accountName":       autorest.Encode("path", accountName),
365		"poolName":          autorest.Encode("path", poolName),
366		"resourceGroupName": autorest.Encode("path", resourceGroupName),
367		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
368		"volumeName":        autorest.Encode("path", volumeName),
369	}
370
371	const APIVersion = "2020-09-01"
372	queryParameters := map[string]interface{}{
373		"api-version": APIVersion,
374	}
375
376	body.ID = nil
377	body.Name = nil
378	body.Type = nil
379	preparer := autorest.CreatePreparer(
380		autorest.AsContentType("application/json; charset=utf-8"),
381		autorest.AsPut(),
382		autorest.WithBaseURL(client.BaseURI),
383		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}", pathParameters),
384		autorest.WithJSON(body),
385		autorest.WithQueryParameters(queryParameters))
386	return preparer.Prepare((&http.Request{}).WithContext(ctx))
387}
388
389// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
390// http.Response Body if it receives an error.
391func (client VolumesClient) CreateOrUpdateSender(req *http.Request) (future VolumesCreateOrUpdateFuture, err error) {
392	var resp *http.Response
393	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
394	if err != nil {
395		return
396	}
397	var azf azure.Future
398	azf, err = azure.NewFutureFromResponse(resp)
399	future.FutureAPI = &azf
400	future.Result = func(client VolumesClient) (vVar Volume, err error) {
401		var done bool
402		done, err = future.DoneWithContext(context.Background(), client)
403		if err != nil {
404			err = autorest.NewErrorWithError(err, "netapp.VolumesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
405			return
406		}
407		if !done {
408			err = azure.NewAsyncOpIncompleteError("netapp.VolumesCreateOrUpdateFuture")
409			return
410		}
411		sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
412		if vVar.Response.Response, err = future.GetResult(sender); err == nil && vVar.Response.Response.StatusCode != http.StatusNoContent {
413			vVar, err = client.CreateOrUpdateResponder(vVar.Response.Response)
414			if err != nil {
415				err = autorest.NewErrorWithError(err, "netapp.VolumesCreateOrUpdateFuture", "Result", vVar.Response.Response, "Failure responding to request")
416			}
417		}
418		return
419	}
420	return
421}
422
423// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
424// closes the http.Response Body.
425func (client VolumesClient) CreateOrUpdateResponder(resp *http.Response) (result Volume, err error) {
426	err = autorest.Respond(
427		resp,
428		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted),
429		autorest.ByUnmarshallingJSON(&result),
430		autorest.ByClosing())
431	result.Response = autorest.Response{Response: resp}
432	return
433}
434
435// Delete delete the specified volume
436// Parameters:
437// resourceGroupName - the name of the resource group.
438// accountName - the name of the NetApp account
439// poolName - the name of the capacity pool
440// volumeName - the name of the volume
441func (client VolumesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesDeleteFuture, err error) {
442	if tracing.IsEnabled() {
443		ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.Delete")
444		defer func() {
445			sc := -1
446			if result.Response() != nil {
447				sc = result.Response().StatusCode
448			}
449			tracing.EndSpan(ctx, sc, err)
450		}()
451	}
452	if err := validation.Validate([]validation.Validation{
453		{TargetValue: resourceGroupName,
454			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
455				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
456				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
457		{TargetValue: poolName,
458			Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil},
459				{Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil},
460				{Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}},
461		{TargetValue: volumeName,
462			Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil},
463				{Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil},
464				{Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil {
465		return result, validation.NewError("netapp.VolumesClient", "Delete", err.Error())
466	}
467
468	req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, poolName, volumeName)
469	if err != nil {
470		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Delete", nil, "Failure preparing request")
471		return
472	}
473
474	result, err = client.DeleteSender(req)
475	if err != nil {
476		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Delete", nil, "Failure sending request")
477		return
478	}
479
480	return
481}
482
483// DeletePreparer prepares the Delete request.
484func (client VolumesClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) {
485	pathParameters := map[string]interface{}{
486		"accountName":       autorest.Encode("path", accountName),
487		"poolName":          autorest.Encode("path", poolName),
488		"resourceGroupName": autorest.Encode("path", resourceGroupName),
489		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
490		"volumeName":        autorest.Encode("path", volumeName),
491	}
492
493	const APIVersion = "2020-09-01"
494	queryParameters := map[string]interface{}{
495		"api-version": APIVersion,
496	}
497
498	preparer := autorest.CreatePreparer(
499		autorest.AsDelete(),
500		autorest.WithBaseURL(client.BaseURI),
501		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}", pathParameters),
502		autorest.WithQueryParameters(queryParameters))
503	return preparer.Prepare((&http.Request{}).WithContext(ctx))
504}
505
506// DeleteSender sends the Delete request. The method will close the
507// http.Response Body if it receives an error.
508func (client VolumesClient) DeleteSender(req *http.Request) (future VolumesDeleteFuture, err error) {
509	var resp *http.Response
510	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
511	if err != nil {
512		return
513	}
514	var azf azure.Future
515	azf, err = azure.NewFutureFromResponse(resp)
516	future.FutureAPI = &azf
517	future.Result = func(client VolumesClient) (ar autorest.Response, err error) {
518		var done bool
519		done, err = future.DoneWithContext(context.Background(), client)
520		if err != nil {
521			err = autorest.NewErrorWithError(err, "netapp.VolumesDeleteFuture", "Result", future.Response(), "Polling failure")
522			return
523		}
524		if !done {
525			err = azure.NewAsyncOpIncompleteError("netapp.VolumesDeleteFuture")
526			return
527		}
528		ar.Response = future.Response()
529		return
530	}
531	return
532}
533
534// DeleteResponder handles the response to the Delete request. The method always
535// closes the http.Response Body.
536func (client VolumesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
537	err = autorest.Respond(
538		resp,
539		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
540		autorest.ByClosing())
541	result.Response = resp
542	return
543}
544
545// DeleteReplication delete the replication connection on the destination volume, and send release to the source
546// replication
547// Parameters:
548// resourceGroupName - the name of the resource group.
549// accountName - the name of the NetApp account
550// poolName - the name of the capacity pool
551// volumeName - the name of the volume
552func (client VolumesClient) DeleteReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesDeleteReplicationFuture, err error) {
553	if tracing.IsEnabled() {
554		ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.DeleteReplication")
555		defer func() {
556			sc := -1
557			if result.Response() != nil {
558				sc = result.Response().StatusCode
559			}
560			tracing.EndSpan(ctx, sc, err)
561		}()
562	}
563	if err := validation.Validate([]validation.Validation{
564		{TargetValue: resourceGroupName,
565			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
566				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
567				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
568		{TargetValue: poolName,
569			Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil},
570				{Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil},
571				{Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}},
572		{TargetValue: volumeName,
573			Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil},
574				{Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil},
575				{Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil {
576		return result, validation.NewError("netapp.VolumesClient", "DeleteReplication", err.Error())
577	}
578
579	req, err := client.DeleteReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName)
580	if err != nil {
581		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "DeleteReplication", nil, "Failure preparing request")
582		return
583	}
584
585	result, err = client.DeleteReplicationSender(req)
586	if err != nil {
587		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "DeleteReplication", nil, "Failure sending request")
588		return
589	}
590
591	return
592}
593
594// DeleteReplicationPreparer prepares the DeleteReplication request.
595func (client VolumesClient) DeleteReplicationPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) {
596	pathParameters := map[string]interface{}{
597		"accountName":       autorest.Encode("path", accountName),
598		"poolName":          autorest.Encode("path", poolName),
599		"resourceGroupName": autorest.Encode("path", resourceGroupName),
600		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
601		"volumeName":        autorest.Encode("path", volumeName),
602	}
603
604	const APIVersion = "2020-09-01"
605	queryParameters := map[string]interface{}{
606		"api-version": APIVersion,
607	}
608
609	preparer := autorest.CreatePreparer(
610		autorest.AsPost(),
611		autorest.WithBaseURL(client.BaseURI),
612		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication", pathParameters),
613		autorest.WithQueryParameters(queryParameters))
614	return preparer.Prepare((&http.Request{}).WithContext(ctx))
615}
616
617// DeleteReplicationSender sends the DeleteReplication request. The method will close the
618// http.Response Body if it receives an error.
619func (client VolumesClient) DeleteReplicationSender(req *http.Request) (future VolumesDeleteReplicationFuture, err error) {
620	var resp *http.Response
621	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
622	if err != nil {
623		return
624	}
625	var azf azure.Future
626	azf, err = azure.NewFutureFromResponse(resp)
627	future.FutureAPI = &azf
628	future.Result = func(client VolumesClient) (ar autorest.Response, err error) {
629		var done bool
630		done, err = future.DoneWithContext(context.Background(), client)
631		if err != nil {
632			err = autorest.NewErrorWithError(err, "netapp.VolumesDeleteReplicationFuture", "Result", future.Response(), "Polling failure")
633			return
634		}
635		if !done {
636			err = azure.NewAsyncOpIncompleteError("netapp.VolumesDeleteReplicationFuture")
637			return
638		}
639		ar.Response = future.Response()
640		return
641	}
642	return
643}
644
645// DeleteReplicationResponder handles the response to the DeleteReplication request. The method always
646// closes the http.Response Body.
647func (client VolumesClient) DeleteReplicationResponder(resp *http.Response) (result autorest.Response, err error) {
648	err = autorest.Respond(
649		resp,
650		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
651		autorest.ByClosing())
652	result.Response = resp
653	return
654}
655
656// Get get the details of the specified volume
657// Parameters:
658// resourceGroupName - the name of the resource group.
659// accountName - the name of the NetApp account
660// poolName - the name of the capacity pool
661// volumeName - the name of the volume
662func (client VolumesClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result Volume, err error) {
663	if tracing.IsEnabled() {
664		ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.Get")
665		defer func() {
666			sc := -1
667			if result.Response.Response != nil {
668				sc = result.Response.Response.StatusCode
669			}
670			tracing.EndSpan(ctx, sc, err)
671		}()
672	}
673	if err := validation.Validate([]validation.Validation{
674		{TargetValue: resourceGroupName,
675			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
676				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
677				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
678		{TargetValue: poolName,
679			Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil},
680				{Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil},
681				{Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}},
682		{TargetValue: volumeName,
683			Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil},
684				{Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil},
685				{Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil {
686		return result, validation.NewError("netapp.VolumesClient", "Get", err.Error())
687	}
688
689	req, err := client.GetPreparer(ctx, resourceGroupName, accountName, poolName, volumeName)
690	if err != nil {
691		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Get", nil, "Failure preparing request")
692		return
693	}
694
695	resp, err := client.GetSender(req)
696	if err != nil {
697		result.Response = autorest.Response{Response: resp}
698		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Get", resp, "Failure sending request")
699		return
700	}
701
702	result, err = client.GetResponder(resp)
703	if err != nil {
704		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Get", resp, "Failure responding to request")
705		return
706	}
707
708	return
709}
710
711// GetPreparer prepares the Get request.
712func (client VolumesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) {
713	pathParameters := map[string]interface{}{
714		"accountName":       autorest.Encode("path", accountName),
715		"poolName":          autorest.Encode("path", poolName),
716		"resourceGroupName": autorest.Encode("path", resourceGroupName),
717		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
718		"volumeName":        autorest.Encode("path", volumeName),
719	}
720
721	const APIVersion = "2020-09-01"
722	queryParameters := map[string]interface{}{
723		"api-version": APIVersion,
724	}
725
726	preparer := autorest.CreatePreparer(
727		autorest.AsGet(),
728		autorest.WithBaseURL(client.BaseURI),
729		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}", pathParameters),
730		autorest.WithQueryParameters(queryParameters))
731	return preparer.Prepare((&http.Request{}).WithContext(ctx))
732}
733
734// GetSender sends the Get request. The method will close the
735// http.Response Body if it receives an error.
736func (client VolumesClient) GetSender(req *http.Request) (*http.Response, error) {
737	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
738}
739
740// GetResponder handles the response to the Get request. The method always
741// closes the http.Response Body.
742func (client VolumesClient) GetResponder(resp *http.Response) (result Volume, err error) {
743	err = autorest.Respond(
744		resp,
745		azure.WithErrorUnlessStatusCode(http.StatusOK),
746		autorest.ByUnmarshallingJSON(&result),
747		autorest.ByClosing())
748	result.Response = autorest.Response{Response: resp}
749	return
750}
751
752// List list all volumes within the capacity pool
753// Parameters:
754// resourceGroupName - the name of the resource group.
755// accountName - the name of the NetApp account
756// poolName - the name of the capacity pool
757func (client VolumesClient) List(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result VolumeListPage, err error) {
758	if tracing.IsEnabled() {
759		ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.List")
760		defer func() {
761			sc := -1
762			if result.vl.Response.Response != nil {
763				sc = result.vl.Response.Response.StatusCode
764			}
765			tracing.EndSpan(ctx, sc, err)
766		}()
767	}
768	if err := validation.Validate([]validation.Validation{
769		{TargetValue: resourceGroupName,
770			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
771				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
772				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
773		{TargetValue: poolName,
774			Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil},
775				{Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil},
776				{Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil {
777		return result, validation.NewError("netapp.VolumesClient", "List", err.Error())
778	}
779
780	result.fn = client.listNextResults
781	req, err := client.ListPreparer(ctx, resourceGroupName, accountName, poolName)
782	if err != nil {
783		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "List", nil, "Failure preparing request")
784		return
785	}
786
787	resp, err := client.ListSender(req)
788	if err != nil {
789		result.vl.Response = autorest.Response{Response: resp}
790		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "List", resp, "Failure sending request")
791		return
792	}
793
794	result.vl, err = client.ListResponder(resp)
795	if err != nil {
796		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "List", resp, "Failure responding to request")
797		return
798	}
799	if result.vl.hasNextLink() && result.vl.IsEmpty() {
800		err = result.NextWithContext(ctx)
801		return
802	}
803
804	return
805}
806
807// ListPreparer prepares the List request.
808func (client VolumesClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) {
809	pathParameters := map[string]interface{}{
810		"accountName":       autorest.Encode("path", accountName),
811		"poolName":          autorest.Encode("path", poolName),
812		"resourceGroupName": autorest.Encode("path", resourceGroupName),
813		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
814	}
815
816	const APIVersion = "2020-09-01"
817	queryParameters := map[string]interface{}{
818		"api-version": APIVersion,
819	}
820
821	preparer := autorest.CreatePreparer(
822		autorest.AsGet(),
823		autorest.WithBaseURL(client.BaseURI),
824		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes", pathParameters),
825		autorest.WithQueryParameters(queryParameters))
826	return preparer.Prepare((&http.Request{}).WithContext(ctx))
827}
828
829// ListSender sends the List request. The method will close the
830// http.Response Body if it receives an error.
831func (client VolumesClient) ListSender(req *http.Request) (*http.Response, error) {
832	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
833}
834
835// ListResponder handles the response to the List request. The method always
836// closes the http.Response Body.
837func (client VolumesClient) ListResponder(resp *http.Response) (result VolumeList, err error) {
838	err = autorest.Respond(
839		resp,
840		azure.WithErrorUnlessStatusCode(http.StatusOK),
841		autorest.ByUnmarshallingJSON(&result),
842		autorest.ByClosing())
843	result.Response = autorest.Response{Response: resp}
844	return
845}
846
847// listNextResults retrieves the next set of results, if any.
848func (client VolumesClient) listNextResults(ctx context.Context, lastResults VolumeList) (result VolumeList, err error) {
849	req, err := lastResults.volumeListPreparer(ctx)
850	if err != nil {
851		return result, autorest.NewErrorWithError(err, "netapp.VolumesClient", "listNextResults", nil, "Failure preparing next results request")
852	}
853	if req == nil {
854		return
855	}
856	resp, err := client.ListSender(req)
857	if err != nil {
858		result.Response = autorest.Response{Response: resp}
859		return result, autorest.NewErrorWithError(err, "netapp.VolumesClient", "listNextResults", resp, "Failure sending next results request")
860	}
861	result, err = client.ListResponder(resp)
862	if err != nil {
863		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "listNextResults", resp, "Failure responding to next results request")
864	}
865	return
866}
867
868// ListComplete enumerates all values, automatically crossing page boundaries as required.
869func (client VolumesClient) ListComplete(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result VolumeListIterator, err error) {
870	if tracing.IsEnabled() {
871		ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.List")
872		defer func() {
873			sc := -1
874			if result.Response().Response.Response != nil {
875				sc = result.page.Response().Response.Response.StatusCode
876			}
877			tracing.EndSpan(ctx, sc, err)
878		}()
879	}
880	result.page, err = client.List(ctx, resourceGroupName, accountName, poolName)
881	return
882}
883
884// PoolChange moves volume to another pool
885// Parameters:
886// resourceGroupName - the name of the resource group.
887// accountName - the name of the NetApp account
888// poolName - the name of the capacity pool
889// volumeName - the name of the volume
890// body - move volume to the pool supplied in the body of the operation.
891func (client VolumesClient) PoolChange(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body PoolChangeRequest) (result VolumesPoolChangeFuture, err error) {
892	if tracing.IsEnabled() {
893		ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.PoolChange")
894		defer func() {
895			sc := -1
896			if result.Response() != nil {
897				sc = result.Response().StatusCode
898			}
899			tracing.EndSpan(ctx, sc, err)
900		}()
901	}
902	if err := validation.Validate([]validation.Validation{
903		{TargetValue: resourceGroupName,
904			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
905				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
906				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
907		{TargetValue: poolName,
908			Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil},
909				{Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil},
910				{Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}},
911		{TargetValue: volumeName,
912			Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil},
913				{Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil},
914				{Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}},
915		{TargetValue: body,
916			Constraints: []validation.Constraint{{Target: "body.NewPoolResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
917		return result, validation.NewError("netapp.VolumesClient", "PoolChange", err.Error())
918	}
919
920	req, err := client.PoolChangePreparer(ctx, resourceGroupName, accountName, poolName, volumeName, body)
921	if err != nil {
922		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "PoolChange", nil, "Failure preparing request")
923		return
924	}
925
926	result, err = client.PoolChangeSender(req)
927	if err != nil {
928		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "PoolChange", nil, "Failure sending request")
929		return
930	}
931
932	return
933}
934
935// PoolChangePreparer prepares the PoolChange request.
936func (client VolumesClient) PoolChangePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body PoolChangeRequest) (*http.Request, error) {
937	pathParameters := map[string]interface{}{
938		"accountName":       autorest.Encode("path", accountName),
939		"poolName":          autorest.Encode("path", poolName),
940		"resourceGroupName": autorest.Encode("path", resourceGroupName),
941		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
942		"volumeName":        autorest.Encode("path", volumeName),
943	}
944
945	const APIVersion = "2020-09-01"
946	queryParameters := map[string]interface{}{
947		"api-version": APIVersion,
948	}
949
950	preparer := autorest.CreatePreparer(
951		autorest.AsContentType("application/json; charset=utf-8"),
952		autorest.AsPost(),
953		autorest.WithBaseURL(client.BaseURI),
954		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/poolChange", pathParameters),
955		autorest.WithJSON(body),
956		autorest.WithQueryParameters(queryParameters))
957	return preparer.Prepare((&http.Request{}).WithContext(ctx))
958}
959
960// PoolChangeSender sends the PoolChange request. The method will close the
961// http.Response Body if it receives an error.
962func (client VolumesClient) PoolChangeSender(req *http.Request) (future VolumesPoolChangeFuture, err error) {
963	var resp *http.Response
964	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
965	if err != nil {
966		return
967	}
968	var azf azure.Future
969	azf, err = azure.NewFutureFromResponse(resp)
970	future.FutureAPI = &azf
971	future.Result = func(client VolumesClient) (ar autorest.Response, err error) {
972		var done bool
973		done, err = future.DoneWithContext(context.Background(), client)
974		if err != nil {
975			err = autorest.NewErrorWithError(err, "netapp.VolumesPoolChangeFuture", "Result", future.Response(), "Polling failure")
976			return
977		}
978		if !done {
979			err = azure.NewAsyncOpIncompleteError("netapp.VolumesPoolChangeFuture")
980			return
981		}
982		ar.Response = future.Response()
983		return
984	}
985	return
986}
987
988// PoolChangeResponder handles the response to the PoolChange request. The method always
989// closes the http.Response Body.
990func (client VolumesClient) PoolChangeResponder(resp *http.Response) (result autorest.Response, err error) {
991	err = autorest.Respond(
992		resp,
993		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
994		autorest.ByClosing())
995	result.Response = resp
996	return
997}
998
999// ReInitializeReplication re-Initializes the replication connection on the destination volume
1000// Parameters:
1001// resourceGroupName - the name of the resource group.
1002// accountName - the name of the NetApp account
1003// poolName - the name of the capacity pool
1004// volumeName - the name of the volume
1005func (client VolumesClient) ReInitializeReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesReInitializeReplicationFuture, err error) {
1006	if tracing.IsEnabled() {
1007		ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.ReInitializeReplication")
1008		defer func() {
1009			sc := -1
1010			if result.Response() != nil {
1011				sc = result.Response().StatusCode
1012			}
1013			tracing.EndSpan(ctx, sc, err)
1014		}()
1015	}
1016	if err := validation.Validate([]validation.Validation{
1017		{TargetValue: resourceGroupName,
1018			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
1019				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
1020				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
1021		{TargetValue: poolName,
1022			Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil},
1023				{Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil},
1024				{Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}},
1025		{TargetValue: volumeName,
1026			Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil},
1027				{Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil},
1028				{Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil {
1029		return result, validation.NewError("netapp.VolumesClient", "ReInitializeReplication", err.Error())
1030	}
1031
1032	req, err := client.ReInitializeReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName)
1033	if err != nil {
1034		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ReInitializeReplication", nil, "Failure preparing request")
1035		return
1036	}
1037
1038	result, err = client.ReInitializeReplicationSender(req)
1039	if err != nil {
1040		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ReInitializeReplication", nil, "Failure sending request")
1041		return
1042	}
1043
1044	return
1045}
1046
1047// ReInitializeReplicationPreparer prepares the ReInitializeReplication request.
1048func (client VolumesClient) ReInitializeReplicationPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) {
1049	pathParameters := map[string]interface{}{
1050		"accountName":       autorest.Encode("path", accountName),
1051		"poolName":          autorest.Encode("path", poolName),
1052		"resourceGroupName": autorest.Encode("path", resourceGroupName),
1053		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
1054		"volumeName":        autorest.Encode("path", volumeName),
1055	}
1056
1057	const APIVersion = "2020-09-01"
1058	queryParameters := map[string]interface{}{
1059		"api-version": APIVersion,
1060	}
1061
1062	preparer := autorest.CreatePreparer(
1063		autorest.AsPost(),
1064		autorest.WithBaseURL(client.BaseURI),
1065		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reinitializeReplication", pathParameters),
1066		autorest.WithQueryParameters(queryParameters))
1067	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1068}
1069
1070// ReInitializeReplicationSender sends the ReInitializeReplication request. The method will close the
1071// http.Response Body if it receives an error.
1072func (client VolumesClient) ReInitializeReplicationSender(req *http.Request) (future VolumesReInitializeReplicationFuture, err error) {
1073	var resp *http.Response
1074	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1075	if err != nil {
1076		return
1077	}
1078	var azf azure.Future
1079	azf, err = azure.NewFutureFromResponse(resp)
1080	future.FutureAPI = &azf
1081	future.Result = func(client VolumesClient) (ar autorest.Response, err error) {
1082		var done bool
1083		done, err = future.DoneWithContext(context.Background(), client)
1084		if err != nil {
1085			err = autorest.NewErrorWithError(err, "netapp.VolumesReInitializeReplicationFuture", "Result", future.Response(), "Polling failure")
1086			return
1087		}
1088		if !done {
1089			err = azure.NewAsyncOpIncompleteError("netapp.VolumesReInitializeReplicationFuture")
1090			return
1091		}
1092		ar.Response = future.Response()
1093		return
1094	}
1095	return
1096}
1097
1098// ReInitializeReplicationResponder handles the response to the ReInitializeReplication request. The method always
1099// closes the http.Response Body.
1100func (client VolumesClient) ReInitializeReplicationResponder(resp *http.Response) (result autorest.Response, err error) {
1101	err = autorest.Respond(
1102		resp,
1103		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1104		autorest.ByClosing())
1105	result.Response = resp
1106	return
1107}
1108
1109// ReplicationStatusMethod get the status of the replication
1110// Parameters:
1111// resourceGroupName - the name of the resource group.
1112// accountName - the name of the NetApp account
1113// poolName - the name of the capacity pool
1114// volumeName - the name of the volume
1115func (client VolumesClient) ReplicationStatusMethod(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result ReplicationStatus, err error) {
1116	if tracing.IsEnabled() {
1117		ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.ReplicationStatusMethod")
1118		defer func() {
1119			sc := -1
1120			if result.Response.Response != nil {
1121				sc = result.Response.Response.StatusCode
1122			}
1123			tracing.EndSpan(ctx, sc, err)
1124		}()
1125	}
1126	if err := validation.Validate([]validation.Validation{
1127		{TargetValue: resourceGroupName,
1128			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
1129				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
1130				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
1131		{TargetValue: poolName,
1132			Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil},
1133				{Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil},
1134				{Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}},
1135		{TargetValue: volumeName,
1136			Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil},
1137				{Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil},
1138				{Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil {
1139		return result, validation.NewError("netapp.VolumesClient", "ReplicationStatusMethod", err.Error())
1140	}
1141
1142	req, err := client.ReplicationStatusMethodPreparer(ctx, resourceGroupName, accountName, poolName, volumeName)
1143	if err != nil {
1144		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ReplicationStatusMethod", nil, "Failure preparing request")
1145		return
1146	}
1147
1148	resp, err := client.ReplicationStatusMethodSender(req)
1149	if err != nil {
1150		result.Response = autorest.Response{Response: resp}
1151		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ReplicationStatusMethod", resp, "Failure sending request")
1152		return
1153	}
1154
1155	result, err = client.ReplicationStatusMethodResponder(resp)
1156	if err != nil {
1157		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ReplicationStatusMethod", resp, "Failure responding to request")
1158		return
1159	}
1160
1161	return
1162}
1163
1164// ReplicationStatusMethodPreparer prepares the ReplicationStatusMethod request.
1165func (client VolumesClient) ReplicationStatusMethodPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) {
1166	pathParameters := map[string]interface{}{
1167		"accountName":       autorest.Encode("path", accountName),
1168		"poolName":          autorest.Encode("path", poolName),
1169		"resourceGroupName": autorest.Encode("path", resourceGroupName),
1170		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
1171		"volumeName":        autorest.Encode("path", volumeName),
1172	}
1173
1174	const APIVersion = "2020-09-01"
1175	queryParameters := map[string]interface{}{
1176		"api-version": APIVersion,
1177	}
1178
1179	preparer := autorest.CreatePreparer(
1180		autorest.AsGet(),
1181		autorest.WithBaseURL(client.BaseURI),
1182		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/replicationStatus", pathParameters),
1183		autorest.WithQueryParameters(queryParameters))
1184	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1185}
1186
1187// ReplicationStatusMethodSender sends the ReplicationStatusMethod request. The method will close the
1188// http.Response Body if it receives an error.
1189func (client VolumesClient) ReplicationStatusMethodSender(req *http.Request) (*http.Response, error) {
1190	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
1191}
1192
1193// ReplicationStatusMethodResponder handles the response to the ReplicationStatusMethod request. The method always
1194// closes the http.Response Body.
1195func (client VolumesClient) ReplicationStatusMethodResponder(resp *http.Response) (result ReplicationStatus, err error) {
1196	err = autorest.Respond(
1197		resp,
1198		azure.WithErrorUnlessStatusCode(http.StatusOK),
1199		autorest.ByUnmarshallingJSON(&result),
1200		autorest.ByClosing())
1201	result.Response = autorest.Response{Response: resp}
1202	return
1203}
1204
1205// ResyncReplication resync the connection on the destination volume. If the operation is ran on the source volume it
1206// will reverse-resync the connection and sync from destination to source.
1207// Parameters:
1208// resourceGroupName - the name of the resource group.
1209// accountName - the name of the NetApp account
1210// poolName - the name of the capacity pool
1211// volumeName - the name of the volume
1212func (client VolumesClient) ResyncReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesResyncReplicationFuture, err error) {
1213	if tracing.IsEnabled() {
1214		ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.ResyncReplication")
1215		defer func() {
1216			sc := -1
1217			if result.Response() != nil {
1218				sc = result.Response().StatusCode
1219			}
1220			tracing.EndSpan(ctx, sc, err)
1221		}()
1222	}
1223	if err := validation.Validate([]validation.Validation{
1224		{TargetValue: resourceGroupName,
1225			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
1226				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
1227				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
1228		{TargetValue: poolName,
1229			Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil},
1230				{Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil},
1231				{Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}},
1232		{TargetValue: volumeName,
1233			Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil},
1234				{Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil},
1235				{Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil {
1236		return result, validation.NewError("netapp.VolumesClient", "ResyncReplication", err.Error())
1237	}
1238
1239	req, err := client.ResyncReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName)
1240	if err != nil {
1241		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ResyncReplication", nil, "Failure preparing request")
1242		return
1243	}
1244
1245	result, err = client.ResyncReplicationSender(req)
1246	if err != nil {
1247		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ResyncReplication", nil, "Failure sending request")
1248		return
1249	}
1250
1251	return
1252}
1253
1254// ResyncReplicationPreparer prepares the ResyncReplication request.
1255func (client VolumesClient) ResyncReplicationPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) {
1256	pathParameters := map[string]interface{}{
1257		"accountName":       autorest.Encode("path", accountName),
1258		"poolName":          autorest.Encode("path", poolName),
1259		"resourceGroupName": autorest.Encode("path", resourceGroupName),
1260		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
1261		"volumeName":        autorest.Encode("path", volumeName),
1262	}
1263
1264	const APIVersion = "2020-09-01"
1265	queryParameters := map[string]interface{}{
1266		"api-version": APIVersion,
1267	}
1268
1269	preparer := autorest.CreatePreparer(
1270		autorest.AsPost(),
1271		autorest.WithBaseURL(client.BaseURI),
1272		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication", pathParameters),
1273		autorest.WithQueryParameters(queryParameters))
1274	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1275}
1276
1277// ResyncReplicationSender sends the ResyncReplication request. The method will close the
1278// http.Response Body if it receives an error.
1279func (client VolumesClient) ResyncReplicationSender(req *http.Request) (future VolumesResyncReplicationFuture, err error) {
1280	var resp *http.Response
1281	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1282	if err != nil {
1283		return
1284	}
1285	var azf azure.Future
1286	azf, err = azure.NewFutureFromResponse(resp)
1287	future.FutureAPI = &azf
1288	future.Result = func(client VolumesClient) (ar autorest.Response, err error) {
1289		var done bool
1290		done, err = future.DoneWithContext(context.Background(), client)
1291		if err != nil {
1292			err = autorest.NewErrorWithError(err, "netapp.VolumesResyncReplicationFuture", "Result", future.Response(), "Polling failure")
1293			return
1294		}
1295		if !done {
1296			err = azure.NewAsyncOpIncompleteError("netapp.VolumesResyncReplicationFuture")
1297			return
1298		}
1299		ar.Response = future.Response()
1300		return
1301	}
1302	return
1303}
1304
1305// ResyncReplicationResponder handles the response to the ResyncReplication request. The method always
1306// closes the http.Response Body.
1307func (client VolumesClient) ResyncReplicationResponder(resp *http.Response) (result autorest.Response, err error) {
1308	err = autorest.Respond(
1309		resp,
1310		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1311		autorest.ByClosing())
1312	result.Response = resp
1313	return
1314}
1315
1316// Revert revert a volume to the snapshot specified in the body
1317// Parameters:
1318// resourceGroupName - the name of the resource group.
1319// accountName - the name of the NetApp account
1320// poolName - the name of the capacity pool
1321// volumeName - the name of the volume
1322// body - object for snapshot to revert supplied in the body of the operation.
1323func (client VolumesClient) Revert(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body VolumeRevert) (result VolumesRevertFuture, err error) {
1324	if tracing.IsEnabled() {
1325		ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.Revert")
1326		defer func() {
1327			sc := -1
1328			if result.Response() != nil {
1329				sc = result.Response().StatusCode
1330			}
1331			tracing.EndSpan(ctx, sc, err)
1332		}()
1333	}
1334	if err := validation.Validate([]validation.Validation{
1335		{TargetValue: resourceGroupName,
1336			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
1337				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
1338				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
1339		{TargetValue: poolName,
1340			Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil},
1341				{Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil},
1342				{Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}},
1343		{TargetValue: volumeName,
1344			Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil},
1345				{Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil},
1346				{Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil {
1347		return result, validation.NewError("netapp.VolumesClient", "Revert", err.Error())
1348	}
1349
1350	req, err := client.RevertPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, body)
1351	if err != nil {
1352		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Revert", nil, "Failure preparing request")
1353		return
1354	}
1355
1356	result, err = client.RevertSender(req)
1357	if err != nil {
1358		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Revert", nil, "Failure sending request")
1359		return
1360	}
1361
1362	return
1363}
1364
1365// RevertPreparer prepares the Revert request.
1366func (client VolumesClient) RevertPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body VolumeRevert) (*http.Request, error) {
1367	pathParameters := map[string]interface{}{
1368		"accountName":       autorest.Encode("path", accountName),
1369		"poolName":          autorest.Encode("path", poolName),
1370		"resourceGroupName": autorest.Encode("path", resourceGroupName),
1371		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
1372		"volumeName":        autorest.Encode("path", volumeName),
1373	}
1374
1375	const APIVersion = "2020-09-01"
1376	queryParameters := map[string]interface{}{
1377		"api-version": APIVersion,
1378	}
1379
1380	preparer := autorest.CreatePreparer(
1381		autorest.AsContentType("application/json; charset=utf-8"),
1382		autorest.AsPost(),
1383		autorest.WithBaseURL(client.BaseURI),
1384		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert", pathParameters),
1385		autorest.WithJSON(body),
1386		autorest.WithQueryParameters(queryParameters))
1387	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1388}
1389
1390// RevertSender sends the Revert request. The method will close the
1391// http.Response Body if it receives an error.
1392func (client VolumesClient) RevertSender(req *http.Request) (future VolumesRevertFuture, err error) {
1393	var resp *http.Response
1394	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1395	if err != nil {
1396		return
1397	}
1398	var azf azure.Future
1399	azf, err = azure.NewFutureFromResponse(resp)
1400	future.FutureAPI = &azf
1401	future.Result = func(client VolumesClient) (ar autorest.Response, err error) {
1402		var done bool
1403		done, err = future.DoneWithContext(context.Background(), client)
1404		if err != nil {
1405			err = autorest.NewErrorWithError(err, "netapp.VolumesRevertFuture", "Result", future.Response(), "Polling failure")
1406			return
1407		}
1408		if !done {
1409			err = azure.NewAsyncOpIncompleteError("netapp.VolumesRevertFuture")
1410			return
1411		}
1412		ar.Response = future.Response()
1413		return
1414	}
1415	return
1416}
1417
1418// RevertResponder handles the response to the Revert request. The method always
1419// closes the http.Response Body.
1420func (client VolumesClient) RevertResponder(resp *http.Response) (result autorest.Response, err error) {
1421	err = autorest.Respond(
1422		resp,
1423		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1424		autorest.ByClosing())
1425	result.Response = resp
1426	return
1427}
1428
1429// Update patch the specified volume
1430// Parameters:
1431// body - volume object supplied in the body of the operation.
1432// resourceGroupName - the name of the resource group.
1433// accountName - the name of the NetApp account
1434// poolName - the name of the capacity pool
1435// volumeName - the name of the volume
1436func (client VolumesClient) Update(ctx context.Context, body VolumePatch, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesUpdateFuture, err error) {
1437	if tracing.IsEnabled() {
1438		ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.Update")
1439		defer func() {
1440			sc := -1
1441			if result.Response() != nil {
1442				sc = result.Response().StatusCode
1443			}
1444			tracing.EndSpan(ctx, sc, err)
1445		}()
1446	}
1447	if err := validation.Validate([]validation.Validation{
1448		{TargetValue: resourceGroupName,
1449			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
1450				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
1451				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
1452		{TargetValue: poolName,
1453			Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil},
1454				{Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil},
1455				{Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}},
1456		{TargetValue: volumeName,
1457			Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil},
1458				{Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil},
1459				{Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil {
1460		return result, validation.NewError("netapp.VolumesClient", "Update", err.Error())
1461	}
1462
1463	req, err := client.UpdatePreparer(ctx, body, resourceGroupName, accountName, poolName, volumeName)
1464	if err != nil {
1465		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Update", nil, "Failure preparing request")
1466		return
1467	}
1468
1469	result, err = client.UpdateSender(req)
1470	if err != nil {
1471		err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Update", nil, "Failure sending request")
1472		return
1473	}
1474
1475	return
1476}
1477
1478// UpdatePreparer prepares the Update request.
1479func (client VolumesClient) UpdatePreparer(ctx context.Context, body VolumePatch, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) {
1480	pathParameters := map[string]interface{}{
1481		"accountName":       autorest.Encode("path", accountName),
1482		"poolName":          autorest.Encode("path", poolName),
1483		"resourceGroupName": autorest.Encode("path", resourceGroupName),
1484		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
1485		"volumeName":        autorest.Encode("path", volumeName),
1486	}
1487
1488	const APIVersion = "2020-09-01"
1489	queryParameters := map[string]interface{}{
1490		"api-version": APIVersion,
1491	}
1492
1493	body.ID = nil
1494	body.Name = nil
1495	body.Type = nil
1496	preparer := autorest.CreatePreparer(
1497		autorest.AsContentType("application/json; charset=utf-8"),
1498		autorest.AsPatch(),
1499		autorest.WithBaseURL(client.BaseURI),
1500		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}", pathParameters),
1501		autorest.WithJSON(body),
1502		autorest.WithQueryParameters(queryParameters))
1503	return preparer.Prepare((&http.Request{}).WithContext(ctx))
1504}
1505
1506// UpdateSender sends the Update request. The method will close the
1507// http.Response Body if it receives an error.
1508func (client VolumesClient) UpdateSender(req *http.Request) (future VolumesUpdateFuture, err error) {
1509	var resp *http.Response
1510	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
1511	if err != nil {
1512		return
1513	}
1514	var azf azure.Future
1515	azf, err = azure.NewFutureFromResponse(resp)
1516	future.FutureAPI = &azf
1517	future.Result = func(client VolumesClient) (vVar Volume, err error) {
1518		var done bool
1519		done, err = future.DoneWithContext(context.Background(), client)
1520		if err != nil {
1521			err = autorest.NewErrorWithError(err, "netapp.VolumesUpdateFuture", "Result", future.Response(), "Polling failure")
1522			return
1523		}
1524		if !done {
1525			err = azure.NewAsyncOpIncompleteError("netapp.VolumesUpdateFuture")
1526			return
1527		}
1528		sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1529		if vVar.Response.Response, err = future.GetResult(sender); err == nil && vVar.Response.Response.StatusCode != http.StatusNoContent {
1530			vVar, err = client.UpdateResponder(vVar.Response.Response)
1531			if err != nil {
1532				err = autorest.NewErrorWithError(err, "netapp.VolumesUpdateFuture", "Result", vVar.Response.Response, "Failure responding to request")
1533			}
1534		}
1535		return
1536	}
1537	return
1538}
1539
1540// UpdateResponder handles the response to the Update request. The method always
1541// closes the http.Response Body.
1542func (client VolumesClient) UpdateResponder(resp *http.Response) (result Volume, err error) {
1543	err = autorest.Respond(
1544		resp,
1545		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
1546		autorest.ByUnmarshallingJSON(&result),
1547		autorest.ByClosing())
1548	result.Response = autorest.Response{Response: resp}
1549	return
1550}
1551