...

Source file src/github.com/Azure/azure-sdk-for-go/services/storsimple1200series/mgmt/2016-10-01/storsimple/managers.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  // 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  // managerExtendedInfo - the manager extended information.
    37  // resourceGroupName - the resource group name
    38  // managerName - the manager name
    39  func (client ManagersClient) CreateExtendedInfo(ctx context.Context, managerExtendedInfo 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: managerExtendedInfo,
    52  			Constraints: []validation.Constraint{{Target: "managerExtendedInfo.ManagerExtendedInfoProperties", Name: validation.Null, Rule: true,
    53  				Chain: []validation.Constraint{{Target: "managerExtendedInfo.ManagerExtendedInfoProperties.IntegrityKey", Name: validation.Null, Rule: true, Chain: nil},
    54  					{Target: "managerExtendedInfo.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, managerExtendedInfo, 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, managerExtendedInfo ManagerExtendedInfo, resourceGroupName string, managerName string) (*http.Request, error) {
    86  	pathParameters := map[string]interface{}{
    87  		"managerName":       autorest.Encode("path", managerName),
    88  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
    89  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
    90  	}
    91  
    92  	const APIVersion = "2016-10-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(managerExtendedInfo),
   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  // manager - the manager.
   128  // resourceGroupName - the resource group name
   129  // managerName - the manager name
   130  func (client ManagersClient) CreateOrUpdate(ctx context.Context, manager 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: manager,
   143  			Constraints: []validation.Constraint{{Target: "manager.ManagerProperties", Name: validation.Null, Rule: false,
   144  				Chain: []validation.Constraint{{Target: "manager.ManagerProperties.Sku", Name: validation.Null, Rule: false,
   145  					Chain: []validation.Constraint{{Target: "manager.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, manager, 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, manager Manager, resourceGroupName string, managerName string) (*http.Request, error) {
   177  	pathParameters := map[string]interface{}{
   178  		"managerName":       autorest.Encode("path", managerName),
   179  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   180  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   181  	}
   182  
   183  	const APIVersion = "2016-10-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(manager),
   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":       autorest.Encode("path", managerName),
   264  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   265  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   266  	}
   267  
   268  	const APIVersion = "2016-10-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":       autorest.Encode("path", managerName),
   346  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   347  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   348  	}
   349  
   350  	const APIVersion = "2016-10-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":       autorest.Encode("path", managerName),
   428  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   429  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   430  	}
   431  
   432  	const APIVersion = "2016-10-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  // GetEncryptionKey returns the symmetric encryption key of the manager.
   464  // Parameters:
   465  // resourceGroupName - the resource group name
   466  // managerName - the manager name
   467  func (client ManagersClient) GetEncryptionKey(ctx context.Context, resourceGroupName string, managerName string) (result SymmetricEncryptedSecret, err error) {
   468  	if tracing.IsEnabled() {
   469  		ctx = tracing.StartSpan(ctx, fqdn+"/ManagersClient.GetEncryptionKey")
   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", "GetEncryptionKey", err.Error())
   483  	}
   484  
   485  	req, err := client.GetEncryptionKeyPreparer(ctx, resourceGroupName, managerName)
   486  	if err != nil {
   487  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "GetEncryptionKey", nil, "Failure preparing request")
   488  		return
   489  	}
   490  
   491  	resp, err := client.GetEncryptionKeySender(req)
   492  	if err != nil {
   493  		result.Response = autorest.Response{Response: resp}
   494  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "GetEncryptionKey", resp, "Failure sending request")
   495  		return
   496  	}
   497  
   498  	result, err = client.GetEncryptionKeyResponder(resp)
   499  	if err != nil {
   500  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "GetEncryptionKey", resp, "Failure responding to request")
   501  		return
   502  	}
   503  
   504  	return
   505  }
   506  
   507  // GetEncryptionKeyPreparer prepares the GetEncryptionKey request.
   508  func (client ManagersClient) GetEncryptionKeyPreparer(ctx context.Context, resourceGroupName string, managerName string) (*http.Request, error) {
   509  	pathParameters := map[string]interface{}{
   510  		"managerName":       autorest.Encode("path", managerName),
   511  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   512  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   513  	}
   514  
   515  	const APIVersion = "2016-10-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}/getEncryptionKey", pathParameters),
   524  		autorest.WithQueryParameters(queryParameters))
   525  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   526  }
   527  
   528  // GetEncryptionKeySender sends the GetEncryptionKey request. The method will close the
   529  // http.Response Body if it receives an error.
   530  func (client ManagersClient) GetEncryptionKeySender(req *http.Request) (*http.Response, error) {
   531  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   532  }
   533  
   534  // GetEncryptionKeyResponder handles the response to the GetEncryptionKey request. The method always
   535  // closes the http.Response Body.
   536  func (client ManagersClient) GetEncryptionKeyResponder(resp *http.Response) (result SymmetricEncryptedSecret, 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  // GetEncryptionSettings returns the encryption settings of the manager.
   547  // Parameters:
   548  // resourceGroupName - the resource group name
   549  // managerName - the manager name
   550  func (client ManagersClient) GetEncryptionSettings(ctx context.Context, resourceGroupName string, managerName string) (result EncryptionSettings, err error) {
   551  	if tracing.IsEnabled() {
   552  		ctx = tracing.StartSpan(ctx, fqdn+"/ManagersClient.GetEncryptionSettings")
   553  		defer func() {
   554  			sc := -1
   555  			if result.Response.Response != nil {
   556  				sc = result.Response.Response.StatusCode
   557  			}
   558  			tracing.EndSpan(ctx, sc, err)
   559  		}()
   560  	}
   561  	if err := validation.Validate([]validation.Validation{
   562  		{TargetValue: managerName,
   563  			Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   564  				{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
   565  		return result, validation.NewError("storsimple.ManagersClient", "GetEncryptionSettings", err.Error())
   566  	}
   567  
   568  	req, err := client.GetEncryptionSettingsPreparer(ctx, resourceGroupName, managerName)
   569  	if err != nil {
   570  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "GetEncryptionSettings", nil, "Failure preparing request")
   571  		return
   572  	}
   573  
   574  	resp, err := client.GetEncryptionSettingsSender(req)
   575  	if err != nil {
   576  		result.Response = autorest.Response{Response: resp}
   577  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "GetEncryptionSettings", resp, "Failure sending request")
   578  		return
   579  	}
   580  
   581  	result, err = client.GetEncryptionSettingsResponder(resp)
   582  	if err != nil {
   583  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "GetEncryptionSettings", resp, "Failure responding to request")
   584  		return
   585  	}
   586  
   587  	return
   588  }
   589  
   590  // GetEncryptionSettingsPreparer prepares the GetEncryptionSettings request.
   591  func (client ManagersClient) GetEncryptionSettingsPreparer(ctx context.Context, resourceGroupName string, managerName string) (*http.Request, error) {
   592  	pathParameters := map[string]interface{}{
   593  		"managerName":       autorest.Encode("path", managerName),
   594  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   595  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   596  	}
   597  
   598  	const APIVersion = "2016-10-01"
   599  	queryParameters := map[string]interface{}{
   600  		"api-version": APIVersion,
   601  	}
   602  
   603  	preparer := autorest.CreatePreparer(
   604  		autorest.AsGet(),
   605  		autorest.WithBaseURL(client.BaseURI),
   606  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/encryptionSettings/default", pathParameters),
   607  		autorest.WithQueryParameters(queryParameters))
   608  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   609  }
   610  
   611  // GetEncryptionSettingsSender sends the GetEncryptionSettings request. The method will close the
   612  // http.Response Body if it receives an error.
   613  func (client ManagersClient) GetEncryptionSettingsSender(req *http.Request) (*http.Response, error) {
   614  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   615  }
   616  
   617  // GetEncryptionSettingsResponder handles the response to the GetEncryptionSettings request. The method always
   618  // closes the http.Response Body.
   619  func (client ManagersClient) GetEncryptionSettingsResponder(resp *http.Response) (result EncryptionSettings, err error) {
   620  	err = autorest.Respond(
   621  		resp,
   622  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   623  		autorest.ByUnmarshallingJSON(&result),
   624  		autorest.ByClosing())
   625  	result.Response = autorest.Response{Response: resp}
   626  	return
   627  }
   628  
   629  // GetExtendedInfo returns the extended information of the specified manager name.
   630  // Parameters:
   631  // resourceGroupName - the resource group name
   632  // managerName - the manager name
   633  func (client ManagersClient) GetExtendedInfo(ctx context.Context, resourceGroupName string, managerName string) (result ManagerExtendedInfo, err error) {
   634  	if tracing.IsEnabled() {
   635  		ctx = tracing.StartSpan(ctx, fqdn+"/ManagersClient.GetExtendedInfo")
   636  		defer func() {
   637  			sc := -1
   638  			if result.Response.Response != nil {
   639  				sc = result.Response.Response.StatusCode
   640  			}
   641  			tracing.EndSpan(ctx, sc, err)
   642  		}()
   643  	}
   644  	if err := validation.Validate([]validation.Validation{
   645  		{TargetValue: managerName,
   646  			Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   647  				{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
   648  		return result, validation.NewError("storsimple.ManagersClient", "GetExtendedInfo", err.Error())
   649  	}
   650  
   651  	req, err := client.GetExtendedInfoPreparer(ctx, resourceGroupName, managerName)
   652  	if err != nil {
   653  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "GetExtendedInfo", nil, "Failure preparing request")
   654  		return
   655  	}
   656  
   657  	resp, err := client.GetExtendedInfoSender(req)
   658  	if err != nil {
   659  		result.Response = autorest.Response{Response: resp}
   660  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "GetExtendedInfo", resp, "Failure sending request")
   661  		return
   662  	}
   663  
   664  	result, err = client.GetExtendedInfoResponder(resp)
   665  	if err != nil {
   666  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "GetExtendedInfo", resp, "Failure responding to request")
   667  		return
   668  	}
   669  
   670  	return
   671  }
   672  
   673  // GetExtendedInfoPreparer prepares the GetExtendedInfo request.
   674  func (client ManagersClient) GetExtendedInfoPreparer(ctx context.Context, resourceGroupName string, managerName string) (*http.Request, error) {
   675  	pathParameters := map[string]interface{}{
   676  		"managerName":       autorest.Encode("path", managerName),
   677  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   678  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   679  	}
   680  
   681  	const APIVersion = "2016-10-01"
   682  	queryParameters := map[string]interface{}{
   683  		"api-version": APIVersion,
   684  	}
   685  
   686  	preparer := autorest.CreatePreparer(
   687  		autorest.AsGet(),
   688  		autorest.WithBaseURL(client.BaseURI),
   689  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/extendedInformation/vaultExtendedInfo", pathParameters),
   690  		autorest.WithQueryParameters(queryParameters))
   691  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   692  }
   693  
   694  // GetExtendedInfoSender sends the GetExtendedInfo request. The method will close the
   695  // http.Response Body if it receives an error.
   696  func (client ManagersClient) GetExtendedInfoSender(req *http.Request) (*http.Response, error) {
   697  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   698  }
   699  
   700  // GetExtendedInfoResponder handles the response to the GetExtendedInfo request. The method always
   701  // closes the http.Response Body.
   702  func (client ManagersClient) GetExtendedInfoResponder(resp *http.Response) (result ManagerExtendedInfo, err error) {
   703  	err = autorest.Respond(
   704  		resp,
   705  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   706  		autorest.ByUnmarshallingJSON(&result),
   707  		autorest.ByClosing())
   708  	result.Response = autorest.Response{Response: resp}
   709  	return
   710  }
   711  
   712  // List retrieves all the managers in a subscription.
   713  func (client ManagersClient) List(ctx context.Context) (result ManagerList, err error) {
   714  	if tracing.IsEnabled() {
   715  		ctx = tracing.StartSpan(ctx, fqdn+"/ManagersClient.List")
   716  		defer func() {
   717  			sc := -1
   718  			if result.Response.Response != nil {
   719  				sc = result.Response.Response.StatusCode
   720  			}
   721  			tracing.EndSpan(ctx, sc, err)
   722  		}()
   723  	}
   724  	req, err := client.ListPreparer(ctx)
   725  	if err != nil {
   726  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "List", nil, "Failure preparing request")
   727  		return
   728  	}
   729  
   730  	resp, err := client.ListSender(req)
   731  	if err != nil {
   732  		result.Response = autorest.Response{Response: resp}
   733  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "List", resp, "Failure sending request")
   734  		return
   735  	}
   736  
   737  	result, err = client.ListResponder(resp)
   738  	if err != nil {
   739  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "List", resp, "Failure responding to request")
   740  		return
   741  	}
   742  
   743  	return
   744  }
   745  
   746  // ListPreparer prepares the List request.
   747  func (client ManagersClient) ListPreparer(ctx context.Context) (*http.Request, error) {
   748  	pathParameters := map[string]interface{}{
   749  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
   750  	}
   751  
   752  	const APIVersion = "2016-10-01"
   753  	queryParameters := map[string]interface{}{
   754  		"api-version": APIVersion,
   755  	}
   756  
   757  	preparer := autorest.CreatePreparer(
   758  		autorest.AsGet(),
   759  		autorest.WithBaseURL(client.BaseURI),
   760  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.StorSimple/managers", pathParameters),
   761  		autorest.WithQueryParameters(queryParameters))
   762  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   763  }
   764  
   765  // ListSender sends the List request. The method will close the
   766  // http.Response Body if it receives an error.
   767  func (client ManagersClient) ListSender(req *http.Request) (*http.Response, error) {
   768  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   769  }
   770  
   771  // ListResponder handles the response to the List request. The method always
   772  // closes the http.Response Body.
   773  func (client ManagersClient) ListResponder(resp *http.Response) (result ManagerList, err error) {
   774  	err = autorest.Respond(
   775  		resp,
   776  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   777  		autorest.ByUnmarshallingJSON(&result),
   778  		autorest.ByClosing())
   779  	result.Response = autorest.Response{Response: resp}
   780  	return
   781  }
   782  
   783  // ListByResourceGroup retrieves all the managers in a resource group.
   784  // Parameters:
   785  // resourceGroupName - the resource group name
   786  func (client ManagersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ManagerList, err error) {
   787  	if tracing.IsEnabled() {
   788  		ctx = tracing.StartSpan(ctx, fqdn+"/ManagersClient.ListByResourceGroup")
   789  		defer func() {
   790  			sc := -1
   791  			if result.Response.Response != nil {
   792  				sc = result.Response.Response.StatusCode
   793  			}
   794  			tracing.EndSpan(ctx, sc, err)
   795  		}()
   796  	}
   797  	req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
   798  	if err != nil {
   799  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "ListByResourceGroup", nil, "Failure preparing request")
   800  		return
   801  	}
   802  
   803  	resp, err := client.ListByResourceGroupSender(req)
   804  	if err != nil {
   805  		result.Response = autorest.Response{Response: resp}
   806  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "ListByResourceGroup", resp, "Failure sending request")
   807  		return
   808  	}
   809  
   810  	result, err = client.ListByResourceGroupResponder(resp)
   811  	if err != nil {
   812  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "ListByResourceGroup", resp, "Failure responding to request")
   813  		return
   814  	}
   815  
   816  	return
   817  }
   818  
   819  // ListByResourceGroupPreparer prepares the ListByResourceGroup request.
   820  func (client ManagersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
   821  	pathParameters := map[string]interface{}{
   822  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   823  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   824  	}
   825  
   826  	const APIVersion = "2016-10-01"
   827  	queryParameters := map[string]interface{}{
   828  		"api-version": APIVersion,
   829  	}
   830  
   831  	preparer := autorest.CreatePreparer(
   832  		autorest.AsGet(),
   833  		autorest.WithBaseURL(client.BaseURI),
   834  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers", pathParameters),
   835  		autorest.WithQueryParameters(queryParameters))
   836  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   837  }
   838  
   839  // ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
   840  // http.Response Body if it receives an error.
   841  func (client ManagersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
   842  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   843  }
   844  
   845  // ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
   846  // closes the http.Response Body.
   847  func (client ManagersClient) ListByResourceGroupResponder(resp *http.Response) (result ManagerList, err error) {
   848  	err = autorest.Respond(
   849  		resp,
   850  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   851  		autorest.ByUnmarshallingJSON(&result),
   852  		autorest.ByClosing())
   853  	result.Response = autorest.Response{Response: resp}
   854  	return
   855  }
   856  
   857  // ListMetricDefinition retrieves metric definition of all metrics aggregated at manager.
   858  // Parameters:
   859  // resourceGroupName - the resource group name
   860  // managerName - the manager name
   861  func (client ManagersClient) ListMetricDefinition(ctx context.Context, resourceGroupName string, managerName string) (result MetricDefinitionList, err error) {
   862  	if tracing.IsEnabled() {
   863  		ctx = tracing.StartSpan(ctx, fqdn+"/ManagersClient.ListMetricDefinition")
   864  		defer func() {
   865  			sc := -1
   866  			if result.Response.Response != nil {
   867  				sc = result.Response.Response.StatusCode
   868  			}
   869  			tracing.EndSpan(ctx, sc, err)
   870  		}()
   871  	}
   872  	if err := validation.Validate([]validation.Validation{
   873  		{TargetValue: managerName,
   874  			Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   875  				{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
   876  		return result, validation.NewError("storsimple.ManagersClient", "ListMetricDefinition", err.Error())
   877  	}
   878  
   879  	req, err := client.ListMetricDefinitionPreparer(ctx, resourceGroupName, managerName)
   880  	if err != nil {
   881  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "ListMetricDefinition", nil, "Failure preparing request")
   882  		return
   883  	}
   884  
   885  	resp, err := client.ListMetricDefinitionSender(req)
   886  	if err != nil {
   887  		result.Response = autorest.Response{Response: resp}
   888  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "ListMetricDefinition", resp, "Failure sending request")
   889  		return
   890  	}
   891  
   892  	result, err = client.ListMetricDefinitionResponder(resp)
   893  	if err != nil {
   894  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "ListMetricDefinition", resp, "Failure responding to request")
   895  		return
   896  	}
   897  
   898  	return
   899  }
   900  
   901  // ListMetricDefinitionPreparer prepares the ListMetricDefinition request.
   902  func (client ManagersClient) ListMetricDefinitionPreparer(ctx context.Context, resourceGroupName string, managerName string) (*http.Request, error) {
   903  	pathParameters := map[string]interface{}{
   904  		"managerName":       autorest.Encode("path", managerName),
   905  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   906  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   907  	}
   908  
   909  	const APIVersion = "2016-10-01"
   910  	queryParameters := map[string]interface{}{
   911  		"api-version": APIVersion,
   912  	}
   913  
   914  	preparer := autorest.CreatePreparer(
   915  		autorest.AsGet(),
   916  		autorest.WithBaseURL(client.BaseURI),
   917  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/metricsDefinitions", pathParameters),
   918  		autorest.WithQueryParameters(queryParameters))
   919  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   920  }
   921  
   922  // ListMetricDefinitionSender sends the ListMetricDefinition request. The method will close the
   923  // http.Response Body if it receives an error.
   924  func (client ManagersClient) ListMetricDefinitionSender(req *http.Request) (*http.Response, error) {
   925  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   926  }
   927  
   928  // ListMetricDefinitionResponder handles the response to the ListMetricDefinition request. The method always
   929  // closes the http.Response Body.
   930  func (client ManagersClient) ListMetricDefinitionResponder(resp *http.Response) (result MetricDefinitionList, err error) {
   931  	err = autorest.Respond(
   932  		resp,
   933  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   934  		autorest.ByUnmarshallingJSON(&result),
   935  		autorest.ByClosing())
   936  	result.Response = autorest.Response{Response: resp}
   937  	return
   938  }
   939  
   940  // ListMetrics gets the  manager metrics
   941  // Parameters:
   942  // resourceGroupName - the resource group name
   943  // managerName - the manager name
   944  // filter - oData Filter options
   945  func (client ManagersClient) ListMetrics(ctx context.Context, resourceGroupName string, managerName string, filter string) (result MetricList, err error) {
   946  	if tracing.IsEnabled() {
   947  		ctx = tracing.StartSpan(ctx, fqdn+"/ManagersClient.ListMetrics")
   948  		defer func() {
   949  			sc := -1
   950  			if result.Response.Response != nil {
   951  				sc = result.Response.Response.StatusCode
   952  			}
   953  			tracing.EndSpan(ctx, sc, err)
   954  		}()
   955  	}
   956  	if err := validation.Validate([]validation.Validation{
   957  		{TargetValue: managerName,
   958  			Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
   959  				{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
   960  		return result, validation.NewError("storsimple.ManagersClient", "ListMetrics", err.Error())
   961  	}
   962  
   963  	req, err := client.ListMetricsPreparer(ctx, resourceGroupName, managerName, filter)
   964  	if err != nil {
   965  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "ListMetrics", nil, "Failure preparing request")
   966  		return
   967  	}
   968  
   969  	resp, err := client.ListMetricsSender(req)
   970  	if err != nil {
   971  		result.Response = autorest.Response{Response: resp}
   972  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "ListMetrics", resp, "Failure sending request")
   973  		return
   974  	}
   975  
   976  	result, err = client.ListMetricsResponder(resp)
   977  	if err != nil {
   978  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "ListMetrics", resp, "Failure responding to request")
   979  		return
   980  	}
   981  
   982  	return
   983  }
   984  
   985  // ListMetricsPreparer prepares the ListMetrics request.
   986  func (client ManagersClient) ListMetricsPreparer(ctx context.Context, resourceGroupName string, managerName string, filter string) (*http.Request, error) {
   987  	pathParameters := map[string]interface{}{
   988  		"managerName":       autorest.Encode("path", managerName),
   989  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   990  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   991  	}
   992  
   993  	const APIVersion = "2016-10-01"
   994  	queryParameters := map[string]interface{}{
   995  		"api-version": APIVersion,
   996  	}
   997  	if len(filter) > 0 {
   998  		queryParameters["$filter"] = autorest.Encode("query", filter)
   999  	}
  1000  
  1001  	preparer := autorest.CreatePreparer(
  1002  		autorest.AsGet(),
  1003  		autorest.WithBaseURL(client.BaseURI),
  1004  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/metrics", pathParameters),
  1005  		autorest.WithQueryParameters(queryParameters))
  1006  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1007  }
  1008  
  1009  // ListMetricsSender sends the ListMetrics request. The method will close the
  1010  // http.Response Body if it receives an error.
  1011  func (client ManagersClient) ListMetricsSender(req *http.Request) (*http.Response, error) {
  1012  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1013  }
  1014  
  1015  // ListMetricsResponder handles the response to the ListMetrics request. The method always
  1016  // closes the http.Response Body.
  1017  func (client ManagersClient) ListMetricsResponder(resp *http.Response) (result MetricList, err error) {
  1018  	err = autorest.Respond(
  1019  		resp,
  1020  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1021  		autorest.ByUnmarshallingJSON(&result),
  1022  		autorest.ByClosing())
  1023  	result.Response = autorest.Response{Response: resp}
  1024  	return
  1025  }
  1026  
  1027  // Update updates the StorSimple Manager.
  1028  // Parameters:
  1029  // parameters - the manager update parameters.
  1030  // resourceGroupName - the resource group name
  1031  // managerName - the manager name
  1032  func (client ManagersClient) Update(ctx context.Context, parameters ManagerPatch, resourceGroupName string, managerName string) (result Manager, err error) {
  1033  	if tracing.IsEnabled() {
  1034  		ctx = tracing.StartSpan(ctx, fqdn+"/ManagersClient.Update")
  1035  		defer func() {
  1036  			sc := -1
  1037  			if result.Response.Response != nil {
  1038  				sc = result.Response.Response.StatusCode
  1039  			}
  1040  			tracing.EndSpan(ctx, sc, err)
  1041  		}()
  1042  	}
  1043  	if err := validation.Validate([]validation.Validation{
  1044  		{TargetValue: managerName,
  1045  			Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1046  				{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
  1047  		return result, validation.NewError("storsimple.ManagersClient", "Update", err.Error())
  1048  	}
  1049  
  1050  	req, err := client.UpdatePreparer(ctx, parameters, resourceGroupName, managerName)
  1051  	if err != nil {
  1052  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "Update", nil, "Failure preparing request")
  1053  		return
  1054  	}
  1055  
  1056  	resp, err := client.UpdateSender(req)
  1057  	if err != nil {
  1058  		result.Response = autorest.Response{Response: resp}
  1059  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "Update", resp, "Failure sending request")
  1060  		return
  1061  	}
  1062  
  1063  	result, err = client.UpdateResponder(resp)
  1064  	if err != nil {
  1065  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "Update", resp, "Failure responding to request")
  1066  		return
  1067  	}
  1068  
  1069  	return
  1070  }
  1071  
  1072  // UpdatePreparer prepares the Update request.
  1073  func (client ManagersClient) UpdatePreparer(ctx context.Context, parameters ManagerPatch, resourceGroupName string, managerName string) (*http.Request, error) {
  1074  	pathParameters := map[string]interface{}{
  1075  		"managerName":       autorest.Encode("path", managerName),
  1076  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1077  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1078  	}
  1079  
  1080  	const APIVersion = "2016-10-01"
  1081  	queryParameters := map[string]interface{}{
  1082  		"api-version": APIVersion,
  1083  	}
  1084  
  1085  	preparer := autorest.CreatePreparer(
  1086  		autorest.AsContentType("application/json; charset=utf-8"),
  1087  		autorest.AsPatch(),
  1088  		autorest.WithBaseURL(client.BaseURI),
  1089  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}", pathParameters),
  1090  		autorest.WithJSON(parameters),
  1091  		autorest.WithQueryParameters(queryParameters))
  1092  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1093  }
  1094  
  1095  // UpdateSender sends the Update request. The method will close the
  1096  // http.Response Body if it receives an error.
  1097  func (client ManagersClient) UpdateSender(req *http.Request) (*http.Response, error) {
  1098  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1099  }
  1100  
  1101  // UpdateResponder handles the response to the Update request. The method always
  1102  // closes the http.Response Body.
  1103  func (client ManagersClient) UpdateResponder(resp *http.Response) (result Manager, err error) {
  1104  	err = autorest.Respond(
  1105  		resp,
  1106  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1107  		autorest.ByUnmarshallingJSON(&result),
  1108  		autorest.ByClosing())
  1109  	result.Response = autorest.Response{Response: resp}
  1110  	return
  1111  }
  1112  
  1113  // UpdateExtendedInfo updates the extended info of the manager.
  1114  // Parameters:
  1115  // managerExtendedInfo - the manager extended information.
  1116  // resourceGroupName - the resource group name
  1117  // managerName - the manager name
  1118  // ifMatch - pass the ETag of ExtendedInfo fetched from GET call
  1119  func (client ManagersClient) UpdateExtendedInfo(ctx context.Context, managerExtendedInfo ManagerExtendedInfo, resourceGroupName string, managerName string, ifMatch string) (result ManagerExtendedInfo, err error) {
  1120  	if tracing.IsEnabled() {
  1121  		ctx = tracing.StartSpan(ctx, fqdn+"/ManagersClient.UpdateExtendedInfo")
  1122  		defer func() {
  1123  			sc := -1
  1124  			if result.Response.Response != nil {
  1125  				sc = result.Response.Response.StatusCode
  1126  			}
  1127  			tracing.EndSpan(ctx, sc, err)
  1128  		}()
  1129  	}
  1130  	if err := validation.Validate([]validation.Validation{
  1131  		{TargetValue: managerName,
  1132  			Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1133  				{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
  1134  		return result, validation.NewError("storsimple.ManagersClient", "UpdateExtendedInfo", err.Error())
  1135  	}
  1136  
  1137  	req, err := client.UpdateExtendedInfoPreparer(ctx, managerExtendedInfo, resourceGroupName, managerName, ifMatch)
  1138  	if err != nil {
  1139  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "UpdateExtendedInfo", nil, "Failure preparing request")
  1140  		return
  1141  	}
  1142  
  1143  	resp, err := client.UpdateExtendedInfoSender(req)
  1144  	if err != nil {
  1145  		result.Response = autorest.Response{Response: resp}
  1146  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "UpdateExtendedInfo", resp, "Failure sending request")
  1147  		return
  1148  	}
  1149  
  1150  	result, err = client.UpdateExtendedInfoResponder(resp)
  1151  	if err != nil {
  1152  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "UpdateExtendedInfo", resp, "Failure responding to request")
  1153  		return
  1154  	}
  1155  
  1156  	return
  1157  }
  1158  
  1159  // UpdateExtendedInfoPreparer prepares the UpdateExtendedInfo request.
  1160  func (client ManagersClient) UpdateExtendedInfoPreparer(ctx context.Context, managerExtendedInfo ManagerExtendedInfo, resourceGroupName string, managerName string, ifMatch string) (*http.Request, error) {
  1161  	pathParameters := map[string]interface{}{
  1162  		"managerName":       autorest.Encode("path", managerName),
  1163  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1164  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1165  	}
  1166  
  1167  	const APIVersion = "2016-10-01"
  1168  	queryParameters := map[string]interface{}{
  1169  		"api-version": APIVersion,
  1170  	}
  1171  
  1172  	preparer := autorest.CreatePreparer(
  1173  		autorest.AsContentType("application/json; charset=utf-8"),
  1174  		autorest.AsPatch(),
  1175  		autorest.WithBaseURL(client.BaseURI),
  1176  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/extendedInformation/vaultExtendedInfo", pathParameters),
  1177  		autorest.WithJSON(managerExtendedInfo),
  1178  		autorest.WithQueryParameters(queryParameters),
  1179  		autorest.WithHeader("If-Match", autorest.String(ifMatch)))
  1180  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1181  }
  1182  
  1183  // UpdateExtendedInfoSender sends the UpdateExtendedInfo request. The method will close the
  1184  // http.Response Body if it receives an error.
  1185  func (client ManagersClient) UpdateExtendedInfoSender(req *http.Request) (*http.Response, error) {
  1186  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1187  }
  1188  
  1189  // UpdateExtendedInfoResponder handles the response to the UpdateExtendedInfo request. The method always
  1190  // closes the http.Response Body.
  1191  func (client ManagersClient) UpdateExtendedInfoResponder(resp *http.Response) (result ManagerExtendedInfo, err error) {
  1192  	err = autorest.Respond(
  1193  		resp,
  1194  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1195  		autorest.ByUnmarshallingJSON(&result),
  1196  		autorest.ByClosing())
  1197  	result.Response = autorest.Response{Response: resp}
  1198  	return
  1199  }
  1200  
  1201  // UploadRegistrationCertificate upload Vault Cred Certificate.
  1202  // Returns UploadCertificateResponse
  1203  // Parameters:
  1204  // certificateName - certificate Name
  1205  // uploadCertificateRequestrequest - uploadCertificateRequest Request
  1206  // resourceGroupName - the resource group name
  1207  // managerName - the manager name
  1208  func (client ManagersClient) UploadRegistrationCertificate(ctx context.Context, certificateName string, uploadCertificateRequestrequest UploadCertificateRequest, resourceGroupName string, managerName string) (result UploadCertificateResponse, err error) {
  1209  	if tracing.IsEnabled() {
  1210  		ctx = tracing.StartSpan(ctx, fqdn+"/ManagersClient.UploadRegistrationCertificate")
  1211  		defer func() {
  1212  			sc := -1
  1213  			if result.Response.Response != nil {
  1214  				sc = result.Response.Response.StatusCode
  1215  			}
  1216  			tracing.EndSpan(ctx, sc, err)
  1217  		}()
  1218  	}
  1219  	if err := validation.Validate([]validation.Validation{
  1220  		{TargetValue: uploadCertificateRequestrequest,
  1221  			Constraints: []validation.Constraint{{Target: "uploadCertificateRequestrequest.RawCertificateData", Name: validation.Null, Rule: true,
  1222  				Chain: []validation.Constraint{{Target: "uploadCertificateRequestrequest.RawCertificateData.Certificate", Name: validation.Null, Rule: true, Chain: nil}}}}},
  1223  		{TargetValue: managerName,
  1224  			Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
  1225  				{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
  1226  		return result, validation.NewError("storsimple.ManagersClient", "UploadRegistrationCertificate", err.Error())
  1227  	}
  1228  
  1229  	req, err := client.UploadRegistrationCertificatePreparer(ctx, certificateName, uploadCertificateRequestrequest, resourceGroupName, managerName)
  1230  	if err != nil {
  1231  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "UploadRegistrationCertificate", nil, "Failure preparing request")
  1232  		return
  1233  	}
  1234  
  1235  	resp, err := client.UploadRegistrationCertificateSender(req)
  1236  	if err != nil {
  1237  		result.Response = autorest.Response{Response: resp}
  1238  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "UploadRegistrationCertificate", resp, "Failure sending request")
  1239  		return
  1240  	}
  1241  
  1242  	result, err = client.UploadRegistrationCertificateResponder(resp)
  1243  	if err != nil {
  1244  		err = autorest.NewErrorWithError(err, "storsimple.ManagersClient", "UploadRegistrationCertificate", resp, "Failure responding to request")
  1245  		return
  1246  	}
  1247  
  1248  	return
  1249  }
  1250  
  1251  // UploadRegistrationCertificatePreparer prepares the UploadRegistrationCertificate request.
  1252  func (client ManagersClient) UploadRegistrationCertificatePreparer(ctx context.Context, certificateName string, uploadCertificateRequestrequest UploadCertificateRequest, resourceGroupName string, managerName string) (*http.Request, error) {
  1253  	pathParameters := map[string]interface{}{
  1254  		"certificateName":   autorest.Encode("path", certificateName),
  1255  		"managerName":       autorest.Encode("path", managerName),
  1256  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1257  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1258  	}
  1259  
  1260  	const APIVersion = "2016-10-01"
  1261  	queryParameters := map[string]interface{}{
  1262  		"api-version": APIVersion,
  1263  	}
  1264  
  1265  	uploadCertificateRequestrequest.ContractVersion = ""
  1266  	preparer := autorest.CreatePreparer(
  1267  		autorest.AsContentType("application/json; charset=utf-8"),
  1268  		autorest.AsPut(),
  1269  		autorest.WithBaseURL(client.BaseURI),
  1270  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/certificates/{certificateName}", pathParameters),
  1271  		autorest.WithJSON(uploadCertificateRequestrequest),
  1272  		autorest.WithQueryParameters(queryParameters))
  1273  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1274  }
  1275  
  1276  // UploadRegistrationCertificateSender sends the UploadRegistrationCertificate request. The method will close the
  1277  // http.Response Body if it receives an error.
  1278  func (client ManagersClient) UploadRegistrationCertificateSender(req *http.Request) (*http.Response, error) {
  1279  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1280  }
  1281  
  1282  // UploadRegistrationCertificateResponder handles the response to the UploadRegistrationCertificate request. The method always
  1283  // closes the http.Response Body.
  1284  func (client ManagersClient) UploadRegistrationCertificateResponder(resp *http.Response) (result UploadCertificateResponse, err error) {
  1285  	err = autorest.Respond(
  1286  		resp,
  1287  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1288  		autorest.ByUnmarshallingJSON(&result),
  1289  		autorest.ByClosing())
  1290  	result.Response = autorest.Response{Response: resp}
  1291  	return
  1292  }
  1293  

View as plain text