package eventgrid // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/tracing" "net/http" ) // PartnerConfigurationsClient is the azure EventGrid Management Client type PartnerConfigurationsClient struct { BaseClient } // NewPartnerConfigurationsClient creates an instance of the PartnerConfigurationsClient client. func NewPartnerConfigurationsClient(subscriptionID string) PartnerConfigurationsClient { return NewPartnerConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewPartnerConfigurationsClientWithBaseURI creates an instance of the PartnerConfigurationsClient client using a // custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, // Azure stack). func NewPartnerConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) PartnerConfigurationsClient { return PartnerConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} } // AuthorizePartner authorize a single partner either by partner registration immutable Id or by partner name. // Parameters: // resourceGroupName - the name of the resource group within the user's subscription. // partnerInfo - the information of the partner to be authorized. func (client PartnerConfigurationsClient) AuthorizePartner(ctx context.Context, resourceGroupName string, partnerInfo Partner) (result PartnerConfiguration, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/PartnerConfigurationsClient.AuthorizePartner") defer func() { sc := -1 if result.Response.Response != nil { sc = result.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.AuthorizePartnerPreparer(ctx, resourceGroupName, partnerInfo) if err != nil { err = autorest.NewErrorWithError(err, "eventgrid.PartnerConfigurationsClient", "AuthorizePartner", nil, "Failure preparing request") return } resp, err := client.AuthorizePartnerSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "eventgrid.PartnerConfigurationsClient", "AuthorizePartner", resp, "Failure sending request") return } result, err = client.AuthorizePartnerResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "eventgrid.PartnerConfigurationsClient", "AuthorizePartner", resp, "Failure responding to request") return } return } // AuthorizePartnerPreparer prepares the AuthorizePartner request. func (client PartnerConfigurationsClient) AuthorizePartnerPreparer(ctx context.Context, resourceGroupName string, partnerInfo Partner) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2021-10-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations/default/authorizePartner", pathParameters), autorest.WithJSON(partnerInfo), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // AuthorizePartnerSender sends the AuthorizePartner request. The method will close the // http.Response Body if it receives an error. func (client PartnerConfigurationsClient) AuthorizePartnerSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // AuthorizePartnerResponder handles the response to the AuthorizePartner request. The method always // closes the http.Response Body. func (client PartnerConfigurationsClient) AuthorizePartnerResponder(resp *http.Response) (result PartnerConfiguration, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // CreateOrUpdate synchronously creates or updates a partner configuration with the specified parameters. // Parameters: // resourceGroupName - the name of the resource group within the user's subscription. // partnerConfigurationInfo - partner configuration information. func (client PartnerConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerConfigurationInfo PartnerConfiguration) (result PartnerConfigurationsCreateOrUpdateFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/PartnerConfigurationsClient.CreateOrUpdate") defer func() { sc := -1 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { sc = result.FutureAPI.Response().StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, partnerConfigurationInfo) if err != nil { err = autorest.NewErrorWithError(err, "eventgrid.PartnerConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") return } result, err = client.CreateOrUpdateSender(req) if err != nil { err = autorest.NewErrorWithError(err, "eventgrid.PartnerConfigurationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") return } return } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client PartnerConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, partnerConfigurationInfo PartnerConfiguration) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2021-10-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } partnerConfigurationInfo.SystemData = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations/default", pathParameters), autorest.WithJSON(partnerConfigurationInfo), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client PartnerConfigurationsClient) CreateOrUpdateSender(req *http.Request) (future PartnerConfigurationsCreateOrUpdateFuture, err error) { var resp *http.Response future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return } var azf azure.Future azf, err = azure.NewFutureFromResponse(resp) future.FutureAPI = &azf future.Result = future.result return } // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client PartnerConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result PartnerConfiguration, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // Delete delete existing partner configuration. // Parameters: // resourceGroupName - the name of the resource group within the user's subscription. func (client PartnerConfigurationsClient) Delete(ctx context.Context, resourceGroupName string) (result PartnerConfigurationsDeleteFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/PartnerConfigurationsClient.Delete") defer func() { sc := -1 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { sc = result.FutureAPI.Response().StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.DeletePreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "eventgrid.PartnerConfigurationsClient", "Delete", nil, "Failure preparing request") return } result, err = client.DeleteSender(req) if err != nil { err = autorest.NewErrorWithError(err, "eventgrid.PartnerConfigurationsClient", "Delete", result.Response(), "Failure sending request") return } return } // DeletePreparer prepares the Delete request. func (client PartnerConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2021-10-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations/default", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client PartnerConfigurationsClient) DeleteSender(req *http.Request) (future PartnerConfigurationsDeleteFuture, err error) { var resp *http.Response future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return } var azf azure.Future azf, err = azure.NewFutureFromResponse(resp) future.FutureAPI = &azf future.Result = future.result return } // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client PartnerConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), autorest.ByClosing()) result.Response = resp return } // Get get properties of a partner configuration. // Parameters: // resourceGroupName - the name of the resource group within the user's subscription. func (client PartnerConfigurationsClient) Get(ctx context.Context, resourceGroupName string) (result PartnerConfiguration, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/PartnerConfigurationsClient.Get") defer func() { sc := -1 if result.Response.Response != nil { sc = result.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.GetPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "eventgrid.PartnerConfigurationsClient", "Get", nil, "Failure preparing request") return } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "eventgrid.PartnerConfigurationsClient", "Get", resp, "Failure sending request") return } result, err = client.GetResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "eventgrid.PartnerConfigurationsClient", "Get", resp, "Failure responding to request") return } return } // GetPreparer prepares the Get request. func (client PartnerConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2021-10-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations/default", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client PartnerConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client PartnerConfigurationsClient) GetResponder(resp *http.Response) (result PartnerConfiguration, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // ListByResourceGroup list all the partner configurations under a resource group. // Parameters: // resourceGroupName - the name of the resource group within the user's subscription. func (client PartnerConfigurationsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result PartnerConfigurationsListResult, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/PartnerConfigurationsClient.ListByResourceGroup") defer func() { sc := -1 if result.Response.Response != nil { sc = result.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "eventgrid.PartnerConfigurationsClient", "ListByResourceGroup", nil, "Failure preparing request") return } resp, err := client.ListByResourceGroupSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "eventgrid.PartnerConfigurationsClient", "ListByResourceGroup", resp, "Failure sending request") return } result, err = client.ListByResourceGroupResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "eventgrid.PartnerConfigurationsClient", "ListByResourceGroup", resp, "Failure responding to request") return } return } // ListByResourceGroupPreparer prepares the ListByResourceGroup request. func (client PartnerConfigurationsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2021-10-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the // http.Response Body if it receives an error. func (client PartnerConfigurationsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always // closes the http.Response Body. func (client PartnerConfigurationsClient) ListByResourceGroupResponder(resp *http.Response) (result PartnerConfigurationsListResult, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // ListBySubscription list all the partner configurations under an Azure subscription. // Parameters: // filter - the query used to filter the search results using OData syntax. Filtering is permitted on the // 'name' property only and with limited number of OData operations. These operations are: the 'contains' // function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). // No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, // 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq // 'westus'. // top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to // 100. If not specified, the default number of results to be returned is 20 items per page. func (client PartnerConfigurationsClient) ListBySubscription(ctx context.Context, filter string, top *int32) (result PartnerConfigurationsListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/PartnerConfigurationsClient.ListBySubscription") defer func() { sc := -1 if result.pclr.Response.Response != nil { sc = result.pclr.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() } result.fn = client.listBySubscriptionNextResults req, err := client.ListBySubscriptionPreparer(ctx, filter, top) if err != nil { err = autorest.NewErrorWithError(err, "eventgrid.PartnerConfigurationsClient", "ListBySubscription", nil, "Failure preparing request") return } resp, err := client.ListBySubscriptionSender(req) if err != nil { result.pclr.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "eventgrid.PartnerConfigurationsClient", "ListBySubscription", resp, "Failure sending request") return } result.pclr, err = client.ListBySubscriptionResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "eventgrid.PartnerConfigurationsClient", "ListBySubscription", resp, "Failure responding to request") return } if result.pclr.hasNextLink() && result.pclr.IsEmpty() { err = result.NextWithContext(ctx) return } return } // ListBySubscriptionPreparer prepares the ListBySubscription request. func (client PartnerConfigurationsClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { pathParameters := map[string]interface{}{ "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2021-10-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) } if top != nil { queryParameters["$top"] = autorest.Encode("query", *top) } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerConfigurations", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // ListBySubscriptionSender sends the ListBySubscription request. The method will close the // http.Response Body if it receives an error. func (client PartnerConfigurationsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always // closes the http.Response Body. func (client PartnerConfigurationsClient) ListBySubscriptionResponder(resp *http.Response) (result PartnerConfigurationsListResult, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // listBySubscriptionNextResults retrieves the next set of results, if any. func (client PartnerConfigurationsClient) listBySubscriptionNextResults(ctx context.Context, lastResults PartnerConfigurationsListResult) (result PartnerConfigurationsListResult, err error) { req, err := lastResults.partnerConfigurationsListResultPreparer(ctx) if err != nil { return result, autorest.NewErrorWithError(err, "eventgrid.PartnerConfigurationsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") } if req == nil { return } resp, err := client.ListBySubscriptionSender(req) if err != nil { result.Response = autorest.Response{Response: resp} return result, autorest.NewErrorWithError(err, "eventgrid.PartnerConfigurationsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") } result, err = client.ListBySubscriptionResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "eventgrid.PartnerConfigurationsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") } return } // ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. func (client PartnerConfigurationsClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result PartnerConfigurationsListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/PartnerConfigurationsClient.ListBySubscription") defer func() { sc := -1 if result.Response().Response.Response != nil { sc = result.page.Response().Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() } result.page, err = client.ListBySubscription(ctx, filter, top) return } // UnauthorizePartner unauthorize a single partner either by partner registration immutable Id or by partner name. // Parameters: // resourceGroupName - the name of the resource group within the user's subscription. // partnerInfo - the information of the partner to be unauthorized. func (client PartnerConfigurationsClient) UnauthorizePartner(ctx context.Context, resourceGroupName string, partnerInfo Partner) (result PartnerConfiguration, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/PartnerConfigurationsClient.UnauthorizePartner") defer func() { sc := -1 if result.Response.Response != nil { sc = result.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.UnauthorizePartnerPreparer(ctx, resourceGroupName, partnerInfo) if err != nil { err = autorest.NewErrorWithError(err, "eventgrid.PartnerConfigurationsClient", "UnauthorizePartner", nil, "Failure preparing request") return } resp, err := client.UnauthorizePartnerSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "eventgrid.PartnerConfigurationsClient", "UnauthorizePartner", resp, "Failure sending request") return } result, err = client.UnauthorizePartnerResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "eventgrid.PartnerConfigurationsClient", "UnauthorizePartner", resp, "Failure responding to request") return } return } // UnauthorizePartnerPreparer prepares the UnauthorizePartner request. func (client PartnerConfigurationsClient) UnauthorizePartnerPreparer(ctx context.Context, resourceGroupName string, partnerInfo Partner) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2021-10-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations/default/unauthorizePartner", pathParameters), autorest.WithJSON(partnerInfo), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // UnauthorizePartnerSender sends the UnauthorizePartner request. The method will close the // http.Response Body if it receives an error. func (client PartnerConfigurationsClient) UnauthorizePartnerSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // UnauthorizePartnerResponder handles the response to the UnauthorizePartner request. The method always // closes the http.Response Body. func (client PartnerConfigurationsClient) UnauthorizePartnerResponder(resp *http.Response) (result PartnerConfiguration, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // Update synchronously updates a partner configuration with the specified parameters. // Parameters: // resourceGroupName - the name of the resource group within the user's subscription. // partnerConfigurationUpdateParameters - partner configuration update information. func (client PartnerConfigurationsClient) Update(ctx context.Context, resourceGroupName string, partnerConfigurationUpdateParameters PartnerConfigurationUpdateParameters) (result PartnerConfigurationsUpdateFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/PartnerConfigurationsClient.Update") defer func() { sc := -1 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { sc = result.FutureAPI.Response().StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.UpdatePreparer(ctx, resourceGroupName, partnerConfigurationUpdateParameters) if err != nil { err = autorest.NewErrorWithError(err, "eventgrid.PartnerConfigurationsClient", "Update", nil, "Failure preparing request") return } result, err = client.UpdateSender(req) if err != nil { err = autorest.NewErrorWithError(err, "eventgrid.PartnerConfigurationsClient", "Update", result.Response(), "Failure sending request") return } return } // UpdatePreparer prepares the Update request. func (client PartnerConfigurationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, partnerConfigurationUpdateParameters PartnerConfigurationUpdateParameters) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2021-10-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations/default", pathParameters), autorest.WithJSON(partnerConfigurationUpdateParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. func (client PartnerConfigurationsClient) UpdateSender(req *http.Request) (future PartnerConfigurationsUpdateFuture, err error) { var resp *http.Response future.FutureAPI = &azure.Future{} resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) if err != nil { return } var azf azure.Future azf, err = azure.NewFutureFromResponse(resp) future.FutureAPI = &azf future.Result = future.result return } // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. func (client PartnerConfigurationsClient) UpdateResponder(resp *http.Response) (result PartnerConfiguration, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return }