...

Source file src/github.com/Azure/azure-sdk-for-go/services/storsimple1200series/mgmt/2016-10-01/storsimple/devices.go

Documentation: github.com/Azure/azure-sdk-for-go/services/storsimple1200series/mgmt/2016-10-01/storsimple

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

View as plain text