...

Source file src/github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights/activitylogalerts.go

Documentation: github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights

     1  package insights
     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  // ActivityLogAlertsClient is the monitor Management Client
    19  type ActivityLogAlertsClient struct {
    20  	BaseClient
    21  }
    22  
    23  // NewActivityLogAlertsClient creates an instance of the ActivityLogAlertsClient client.
    24  func NewActivityLogAlertsClient(subscriptionID string) ActivityLogAlertsClient {
    25  	return NewActivityLogAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID)
    26  }
    27  
    28  // NewActivityLogAlertsClientWithBaseURI creates an instance of the ActivityLogAlertsClient client using a custom
    29  // endpoint.  Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure
    30  // stack).
    31  func NewActivityLogAlertsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogAlertsClient {
    32  	return ActivityLogAlertsClient{NewWithBaseURI(baseURI, subscriptionID)}
    33  }
    34  
    35  // CreateOrUpdate create a new activity log alert or update an existing one.
    36  // Parameters:
    37  // resourceGroupName - the name of the resource group.
    38  // activityLogAlertName - the name of the activity log alert.
    39  // activityLogAlert - the activity log alert to create or use for the update.
    40  func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (result ActivityLogAlertResource, err error) {
    41  	if tracing.IsEnabled() {
    42  		ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.CreateOrUpdate")
    43  		defer func() {
    44  			sc := -1
    45  			if result.Response.Response != nil {
    46  				sc = result.Response.Response.StatusCode
    47  			}
    48  			tracing.EndSpan(ctx, sc, err)
    49  		}()
    50  	}
    51  	if err := validation.Validate([]validation.Validation{
    52  		{TargetValue: activityLogAlert,
    53  			Constraints: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert", Name: validation.Null, Rule: false,
    54  				Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Scopes", Name: validation.Null, Rule: true, Chain: nil},
    55  					{Target: "activityLogAlert.ActivityLogAlert.Condition", Name: validation.Null, Rule: true,
    56  						Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Condition.AllOf", Name: validation.Null, Rule: true, Chain: nil}}},
    57  					{Target: "activityLogAlert.ActivityLogAlert.Actions", Name: validation.Null, Rule: true, Chain: nil},
    58  				}}}}}); err != nil {
    59  		return result, validation.NewError("insights.ActivityLogAlertsClient", "CreateOrUpdate", err.Error())
    60  	}
    61  
    62  	req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlert)
    63  	if err != nil {
    64  		err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "CreateOrUpdate", nil, "Failure preparing request")
    65  		return
    66  	}
    67  
    68  	resp, err := client.CreateOrUpdateSender(req)
    69  	if err != nil {
    70  		result.Response = autorest.Response{Response: resp}
    71  		err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure sending request")
    72  		return
    73  	}
    74  
    75  	result, err = client.CreateOrUpdateResponder(resp)
    76  	if err != nil {
    77  		err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure responding to request")
    78  		return
    79  	}
    80  
    81  	return
    82  }
    83  
    84  // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
    85  func (client ActivityLogAlertsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (*http.Request, error) {
    86  	pathParameters := map[string]interface{}{
    87  		"activityLogAlertName": autorest.Encode("path", activityLogAlertName),
    88  		"resourceGroupName":    autorest.Encode("path", resourceGroupName),
    89  		"subscriptionId":       autorest.Encode("path", client.SubscriptionID),
    90  	}
    91  
    92  	const APIVersion = "2017-04-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.insights/activityLogAlerts/{activityLogAlertName}", pathParameters),
   102  		autorest.WithJSON(activityLogAlert),
   103  		autorest.WithQueryParameters(queryParameters))
   104  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   105  }
   106  
   107  // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
   108  // http.Response Body if it receives an error.
   109  func (client ActivityLogAlertsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
   110  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   111  }
   112  
   113  // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
   114  // closes the http.Response Body.
   115  func (client ActivityLogAlertsClient) CreateOrUpdateResponder(resp *http.Response) (result ActivityLogAlertResource, err error) {
   116  	err = autorest.Respond(
   117  		resp,
   118  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
   119  		autorest.ByUnmarshallingJSON(&result),
   120  		autorest.ByClosing())
   121  	result.Response = autorest.Response{Response: resp}
   122  	return
   123  }
   124  
   125  // Delete delete an activity log alert.
   126  // Parameters:
   127  // resourceGroupName - the name of the resource group.
   128  // activityLogAlertName - the name of the activity log alert.
   129  func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) {
   130  	if tracing.IsEnabled() {
   131  		ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.Delete")
   132  		defer func() {
   133  			sc := -1
   134  			if result.Response != nil {
   135  				sc = result.Response.StatusCode
   136  			}
   137  			tracing.EndSpan(ctx, sc, err)
   138  		}()
   139  	}
   140  	req, err := client.DeletePreparer(ctx, resourceGroupName, activityLogAlertName)
   141  	if err != nil {
   142  		err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", nil, "Failure preparing request")
   143  		return
   144  	}
   145  
   146  	resp, err := client.DeleteSender(req)
   147  	if err != nil {
   148  		result.Response = resp
   149  		err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", resp, "Failure sending request")
   150  		return
   151  	}
   152  
   153  	result, err = client.DeleteResponder(resp)
   154  	if err != nil {
   155  		err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", resp, "Failure responding to request")
   156  		return
   157  	}
   158  
   159  	return
   160  }
   161  
   162  // DeletePreparer prepares the Delete request.
   163  func (client ActivityLogAlertsClient) DeletePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) {
   164  	pathParameters := map[string]interface{}{
   165  		"activityLogAlertName": autorest.Encode("path", activityLogAlertName),
   166  		"resourceGroupName":    autorest.Encode("path", resourceGroupName),
   167  		"subscriptionId":       autorest.Encode("path", client.SubscriptionID),
   168  	}
   169  
   170  	const APIVersion = "2017-04-01"
   171  	queryParameters := map[string]interface{}{
   172  		"api-version": APIVersion,
   173  	}
   174  
   175  	preparer := autorest.CreatePreparer(
   176  		autorest.AsDelete(),
   177  		autorest.WithBaseURL(client.BaseURI),
   178  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}", pathParameters),
   179  		autorest.WithQueryParameters(queryParameters))
   180  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   181  }
   182  
   183  // DeleteSender sends the Delete request. The method will close the
   184  // http.Response Body if it receives an error.
   185  func (client ActivityLogAlertsClient) DeleteSender(req *http.Request) (*http.Response, error) {
   186  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   187  }
   188  
   189  // DeleteResponder handles the response to the Delete request. The method always
   190  // closes the http.Response Body.
   191  func (client ActivityLogAlertsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
   192  	err = autorest.Respond(
   193  		resp,
   194  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
   195  		autorest.ByClosing())
   196  	result.Response = resp
   197  	return
   198  }
   199  
   200  // Get get an activity log alert.
   201  // Parameters:
   202  // resourceGroupName - the name of the resource group.
   203  // activityLogAlertName - the name of the activity log alert.
   204  func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result ActivityLogAlertResource, err error) {
   205  	if tracing.IsEnabled() {
   206  		ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.Get")
   207  		defer func() {
   208  			sc := -1
   209  			if result.Response.Response != nil {
   210  				sc = result.Response.Response.StatusCode
   211  			}
   212  			tracing.EndSpan(ctx, sc, err)
   213  		}()
   214  	}
   215  	req, err := client.GetPreparer(ctx, resourceGroupName, activityLogAlertName)
   216  	if err != nil {
   217  		err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Get", nil, "Failure preparing request")
   218  		return
   219  	}
   220  
   221  	resp, err := client.GetSender(req)
   222  	if err != nil {
   223  		result.Response = autorest.Response{Response: resp}
   224  		err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Get", resp, "Failure sending request")
   225  		return
   226  	}
   227  
   228  	result, err = client.GetResponder(resp)
   229  	if err != nil {
   230  		err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Get", resp, "Failure responding to request")
   231  		return
   232  	}
   233  
   234  	return
   235  }
   236  
   237  // GetPreparer prepares the Get request.
   238  func (client ActivityLogAlertsClient) GetPreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) {
   239  	pathParameters := map[string]interface{}{
   240  		"activityLogAlertName": autorest.Encode("path", activityLogAlertName),
   241  		"resourceGroupName":    autorest.Encode("path", resourceGroupName),
   242  		"subscriptionId":       autorest.Encode("path", client.SubscriptionID),
   243  	}
   244  
   245  	const APIVersion = "2017-04-01"
   246  	queryParameters := map[string]interface{}{
   247  		"api-version": APIVersion,
   248  	}
   249  
   250  	preparer := autorest.CreatePreparer(
   251  		autorest.AsGet(),
   252  		autorest.WithBaseURL(client.BaseURI),
   253  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}", pathParameters),
   254  		autorest.WithQueryParameters(queryParameters))
   255  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   256  }
   257  
   258  // GetSender sends the Get request. The method will close the
   259  // http.Response Body if it receives an error.
   260  func (client ActivityLogAlertsClient) GetSender(req *http.Request) (*http.Response, error) {
   261  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   262  }
   263  
   264  // GetResponder handles the response to the Get request. The method always
   265  // closes the http.Response Body.
   266  func (client ActivityLogAlertsClient) GetResponder(resp *http.Response) (result ActivityLogAlertResource, err error) {
   267  	err = autorest.Respond(
   268  		resp,
   269  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   270  		autorest.ByUnmarshallingJSON(&result),
   271  		autorest.ByClosing())
   272  	result.Response = autorest.Response{Response: resp}
   273  	return
   274  }
   275  
   276  // ListByResourceGroup get a list of all activity log alerts in a resource group.
   277  // Parameters:
   278  // resourceGroupName - the name of the resource group.
   279  func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActivityLogAlertList, err error) {
   280  	if tracing.IsEnabled() {
   281  		ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListByResourceGroup")
   282  		defer func() {
   283  			sc := -1
   284  			if result.Response.Response != nil {
   285  				sc = result.Response.Response.StatusCode
   286  			}
   287  			tracing.EndSpan(ctx, sc, err)
   288  		}()
   289  	}
   290  	req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
   291  	if err != nil {
   292  		err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListByResourceGroup", nil, "Failure preparing request")
   293  		return
   294  	}
   295  
   296  	resp, err := client.ListByResourceGroupSender(req)
   297  	if err != nil {
   298  		result.Response = autorest.Response{Response: resp}
   299  		err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure sending request")
   300  		return
   301  	}
   302  
   303  	result, err = client.ListByResourceGroupResponder(resp)
   304  	if err != nil {
   305  		err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure responding to request")
   306  		return
   307  	}
   308  
   309  	return
   310  }
   311  
   312  // ListByResourceGroupPreparer prepares the ListByResourceGroup request.
   313  func (client ActivityLogAlertsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
   314  	pathParameters := map[string]interface{}{
   315  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   316  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   317  	}
   318  
   319  	const APIVersion = "2017-04-01"
   320  	queryParameters := map[string]interface{}{
   321  		"api-version": APIVersion,
   322  	}
   323  
   324  	preparer := autorest.CreatePreparer(
   325  		autorest.AsGet(),
   326  		autorest.WithBaseURL(client.BaseURI),
   327  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts", pathParameters),
   328  		autorest.WithQueryParameters(queryParameters))
   329  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   330  }
   331  
   332  // ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
   333  // http.Response Body if it receives an error.
   334  func (client ActivityLogAlertsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
   335  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   336  }
   337  
   338  // ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
   339  // closes the http.Response Body.
   340  func (client ActivityLogAlertsClient) ListByResourceGroupResponder(resp *http.Response) (result ActivityLogAlertList, err error) {
   341  	err = autorest.Respond(
   342  		resp,
   343  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   344  		autorest.ByUnmarshallingJSON(&result),
   345  		autorest.ByClosing())
   346  	result.Response = autorest.Response{Response: resp}
   347  	return
   348  }
   349  
   350  // ListBySubscriptionID get a list of all activity log alerts in a subscription.
   351  func (client ActivityLogAlertsClient) ListBySubscriptionID(ctx context.Context) (result ActivityLogAlertList, err error) {
   352  	if tracing.IsEnabled() {
   353  		ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListBySubscriptionID")
   354  		defer func() {
   355  			sc := -1
   356  			if result.Response.Response != nil {
   357  				sc = result.Response.Response.StatusCode
   358  			}
   359  			tracing.EndSpan(ctx, sc, err)
   360  		}()
   361  	}
   362  	req, err := client.ListBySubscriptionIDPreparer(ctx)
   363  	if err != nil {
   364  		err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", nil, "Failure preparing request")
   365  		return
   366  	}
   367  
   368  	resp, err := client.ListBySubscriptionIDSender(req)
   369  	if err != nil {
   370  		result.Response = autorest.Response{Response: resp}
   371  		err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure sending request")
   372  		return
   373  	}
   374  
   375  	result, err = client.ListBySubscriptionIDResponder(resp)
   376  	if err != nil {
   377  		err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure responding to request")
   378  		return
   379  	}
   380  
   381  	return
   382  }
   383  
   384  // ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request.
   385  func (client ActivityLogAlertsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) {
   386  	pathParameters := map[string]interface{}{
   387  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
   388  	}
   389  
   390  	const APIVersion = "2017-04-01"
   391  	queryParameters := map[string]interface{}{
   392  		"api-version": APIVersion,
   393  	}
   394  
   395  	preparer := autorest.CreatePreparer(
   396  		autorest.AsGet(),
   397  		autorest.WithBaseURL(client.BaseURI),
   398  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts", pathParameters),
   399  		autorest.WithQueryParameters(queryParameters))
   400  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   401  }
   402  
   403  // ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the
   404  // http.Response Body if it receives an error.
   405  func (client ActivityLogAlertsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) {
   406  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   407  }
   408  
   409  // ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always
   410  // closes the http.Response Body.
   411  func (client ActivityLogAlertsClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActivityLogAlertList, err error) {
   412  	err = autorest.Respond(
   413  		resp,
   414  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   415  		autorest.ByUnmarshallingJSON(&result),
   416  		autorest.ByClosing())
   417  	result.Response = autorest.Response{Response: resp}
   418  	return
   419  }
   420  
   421  // Update updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method.
   422  // Parameters:
   423  // resourceGroupName - the name of the resource group.
   424  // activityLogAlertName - the name of the activity log alert.
   425  // activityLogAlertPatch - parameters supplied to the operation.
   426  func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (result ActivityLogAlertResource, err error) {
   427  	if tracing.IsEnabled() {
   428  		ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.Update")
   429  		defer func() {
   430  			sc := -1
   431  			if result.Response.Response != nil {
   432  				sc = result.Response.Response.StatusCode
   433  			}
   434  			tracing.EndSpan(ctx, sc, err)
   435  		}()
   436  	}
   437  	req, err := client.UpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlertPatch)
   438  	if err != nil {
   439  		err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Update", nil, "Failure preparing request")
   440  		return
   441  	}
   442  
   443  	resp, err := client.UpdateSender(req)
   444  	if err != nil {
   445  		result.Response = autorest.Response{Response: resp}
   446  		err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Update", resp, "Failure sending request")
   447  		return
   448  	}
   449  
   450  	result, err = client.UpdateResponder(resp)
   451  	if err != nil {
   452  		err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Update", resp, "Failure responding to request")
   453  		return
   454  	}
   455  
   456  	return
   457  }
   458  
   459  // UpdatePreparer prepares the Update request.
   460  func (client ActivityLogAlertsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (*http.Request, error) {
   461  	pathParameters := map[string]interface{}{
   462  		"activityLogAlertName": autorest.Encode("path", activityLogAlertName),
   463  		"resourceGroupName":    autorest.Encode("path", resourceGroupName),
   464  		"subscriptionId":       autorest.Encode("path", client.SubscriptionID),
   465  	}
   466  
   467  	const APIVersion = "2017-04-01"
   468  	queryParameters := map[string]interface{}{
   469  		"api-version": APIVersion,
   470  	}
   471  
   472  	preparer := autorest.CreatePreparer(
   473  		autorest.AsContentType("application/json; charset=utf-8"),
   474  		autorest.AsPatch(),
   475  		autorest.WithBaseURL(client.BaseURI),
   476  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}", pathParameters),
   477  		autorest.WithJSON(activityLogAlertPatch),
   478  		autorest.WithQueryParameters(queryParameters))
   479  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   480  }
   481  
   482  // UpdateSender sends the Update request. The method will close the
   483  // http.Response Body if it receives an error.
   484  func (client ActivityLogAlertsClient) UpdateSender(req *http.Request) (*http.Response, error) {
   485  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   486  }
   487  
   488  // UpdateResponder handles the response to the Update request. The method always
   489  // closes the http.Response Body.
   490  func (client ActivityLogAlertsClient) UpdateResponder(resp *http.Response) (result ActivityLogAlertResource, err error) {
   491  	err = autorest.Respond(
   492  		resp,
   493  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   494  		autorest.ByUnmarshallingJSON(&result),
   495  		autorest.ByClosing())
   496  	result.Response = autorest.Response{Response: resp}
   497  	return
   498  }
   499  

View as plain text