...

Source file src/github.com/Azure/azure-sdk-for-go/services/storsimple8000series/mgmt/2017-06-01/storsimple/managers.go

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

View as plain text