diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/CHANGELOG.md b/sdk/resourcemanager/eventgrid/armeventgrid/CHANGELOG.md index 0498497d8e5f..93ac1be1d3a5 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/CHANGELOG.md +++ b/sdk/resourcemanager/eventgrid/armeventgrid/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 2.2.0 (2023-11-24) +### Features Added + +- Support for test fakes and OpenTelemetry trace spans. + + ## 2.2.0-beta.1 (2023-05-26) ### Features Added diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/README.md b/sdk/resourcemanager/eventgrid/armeventgrid/README.md index 5b1725ce0e85..12880e13317b 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/README.md +++ b/sdk/resourcemanager/eventgrid/armeventgrid/README.md @@ -60,6 +60,13 @@ A client groups a set of related APIs, providing access to its functionality. C client := clientFactory.NewPartnerNamespacesClient() ``` +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + ## More sample code - [Domain](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/eventgrid/domain) diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/assets.json b/sdk/resourcemanager/eventgrid/armeventgrid/assets.json index 8c5e6e48b195..744f9e264909 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/assets.json +++ b/sdk/resourcemanager/eventgrid/armeventgrid/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "go", "TagPrefix": "go/resourcemanager/eventgrid/armeventgrid", - "Tag": "go/resourcemanager/eventgrid/armeventgrid_b2276859e2" + "Tag": "go/resourcemanager/eventgrid/armeventgrid_681fe05189" } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/autorest.md b/sdk/resourcemanager/eventgrid/armeventgrid/autorest.md index adec3a1e14a6..4270d63cd2ad 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/autorest.md +++ b/sdk/resourcemanager/eventgrid/armeventgrid/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 2.2.0-beta.1 -tag: package-2023-06-preview +module-version: 2.2.0 +tag: package-2022-06 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/cacertificates_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/cacertificates_client.go deleted file mode 100644 index 308b9fe2f0de..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/cacertificates_client.go +++ /dev/null @@ -1,330 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armeventgrid - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strconv" - "strings" -) - -// CaCertificatesClient contains the methods for the CaCertificates group. -// Don't use this type directly, use NewCaCertificatesClient() instead. -type CaCertificatesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewCaCertificatesClient creates a new instance of CaCertificatesClient with the specified values. -// - subscriptionID - Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewCaCertificatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CaCertificatesClient, error) { - cl, err := arm.NewClient(moduleName+".CaCertificatesClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &CaCertificatesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreateOrUpdate - Create or update a CA certificate with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - caCertificateName - The CA certificate name. -// - caCertificateInfo - CA certificate information. -// - options - CaCertificatesClientBeginCreateOrUpdateOptions contains the optional parameters for the CaCertificatesClient.BeginCreateOrUpdate -// method. -func (client *CaCertificatesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, caCertificateName string, caCertificateInfo CaCertificate, options *CaCertificatesClientBeginCreateOrUpdateOptions) (*runtime.Poller[CaCertificatesClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, namespaceName, caCertificateName, caCertificateInfo, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CaCertificatesClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[CaCertificatesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// CreateOrUpdate - Create or update a CA certificate with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *CaCertificatesClient) createOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, caCertificateName string, caCertificateInfo CaCertificate, options *CaCertificatesClientBeginCreateOrUpdateOptions) (*http.Response, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, namespaceName, caCertificateName, caCertificateInfo, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *CaCertificatesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, caCertificateName string, caCertificateInfo CaCertificate, options *CaCertificatesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/caCertificates/{caCertificateName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if caCertificateName == "" { - return nil, errors.New("parameter caCertificateName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{caCertificateName}", url.PathEscape(caCertificateName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, caCertificateInfo) -} - -// BeginDelete - Delete an existing CA certificate. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - caCertificateName - Name of the CA certificate. -// - options - CaCertificatesClientBeginDeleteOptions contains the optional parameters for the CaCertificatesClient.BeginDelete -// method. -func (client *CaCertificatesClient) BeginDelete(ctx context.Context, resourceGroupName string, namespaceName string, caCertificateName string, options *CaCertificatesClientBeginDeleteOptions) (*runtime.Poller[CaCertificatesClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, namespaceName, caCertificateName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CaCertificatesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[CaCertificatesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Delete - Delete an existing CA certificate. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *CaCertificatesClient) deleteOperation(ctx context.Context, resourceGroupName string, namespaceName string, caCertificateName string, options *CaCertificatesClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, namespaceName, caCertificateName, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *CaCertificatesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, caCertificateName string, options *CaCertificatesClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/caCertificates/{caCertificateName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if caCertificateName == "" { - return nil, errors.New("parameter caCertificateName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{caCertificateName}", url.PathEscape(caCertificateName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get properties of a CA certificate. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - caCertificateName - Name of the CA certificate. -// - options - CaCertificatesClientGetOptions contains the optional parameters for the CaCertificatesClient.Get method. -func (client *CaCertificatesClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, caCertificateName string, options *CaCertificatesClientGetOptions) (CaCertificatesClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, namespaceName, caCertificateName, options) - if err != nil { - return CaCertificatesClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return CaCertificatesClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CaCertificatesClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *CaCertificatesClient) getCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, caCertificateName string, options *CaCertificatesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/caCertificates/{caCertificateName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if caCertificateName == "" { - return nil, errors.New("parameter caCertificateName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{caCertificateName}", url.PathEscape(caCertificateName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *CaCertificatesClient) getHandleResponse(resp *http.Response) (CaCertificatesClientGetResponse, error) { - result := CaCertificatesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.CaCertificate); err != nil { - return CaCertificatesClientGetResponse{}, err - } - return result, nil -} - -// NewListByNamespacePager - Get all the CA certificates under a namespace. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - options - CaCertificatesClientListByNamespaceOptions contains the optional parameters for the CaCertificatesClient.NewListByNamespacePager -// method. -func (client *CaCertificatesClient) NewListByNamespacePager(resourceGroupName string, namespaceName string, options *CaCertificatesClientListByNamespaceOptions) *runtime.Pager[CaCertificatesClientListByNamespaceResponse] { - return runtime.NewPager(runtime.PagingHandler[CaCertificatesClientListByNamespaceResponse]{ - More: func(page CaCertificatesClientListByNamespaceResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *CaCertificatesClientListByNamespaceResponse) (CaCertificatesClientListByNamespaceResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByNamespaceCreateRequest(ctx, resourceGroupName, namespaceName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return CaCertificatesClientListByNamespaceResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return CaCertificatesClientListByNamespaceResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CaCertificatesClientListByNamespaceResponse{}, runtime.NewResponseError(resp) - } - return client.listByNamespaceHandleResponse(resp) - }, - }) -} - -// listByNamespaceCreateRequest creates the ListByNamespace request. -func (client *CaCertificatesClient) listByNamespaceCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, options *CaCertificatesClientListByNamespaceOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/caCertificates" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByNamespaceHandleResponse handles the ListByNamespace response. -func (client *CaCertificatesClient) listByNamespaceHandleResponse(resp *http.Response) (CaCertificatesClientListByNamespaceResponse, error) { - result := CaCertificatesClientListByNamespaceResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.CaCertificatesListResult); err != nil { - return CaCertificatesClientListByNamespaceResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/cacertificates_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/cacertificates_client_example_test.go deleted file mode 100644 index dbfe95cb4936..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/cacertificates_client_example_test.go +++ /dev/null @@ -1,155 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armeventgrid_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/CaCertificates_Get.json -func ExampleCaCertificatesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCaCertificatesClient().Get(ctx, "examplerg", "exampleNamespaceName1", "exampleCACertificateName1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CaCertificate = armeventgrid.CaCertificate{ - // Name: to.Ptr("exampleCACertificateName1"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces/caCertificates"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/exampleNamespaceName1/caCertificates/exampleCACertificateName1"), - // Properties: &armeventgrid.CaCertificateProperties{ - // Description: to.Ptr("This is a test Root certificate"), - // EncodedCertificate: to.Ptr("base64EncodePemFormattedCertificateString"), - // ExpiryTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-12T23:06:43+00:00"); return t}()), - // IssueTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-12T23:06:43+00:00"); return t}()), - // ProvisioningState: to.Ptr(armeventgrid.CaCertificateProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/CaCertificates_CreateOrUpdate.json -func ExampleCaCertificatesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCaCertificatesClient().BeginCreateOrUpdate(ctx, "examplerg", "exampleNamespaceName1", "exampleCACertificateName1", armeventgrid.CaCertificate{ - Properties: &armeventgrid.CaCertificateProperties{ - Description: to.Ptr("This is a test certificate"), - EncodedCertificate: to.Ptr("base64EncodePemFormattedCertificateString"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CaCertificate = armeventgrid.CaCertificate{ - // Name: to.Ptr("exampleCACertificateName1"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces/caCertificates"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/exampleNamespaceName1/caCertificates/exampleCACertificateName1"), - // Properties: &armeventgrid.CaCertificateProperties{ - // Description: to.Ptr("This is a test Root certificate"), - // EncodedCertificate: to.Ptr("base64EncodePemFormattedCertificateString"), - // ExpiryTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-12T23:06:43+00:00"); return t}()), - // IssueTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-12T23:06:43+00:00"); return t}()), - // ProvisioningState: to.Ptr(armeventgrid.CaCertificateProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/CaCertificates_Delete.json -func ExampleCaCertificatesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCaCertificatesClient().BeginDelete(ctx, "examplerg", "exampleNamespaceName1", "exampleCACertificateName1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/CaCertificates_ListByNamespace.json -func ExampleCaCertificatesClient_NewListByNamespacePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCaCertificatesClient().NewListByNamespacePager("examplerg", "namespace123", &armeventgrid.CaCertificatesClientListByNamespaceOptions{Filter: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CaCertificatesListResult = armeventgrid.CaCertificatesListResult{ - // Value: []*armeventgrid.CaCertificate{ - // { - // Name: to.Ptr("exampleCACertificateName1"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces/caCertificates"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/exampleNamespaceName1/caCertificates/exampleCACertificateName1"), - // Properties: &armeventgrid.CaCertificateProperties{ - // Description: to.Ptr("This is a test Root certificate"), - // EncodedCertificate: to.Ptr("base64EncodePemFormattedCertificateString"), - // ExpiryTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-12T23:06:43+00:00"); return t}()), - // IssueTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-12T23:06:43+00:00"); return t}()), - // ProvisioningState: to.Ptr(armeventgrid.CaCertificateProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/channels_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/channels_client.go index 12f65eada4f7..81abb4b20274 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/channels_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/channels_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid @@ -35,7 +34,7 @@ type ChannelsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewChannelsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ChannelsClient, error) { - cl, err := arm.NewClient(moduleName+".ChannelsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -49,25 +48,32 @@ func NewChannelsClient(subscriptionID string, credential azcore.TokenCredential, // CreateOrUpdate - Synchronously creates or updates a new channel with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the partners subscription. // - partnerNamespaceName - Name of the partner namespace. // - channelName - Name of the channel. // - channelInfo - Channel information. // - options - ChannelsClientCreateOrUpdateOptions contains the optional parameters for the ChannelsClient.CreateOrUpdate method. func (client *ChannelsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerNamespaceName string, channelName string, channelInfo Channel, options *ChannelsClientCreateOrUpdateOptions) (ChannelsClientCreateOrUpdateResponse, error) { + var err error + const operationName = "ChannelsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, partnerNamespaceName, channelName, channelInfo, options) if err != nil { return ChannelsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ChannelsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return ChannelsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ChannelsClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -94,10 +100,13 @@ func (client *ChannelsClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, channelInfo) + if err := runtime.MarshalAsJSON(req, channelInfo); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -112,7 +121,7 @@ func (client *ChannelsClient) createOrUpdateHandleResponse(resp *http.Response) // BeginDelete - Delete an existing channel. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the partners subscription. // - partnerNamespaceName - Name of the partner namespace. // - channelName - Name of the channel. @@ -123,29 +132,40 @@ func (client *ChannelsClient) BeginDelete(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[ChannelsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ChannelsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[ChannelsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ChannelsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Delete - Delete an existing channel. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *ChannelsClient) deleteOperation(ctx context.Context, resourceGroupName string, partnerNamespaceName string, channelName string, options *ChannelsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ChannelsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, partnerNamespaceName, channelName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -172,7 +192,7 @@ func (client *ChannelsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -180,24 +200,31 @@ func (client *ChannelsClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Get properties of a channel. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the partners subscription. // - partnerNamespaceName - Name of the partner namespace. // - channelName - Name of the channel. // - options - ChannelsClientGetOptions contains the optional parameters for the ChannelsClient.Get method. func (client *ChannelsClient) Get(ctx context.Context, resourceGroupName string, partnerNamespaceName string, channelName string, options *ChannelsClientGetOptions) (ChannelsClientGetResponse, error) { + var err error + const operationName = "ChannelsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, partnerNamespaceName, channelName, options) if err != nil { return ChannelsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ChannelsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ChannelsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ChannelsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -224,7 +251,7 @@ func (client *ChannelsClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -242,24 +269,31 @@ func (client *ChannelsClient) getHandleResponse(resp *http.Response) (ChannelsCl // GetFullURL - Get the full endpoint URL of a partner destination channel. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the partners subscription. // - partnerNamespaceName - Name of the partner namespace. // - channelName - Name of the Channel. // - options - ChannelsClientGetFullURLOptions contains the optional parameters for the ChannelsClient.GetFullURL method. func (client *ChannelsClient) GetFullURL(ctx context.Context, resourceGroupName string, partnerNamespaceName string, channelName string, options *ChannelsClientGetFullURLOptions) (ChannelsClientGetFullURLResponse, error) { + var err error + const operationName = "ChannelsClient.GetFullURL" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getFullURLCreateRequest(ctx, resourceGroupName, partnerNamespaceName, channelName, options) if err != nil { return ChannelsClientGetFullURLResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ChannelsClientGetFullURLResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ChannelsClientGetFullURLResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ChannelsClientGetFullURLResponse{}, err } - return client.getFullURLHandleResponse(resp) + resp, err := client.getFullURLHandleResponse(httpResp) + return resp, err } // getFullURLCreateRequest creates the GetFullURL request. @@ -286,7 +320,7 @@ func (client *ChannelsClient) getFullURLCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -303,7 +337,7 @@ func (client *ChannelsClient) getFullURLHandleResponse(resp *http.Response) (Cha // NewListByPartnerNamespacePager - List all the channels in a partner namespace. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the partners subscription. // - partnerNamespaceName - Name of the partner namespace. // - options - ChannelsClientListByPartnerNamespaceOptions contains the optional parameters for the ChannelsClient.NewListByPartnerNamespacePager @@ -314,25 +348,20 @@ func (client *ChannelsClient) NewListByPartnerNamespacePager(resourceGroupName s return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ChannelsClientListByPartnerNamespaceResponse) (ChannelsClientListByPartnerNamespaceResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByPartnerNamespaceCreateRequest(ctx, resourceGroupName, partnerNamespaceName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ChannelsClient.NewListByPartnerNamespacePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByPartnerNamespaceCreateRequest(ctx, resourceGroupName, partnerNamespaceName, options) + }, nil) if err != nil { return ChannelsClientListByPartnerNamespaceResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ChannelsClientListByPartnerNamespaceResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ChannelsClientListByPartnerNamespaceResponse{}, runtime.NewResponseError(resp) - } return client.listByPartnerNamespaceHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -356,7 +385,7 @@ func (client *ChannelsClient) listByPartnerNamespaceCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -380,23 +409,29 @@ func (client *ChannelsClient) listByPartnerNamespaceHandleResponse(resp *http.Re // Update - Synchronously updates a channel with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the partners subscription. // - partnerNamespaceName - Name of the partner namespace. // - channelName - Name of the channel. // - channelUpdateParameters - Channel update information. // - options - ChannelsClientUpdateOptions contains the optional parameters for the ChannelsClient.Update method. func (client *ChannelsClient) Update(ctx context.Context, resourceGroupName string, partnerNamespaceName string, channelName string, channelUpdateParameters ChannelUpdateParameters, options *ChannelsClientUpdateOptions) (ChannelsClientUpdateResponse, error) { + var err error + const operationName = "ChannelsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, partnerNamespaceName, channelName, channelUpdateParameters, options) if err != nil { return ChannelsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ChannelsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ChannelsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ChannelsClientUpdateResponse{}, err } return ChannelsClientUpdateResponse{}, nil } @@ -425,7 +460,10 @@ func (client *ChannelsClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() - return req, runtime.MarshalAsJSON(req, channelUpdateParameters) + if err := runtime.MarshalAsJSON(req, channelUpdateParameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/channels_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/channels_client_example_test.go index ce70039795a9..3b06a68a267e 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/channels_client_example_test.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/channels_client_example_test.go @@ -20,7 +20,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Channels_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Channels_Get.json func ExampleChannelsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -41,14 +41,14 @@ func ExampleChannelsClient_Get() { // res.Channel = armeventgrid.Channel{ // Name: to.Ptr("exampleChannelName1"), // Type: to.Ptr("Microsoft.EventGrid/partnerNamespaces/channels"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerNamespaces/examplePartnerNamespaceName1/changes/exampleChannelName1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerNamespaces/examplePartnerNamespaceName1/changes/exampleChannelName1"), // Properties: &armeventgrid.ChannelProperties{ // ChannelType: to.Ptr(armeventgrid.ChannelTypePartnerTopic), - // ExpirationTimeIfNotActivatedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-21T22:50:25.410433Z"); return t}()), + // ExpirationTimeIfNotActivatedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-21T22:50:25.410Z"); return t}()), // MessageForActivation: to.Ptr("Example message to approver"), // PartnerTopicInfo: &armeventgrid.PartnerTopicInfo{ // Name: to.Ptr("examplePartnerTopic1"), - // AzureSubscriptionID: to.Ptr("8f6b6269-84f2-4d09-9e31-1127efcd1e40"), + // AzureSubscriptionID: to.Ptr("5b4b650e-28b9-4790-b3ab-ddbd88d727c4"), // ResourceGroupName: to.Ptr("examplerg2"), // Source: to.Ptr("ContosoCorp.Accounts.User1"), // }, @@ -58,7 +58,7 @@ func ExampleChannelsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Channels_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Channels_CreateOrUpdate.json func ExampleChannelsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -72,11 +72,11 @@ func ExampleChannelsClient_CreateOrUpdate() { res, err := clientFactory.NewChannelsClient().CreateOrUpdate(ctx, "examplerg", "examplePartnerNamespaceName1", "exampleChannelName1", armeventgrid.Channel{ Properties: &armeventgrid.ChannelProperties{ ChannelType: to.Ptr(armeventgrid.ChannelTypePartnerTopic), - ExpirationTimeIfNotActivatedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-21T22:50:25.410433Z"); return t }()), + ExpirationTimeIfNotActivatedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-21T22:50:25.410Z"); return t }()), MessageForActivation: to.Ptr("Example message to approver"), PartnerTopicInfo: &armeventgrid.PartnerTopicInfo{ Name: to.Ptr("examplePartnerTopic1"), - AzureSubscriptionID: to.Ptr("8f6b6269-84f2-4d09-9e31-1127efcd1e40"), + AzureSubscriptionID: to.Ptr("5b4b650e-28b9-4790-b3ab-ddbd88d727c4"), ResourceGroupName: to.Ptr("examplerg2"), Source: to.Ptr("ContosoCorp.Accounts.User1"), }, @@ -91,14 +91,14 @@ func ExampleChannelsClient_CreateOrUpdate() { // res.Channel = armeventgrid.Channel{ // Name: to.Ptr("exampleChannelName1"), // Type: to.Ptr("Microsoft.EventGrid/partnerNamespaces/channels"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerNamespaces/examplePartnerNamespaceName1/changes/exampleChannelName1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerNamespaces/examplePartnerNamespaceName1/changes/exampleChannelName1"), // Properties: &armeventgrid.ChannelProperties{ // ChannelType: to.Ptr(armeventgrid.ChannelTypePartnerTopic), - // ExpirationTimeIfNotActivatedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-21T22:50:25.410433Z"); return t}()), + // ExpirationTimeIfNotActivatedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-21T22:50:25.410Z"); return t}()), // MessageForActivation: to.Ptr("Example message to approver"), // PartnerTopicInfo: &armeventgrid.PartnerTopicInfo{ // Name: to.Ptr("examplePartnerTopic1"), - // AzureSubscriptionID: to.Ptr("8f6b6269-84f2-4d09-9e31-1127efcd1e40"), + // AzureSubscriptionID: to.Ptr("5b4b650e-28b9-4790-b3ab-ddbd88d727c4"), // ResourceGroupName: to.Ptr("examplerg2"), // Source: to.Ptr("ContosoCorp.Accounts.User1"), // }, @@ -106,7 +106,7 @@ func ExampleChannelsClient_CreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Channels_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Channels_Delete.json func ExampleChannelsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -127,7 +127,7 @@ func ExampleChannelsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Channels_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Channels_Update.json func ExampleChannelsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -148,7 +148,7 @@ func ExampleChannelsClient_Update() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Channels_ListByPartnerNamespace.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Channels_ListByPartnerNamespace.json func ExampleChannelsClient_NewListByPartnerNamespacePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -177,14 +177,14 @@ func ExampleChannelsClient_NewListByPartnerNamespacePager() { // { // Name: to.Ptr("exampleChannelName1"), // Type: to.Ptr("Microsoft.EventGrid/partnerNamespaces/channels"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerNamespaces/examplePartnerNamespaceName1/changes/exampleChannelName1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerNamespaces/examplePartnerNamespaceName1/changes/exampleChannelName1"), // Properties: &armeventgrid.ChannelProperties{ // ChannelType: to.Ptr(armeventgrid.ChannelTypePartnerTopic), - // ExpirationTimeIfNotActivatedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-21T22:50:25.410433Z"); return t}()), + // ExpirationTimeIfNotActivatedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-21T22:50:25.410Z"); return t}()), // MessageForActivation: to.Ptr("Example message to approver"), // PartnerTopicInfo: &armeventgrid.PartnerTopicInfo{ // Name: to.Ptr("examplePartnerTopic1"), - // AzureSubscriptionID: to.Ptr("8f6b6269-84f2-4d09-9e31-1127efcd1e40"), + // AzureSubscriptionID: to.Ptr("5b4b650e-28b9-4790-b3ab-ddbd88d727c4"), // ResourceGroupName: to.Ptr("examplerg2"), // Source: to.Ptr("ContosoCorp.Accounts.User1"), // }, @@ -196,7 +196,7 @@ func ExampleChannelsClient_NewListByPartnerNamespacePager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Channels_GetFullUrl.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Channels_GetFullUrl.json func ExampleChannelsClient_GetFullURL() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/client_factory.go b/sdk/resourcemanager/eventgrid/armeventgrid/client_factory.go index 17ee72896c8e..cacb2bbdf580 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/client_factory.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/client_factory.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid @@ -29,7 +28,7 @@ type ClientFactory struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + _, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -39,151 +38,127 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -func (c *ClientFactory) NewCaCertificatesClient() *CaCertificatesClient { - subClient, _ := NewCaCertificatesClient(c.subscriptionID, c.credential, c.options) - return subClient -} - +// NewChannelsClient creates a new instance of ChannelsClient. func (c *ClientFactory) NewChannelsClient() *ChannelsClient { subClient, _ := NewChannelsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewClientGroupsClient() *ClientGroupsClient { - subClient, _ := NewClientGroupsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -func (c *ClientFactory) NewClientsClient() *ClientsClient { - subClient, _ := NewClientsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -func (c *ClientFactory) NewDomainsClient() *DomainsClient { - subClient, _ := NewDomainsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -func (c *ClientFactory) NewDomainTopicsClient() *DomainTopicsClient { - subClient, _ := NewDomainTopicsClient(c.subscriptionID, c.credential, c.options) +// NewDomainEventSubscriptionsClient creates a new instance of DomainEventSubscriptionsClient. +func (c *ClientFactory) NewDomainEventSubscriptionsClient() *DomainEventSubscriptionsClient { + subClient, _ := NewDomainEventSubscriptionsClient(c.subscriptionID, c.credential, c.options) return subClient } +// NewDomainTopicEventSubscriptionsClient creates a new instance of DomainTopicEventSubscriptionsClient. func (c *ClientFactory) NewDomainTopicEventSubscriptionsClient() *DomainTopicEventSubscriptionsClient { subClient, _ := NewDomainTopicEventSubscriptionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewTopicEventSubscriptionsClient() *TopicEventSubscriptionsClient { - subClient, _ := NewTopicEventSubscriptionsClient(c.subscriptionID, c.credential, c.options) +// NewDomainTopicsClient creates a new instance of DomainTopicsClient. +func (c *ClientFactory) NewDomainTopicsClient() *DomainTopicsClient { + subClient, _ := NewDomainTopicsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewDomainEventSubscriptionsClient() *DomainEventSubscriptionsClient { - subClient, _ := NewDomainEventSubscriptionsClient(c.subscriptionID, c.credential, c.options) +// NewDomainsClient creates a new instance of DomainsClient. +func (c *ClientFactory) NewDomainsClient() *DomainsClient { + subClient, _ := NewDomainsClient(c.subscriptionID, c.credential, c.options) return subClient } +// NewEventSubscriptionsClient creates a new instance of EventSubscriptionsClient. func (c *ClientFactory) NewEventSubscriptionsClient() *EventSubscriptionsClient { subClient, _ := NewEventSubscriptionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewSystemTopicEventSubscriptionsClient() *SystemTopicEventSubscriptionsClient { - subClient, _ := NewSystemTopicEventSubscriptionsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -func (c *ClientFactory) NewNamespaceTopicEventSubscriptionsClient() *NamespaceTopicEventSubscriptionsClient { - subClient, _ := NewNamespaceTopicEventSubscriptionsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -func (c *ClientFactory) NewPartnerTopicEventSubscriptionsClient() *PartnerTopicEventSubscriptionsClient { - subClient, _ := NewPartnerTopicEventSubscriptionsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -func (c *ClientFactory) NewNamespacesClient() *NamespacesClient { - subClient, _ := NewNamespacesClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -func (c *ClientFactory) NewNamespaceTopicsClient() *NamespaceTopicsClient { - subClient, _ := NewNamespaceTopicsClient(c.subscriptionID, c.credential, c.options) +// NewExtensionTopicsClient creates a new instance of ExtensionTopicsClient. +func (c *ClientFactory) NewExtensionTopicsClient() *ExtensionTopicsClient { + subClient, _ := NewExtensionTopicsClient(c.credential, c.options) return subClient } +// NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } +// NewPartnerConfigurationsClient creates a new instance of PartnerConfigurationsClient. func (c *ClientFactory) NewPartnerConfigurationsClient() *PartnerConfigurationsClient { subClient, _ := NewPartnerConfigurationsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewPartnerDestinationsClient() *PartnerDestinationsClient { - subClient, _ := NewPartnerDestinationsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - +// NewPartnerNamespacesClient creates a new instance of PartnerNamespacesClient. func (c *ClientFactory) NewPartnerNamespacesClient() *PartnerNamespacesClient { subClient, _ := NewPartnerNamespacesClient(c.subscriptionID, c.credential, c.options) return subClient } +// NewPartnerRegistrationsClient creates a new instance of PartnerRegistrationsClient. func (c *ClientFactory) NewPartnerRegistrationsClient() *PartnerRegistrationsClient { subClient, _ := NewPartnerRegistrationsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewPartnerTopicsClient() *PartnerTopicsClient { - subClient, _ := NewPartnerTopicsClient(c.subscriptionID, c.credential, c.options) +// NewPartnerTopicEventSubscriptionsClient creates a new instance of PartnerTopicEventSubscriptionsClient. +func (c *ClientFactory) NewPartnerTopicEventSubscriptionsClient() *PartnerTopicEventSubscriptionsClient { + subClient, _ := NewPartnerTopicEventSubscriptionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewPermissionBindingsClient() *PermissionBindingsClient { - subClient, _ := NewPermissionBindingsClient(c.subscriptionID, c.credential, c.options) +// NewPartnerTopicsClient creates a new instance of PartnerTopicsClient. +func (c *ClientFactory) NewPartnerTopicsClient() *PartnerTopicsClient { + subClient, _ := NewPartnerTopicsClient(c.subscriptionID, c.credential, c.options) return subClient } +// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient. func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) return subClient } +// NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient. func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewSystemTopicsClient() *SystemTopicsClient { - subClient, _ := NewSystemTopicsClient(c.subscriptionID, c.credential, c.options) +// NewSystemTopicEventSubscriptionsClient creates a new instance of SystemTopicEventSubscriptionsClient. +func (c *ClientFactory) NewSystemTopicEventSubscriptionsClient() *SystemTopicEventSubscriptionsClient { + subClient, _ := NewSystemTopicEventSubscriptionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewTopicsClient() *TopicsClient { - subClient, _ := NewTopicsClient(c.subscriptionID, c.credential, c.options) +// NewSystemTopicsClient creates a new instance of SystemTopicsClient. +func (c *ClientFactory) NewSystemTopicsClient() *SystemTopicsClient { + subClient, _ := NewSystemTopicsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewExtensionTopicsClient() *ExtensionTopicsClient { - subClient, _ := NewExtensionTopicsClient(c.credential, c.options) +// NewTopicEventSubscriptionsClient creates a new instance of TopicEventSubscriptionsClient. +func (c *ClientFactory) NewTopicEventSubscriptionsClient() *TopicEventSubscriptionsClient { + subClient, _ := NewTopicEventSubscriptionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewTopicSpacesClient() *TopicSpacesClient { - subClient, _ := NewTopicSpacesClient(c.subscriptionID, c.credential, c.options) +// NewTopicTypesClient creates a new instance of TopicTypesClient. +func (c *ClientFactory) NewTopicTypesClient() *TopicTypesClient { + subClient, _ := NewTopicTypesClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewTopicTypesClient() *TopicTypesClient { - subClient, _ := NewTopicTypesClient(c.credential, c.options) +// NewTopicsClient creates a new instance of TopicsClient. +func (c *ClientFactory) NewTopicsClient() *TopicsClient { + subClient, _ := NewTopicsClient(c.subscriptionID, c.credential, c.options) return subClient } +// NewVerifiedPartnersClient creates a new instance of VerifiedPartnersClient. func (c *ClientFactory) NewVerifiedPartnersClient() *VerifiedPartnersClient { subClient, _ := NewVerifiedPartnersClient(c.credential, c.options) return subClient diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/clientgroups_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/clientgroups_client.go deleted file mode 100644 index 011a9829a191..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/clientgroups_client.go +++ /dev/null @@ -1,330 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armeventgrid - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strconv" - "strings" -) - -// ClientGroupsClient contains the methods for the ClientGroups group. -// Don't use this type directly, use NewClientGroupsClient() instead. -type ClientGroupsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewClientGroupsClient creates a new instance of ClientGroupsClient with the specified values. -// - subscriptionID - Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewClientGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientGroupsClient, error) { - cl, err := arm.NewClient(moduleName+".ClientGroupsClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ClientGroupsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreateOrUpdate - Create or update a client group with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - clientGroupName - The client group name. -// - clientGroupInfo - Client group information. -// - options - ClientGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the ClientGroupsClient.BeginCreateOrUpdate -// method. -func (client *ClientGroupsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, clientGroupName string, clientGroupInfo ClientGroup, options *ClientGroupsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ClientGroupsClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, namespaceName, clientGroupName, clientGroupInfo, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientGroupsClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[ClientGroupsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// CreateOrUpdate - Create or update a client group with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *ClientGroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, clientGroupName string, clientGroupInfo ClientGroup, options *ClientGroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, namespaceName, clientGroupName, clientGroupInfo, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ClientGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, clientGroupName string, clientGroupInfo ClientGroup, options *ClientGroupsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clientGroups/{clientGroupName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if clientGroupName == "" { - return nil, errors.New("parameter clientGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{clientGroupName}", url.PathEscape(clientGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, clientGroupInfo) -} - -// BeginDelete - Delete an existing client group. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - clientGroupName - Name of the client group. -// - options - ClientGroupsClientBeginDeleteOptions contains the optional parameters for the ClientGroupsClient.BeginDelete -// method. -func (client *ClientGroupsClient) BeginDelete(ctx context.Context, resourceGroupName string, namespaceName string, clientGroupName string, options *ClientGroupsClientBeginDeleteOptions) (*runtime.Poller[ClientGroupsClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, namespaceName, clientGroupName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientGroupsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[ClientGroupsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Delete - Delete an existing client group. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *ClientGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, namespaceName string, clientGroupName string, options *ClientGroupsClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, namespaceName, clientGroupName, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ClientGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, clientGroupName string, options *ClientGroupsClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clientGroups/{clientGroupName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if clientGroupName == "" { - return nil, errors.New("parameter clientGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{clientGroupName}", url.PathEscape(clientGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get properties of a client group. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - clientGroupName - Name of the client group. -// - options - ClientGroupsClientGetOptions contains the optional parameters for the ClientGroupsClient.Get method. -func (client *ClientGroupsClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, clientGroupName string, options *ClientGroupsClientGetOptions) (ClientGroupsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, namespaceName, clientGroupName, options) - if err != nil { - return ClientGroupsClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ClientGroupsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientGroupsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *ClientGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, clientGroupName string, options *ClientGroupsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clientGroups/{clientGroupName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if clientGroupName == "" { - return nil, errors.New("parameter clientGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{clientGroupName}", url.PathEscape(clientGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ClientGroupsClient) getHandleResponse(resp *http.Response) (ClientGroupsClientGetResponse, error) { - result := ClientGroupsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ClientGroup); err != nil { - return ClientGroupsClientGetResponse{}, err - } - return result, nil -} - -// NewListByNamespacePager - Get all the client groups under a namespace. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - options - ClientGroupsClientListByNamespaceOptions contains the optional parameters for the ClientGroupsClient.NewListByNamespacePager -// method. -func (client *ClientGroupsClient) NewListByNamespacePager(resourceGroupName string, namespaceName string, options *ClientGroupsClientListByNamespaceOptions) *runtime.Pager[ClientGroupsClientListByNamespaceResponse] { - return runtime.NewPager(runtime.PagingHandler[ClientGroupsClientListByNamespaceResponse]{ - More: func(page ClientGroupsClientListByNamespaceResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ClientGroupsClientListByNamespaceResponse) (ClientGroupsClientListByNamespaceResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByNamespaceCreateRequest(ctx, resourceGroupName, namespaceName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ClientGroupsClientListByNamespaceResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ClientGroupsClientListByNamespaceResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientGroupsClientListByNamespaceResponse{}, runtime.NewResponseError(resp) - } - return client.listByNamespaceHandleResponse(resp) - }, - }) -} - -// listByNamespaceCreateRequest creates the ListByNamespace request. -func (client *ClientGroupsClient) listByNamespaceCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, options *ClientGroupsClientListByNamespaceOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clientGroups" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByNamespaceHandleResponse handles the ListByNamespace response. -func (client *ClientGroupsClient) listByNamespaceHandleResponse(resp *http.Response) (ClientGroupsClientListByNamespaceResponse, error) { - result := ClientGroupsClientListByNamespaceResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ClientGroupsListResult); err != nil { - return ClientGroupsClientListByNamespaceResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/clientgroups_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/clientgroups_client_example_test.go deleted file mode 100644 index 068554722c3d..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/clientgroups_client_example_test.go +++ /dev/null @@ -1,146 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armeventgrid_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/ClientGroups_Get.json -func ExampleClientGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClientGroupsClient().Get(ctx, "examplerg", "exampleNamespaceName1", "exampleClientGroupName1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ClientGroup = armeventgrid.ClientGroup{ - // Name: to.Ptr("exampleClientGroupName1"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces/clientGroups"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/exampleNamespaceName1/clientGroups/exampleClientGroupName1"), - // Properties: &armeventgrid.ClientGroupProperties{ - // Description: to.Ptr("This is a test client group"), - // Query: to.Ptr("attributes.b IN ['a', 'b', 'c']"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/ClientGroups_CreateOrUpdate.json -func ExampleClientGroupsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClientGroupsClient().BeginCreateOrUpdate(ctx, "examplerg", "exampleNamespaceName1", "exampleClientGroupName1", armeventgrid.ClientGroup{ - Properties: &armeventgrid.ClientGroupProperties{ - Description: to.Ptr("This is a test client group"), - Query: to.Ptr("attributes.b IN ['a', 'b', 'c']"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ClientGroup = armeventgrid.ClientGroup{ - // Name: to.Ptr("exampleClientGroupName1"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces/clientGroups"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/exampleNamespaceName1/clientGroups/exampleClientGroupName1"), - // Properties: &armeventgrid.ClientGroupProperties{ - // Description: to.Ptr("This is a test client group"), - // Query: to.Ptr("attributes.b IN ['a', 'b', 'c']"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/ClientGroups_Delete.json -func ExampleClientGroupsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClientGroupsClient().BeginDelete(ctx, "examplerg", "exampleNamespaceName1", "exampleClientGroupName1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/ClientGroups_ListByNamespace.json -func ExampleClientGroupsClient_NewListByNamespacePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClientGroupsClient().NewListByNamespacePager("examplerg", "namespace123", &armeventgrid.ClientGroupsClientListByNamespaceOptions{Filter: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ClientGroupsListResult = armeventgrid.ClientGroupsListResult{ - // Value: []*armeventgrid.ClientGroup{ - // { - // Name: to.Ptr("exampleClientGroupName1"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces/clientGroups"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/exampleNamespaceName1/clientGroups/exampleClientGroupName1"), - // Properties: &armeventgrid.ClientGroupProperties{ - // Description: to.Ptr("This is a test client group"), - // Query: to.Ptr("attributes.b IN ['a', 'b', 'c']"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/clients_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/clients_client.go deleted file mode 100644 index e34024e38aca..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/clients_client.go +++ /dev/null @@ -1,329 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armeventgrid - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strconv" - "strings" -) - -// ClientsClient contains the methods for the Clients group. -// Don't use this type directly, use NewClientsClient() instead. -type ClientsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewClientsClient creates a new instance of ClientsClient with the specified values. -// - subscriptionID - Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewClientsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientsClient, error) { - cl, err := arm.NewClient(moduleName+".ClientsClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ClientsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreateOrUpdate - Create or update a client with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - clientName - The client name. -// - clientInfo - Client information. -// - options - ClientsClientBeginCreateOrUpdateOptions contains the optional parameters for the ClientsClient.BeginCreateOrUpdate -// method. -func (client *ClientsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, clientName string, clientInfo Client, options *ClientsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ClientsClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, namespaceName, clientName, clientInfo, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientsClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[ClientsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// CreateOrUpdate - Create or update a client with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *ClientsClient) createOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, clientName string, clientInfo Client, options *ClientsClientBeginCreateOrUpdateOptions) (*http.Response, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, namespaceName, clientName, clientInfo, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ClientsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, clientName string, clientInfo Client, options *ClientsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clients/{clientName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if clientName == "" { - return nil, errors.New("parameter clientName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{clientName}", url.PathEscape(clientName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, clientInfo) -} - -// BeginDelete - Delete an existing client. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - clientName - Name of the client. -// - options - ClientsClientBeginDeleteOptions contains the optional parameters for the ClientsClient.BeginDelete method. -func (client *ClientsClient) BeginDelete(ctx context.Context, resourceGroupName string, namespaceName string, clientName string, options *ClientsClientBeginDeleteOptions) (*runtime.Poller[ClientsClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, namespaceName, clientName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[ClientsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Delete - Delete an existing client. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *ClientsClient) deleteOperation(ctx context.Context, resourceGroupName string, namespaceName string, clientName string, options *ClientsClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, namespaceName, clientName, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ClientsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, clientName string, options *ClientsClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clients/{clientName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if clientName == "" { - return nil, errors.New("parameter clientName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{clientName}", url.PathEscape(clientName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get properties of a client. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - clientName - Name of the client. -// - options - ClientsClientGetOptions contains the optional parameters for the ClientsClient.Get method. -func (client *ClientsClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, clientName string, options *ClientsClientGetOptions) (ClientsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, namespaceName, clientName, options) - if err != nil { - return ClientsClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ClientsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *ClientsClient) getCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, clientName string, options *ClientsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clients/{clientName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if clientName == "" { - return nil, errors.New("parameter clientName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{clientName}", url.PathEscape(clientName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ClientsClient) getHandleResponse(resp *http.Response) (ClientsClientGetResponse, error) { - result := ClientsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Client); err != nil { - return ClientsClientGetResponse{}, err - } - return result, nil -} - -// NewListByNamespacePager - Get all the permission bindings under a namespace. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - options - ClientsClientListByNamespaceOptions contains the optional parameters for the ClientsClient.NewListByNamespacePager -// method. -func (client *ClientsClient) NewListByNamespacePager(resourceGroupName string, namespaceName string, options *ClientsClientListByNamespaceOptions) *runtime.Pager[ClientsClientListByNamespaceResponse] { - return runtime.NewPager(runtime.PagingHandler[ClientsClientListByNamespaceResponse]{ - More: func(page ClientsClientListByNamespaceResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ClientsClientListByNamespaceResponse) (ClientsClientListByNamespaceResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByNamespaceCreateRequest(ctx, resourceGroupName, namespaceName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ClientsClientListByNamespaceResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ClientsClientListByNamespaceResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientsClientListByNamespaceResponse{}, runtime.NewResponseError(resp) - } - return client.listByNamespaceHandleResponse(resp) - }, - }) -} - -// listByNamespaceCreateRequest creates the ListByNamespace request. -func (client *ClientsClient) listByNamespaceCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, options *ClientsClientListByNamespaceOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clients" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByNamespaceHandleResponse handles the ListByNamespace response. -func (client *ClientsClient) listByNamespaceHandleResponse(resp *http.Response) (ClientsClientListByNamespaceResponse, error) { - result := ClientsClientListByNamespaceResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ClientsListResult); err != nil { - return ClientsClientListByNamespaceResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/clients_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/clients_client_example_test.go deleted file mode 100644 index e11c213c3b02..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/clients_client_example_test.go +++ /dev/null @@ -1,214 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armeventgrid_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Clients_Get.json -func ExampleClientsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClientsClient().Get(ctx, "examplerg", "exampleNamespaceName1", "exampleClientName1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Client = armeventgrid.Client{ - // Name: to.Ptr("exampleClientName1"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces/clients"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/exampleNamespaceName1/clients/exampleClientName1"), - // Properties: &armeventgrid.ClientProperties{ - // Description: to.Ptr("This is a test client"), - // Attributes: map[string]any{ - // "deviceTypes": []any{ - // "Light", - // "1", - // }, - // "floor": float64(3), - // "room": "345a", - // }, - // Authentication: &armeventgrid.ClientAuthentication{ - // CertificateSubject: &armeventgrid.ClientCertificateSubjectDistinguishedName{ - // CommonName: to.Ptr("CertificateCommonName"), - // CountryCode: to.Ptr("US"), - // Organization: to.Ptr("Microsoft"), - // OrganizationUnit: to.Ptr("Azure"), - // }, - // }, - // ProvisioningState: to.Ptr(armeventgrid.ClientProvisioningStateSucceeded), - // State: to.Ptr(armeventgrid.ClientStateEnabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Clients_CreateOrUpdate.json -func ExampleClientsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClientsClient().BeginCreateOrUpdate(ctx, "examplerg", "exampleNamespaceName1", "exampleClientName1", armeventgrid.Client{ - Properties: &armeventgrid.ClientProperties{ - Description: to.Ptr("This is a test client"), - Attributes: map[string]any{ - "deviceTypes": []any{ - "Fan", - "Light", - "AC", - }, - "floor": float64(3), - "room": "345", - }, - Authentication: &armeventgrid.ClientAuthentication{ - CertificateSubject: &armeventgrid.ClientCertificateSubjectDistinguishedName{ - CommonName: to.Ptr("CertificateCommonName"), - CountryCode: to.Ptr("US"), - Organization: to.Ptr("Microsoft"), - OrganizationUnit: to.Ptr("Azure"), - }, - }, - State: to.Ptr(armeventgrid.ClientStateEnabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Client = armeventgrid.Client{ - // Name: to.Ptr("exampleClientName1"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces/clients"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/exampleNamespaceName1/clients/exampleClientName1"), - // Properties: &armeventgrid.ClientProperties{ - // Description: to.Ptr("This is a test client"), - // Attributes: map[string]any{ - // "deviceTypes": []any{ - // "Light", - // "1", - // }, - // "floor": float64(3), - // "room": "345a", - // }, - // Authentication: &armeventgrid.ClientAuthentication{ - // CertificateSubject: &armeventgrid.ClientCertificateSubjectDistinguishedName{ - // CommonName: to.Ptr("CertificateCommonName"), - // CountryCode: to.Ptr("US"), - // Organization: to.Ptr("Microsoft"), - // OrganizationUnit: to.Ptr("Azure"), - // }, - // }, - // ProvisioningState: to.Ptr(armeventgrid.ClientProvisioningStateSucceeded), - // State: to.Ptr(armeventgrid.ClientStateEnabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Clients_Delete.json -func ExampleClientsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClientsClient().BeginDelete(ctx, "examplerg", "exampleNamespaceName1", "exampleClientName1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Clients_ListByNamespace.json -func ExampleClientsClient_NewListByNamespacePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClientsClient().NewListByNamespacePager("examplerg", "namespace123", &armeventgrid.ClientsClientListByNamespaceOptions{Filter: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ClientsListResult = armeventgrid.ClientsListResult{ - // Value: []*armeventgrid.Client{ - // { - // Name: to.Ptr("exampleClientName1"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces/clients"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/exampleNamespaceName1/clients/exampleClientName1"), - // Properties: &armeventgrid.ClientProperties{ - // Description: to.Ptr("This is a test client"), - // Attributes: map[string]any{ - // "deviceTypes": []any{ - // "Light", - // "1", - // }, - // "floor": float64(3), - // "room": "345a", - // }, - // Authentication: &armeventgrid.ClientAuthentication{ - // CertificateSubject: &armeventgrid.ClientCertificateSubjectDistinguishedName{ - // CommonName: to.Ptr("CertificateCommonName"), - // CountryCode: to.Ptr("US"), - // Organization: to.Ptr("Microsoft"), - // OrganizationUnit: to.Ptr("Azure"), - // }, - // }, - // ProvisioningState: to.Ptr(armeventgrid.ClientProvisioningStateSucceeded), - // State: to.Ptr(armeventgrid.ClientStateEnabled), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/constants.go b/sdk/resourcemanager/eventgrid/armeventgrid/constants.go index 9e28731ea181..0c952e590c2f 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/constants.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/constants.go @@ -3,15 +3,14 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid const ( - moduleName = "armeventgrid" - moduleVersion = "v2.2.0-beta.1" + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid" + moduleVersion = "v2.2.0" ) // AdvancedFilterOperatorType - The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. @@ -64,65 +63,17 @@ func PossibleAdvancedFilterOperatorTypeValues() []AdvancedFilterOperatorType { } } -type AlternativeAuthenticationNameSource string - -const ( - AlternativeAuthenticationNameSourceClientCertificateDNS AlternativeAuthenticationNameSource = "ClientCertificateDns" - AlternativeAuthenticationNameSourceClientCertificateEmail AlternativeAuthenticationNameSource = "ClientCertificateEmail" - AlternativeAuthenticationNameSourceClientCertificateIP AlternativeAuthenticationNameSource = "ClientCertificateIp" - AlternativeAuthenticationNameSourceClientCertificateSubject AlternativeAuthenticationNameSource = "ClientCertificateSubject" - AlternativeAuthenticationNameSourceClientCertificateURI AlternativeAuthenticationNameSource = "ClientCertificateUri" -) - -// PossibleAlternativeAuthenticationNameSourceValues returns the possible values for the AlternativeAuthenticationNameSource const type. -func PossibleAlternativeAuthenticationNameSourceValues() []AlternativeAuthenticationNameSource { - return []AlternativeAuthenticationNameSource{ - AlternativeAuthenticationNameSourceClientCertificateDNS, - AlternativeAuthenticationNameSourceClientCertificateEmail, - AlternativeAuthenticationNameSourceClientCertificateIP, - AlternativeAuthenticationNameSourceClientCertificateSubject, - AlternativeAuthenticationNameSourceClientCertificateURI, - } -} - -// CaCertificateProvisioningState - Provisioning state of the CA Certificate resource. -type CaCertificateProvisioningState string - -const ( - CaCertificateProvisioningStateCanceled CaCertificateProvisioningState = "Canceled" - CaCertificateProvisioningStateCreating CaCertificateProvisioningState = "Creating" - CaCertificateProvisioningStateDeleted CaCertificateProvisioningState = "Deleted" - CaCertificateProvisioningStateDeleting CaCertificateProvisioningState = "Deleting" - CaCertificateProvisioningStateFailed CaCertificateProvisioningState = "Failed" - CaCertificateProvisioningStateSucceeded CaCertificateProvisioningState = "Succeeded" - CaCertificateProvisioningStateUpdating CaCertificateProvisioningState = "Updating" -) - -// PossibleCaCertificateProvisioningStateValues returns the possible values for the CaCertificateProvisioningState const type. -func PossibleCaCertificateProvisioningStateValues() []CaCertificateProvisioningState { - return []CaCertificateProvisioningState{ - CaCertificateProvisioningStateCanceled, - CaCertificateProvisioningStateCreating, - CaCertificateProvisioningStateDeleted, - CaCertificateProvisioningStateDeleting, - CaCertificateProvisioningStateFailed, - CaCertificateProvisioningStateSucceeded, - CaCertificateProvisioningStateUpdating, - } -} - // ChannelProvisioningState - Provisioning state of the channel. type ChannelProvisioningState string const ( - ChannelProvisioningStateCanceled ChannelProvisioningState = "Canceled" - ChannelProvisioningStateCreating ChannelProvisioningState = "Creating" - ChannelProvisioningStateDeleting ChannelProvisioningState = "Deleting" - ChannelProvisioningStateFailed ChannelProvisioningState = "Failed" - ChannelProvisioningStateIdleDueToMirroredPartnerDestinationDeletion ChannelProvisioningState = "IdleDueToMirroredPartnerDestinationDeletion" - ChannelProvisioningStateIdleDueToMirroredPartnerTopicDeletion ChannelProvisioningState = "IdleDueToMirroredPartnerTopicDeletion" - ChannelProvisioningStateSucceeded ChannelProvisioningState = "Succeeded" - ChannelProvisioningStateUpdating ChannelProvisioningState = "Updating" + ChannelProvisioningStateCanceled ChannelProvisioningState = "Canceled" + ChannelProvisioningStateCreating ChannelProvisioningState = "Creating" + ChannelProvisioningStateDeleting ChannelProvisioningState = "Deleting" + ChannelProvisioningStateFailed ChannelProvisioningState = "Failed" + ChannelProvisioningStateIdleDueToMirroredPartnerTopicDeletion ChannelProvisioningState = "IdleDueToMirroredPartnerTopicDeletion" + ChannelProvisioningStateSucceeded ChannelProvisioningState = "Succeeded" + ChannelProvisioningStateUpdating ChannelProvisioningState = "Updating" ) // PossibleChannelProvisioningStateValues returns the possible values for the ChannelProvisioningState const type. @@ -132,7 +83,6 @@ func PossibleChannelProvisioningStateValues() []ChannelProvisioningState { ChannelProvisioningStateCreating, ChannelProvisioningStateDeleting, ChannelProvisioningStateFailed, - ChannelProvisioningStateIdleDueToMirroredPartnerDestinationDeletion, ChannelProvisioningStateIdleDueToMirroredPartnerTopicDeletion, ChannelProvisioningStateSucceeded, ChannelProvisioningStateUpdating, @@ -143,110 +93,16 @@ func PossibleChannelProvisioningStateValues() []ChannelProvisioningState { type ChannelType string const ( - ChannelTypePartnerDestination ChannelType = "PartnerDestination" - ChannelTypePartnerTopic ChannelType = "PartnerTopic" + ChannelTypePartnerTopic ChannelType = "PartnerTopic" ) // PossibleChannelTypeValues returns the possible values for the ChannelType const type. func PossibleChannelTypeValues() []ChannelType { return []ChannelType{ - ChannelTypePartnerDestination, ChannelTypePartnerTopic, } } -// ClientCertificateValidationScheme - The validation scheme used to authenticate the client. Default value is SubjectMatchesAuthenticationName. -type ClientCertificateValidationScheme string - -const ( - ClientCertificateValidationSchemeDNSMatchesAuthenticationName ClientCertificateValidationScheme = "DnsMatchesAuthenticationName" - ClientCertificateValidationSchemeEmailMatchesAuthenticationName ClientCertificateValidationScheme = "EmailMatchesAuthenticationName" - ClientCertificateValidationSchemeIPMatchesAuthenticationName ClientCertificateValidationScheme = "IpMatchesAuthenticationName" - ClientCertificateValidationSchemeSubjectMatchesAuthenticationName ClientCertificateValidationScheme = "SubjectMatchesAuthenticationName" - ClientCertificateValidationSchemeThumbprintMatch ClientCertificateValidationScheme = "ThumbprintMatch" - ClientCertificateValidationSchemeURIMatchesAuthenticationName ClientCertificateValidationScheme = "UriMatchesAuthenticationName" -) - -// PossibleClientCertificateValidationSchemeValues returns the possible values for the ClientCertificateValidationScheme const type. -func PossibleClientCertificateValidationSchemeValues() []ClientCertificateValidationScheme { - return []ClientCertificateValidationScheme{ - ClientCertificateValidationSchemeDNSMatchesAuthenticationName, - ClientCertificateValidationSchemeEmailMatchesAuthenticationName, - ClientCertificateValidationSchemeIPMatchesAuthenticationName, - ClientCertificateValidationSchemeSubjectMatchesAuthenticationName, - ClientCertificateValidationSchemeThumbprintMatch, - ClientCertificateValidationSchemeURIMatchesAuthenticationName, - } -} - -// ClientGroupProvisioningState - Provisioning state of the ClientGroup resource. -type ClientGroupProvisioningState string - -const ( - ClientGroupProvisioningStateCanceled ClientGroupProvisioningState = "Canceled" - ClientGroupProvisioningStateCreating ClientGroupProvisioningState = "Creating" - ClientGroupProvisioningStateDeleted ClientGroupProvisioningState = "Deleted" - ClientGroupProvisioningStateDeleting ClientGroupProvisioningState = "Deleting" - ClientGroupProvisioningStateFailed ClientGroupProvisioningState = "Failed" - ClientGroupProvisioningStateSucceeded ClientGroupProvisioningState = "Succeeded" - ClientGroupProvisioningStateUpdating ClientGroupProvisioningState = "Updating" -) - -// PossibleClientGroupProvisioningStateValues returns the possible values for the ClientGroupProvisioningState const type. -func PossibleClientGroupProvisioningStateValues() []ClientGroupProvisioningState { - return []ClientGroupProvisioningState{ - ClientGroupProvisioningStateCanceled, - ClientGroupProvisioningStateCreating, - ClientGroupProvisioningStateDeleted, - ClientGroupProvisioningStateDeleting, - ClientGroupProvisioningStateFailed, - ClientGroupProvisioningStateSucceeded, - ClientGroupProvisioningStateUpdating, - } -} - -// ClientProvisioningState - Provisioning state of the Client resource. -type ClientProvisioningState string - -const ( - ClientProvisioningStateCanceled ClientProvisioningState = "Canceled" - ClientProvisioningStateCreating ClientProvisioningState = "Creating" - ClientProvisioningStateDeleted ClientProvisioningState = "Deleted" - ClientProvisioningStateDeleting ClientProvisioningState = "Deleting" - ClientProvisioningStateFailed ClientProvisioningState = "Failed" - ClientProvisioningStateSucceeded ClientProvisioningState = "Succeeded" - ClientProvisioningStateUpdating ClientProvisioningState = "Updating" -) - -// PossibleClientProvisioningStateValues returns the possible values for the ClientProvisioningState const type. -func PossibleClientProvisioningStateValues() []ClientProvisioningState { - return []ClientProvisioningState{ - ClientProvisioningStateCanceled, - ClientProvisioningStateCreating, - ClientProvisioningStateDeleted, - ClientProvisioningStateDeleting, - ClientProvisioningStateFailed, - ClientProvisioningStateSucceeded, - ClientProvisioningStateUpdating, - } -} - -// ClientState - Indicates if the client is enabled or not. Default value is Enabled. -type ClientState string - -const ( - ClientStateDisabled ClientState = "Disabled" - ClientStateEnabled ClientState = "Enabled" -) - -// PossibleClientStateValues returns the possible values for the ClientState const type. -func PossibleClientStateValues() []ClientState { - return []ClientState{ - ClientStateDisabled, - ClientStateEnabled, - } -} - // CreatedByType - The type of identity that created the resource. type CreatedByType string @@ -313,34 +169,6 @@ func PossibleDeliveryAttributeMappingTypeValues() []DeliveryAttributeMappingType } } -// DeliveryMode - Delivery mode of the event subscription. -type DeliveryMode string - -const ( - DeliveryModeQueue DeliveryMode = "Queue" -) - -// PossibleDeliveryModeValues returns the possible values for the DeliveryMode const type. -func PossibleDeliveryModeValues() []DeliveryMode { - return []DeliveryMode{ - DeliveryModeQueue, - } -} - -// DeliverySchema - The event delivery schema for the event subscription. -type DeliverySchema string - -const ( - DeliverySchemaCloudEventSchemaV10 DeliverySchema = "CloudEventSchemaV1_0" -) - -// PossibleDeliverySchemaValues returns the possible values for the DeliverySchema const type. -func PossibleDeliverySchemaValues() []DeliverySchema { - return []DeliverySchema{ - DeliverySchemaCloudEventSchemaV10, - } -} - // DomainProvisioningState - Provisioning state of the Event Grid Domain Resource. type DomainProvisioningState string @@ -393,14 +221,13 @@ func PossibleDomainTopicProvisioningStateValues() []DomainTopicProvisioningState type EndpointType string const ( - EndpointTypeAzureFunction EndpointType = "AzureFunction" - EndpointTypeEventHub EndpointType = "EventHub" - EndpointTypeHybridConnection EndpointType = "HybridConnection" - EndpointTypePartnerDestination EndpointType = "PartnerDestination" - EndpointTypeServiceBusQueue EndpointType = "ServiceBusQueue" - EndpointTypeServiceBusTopic EndpointType = "ServiceBusTopic" - EndpointTypeStorageQueue EndpointType = "StorageQueue" - EndpointTypeWebHook EndpointType = "WebHook" + EndpointTypeAzureFunction EndpointType = "AzureFunction" + EndpointTypeEventHub EndpointType = "EventHub" + EndpointTypeHybridConnection EndpointType = "HybridConnection" + EndpointTypeServiceBusQueue EndpointType = "ServiceBusQueue" + EndpointTypeServiceBusTopic EndpointType = "ServiceBusTopic" + EndpointTypeStorageQueue EndpointType = "StorageQueue" + EndpointTypeWebHook EndpointType = "WebHook" ) // PossibleEndpointTypeValues returns the possible values for the EndpointType const type. @@ -409,7 +236,6 @@ func PossibleEndpointTypeValues() []EndpointType { EndpointTypeAzureFunction, EndpointTypeEventHub, EndpointTypeHybridConnection, - EndpointTypePartnerDestination, EndpointTypeServiceBusQueue, EndpointTypeServiceBusTopic, EndpointTypeStorageQueue, @@ -449,20 +275,6 @@ func PossibleEventDeliverySchemaValues() []EventDeliverySchema { } } -// EventInputSchema - This determines the format that is expected for incoming events published to the topic. -type EventInputSchema string - -const ( - EventInputSchemaCloudEventSchemaV10 EventInputSchema = "CloudEventSchemaV1_0" -) - -// PossibleEventInputSchemaValues returns the possible values for the EventInputSchema const type. -func PossibleEventInputSchemaValues() []EventInputSchema { - return []EventInputSchema{ - EventInputSchemaCloudEventSchemaV10, - } -} - // EventSubscriptionIdentityType - The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both // an implicitly created identity and a set of user-assigned identities. The type 'None' will remove any identity. type EventSubscriptionIdentityType string @@ -506,56 +318,6 @@ func PossibleEventSubscriptionProvisioningStateValues() []EventSubscriptionProvi } } -// FilterOperatorType - The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. -type FilterOperatorType string - -const ( - FilterOperatorTypeBoolEquals FilterOperatorType = "BoolEquals" - FilterOperatorTypeIsNotNull FilterOperatorType = "IsNotNull" - FilterOperatorTypeIsNullOrUndefined FilterOperatorType = "IsNullOrUndefined" - FilterOperatorTypeNumberGreaterThan FilterOperatorType = "NumberGreaterThan" - FilterOperatorTypeNumberGreaterThanOrEquals FilterOperatorType = "NumberGreaterThanOrEquals" - FilterOperatorTypeNumberIn FilterOperatorType = "NumberIn" - FilterOperatorTypeNumberInRange FilterOperatorType = "NumberInRange" - FilterOperatorTypeNumberLessThan FilterOperatorType = "NumberLessThan" - FilterOperatorTypeNumberLessThanOrEquals FilterOperatorType = "NumberLessThanOrEquals" - FilterOperatorTypeNumberNotIn FilterOperatorType = "NumberNotIn" - FilterOperatorTypeNumberNotInRange FilterOperatorType = "NumberNotInRange" - FilterOperatorTypeStringBeginsWith FilterOperatorType = "StringBeginsWith" - FilterOperatorTypeStringContains FilterOperatorType = "StringContains" - FilterOperatorTypeStringEndsWith FilterOperatorType = "StringEndsWith" - FilterOperatorTypeStringIn FilterOperatorType = "StringIn" - FilterOperatorTypeStringNotBeginsWith FilterOperatorType = "StringNotBeginsWith" - FilterOperatorTypeStringNotContains FilterOperatorType = "StringNotContains" - FilterOperatorTypeStringNotEndsWith FilterOperatorType = "StringNotEndsWith" - FilterOperatorTypeStringNotIn FilterOperatorType = "StringNotIn" -) - -// PossibleFilterOperatorTypeValues returns the possible values for the FilterOperatorType const type. -func PossibleFilterOperatorTypeValues() []FilterOperatorType { - return []FilterOperatorType{ - FilterOperatorTypeBoolEquals, - FilterOperatorTypeIsNotNull, - FilterOperatorTypeIsNullOrUndefined, - FilterOperatorTypeNumberGreaterThan, - FilterOperatorTypeNumberGreaterThanOrEquals, - FilterOperatorTypeNumberIn, - FilterOperatorTypeNumberInRange, - FilterOperatorTypeNumberLessThan, - FilterOperatorTypeNumberLessThanOrEquals, - FilterOperatorTypeNumberNotIn, - FilterOperatorTypeNumberNotInRange, - FilterOperatorTypeStringBeginsWith, - FilterOperatorTypeStringContains, - FilterOperatorTypeStringEndsWith, - FilterOperatorTypeStringIn, - FilterOperatorTypeStringNotBeginsWith, - FilterOperatorTypeStringNotContains, - FilterOperatorTypeStringNotEndsWith, - FilterOperatorTypeStringNotIn, - } -} - // IPActionType - Action to perform based on the match or no match of the IpMask. type IPActionType string @@ -624,84 +386,6 @@ func PossibleInputSchemaMappingTypeValues() []InputSchemaMappingType { } } -// NamespaceProvisioningState - Provisioning state of the namespace resource. -type NamespaceProvisioningState string - -const ( - NamespaceProvisioningStateCanceled NamespaceProvisioningState = "Canceled" - NamespaceProvisioningStateCreateFailed NamespaceProvisioningState = "CreateFailed" - NamespaceProvisioningStateCreating NamespaceProvisioningState = "Creating" - NamespaceProvisioningStateDeleteFailed NamespaceProvisioningState = "DeleteFailed" - NamespaceProvisioningStateDeleted NamespaceProvisioningState = "Deleted" - NamespaceProvisioningStateDeleting NamespaceProvisioningState = "Deleting" - NamespaceProvisioningStateFailed NamespaceProvisioningState = "Failed" - NamespaceProvisioningStateSucceeded NamespaceProvisioningState = "Succeeded" - NamespaceProvisioningStateUpdatedFailed NamespaceProvisioningState = "UpdatedFailed" - NamespaceProvisioningStateUpdating NamespaceProvisioningState = "Updating" -) - -// PossibleNamespaceProvisioningStateValues returns the possible values for the NamespaceProvisioningState const type. -func PossibleNamespaceProvisioningStateValues() []NamespaceProvisioningState { - return []NamespaceProvisioningState{ - NamespaceProvisioningStateCanceled, - NamespaceProvisioningStateCreateFailed, - NamespaceProvisioningStateCreating, - NamespaceProvisioningStateDeleteFailed, - NamespaceProvisioningStateDeleted, - NamespaceProvisioningStateDeleting, - NamespaceProvisioningStateFailed, - NamespaceProvisioningStateSucceeded, - NamespaceProvisioningStateUpdatedFailed, - NamespaceProvisioningStateUpdating, - } -} - -// NamespaceTopicProvisioningState - Provisioning state of the namespace topic. -type NamespaceTopicProvisioningState string - -const ( - NamespaceTopicProvisioningStateCanceled NamespaceTopicProvisioningState = "Canceled" - NamespaceTopicProvisioningStateCreateFailed NamespaceTopicProvisioningState = "CreateFailed" - NamespaceTopicProvisioningStateCreating NamespaceTopicProvisioningState = "Creating" - NamespaceTopicProvisioningStateDeleteFailed NamespaceTopicProvisioningState = "DeleteFailed" - NamespaceTopicProvisioningStateDeleted NamespaceTopicProvisioningState = "Deleted" - NamespaceTopicProvisioningStateDeleting NamespaceTopicProvisioningState = "Deleting" - NamespaceTopicProvisioningStateFailed NamespaceTopicProvisioningState = "Failed" - NamespaceTopicProvisioningStateSucceeded NamespaceTopicProvisioningState = "Succeeded" - NamespaceTopicProvisioningStateUpdatedFailed NamespaceTopicProvisioningState = "UpdatedFailed" - NamespaceTopicProvisioningStateUpdating NamespaceTopicProvisioningState = "Updating" -) - -// PossibleNamespaceTopicProvisioningStateValues returns the possible values for the NamespaceTopicProvisioningState const type. -func PossibleNamespaceTopicProvisioningStateValues() []NamespaceTopicProvisioningState { - return []NamespaceTopicProvisioningState{ - NamespaceTopicProvisioningStateCanceled, - NamespaceTopicProvisioningStateCreateFailed, - NamespaceTopicProvisioningStateCreating, - NamespaceTopicProvisioningStateDeleteFailed, - NamespaceTopicProvisioningStateDeleted, - NamespaceTopicProvisioningStateDeleting, - NamespaceTopicProvisioningStateFailed, - NamespaceTopicProvisioningStateSucceeded, - NamespaceTopicProvisioningStateUpdatedFailed, - NamespaceTopicProvisioningStateUpdating, - } -} - -// PartnerClientAuthenticationType - Type of client authentication -type PartnerClientAuthenticationType string - -const ( - PartnerClientAuthenticationTypeAzureAD PartnerClientAuthenticationType = "AzureAD" -) - -// PossiblePartnerClientAuthenticationTypeValues returns the possible values for the PartnerClientAuthenticationType const type. -func PossiblePartnerClientAuthenticationTypeValues() []PartnerClientAuthenticationType { - return []PartnerClientAuthenticationType{ - PartnerClientAuthenticationTypeAzureAD, - } -} - // PartnerConfigurationProvisioningState - Provisioning state of the partner configuration. type PartnerConfigurationProvisioningState string @@ -726,62 +410,6 @@ func PossiblePartnerConfigurationProvisioningStateValues() []PartnerConfiguratio } } -// PartnerDestinationActivationState - Activation state of the partner destination. -type PartnerDestinationActivationState string - -const ( - PartnerDestinationActivationStateActivated PartnerDestinationActivationState = "Activated" - PartnerDestinationActivationStateNeverActivated PartnerDestinationActivationState = "NeverActivated" -) - -// PossiblePartnerDestinationActivationStateValues returns the possible values for the PartnerDestinationActivationState const type. -func PossiblePartnerDestinationActivationStateValues() []PartnerDestinationActivationState { - return []PartnerDestinationActivationState{ - PartnerDestinationActivationStateActivated, - PartnerDestinationActivationStateNeverActivated, - } -} - -// PartnerDestinationProvisioningState - Provisioning state of the partner destination. -type PartnerDestinationProvisioningState string - -const ( - PartnerDestinationProvisioningStateCanceled PartnerDestinationProvisioningState = "Canceled" - PartnerDestinationProvisioningStateCreating PartnerDestinationProvisioningState = "Creating" - PartnerDestinationProvisioningStateDeleting PartnerDestinationProvisioningState = "Deleting" - PartnerDestinationProvisioningStateFailed PartnerDestinationProvisioningState = "Failed" - PartnerDestinationProvisioningStateIdleDueToMirroredChannelResourceDeletion PartnerDestinationProvisioningState = "IdleDueToMirroredChannelResourceDeletion" - PartnerDestinationProvisioningStateSucceeded PartnerDestinationProvisioningState = "Succeeded" - PartnerDestinationProvisioningStateUpdating PartnerDestinationProvisioningState = "Updating" -) - -// PossiblePartnerDestinationProvisioningStateValues returns the possible values for the PartnerDestinationProvisioningState const type. -func PossiblePartnerDestinationProvisioningStateValues() []PartnerDestinationProvisioningState { - return []PartnerDestinationProvisioningState{ - PartnerDestinationProvisioningStateCanceled, - PartnerDestinationProvisioningStateCreating, - PartnerDestinationProvisioningStateDeleting, - PartnerDestinationProvisioningStateFailed, - PartnerDestinationProvisioningStateIdleDueToMirroredChannelResourceDeletion, - PartnerDestinationProvisioningStateSucceeded, - PartnerDestinationProvisioningStateUpdating, - } -} - -// PartnerEndpointType - Type of the endpoint for the partner destination -type PartnerEndpointType string - -const ( - PartnerEndpointTypeWebHook PartnerEndpointType = "WebHook" -) - -// PossiblePartnerEndpointTypeValues returns the possible values for the PartnerEndpointType const type. -func PossiblePartnerEndpointTypeValues() []PartnerEndpointType { - return []PartnerEndpointType{ - PartnerEndpointTypeWebHook, - } -} - // PartnerNamespaceProvisioningState - Provisioning state of the partner namespace. type PartnerNamespaceProvisioningState string @@ -892,48 +520,6 @@ func PossiblePartnerTopicRoutingModeValues() []PartnerTopicRoutingMode { } } -// PermissionBindingProvisioningState - Provisioning state of the PermissionBinding resource. -type PermissionBindingProvisioningState string - -const ( - PermissionBindingProvisioningStateCanceled PermissionBindingProvisioningState = "Canceled" - PermissionBindingProvisioningStateCreating PermissionBindingProvisioningState = "Creating" - PermissionBindingProvisioningStateDeleted PermissionBindingProvisioningState = "Deleted" - PermissionBindingProvisioningStateDeleting PermissionBindingProvisioningState = "Deleting" - PermissionBindingProvisioningStateFailed PermissionBindingProvisioningState = "Failed" - PermissionBindingProvisioningStateSucceeded PermissionBindingProvisioningState = "Succeeded" - PermissionBindingProvisioningStateUpdating PermissionBindingProvisioningState = "Updating" -) - -// PossiblePermissionBindingProvisioningStateValues returns the possible values for the PermissionBindingProvisioningState const type. -func PossiblePermissionBindingProvisioningStateValues() []PermissionBindingProvisioningState { - return []PermissionBindingProvisioningState{ - PermissionBindingProvisioningStateCanceled, - PermissionBindingProvisioningStateCreating, - PermissionBindingProvisioningStateDeleted, - PermissionBindingProvisioningStateDeleting, - PermissionBindingProvisioningStateFailed, - PermissionBindingProvisioningStateSucceeded, - PermissionBindingProvisioningStateUpdating, - } -} - -// PermissionType - The allowed permission. -type PermissionType string - -const ( - PermissionTypePublisher PermissionType = "Publisher" - PermissionTypeSubscriber PermissionType = "Subscriber" -) - -// PossiblePermissionTypeValues returns the possible values for the PermissionType const type. -func PossiblePermissionTypeValues() []PermissionType { - return []PermissionType{ - PermissionTypePublisher, - PermissionTypeSubscriber, - } -} - // PersistedConnectionStatus - Status of the connection. type PersistedConnectionStatus string @@ -958,7 +544,6 @@ type PrivateEndpointConnectionsParentType string const ( PrivateEndpointConnectionsParentTypeDomains PrivateEndpointConnectionsParentType = "domains" - PrivateEndpointConnectionsParentTypeNamespaces PrivateEndpointConnectionsParentType = "namespaces" PrivateEndpointConnectionsParentTypePartnerNamespaces PrivateEndpointConnectionsParentType = "partnerNamespaces" PrivateEndpointConnectionsParentTypeTopics PrivateEndpointConnectionsParentType = "topics" ) @@ -967,7 +552,6 @@ const ( func PossiblePrivateEndpointConnectionsParentTypeValues() []PrivateEndpointConnectionsParentType { return []PrivateEndpointConnectionsParentType{ PrivateEndpointConnectionsParentTypeDomains, - PrivateEndpointConnectionsParentTypeNamespaces, PrivateEndpointConnectionsParentTypePartnerNamespaces, PrivateEndpointConnectionsParentTypeTopics, } @@ -990,20 +574,6 @@ func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { } } -// PublisherType - Publisher type of the namespace topic. -type PublisherType string - -const ( - PublisherTypeCustom PublisherType = "Custom" -) - -// PossiblePublisherTypeValues returns the possible values for the PublisherType const type. -func PossiblePublisherTypeValues() []PublisherType { - return []PublisherType{ - PublisherTypeCustom, - } -} - // ReadinessState - The readiness state of the corresponding partner topic. type ReadinessState string @@ -1020,22 +590,6 @@ func PossibleReadinessStateValues() []ReadinessState { } } -// ResourceKind - Kind of the resource. -type ResourceKind string - -const ( - ResourceKindAzure ResourceKind = "Azure" - ResourceKindAzureArc ResourceKind = "AzureArc" -) - -// PossibleResourceKindValues returns the possible values for the ResourceKind const type. -func PossibleResourceKindValues() []ResourceKind { - return []ResourceKind{ - ResourceKindAzure, - ResourceKindAzureArc, - } -} - // ResourceProvisioningState - Provisioning state of the Private Endpoint Connection. type ResourceProvisioningState string @@ -1076,119 +630,6 @@ func PossibleResourceRegionTypeValues() []ResourceRegionType { } } -type RoutingIdentityType string - -const ( - RoutingIdentityTypeNone RoutingIdentityType = "None" - RoutingIdentityTypeSystemAssigned RoutingIdentityType = "SystemAssigned" - RoutingIdentityTypeUserAssigned RoutingIdentityType = "UserAssigned" -) - -// PossibleRoutingIdentityTypeValues returns the possible values for the RoutingIdentityType const type. -func PossibleRoutingIdentityTypeValues() []RoutingIdentityType { - return []RoutingIdentityType{ - RoutingIdentityTypeNone, - RoutingIdentityTypeSystemAssigned, - RoutingIdentityTypeUserAssigned, - } -} - -// SKU - The Sku name of the resource. The possible values are: Basic or Premium. -type SKU string - -const ( - SKUBasic SKU = "Basic" - SKUPremium SKU = "Premium" -) - -// PossibleSKUValues returns the possible values for the SKU const type. -func PossibleSKUValues() []SKU { - return []SKU{ - SKUBasic, - SKUPremium, - } -} - -// SKUName - The name of the SKU. -type SKUName string - -const ( - SKUNameStandard SKUName = "Standard" -) - -// PossibleSKUNameValues returns the possible values for the SKUName const type. -func PossibleSKUNameValues() []SKUName { - return []SKUName{ - SKUNameStandard, - } -} - -// StaticRoutingEnrichmentType - Static routing enrichment value type. For e.g. this property value can be 'String'. -type StaticRoutingEnrichmentType string - -const ( - StaticRoutingEnrichmentTypeString StaticRoutingEnrichmentType = "String" -) - -// PossibleStaticRoutingEnrichmentTypeValues returns the possible values for the StaticRoutingEnrichmentType const type. -func PossibleStaticRoutingEnrichmentTypeValues() []StaticRoutingEnrichmentType { - return []StaticRoutingEnrichmentType{ - StaticRoutingEnrichmentTypeString, - } -} - -// SubscriptionProvisioningState - Provisioning state of the event subscription. -type SubscriptionProvisioningState string - -const ( - SubscriptionProvisioningStateAwaitingManualAction SubscriptionProvisioningState = "AwaitingManualAction" - SubscriptionProvisioningStateCanceled SubscriptionProvisioningState = "Canceled" - SubscriptionProvisioningStateCreateFailed SubscriptionProvisioningState = "CreateFailed" - SubscriptionProvisioningStateCreating SubscriptionProvisioningState = "Creating" - SubscriptionProvisioningStateDeleteFailed SubscriptionProvisioningState = "DeleteFailed" - SubscriptionProvisioningStateDeleted SubscriptionProvisioningState = "Deleted" - SubscriptionProvisioningStateDeleting SubscriptionProvisioningState = "Deleting" - SubscriptionProvisioningStateFailed SubscriptionProvisioningState = "Failed" - SubscriptionProvisioningStateSucceeded SubscriptionProvisioningState = "Succeeded" - SubscriptionProvisioningStateUpdatedFailed SubscriptionProvisioningState = "UpdatedFailed" - SubscriptionProvisioningStateUpdating SubscriptionProvisioningState = "Updating" -) - -// PossibleSubscriptionProvisioningStateValues returns the possible values for the SubscriptionProvisioningState const type. -func PossibleSubscriptionProvisioningStateValues() []SubscriptionProvisioningState { - return []SubscriptionProvisioningState{ - SubscriptionProvisioningStateAwaitingManualAction, - SubscriptionProvisioningStateCanceled, - SubscriptionProvisioningStateCreateFailed, - SubscriptionProvisioningStateCreating, - SubscriptionProvisioningStateDeleteFailed, - SubscriptionProvisioningStateDeleted, - SubscriptionProvisioningStateDeleting, - SubscriptionProvisioningStateFailed, - SubscriptionProvisioningStateSucceeded, - SubscriptionProvisioningStateUpdatedFailed, - SubscriptionProvisioningStateUpdating, - } -} - -// TLSVersion - Minimum TLS version of the publisher allowed to publish to this domain -type TLSVersion string - -const ( - TLSVersionOne0 TLSVersion = "1.0" - TLSVersionOne1 TLSVersion = "1.1" - TLSVersionOne2 TLSVersion = "1.2" -) - -// PossibleTLSVersionValues returns the possible values for the TLSVersion const type. -func PossibleTLSVersionValues() []TLSVersion { - return []TLSVersion{ - TLSVersionOne0, - TLSVersionOne1, - TLSVersionOne2, - } -} - // TopicProvisioningState - Provisioning state of the topic. type TopicProvisioningState string @@ -1213,48 +654,6 @@ func PossibleTopicProvisioningStateValues() []TopicProvisioningState { } } -// TopicSpaceProvisioningState - Provisioning state of the TopicSpace resource. -type TopicSpaceProvisioningState string - -const ( - TopicSpaceProvisioningStateCanceled TopicSpaceProvisioningState = "Canceled" - TopicSpaceProvisioningStateCreating TopicSpaceProvisioningState = "Creating" - TopicSpaceProvisioningStateDeleted TopicSpaceProvisioningState = "Deleted" - TopicSpaceProvisioningStateDeleting TopicSpaceProvisioningState = "Deleting" - TopicSpaceProvisioningStateFailed TopicSpaceProvisioningState = "Failed" - TopicSpaceProvisioningStateSucceeded TopicSpaceProvisioningState = "Succeeded" - TopicSpaceProvisioningStateUpdating TopicSpaceProvisioningState = "Updating" -) - -// PossibleTopicSpaceProvisioningStateValues returns the possible values for the TopicSpaceProvisioningState const type. -func PossibleTopicSpaceProvisioningStateValues() []TopicSpaceProvisioningState { - return []TopicSpaceProvisioningState{ - TopicSpaceProvisioningStateCanceled, - TopicSpaceProvisioningStateCreating, - TopicSpaceProvisioningStateDeleted, - TopicSpaceProvisioningStateDeleting, - TopicSpaceProvisioningStateFailed, - TopicSpaceProvisioningStateSucceeded, - TopicSpaceProvisioningStateUpdating, - } -} - -// TopicSpacesConfigurationState - Indicate if Topic Spaces Configuration is enabled for the namespace. Default is Disabled. -type TopicSpacesConfigurationState string - -const ( - TopicSpacesConfigurationStateDisabled TopicSpacesConfigurationState = "Disabled" - TopicSpacesConfigurationStateEnabled TopicSpacesConfigurationState = "Enabled" -) - -// PossibleTopicSpacesConfigurationStateValues returns the possible values for the TopicSpacesConfigurationState const type. -func PossibleTopicSpacesConfigurationStateValues() []TopicSpacesConfigurationState { - return []TopicSpacesConfigurationState{ - TopicSpacesConfigurationStateDisabled, - TopicSpacesConfigurationStateEnabled, - } -} - // TopicTypeProvisioningState - Provisioning state of the topic type type TopicTypeProvisioningState string diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/domaineventsubscriptions_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/domaineventsubscriptions_client.go index 0fff01260e9f..6da1d4d74661 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/domaineventsubscriptions_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/domaineventsubscriptions_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid @@ -35,7 +34,7 @@ type DomainEventSubscriptionsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewDomainEventSubscriptionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DomainEventSubscriptionsClient, error) { - cl, err := arm.NewClient(moduleName+".DomainEventSubscriptionsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -49,7 +48,7 @@ func NewDomainEventSubscriptionsClient(subscriptionID string, credential azcore. // BeginCreateOrUpdate - Asynchronously creates a new event subscription or updates an existing event subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the domain topic. // - eventSubscriptionName - Name of the event subscription to be created. Event subscription names must be between 3 and 100 @@ -63,29 +62,40 @@ func (client *DomainEventSubscriptionsClient) BeginCreateOrUpdate(ctx context.Co if err != nil { return nil, err } - return runtime.NewPoller[DomainEventSubscriptionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DomainEventSubscriptionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DomainEventSubscriptionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DomainEventSubscriptionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // CreateOrUpdate - Asynchronously creates a new event subscription or updates an existing event subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *DomainEventSubscriptionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, domainName string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription, options *DomainEventSubscriptionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "DomainEventSubscriptionsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, domainName, eventSubscriptionName, eventSubscriptionInfo, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -112,16 +122,19 @@ func (client *DomainEventSubscriptionsClient) createOrUpdateCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, eventSubscriptionInfo) + if err := runtime.MarshalAsJSON(req, eventSubscriptionInfo); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete an existing event subscription for a domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the domain. // - eventSubscriptionName - Name of the event subscription to be deleted. Event subscription names must be between 3 and 100 @@ -134,29 +147,40 @@ func (client *DomainEventSubscriptionsClient) BeginDelete(ctx context.Context, r if err != nil { return nil, err } - return runtime.NewPoller[DomainEventSubscriptionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DomainEventSubscriptionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DomainEventSubscriptionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DomainEventSubscriptionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Delete - Delete an existing event subscription for a domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *DomainEventSubscriptionsClient) deleteOperation(ctx context.Context, resourceGroupName string, domainName string, eventSubscriptionName string, options *DomainEventSubscriptionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "DomainEventSubscriptionsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, domainName, eventSubscriptionName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -183,7 +207,7 @@ func (client *DomainEventSubscriptionsClient) deleteCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -191,26 +215,33 @@ func (client *DomainEventSubscriptionsClient) deleteCreateRequest(ctx context.Co // Get - Get properties of an event subscription of a domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. -// - domainName - Name of the domain. +// - domainName - Name of the partner topic. // - eventSubscriptionName - Name of the event subscription to be found. Event subscription names must be between 3 and 100 // characters in length and use alphanumeric letters only. // - options - DomainEventSubscriptionsClientGetOptions contains the optional parameters for the DomainEventSubscriptionsClient.Get // method. func (client *DomainEventSubscriptionsClient) Get(ctx context.Context, resourceGroupName string, domainName string, eventSubscriptionName string, options *DomainEventSubscriptionsClientGetOptions) (DomainEventSubscriptionsClientGetResponse, error) { + var err error + const operationName = "DomainEventSubscriptionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, domainName, eventSubscriptionName, options) if err != nil { return DomainEventSubscriptionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DomainEventSubscriptionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DomainEventSubscriptionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DomainEventSubscriptionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -237,7 +268,7 @@ func (client *DomainEventSubscriptionsClient) getCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -255,25 +286,32 @@ func (client *DomainEventSubscriptionsClient) getHandleResponse(resp *http.Respo // GetDeliveryAttributes - Get all delivery attributes for an event subscription for domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. -// - domainName - Name of the domain. +// - domainName - Name of the domain topic. // - eventSubscriptionName - Name of the event subscription. // - options - DomainEventSubscriptionsClientGetDeliveryAttributesOptions contains the optional parameters for the DomainEventSubscriptionsClient.GetDeliveryAttributes // method. func (client *DomainEventSubscriptionsClient) GetDeliveryAttributes(ctx context.Context, resourceGroupName string, domainName string, eventSubscriptionName string, options *DomainEventSubscriptionsClientGetDeliveryAttributesOptions) (DomainEventSubscriptionsClientGetDeliveryAttributesResponse, error) { + var err error + const operationName = "DomainEventSubscriptionsClient.GetDeliveryAttributes" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getDeliveryAttributesCreateRequest(ctx, resourceGroupName, domainName, eventSubscriptionName, options) if err != nil { return DomainEventSubscriptionsClientGetDeliveryAttributesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DomainEventSubscriptionsClientGetDeliveryAttributesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DomainEventSubscriptionsClientGetDeliveryAttributesResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DomainEventSubscriptionsClientGetDeliveryAttributesResponse{}, err } - return client.getDeliveryAttributesHandleResponse(resp) + resp, err := client.getDeliveryAttributesHandleResponse(httpResp) + return resp, err } // getDeliveryAttributesCreateRequest creates the GetDeliveryAttributes request. @@ -300,7 +338,7 @@ func (client *DomainEventSubscriptionsClient) getDeliveryAttributesCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -318,25 +356,32 @@ func (client *DomainEventSubscriptionsClient) getDeliveryAttributesHandleRespons // GetFullURL - Get the full endpoint URL for an event subscription for domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the domain topic. // - eventSubscriptionName - Name of the event subscription. // - options - DomainEventSubscriptionsClientGetFullURLOptions contains the optional parameters for the DomainEventSubscriptionsClient.GetFullURL // method. func (client *DomainEventSubscriptionsClient) GetFullURL(ctx context.Context, resourceGroupName string, domainName string, eventSubscriptionName string, options *DomainEventSubscriptionsClientGetFullURLOptions) (DomainEventSubscriptionsClientGetFullURLResponse, error) { + var err error + const operationName = "DomainEventSubscriptionsClient.GetFullURL" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getFullURLCreateRequest(ctx, resourceGroupName, domainName, eventSubscriptionName, options) if err != nil { return DomainEventSubscriptionsClientGetFullURLResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DomainEventSubscriptionsClientGetFullURLResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DomainEventSubscriptionsClientGetFullURLResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DomainEventSubscriptionsClientGetFullURLResponse{}, err } - return client.getFullURLHandleResponse(resp) + resp, err := client.getFullURLHandleResponse(httpResp) + return resp, err } // getFullURLCreateRequest creates the GetFullURL request. @@ -363,7 +408,7 @@ func (client *DomainEventSubscriptionsClient) getFullURLCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -380,7 +425,7 @@ func (client *DomainEventSubscriptionsClient) getFullURLHandleResponse(resp *htt // NewListPager - List all event subscriptions that have been created for a specific topic. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the domain. // - options - DomainEventSubscriptionsClientListOptions contains the optional parameters for the DomainEventSubscriptionsClient.NewListPager @@ -391,25 +436,20 @@ func (client *DomainEventSubscriptionsClient) NewListPager(resourceGroupName str return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *DomainEventSubscriptionsClientListResponse) (DomainEventSubscriptionsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, resourceGroupName, domainName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DomainEventSubscriptionsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, domainName, options) + }, nil) if err != nil { return DomainEventSubscriptionsClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DomainEventSubscriptionsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DomainEventSubscriptionsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -433,7 +473,7 @@ func (client *DomainEventSubscriptionsClient) listCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -457,7 +497,7 @@ func (client *DomainEventSubscriptionsClient) listHandleResponse(resp *http.Resp // BeginUpdate - Update an existing event subscription for a topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the domain. // - eventSubscriptionName - Name of the event subscription to be updated. @@ -470,29 +510,40 @@ func (client *DomainEventSubscriptionsClient) BeginUpdate(ctx context.Context, r if err != nil { return nil, err } - return runtime.NewPoller[DomainEventSubscriptionsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DomainEventSubscriptionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DomainEventSubscriptionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DomainEventSubscriptionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Update - Update an existing event subscription for a topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *DomainEventSubscriptionsClient) update(ctx context.Context, resourceGroupName string, domainName string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters, options *DomainEventSubscriptionsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "DomainEventSubscriptionsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, domainName, eventSubscriptionName, eventSubscriptionUpdateParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -519,8 +570,11 @@ func (client *DomainEventSubscriptionsClient) updateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, eventSubscriptionUpdateParameters) + if err := runtime.MarshalAsJSON(req, eventSubscriptionUpdateParameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/domaineventsubscriptions_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/domaineventsubscriptions_client_example_test.go index cf8477acf9bf..a95630fd5228 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/domaineventsubscriptions_client_example_test.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/domaineventsubscriptions_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/DomainEventSubscriptions_GetDeliveryAttributes.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/DomainEventSubscriptions_GetDeliveryAttributes.json func ExampleDomainEventSubscriptionsClient_GetDeliveryAttributes() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -64,7 +64,7 @@ func ExampleDomainEventSubscriptionsClient_GetDeliveryAttributes() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/DomainEventSubscriptions_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/DomainEventSubscriptions_Get.json func ExampleDomainEventSubscriptionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -85,13 +85,13 @@ func ExampleDomainEventSubscriptionsClient_Get() { // res.EventSubscription = armeventgrid.EventSubscription{ // Name: to.Ptr("examplesubscription1"), // Type: to.Ptr("Microsoft.EventGrid/domains/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampleDomain1/eventSubscriptions/examplesubscription1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampleDomain1/eventSubscriptions/examplesubscription1"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.StorageQueueEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeStorageQueue), // Properties: &armeventgrid.StorageQueueEventSubscriptionDestinationProperties{ // QueueName: to.Ptr("que"), - // ResourceID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.Storage/storageAccounts/testtrackedsource"), + // ResourceID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.Storage/storageAccounts/testtrackedsource"), // }, // }, // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), @@ -111,12 +111,12 @@ func ExampleDomainEventSubscriptionsClient_Get() { // EventTimeToLiveInMinutes: to.Ptr[int32](1440), // MaxDeliveryAttempts: to.Ptr[int32](30), // }, - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampleDomain1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampleDomain1"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/DomainEventSubscriptions_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/DomainEventSubscriptions_CreateOrUpdate.json func ExampleDomainEventSubscriptionsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -155,7 +155,7 @@ func ExampleDomainEventSubscriptionsClient_BeginCreateOrUpdate() { // res.EventSubscription = armeventgrid.EventSubscription{ // Name: to.Ptr("exampleEventSubscriptionName1"), // Type: to.Ptr("Microsoft.EventGrid/domains/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampleDomain1/eventSubscriptions/exampleEventSubscriptionName1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampleDomain1/eventSubscriptions/exampleEventSubscriptionName1"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -174,12 +174,12 @@ func ExampleDomainEventSubscriptionsClient_BeginCreateOrUpdate() { // EventTimeToLiveInMinutes: to.Ptr[int32](1440), // MaxDeliveryAttempts: to.Ptr[int32](30), // }, - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampleDomain1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampleDomain1"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/DomainEventSubscriptions_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/DomainEventSubscriptions_Delete.json func ExampleDomainEventSubscriptionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -200,7 +200,7 @@ func ExampleDomainEventSubscriptionsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/DomainEventSubscriptions_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/DomainEventSubscriptions_Update.json func ExampleDomainEventSubscriptionsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -236,7 +236,7 @@ func ExampleDomainEventSubscriptionsClient_BeginUpdate() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/DomainEventSubscriptions_GetFullUrl.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/DomainEventSubscriptions_GetFullUrl.json func ExampleDomainEventSubscriptionsClient_GetFullURL() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -259,7 +259,7 @@ func ExampleDomainEventSubscriptionsClient_GetFullURL() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/DomainEventSubscriptions_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/DomainEventSubscriptions_List.json func ExampleDomainEventSubscriptionsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -288,13 +288,13 @@ func ExampleDomainEventSubscriptionsClient_NewListPager() { // { // Name: to.Ptr("examplesubscription1"), // Type: to.Ptr("Microsoft.EventGrid/domains/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampleDomain1/eventSubscriptions/examplesubscription1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampleDomain1/eventSubscriptions/examplesubscription1"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.StorageQueueEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeStorageQueue), // Properties: &armeventgrid.StorageQueueEventSubscriptionDestinationProperties{ // QueueName: to.Ptr("que"), - // ResourceID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.Storage/storageAccounts/testtrackedsource"), + // ResourceID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.Storage/storageAccounts/testtrackedsource"), // }, // }, // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), @@ -314,7 +314,7 @@ func ExampleDomainEventSubscriptionsClient_NewListPager() { // EventTimeToLiveInMinutes: to.Ptr[int32](1440), // MaxDeliveryAttempts: to.Ptr[int32](30), // }, - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampleDomain1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampleDomain1"), // }, // }}, // } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/domains_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/domains_client.go index fd2643299aaa..b27e324226e9 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/domains_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/domains_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid @@ -35,7 +34,7 @@ type DomainsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewDomainsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DomainsClient, error) { - cl, err := arm.NewClient(moduleName+".DomainsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -49,7 +48,7 @@ func NewDomainsClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreateOrUpdate - Asynchronously creates or updates a new domain with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the domain. // - domainInfo - Domain information. @@ -61,29 +60,40 @@ func (client *DomainsClient) BeginCreateOrUpdate(ctx context.Context, resourceGr if err != nil { return nil, err } - return runtime.NewPoller[DomainsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DomainsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DomainsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DomainsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // CreateOrUpdate - Asynchronously creates or updates a new domain with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *DomainsClient) createOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainInfo Domain, options *DomainsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "DomainsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, domainName, domainInfo, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -106,16 +116,19 @@ func (client *DomainsClient) createOrUpdateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, domainInfo) + if err := runtime.MarshalAsJSON(req, domainInfo); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete existing domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the domain. // - options - DomainsClientBeginDeleteOptions contains the optional parameters for the DomainsClient.BeginDelete method. @@ -125,29 +138,40 @@ func (client *DomainsClient) BeginDelete(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[DomainsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DomainsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DomainsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DomainsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Delete - Delete existing domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *DomainsClient) deleteOperation(ctx context.Context, resourceGroupName string, domainName string, options *DomainsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "DomainsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, domainName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -170,7 +194,7 @@ func (client *DomainsClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -178,23 +202,30 @@ func (client *DomainsClient) deleteCreateRequest(ctx context.Context, resourceGr // Get - Get properties of a domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the domain. // - options - DomainsClientGetOptions contains the optional parameters for the DomainsClient.Get method. func (client *DomainsClient) Get(ctx context.Context, resourceGroupName string, domainName string, options *DomainsClientGetOptions) (DomainsClientGetResponse, error) { + var err error + const operationName = "DomainsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, domainName, options) if err != nil { return DomainsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DomainsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DomainsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DomainsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -217,7 +248,7 @@ func (client *DomainsClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -234,7 +265,7 @@ func (client *DomainsClient) getHandleResponse(resp *http.Response) (DomainsClie // NewListByResourceGroupPager - List all the domains under a resource group. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - options - DomainsClientListByResourceGroupOptions contains the optional parameters for the DomainsClient.NewListByResourceGroupPager // method. @@ -244,25 +275,20 @@ func (client *DomainsClient) NewListByResourceGroupPager(resourceGroupName strin return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *DomainsClientListByResourceGroupResponse) (DomainsClientListByResourceGroupResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DomainsClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) if err != nil { return DomainsClientListByResourceGroupResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DomainsClientListByResourceGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DomainsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } return client.listByResourceGroupHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -282,7 +308,7 @@ func (client *DomainsClient) listByResourceGroupCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -305,7 +331,7 @@ func (client *DomainsClient) listByResourceGroupHandleResponse(resp *http.Respon // NewListBySubscriptionPager - List all the domains under an Azure subscription. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - options - DomainsClientListBySubscriptionOptions contains the optional parameters for the DomainsClient.NewListBySubscriptionPager // method. func (client *DomainsClient) NewListBySubscriptionPager(options *DomainsClientListBySubscriptionOptions) *runtime.Pager[DomainsClientListBySubscriptionResponse] { @@ -314,25 +340,20 @@ func (client *DomainsClient) NewListBySubscriptionPager(options *DomainsClientLi return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *DomainsClientListBySubscriptionResponse) (DomainsClientListBySubscriptionResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listBySubscriptionCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DomainsClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) if err != nil { return DomainsClientListBySubscriptionResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DomainsClientListBySubscriptionResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DomainsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) - } return client.listBySubscriptionHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -348,7 +369,7 @@ func (client *DomainsClient) listBySubscriptionCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -372,24 +393,31 @@ func (client *DomainsClient) listBySubscriptionHandleResponse(resp *http.Respons // ListSharedAccessKeys - List the two keys used to publish to a domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the domain. // - options - DomainsClientListSharedAccessKeysOptions contains the optional parameters for the DomainsClient.ListSharedAccessKeys // method. func (client *DomainsClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, domainName string, options *DomainsClientListSharedAccessKeysOptions) (DomainsClientListSharedAccessKeysResponse, error) { + var err error + const operationName = "DomainsClient.ListSharedAccessKeys" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.listSharedAccessKeysCreateRequest(ctx, resourceGroupName, domainName, options) if err != nil { return DomainsClientListSharedAccessKeysResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DomainsClientListSharedAccessKeysResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DomainsClientListSharedAccessKeysResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DomainsClientListSharedAccessKeysResponse{}, err } - return client.listSharedAccessKeysHandleResponse(resp) + resp, err := client.listSharedAccessKeysHandleResponse(httpResp) + return resp, err } // listSharedAccessKeysCreateRequest creates the ListSharedAccessKeys request. @@ -412,7 +440,7 @@ func (client *DomainsClient) listSharedAccessKeysCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -430,24 +458,31 @@ func (client *DomainsClient) listSharedAccessKeysHandleResponse(resp *http.Respo // RegenerateKey - Regenerate a shared access key for a domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the domain. // - regenerateKeyRequest - Request body to regenerate key. // - options - DomainsClientRegenerateKeyOptions contains the optional parameters for the DomainsClient.RegenerateKey method. func (client *DomainsClient) RegenerateKey(ctx context.Context, resourceGroupName string, domainName string, regenerateKeyRequest DomainRegenerateKeyRequest, options *DomainsClientRegenerateKeyOptions) (DomainsClientRegenerateKeyResponse, error) { + var err error + const operationName = "DomainsClient.RegenerateKey" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.regenerateKeyCreateRequest(ctx, resourceGroupName, domainName, regenerateKeyRequest, options) if err != nil { return DomainsClientRegenerateKeyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DomainsClientRegenerateKeyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DomainsClientRegenerateKeyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DomainsClientRegenerateKeyResponse{}, err } - return client.regenerateKeyHandleResponse(resp) + resp, err := client.regenerateKeyHandleResponse(httpResp) + return resp, err } // regenerateKeyCreateRequest creates the RegenerateKey request. @@ -470,10 +505,13 @@ func (client *DomainsClient) regenerateKeyCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, regenerateKeyRequest) + if err := runtime.MarshalAsJSON(req, regenerateKeyRequest); err != nil { + return nil, err + } + return req, nil } // regenerateKeyHandleResponse handles the RegenerateKey response. @@ -488,7 +526,7 @@ func (client *DomainsClient) regenerateKeyHandleResponse(resp *http.Response) (D // BeginUpdate - Asynchronously updates a domain with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the domain. // - domainUpdateParameters - Domain update information. @@ -499,29 +537,40 @@ func (client *DomainsClient) BeginUpdate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[DomainsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DomainsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DomainsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DomainsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Update - Asynchronously updates a domain with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *DomainsClient) update(ctx context.Context, resourceGroupName string, domainName string, domainUpdateParameters DomainUpdateParameters, options *DomainsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "DomainsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, domainName, domainUpdateParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -544,8 +593,11 @@ func (client *DomainsClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, domainUpdateParameters) + if err := runtime.MarshalAsJSON(req, domainUpdateParameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/domains_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/domains_client_example_test.go index 32b3e1de60bb..8e23c02a8018 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/domains_client_example_test.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/domains_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Domains_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Domains_Get.json func ExampleDomainsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -39,7 +39,7 @@ func ExampleDomainsClient_Get() { // res.Domain = armeventgrid.Domain{ // Name: to.Ptr("exampledomain2"), // Type: to.Ptr("Microsoft.EventGrid/domains"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampledomain2"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampledomain2"), // Location: to.Ptr("westcentralus"), // Tags: map[string]*string{ // "tag1": to.Ptr("value1"), @@ -52,7 +52,7 @@ func ExampleDomainsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Domains_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Domains_CreateOrUpdate.json func ExampleDomainsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -91,7 +91,7 @@ func ExampleDomainsClient_BeginCreateOrUpdate() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Domains_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Domains_Delete.json func ExampleDomainsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -112,7 +112,7 @@ func ExampleDomainsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Domains_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Domains_Update.json func ExampleDomainsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -150,7 +150,7 @@ func ExampleDomainsClient_BeginUpdate() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Domains_ListBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Domains_ListBySubscription.json func ExampleDomainsClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -179,7 +179,7 @@ func ExampleDomainsClient_NewListBySubscriptionPager() { // { // Name: to.Ptr("exampledomain1"), // Type: to.Ptr("Microsoft.EventGrid/domains"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampledomain1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampledomain1"), // Location: to.Ptr("westus2"), // Tags: map[string]*string{ // "tag1": to.Ptr("value1"), @@ -193,7 +193,7 @@ func ExampleDomainsClient_NewListBySubscriptionPager() { // { // Name: to.Ptr("exampledomain2"), // Type: to.Ptr("Microsoft.EventGrid/domains"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampledomain2"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampledomain2"), // Location: to.Ptr("westcentralus"), // Tags: map[string]*string{ // "tag1": to.Ptr("value1"), @@ -208,7 +208,7 @@ func ExampleDomainsClient_NewListBySubscriptionPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Domains_ListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Domains_ListByResourceGroup.json func ExampleDomainsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -237,7 +237,7 @@ func ExampleDomainsClient_NewListByResourceGroupPager() { // { // Name: to.Ptr("exampledomain1"), // Type: to.Ptr("Microsoft.EventGrid/domains"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampledomain1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampledomain1"), // Location: to.Ptr("westus2"), // Tags: map[string]*string{ // "tag1": to.Ptr("value1"), @@ -251,7 +251,7 @@ func ExampleDomainsClient_NewListByResourceGroupPager() { // { // Name: to.Ptr("exampledomain2"), // Type: to.Ptr("Microsoft.EventGrid/domains"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampledomain2"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampledomain2"), // Location: to.Ptr("westcentralus"), // Tags: map[string]*string{ // "tag1": to.Ptr("value1"), @@ -266,7 +266,7 @@ func ExampleDomainsClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Domains_ListSharedAccessKeys.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Domains_ListSharedAccessKeys.json func ExampleDomainsClient_ListSharedAccessKeys() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -285,12 +285,12 @@ func ExampleDomainsClient_ListSharedAccessKeys() { _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. // res.DomainSharedAccessKeys = armeventgrid.DomainSharedAccessKeys{ - // Key1: to.Ptr("testKey1Value"), - // Key2: to.Ptr("testKey2Value"), + // Key1: to.Ptr(""), + // Key2: to.Ptr(""), // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Domains_RegenerateKey.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Domains_RegenerateKey.json func ExampleDomainsClient_RegenerateKey() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -311,7 +311,7 @@ func ExampleDomainsClient_RegenerateKey() { _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. // res.DomainSharedAccessKeys = armeventgrid.DomainSharedAccessKeys{ - // Key1: to.Ptr("testKey1Value"), - // Key2: to.Ptr("testKey2Value"), + // Key1: to.Ptr(""), + // Key2: to.Ptr(""), // } } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/domaintopiceventsubscriptions_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/domaintopiceventsubscriptions_client.go index 556e9a6f5cd8..8b5bc892568d 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/domaintopiceventsubscriptions_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/domaintopiceventsubscriptions_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid @@ -35,7 +34,7 @@ type DomainTopicEventSubscriptionsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewDomainTopicEventSubscriptionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DomainTopicEventSubscriptionsClient, error) { - cl, err := arm.NewClient(moduleName+".DomainTopicEventSubscriptionsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -49,7 +48,7 @@ func NewDomainTopicEventSubscriptionsClient(subscriptionID string, credential az // BeginCreateOrUpdate - Asynchronously creates a new event subscription or updates an existing event subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the top level domain. // - topicName - Name of the domain topic. @@ -64,29 +63,40 @@ func (client *DomainTopicEventSubscriptionsClient) BeginCreateOrUpdate(ctx conte if err != nil { return nil, err } - return runtime.NewPoller[DomainTopicEventSubscriptionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DomainTopicEventSubscriptionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DomainTopicEventSubscriptionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DomainTopicEventSubscriptionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // CreateOrUpdate - Asynchronously creates a new event subscription or updates an existing event subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *DomainTopicEventSubscriptionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, domainName string, topicName string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription, options *DomainTopicEventSubscriptionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "DomainTopicEventSubscriptionsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, domainName, topicName, eventSubscriptionName, eventSubscriptionInfo, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -117,16 +127,19 @@ func (client *DomainTopicEventSubscriptionsClient) createOrUpdateCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, eventSubscriptionInfo) + if err := runtime.MarshalAsJSON(req, eventSubscriptionInfo); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete a nested existing event subscription for a domain topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the top level domain. // - topicName - Name of the domain topic. @@ -140,29 +153,40 @@ func (client *DomainTopicEventSubscriptionsClient) BeginDelete(ctx context.Conte if err != nil { return nil, err } - return runtime.NewPoller[DomainTopicEventSubscriptionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DomainTopicEventSubscriptionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DomainTopicEventSubscriptionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DomainTopicEventSubscriptionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Delete - Delete a nested existing event subscription for a domain topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *DomainTopicEventSubscriptionsClient) deleteOperation(ctx context.Context, resourceGroupName string, domainName string, topicName string, eventSubscriptionName string, options *DomainTopicEventSubscriptionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "DomainTopicEventSubscriptionsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, domainName, topicName, eventSubscriptionName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -193,7 +217,7 @@ func (client *DomainTopicEventSubscriptionsClient) deleteCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -201,7 +225,7 @@ func (client *DomainTopicEventSubscriptionsClient) deleteCreateRequest(ctx conte // Get - Get properties of a nested event subscription for a domain topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the top level domain. // - topicName - Name of the domain topic. @@ -209,18 +233,25 @@ func (client *DomainTopicEventSubscriptionsClient) deleteCreateRequest(ctx conte // - options - DomainTopicEventSubscriptionsClientGetOptions contains the optional parameters for the DomainTopicEventSubscriptionsClient.Get // method. func (client *DomainTopicEventSubscriptionsClient) Get(ctx context.Context, resourceGroupName string, domainName string, topicName string, eventSubscriptionName string, options *DomainTopicEventSubscriptionsClientGetOptions) (DomainTopicEventSubscriptionsClientGetResponse, error) { + var err error + const operationName = "DomainTopicEventSubscriptionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, domainName, topicName, eventSubscriptionName, options) if err != nil { return DomainTopicEventSubscriptionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DomainTopicEventSubscriptionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DomainTopicEventSubscriptionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DomainTopicEventSubscriptionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -251,7 +282,7 @@ func (client *DomainTopicEventSubscriptionsClient) getCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,7 +300,7 @@ func (client *DomainTopicEventSubscriptionsClient) getHandleResponse(resp *http. // GetDeliveryAttributes - Get all delivery attributes for an event subscription for domain topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the top level domain. // - topicName - Name of the domain topic. @@ -277,18 +308,25 @@ func (client *DomainTopicEventSubscriptionsClient) getHandleResponse(resp *http. // - options - DomainTopicEventSubscriptionsClientGetDeliveryAttributesOptions contains the optional parameters for the DomainTopicEventSubscriptionsClient.GetDeliveryAttributes // method. func (client *DomainTopicEventSubscriptionsClient) GetDeliveryAttributes(ctx context.Context, resourceGroupName string, domainName string, topicName string, eventSubscriptionName string, options *DomainTopicEventSubscriptionsClientGetDeliveryAttributesOptions) (DomainTopicEventSubscriptionsClientGetDeliveryAttributesResponse, error) { + var err error + const operationName = "DomainTopicEventSubscriptionsClient.GetDeliveryAttributes" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getDeliveryAttributesCreateRequest(ctx, resourceGroupName, domainName, topicName, eventSubscriptionName, options) if err != nil { return DomainTopicEventSubscriptionsClientGetDeliveryAttributesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DomainTopicEventSubscriptionsClientGetDeliveryAttributesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DomainTopicEventSubscriptionsClientGetDeliveryAttributesResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DomainTopicEventSubscriptionsClientGetDeliveryAttributesResponse{}, err } - return client.getDeliveryAttributesHandleResponse(resp) + resp, err := client.getDeliveryAttributesHandleResponse(httpResp) + return resp, err } // getDeliveryAttributesCreateRequest creates the GetDeliveryAttributes request. @@ -319,7 +357,7 @@ func (client *DomainTopicEventSubscriptionsClient) getDeliveryAttributesCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -337,7 +375,7 @@ func (client *DomainTopicEventSubscriptionsClient) getDeliveryAttributesHandleRe // GetFullURL - Get the full endpoint URL for a nested event subscription for domain topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the top level domain. // - topicName - Name of the domain topic. @@ -345,18 +383,25 @@ func (client *DomainTopicEventSubscriptionsClient) getDeliveryAttributesHandleRe // - options - DomainTopicEventSubscriptionsClientGetFullURLOptions contains the optional parameters for the DomainTopicEventSubscriptionsClient.GetFullURL // method. func (client *DomainTopicEventSubscriptionsClient) GetFullURL(ctx context.Context, resourceGroupName string, domainName string, topicName string, eventSubscriptionName string, options *DomainTopicEventSubscriptionsClientGetFullURLOptions) (DomainTopicEventSubscriptionsClientGetFullURLResponse, error) { + var err error + const operationName = "DomainTopicEventSubscriptionsClient.GetFullURL" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getFullURLCreateRequest(ctx, resourceGroupName, domainName, topicName, eventSubscriptionName, options) if err != nil { return DomainTopicEventSubscriptionsClientGetFullURLResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DomainTopicEventSubscriptionsClientGetFullURLResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DomainTopicEventSubscriptionsClientGetFullURLResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DomainTopicEventSubscriptionsClientGetFullURLResponse{}, err } - return client.getFullURLHandleResponse(resp) + resp, err := client.getFullURLHandleResponse(httpResp) + return resp, err } // getFullURLCreateRequest creates the GetFullURL request. @@ -387,7 +432,7 @@ func (client *DomainTopicEventSubscriptionsClient) getFullURLCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -404,7 +449,7 @@ func (client *DomainTopicEventSubscriptionsClient) getFullURLHandleResponse(resp // NewListPager - List all event subscriptions that have been created for a specific domain topic. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the top level domain. // - topicName - Name of the domain topic. @@ -416,25 +461,20 @@ func (client *DomainTopicEventSubscriptionsClient) NewListPager(resourceGroupNam return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *DomainTopicEventSubscriptionsClientListResponse) (DomainTopicEventSubscriptionsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, resourceGroupName, domainName, topicName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DomainTopicEventSubscriptionsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, domainName, topicName, options) + }, nil) if err != nil { return DomainTopicEventSubscriptionsClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DomainTopicEventSubscriptionsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DomainTopicEventSubscriptionsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -462,7 +502,7 @@ func (client *DomainTopicEventSubscriptionsClient) listCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -486,7 +526,7 @@ func (client *DomainTopicEventSubscriptionsClient) listHandleResponse(resp *http // BeginUpdate - Update an existing event subscription for a domain topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the domain. // - topicName - Name of the topic. @@ -500,29 +540,40 @@ func (client *DomainTopicEventSubscriptionsClient) BeginUpdate(ctx context.Conte if err != nil { return nil, err } - return runtime.NewPoller[DomainTopicEventSubscriptionsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DomainTopicEventSubscriptionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DomainTopicEventSubscriptionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DomainTopicEventSubscriptionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Update - Update an existing event subscription for a domain topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *DomainTopicEventSubscriptionsClient) update(ctx context.Context, resourceGroupName string, domainName string, topicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters, options *DomainTopicEventSubscriptionsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "DomainTopicEventSubscriptionsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, domainName, topicName, eventSubscriptionName, eventSubscriptionUpdateParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -553,8 +604,11 @@ func (client *DomainTopicEventSubscriptionsClient) updateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, eventSubscriptionUpdateParameters) + if err := runtime.MarshalAsJSON(req, eventSubscriptionUpdateParameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/domaintopiceventsubscriptions_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/domaintopiceventsubscriptions_client_example_test.go index 360872484716..0c066848d29d 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/domaintopiceventsubscriptions_client_example_test.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/domaintopiceventsubscriptions_client_example_test.go @@ -18,53 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/DomainTopicEventSubscriptions_GetDeliveryAttributes.json -func ExampleDomainTopicEventSubscriptionsClient_GetDeliveryAttributes() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDomainTopicEventSubscriptionsClient().GetDeliveryAttributes(ctx, "examplerg", "exampleDomain1", "exampleDomainTopic1", "examplesubscription1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DeliveryAttributeListResult = armeventgrid.DeliveryAttributeListResult{ - // Value: []armeventgrid.DeliveryAttributeMappingClassification{ - // &armeventgrid.StaticDeliveryAttributeMapping{ - // Name: to.Ptr("header1"), - // Type: to.Ptr(armeventgrid.DeliveryAttributeMappingTypeStatic), - // Properties: &armeventgrid.StaticDeliveryAttributeMappingProperties{ - // IsSecret: to.Ptr(false), - // Value: to.Ptr("NormalValue"), - // }, - // }, - // &armeventgrid.DynamicDeliveryAttributeMapping{ - // Name: to.Ptr("header2"), - // Type: to.Ptr(armeventgrid.DeliveryAttributeMappingTypeDynamic), - // Properties: &armeventgrid.DynamicDeliveryAttributeMappingProperties{ - // SourceField: to.Ptr("data.foo"), - // }, - // }, - // &armeventgrid.StaticDeliveryAttributeMapping{ - // Name: to.Ptr("header3"), - // Type: to.Ptr(armeventgrid.DeliveryAttributeMappingTypeStatic), - // Properties: &armeventgrid.StaticDeliveryAttributeMappingProperties{ - // IsSecret: to.Ptr(true), - // Value: to.Ptr("mySecretValue"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/DomainTopicEventSubscriptions_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/DomainTopicEventSubscriptions_Get.json func ExampleDomainTopicEventSubscriptionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -85,13 +39,13 @@ func ExampleDomainTopicEventSubscriptionsClient_Get() { // res.EventSubscription = armeventgrid.EventSubscription{ // Name: to.Ptr("examplesubscription1"), // Type: to.Ptr("Microsoft.EventGrid/domains/domainTopics/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampleDomain1/domainTopics/exampleDomainTopic1/eventSubscriptions/examplesubscription1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampleDomain1/domainTopics/exampleDomainTopic1/eventSubscriptions/examplesubscription1"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.StorageQueueEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeStorageQueue), // Properties: &armeventgrid.StorageQueueEventSubscriptionDestinationProperties{ // QueueName: to.Ptr("que"), - // ResourceID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.Storage/storageAccounts/testtrackedsource"), + // ResourceID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.Storage/storageAccounts/testtrackedsource"), // }, // }, // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), @@ -111,12 +65,12 @@ func ExampleDomainTopicEventSubscriptionsClient_Get() { // EventTimeToLiveInMinutes: to.Ptr[int32](1440), // MaxDeliveryAttempts: to.Ptr[int32](30), // }, - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampleDomain1/domainTopics/exampleDomainTopic1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampleDomain1/domainTopics/exampleDomainTopic1"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/DomainTopicEventSubscriptions_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/DomainTopicEventSubscriptions_CreateOrUpdate.json func ExampleDomainTopicEventSubscriptionsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -155,7 +109,7 @@ func ExampleDomainTopicEventSubscriptionsClient_BeginCreateOrUpdate() { // res.EventSubscription = armeventgrid.EventSubscription{ // Name: to.Ptr("exampleEventSubscriptionName1"), // Type: to.Ptr("Microsoft.EventGrid/domains/domainTopics/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampleDomain1/domainTopics/exampleDomainTopic1/eventSubscriptions/exampleEventSubscriptionName1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampleDomain1/domainTopics/exampleDomainTopic1/eventSubscriptions/exampleEventSubscriptionName1"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -174,12 +128,12 @@ func ExampleDomainTopicEventSubscriptionsClient_BeginCreateOrUpdate() { // EventTimeToLiveInMinutes: to.Ptr[int32](1440), // MaxDeliveryAttempts: to.Ptr[int32](30), // }, - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampleDomain1/domainTopics/exampleDomainTopic1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampleDomain1/domainTopics/exampleDomainTopic1"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/DomainTopicEventSubscriptions_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/DomainTopicEventSubscriptions_Delete.json func ExampleDomainTopicEventSubscriptionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -200,7 +154,7 @@ func ExampleDomainTopicEventSubscriptionsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/DomainTopicEventSubscriptions_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/DomainTopicEventSubscriptions_Update.json func ExampleDomainTopicEventSubscriptionsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -236,7 +190,7 @@ func ExampleDomainTopicEventSubscriptionsClient_BeginUpdate() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/DomainTopicEventSubscriptions_GetFullUrl.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/DomainTopicEventSubscriptions_GetFullUrl.json func ExampleDomainTopicEventSubscriptionsClient_GetFullURL() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -259,7 +213,7 @@ func ExampleDomainTopicEventSubscriptionsClient_GetFullURL() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/DomainTopicEventSubscriptions_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/DomainTopicEventSubscriptions_List.json func ExampleDomainTopicEventSubscriptionsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -288,13 +242,13 @@ func ExampleDomainTopicEventSubscriptionsClient_NewListPager() { // { // Name: to.Ptr("examplesubscription1"), // Type: to.Ptr("Microsoft.EventGrid/domains/domainTopics/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampleDomain1/domainTopics/exampleDomainTopic1/eventSubscriptions/examplesubscription1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampleDomain1/domainTopics/exampleDomainTopic1/eventSubscriptions/examplesubscription1"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.StorageQueueEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeStorageQueue), // Properties: &armeventgrid.StorageQueueEventSubscriptionDestinationProperties{ // QueueName: to.Ptr("que"), - // ResourceID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.Storage/storageAccounts/testtrackedsource"), + // ResourceID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.Storage/storageAccounts/testtrackedsource"), // }, // }, // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), @@ -314,9 +268,55 @@ func ExampleDomainTopicEventSubscriptionsClient_NewListPager() { // EventTimeToLiveInMinutes: to.Ptr[int32](1440), // MaxDeliveryAttempts: to.Ptr[int32](30), // }, - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampleDomain1/domainTopics/exampleDomainTopic1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampleDomain1/domainTopics/exampleDomainTopic1"), // }, // }}, // } } } + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/DomainTopicEventSubscriptions_GetDeliveryAttributes.json +func ExampleDomainTopicEventSubscriptionsClient_GetDeliveryAttributes() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewDomainTopicEventSubscriptionsClient().GetDeliveryAttributes(ctx, "examplerg", "exampleDomain1", "exampleDomainTopic1", "examplesubscription1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.DeliveryAttributeListResult = armeventgrid.DeliveryAttributeListResult{ + // Value: []armeventgrid.DeliveryAttributeMappingClassification{ + // &armeventgrid.StaticDeliveryAttributeMapping{ + // Name: to.Ptr("header1"), + // Type: to.Ptr(armeventgrid.DeliveryAttributeMappingTypeStatic), + // Properties: &armeventgrid.StaticDeliveryAttributeMappingProperties{ + // IsSecret: to.Ptr(false), + // Value: to.Ptr("NormalValue"), + // }, + // }, + // &armeventgrid.DynamicDeliveryAttributeMapping{ + // Name: to.Ptr("header2"), + // Type: to.Ptr(armeventgrid.DeliveryAttributeMappingTypeDynamic), + // Properties: &armeventgrid.DynamicDeliveryAttributeMappingProperties{ + // SourceField: to.Ptr("data.foo"), + // }, + // }, + // &armeventgrid.StaticDeliveryAttributeMapping{ + // Name: to.Ptr("header3"), + // Type: to.Ptr(armeventgrid.DeliveryAttributeMappingTypeStatic), + // Properties: &armeventgrid.StaticDeliveryAttributeMappingProperties{ + // IsSecret: to.Ptr(true), + // Value: to.Ptr("mySecretValue"), + // }, + // }}, + // } +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/domaintopics_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/domaintopics_client.go index 6f0dd8d66720..272c68bfba95 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/domaintopics_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/domaintopics_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid @@ -35,7 +34,7 @@ type DomainTopicsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewDomainTopicsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DomainTopicsClient, error) { - cl, err := arm.NewClient(moduleName+".DomainTopicsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -49,7 +48,7 @@ func NewDomainTopicsClient(subscriptionID string, credential azcore.TokenCredent // BeginCreateOrUpdate - Asynchronously creates or updates a new domain topic with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the domain. // - domainTopicName - Name of the domain topic. @@ -61,29 +60,40 @@ func (client *DomainTopicsClient) BeginCreateOrUpdate(ctx context.Context, resou if err != nil { return nil, err } - return runtime.NewPoller[DomainTopicsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DomainTopicsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DomainTopicsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DomainTopicsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // CreateOrUpdate - Asynchronously creates or updates a new domain topic with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *DomainTopicsClient) createOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string, options *DomainTopicsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "DomainTopicsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, domainName, domainTopicName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -110,7 +120,7 @@ func (client *DomainTopicsClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -119,7 +129,7 @@ func (client *DomainTopicsClient) createOrUpdateCreateRequest(ctx context.Contex // BeginDelete - Delete existing domain topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the domain. // - domainTopicName - Name of the domain topic. @@ -131,29 +141,40 @@ func (client *DomainTopicsClient) BeginDelete(ctx context.Context, resourceGroup if err != nil { return nil, err } - return runtime.NewPoller[DomainTopicsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DomainTopicsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[DomainTopicsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DomainTopicsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Delete - Delete existing domain topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *DomainTopicsClient) deleteOperation(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string, options *DomainTopicsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "DomainTopicsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, domainName, domainTopicName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -180,7 +201,7 @@ func (client *DomainTopicsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -188,24 +209,31 @@ func (client *DomainTopicsClient) deleteCreateRequest(ctx context.Context, resou // Get - Get properties of a domain topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the domain. // - domainTopicName - Name of the topic. // - options - DomainTopicsClientGetOptions contains the optional parameters for the DomainTopicsClient.Get method. func (client *DomainTopicsClient) Get(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string, options *DomainTopicsClientGetOptions) (DomainTopicsClientGetResponse, error) { + var err error + const operationName = "DomainTopicsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, domainName, domainTopicName, options) if err != nil { return DomainTopicsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DomainTopicsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DomainTopicsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DomainTopicsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -232,7 +260,7 @@ func (client *DomainTopicsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -249,7 +277,7 @@ func (client *DomainTopicsClient) getHandleResponse(resp *http.Response) (Domain // NewListByDomainPager - List all the topics in a domain. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Domain name. // - options - DomainTopicsClientListByDomainOptions contains the optional parameters for the DomainTopicsClient.NewListByDomainPager @@ -260,25 +288,20 @@ func (client *DomainTopicsClient) NewListByDomainPager(resourceGroupName string, return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *DomainTopicsClientListByDomainResponse) (DomainTopicsClientListByDomainResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByDomainCreateRequest(ctx, resourceGroupName, domainName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DomainTopicsClient.NewListByDomainPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByDomainCreateRequest(ctx, resourceGroupName, domainName, options) + }, nil) if err != nil { return DomainTopicsClientListByDomainResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DomainTopicsClientListByDomainResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DomainTopicsClientListByDomainResponse{}, runtime.NewResponseError(resp) - } return client.listByDomainHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -302,7 +325,7 @@ func (client *DomainTopicsClient) listByDomainCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/domaintopics_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/domaintopics_client_example_test.go index 70a172ece9d2..d2678f7be601 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/domaintopics_client_example_test.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/domaintopics_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/DomainTopics_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/DomainTopics_Get.json func ExampleDomainTopicsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -38,14 +38,14 @@ func ExampleDomainTopicsClient_Get() { // res.DomainTopic = armeventgrid.DomainTopic{ // Name: to.Ptr("topic1"), // Type: to.Ptr("Microsoft.EventGrid/domains/topics"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampledomain2/topics/topic1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/exampledomain2/topics/topic1"), // Properties: &armeventgrid.DomainTopicProperties{ // ProvisioningState: to.Ptr(armeventgrid.DomainTopicProvisioningStateSucceeded), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/DomainTopics_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/DomainTopics_CreateOrUpdate.json func ExampleDomainTopicsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -66,7 +66,7 @@ func ExampleDomainTopicsClient_BeginCreateOrUpdate() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/DomainTopics_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/DomainTopics_Delete.json func ExampleDomainTopicsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -87,7 +87,7 @@ func ExampleDomainTopicsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/DomainTopics_ListByDomain.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/DomainTopics_ListByDomain.json func ExampleDomainTopicsClient_NewListByDomainPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -116,7 +116,7 @@ func ExampleDomainTopicsClient_NewListByDomainPager() { // { // Name: to.Ptr("domainCli100topic1"), // Type: to.Ptr("Microsoft.EventGrid/domains/topics"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/devexprg/providers/Microsoft.EventGrid/domains/domainCli100/topics/domainCli100topic1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/devexprg/providers/Microsoft.EventGrid/domains/domainCli100/topics/domainCli100topic1"), // Properties: &armeventgrid.DomainTopicProperties{ // ProvisioningState: to.Ptr(armeventgrid.DomainTopicProvisioningStateSucceeded), // }, @@ -124,7 +124,7 @@ func ExampleDomainTopicsClient_NewListByDomainPager() { // { // Name: to.Ptr("domainCli100topic2"), // Type: to.Ptr("Microsoft.EventGrid/domains/topics"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/devexprg/providers/Microsoft.EventGrid/domains/domainCli100/topics/domainCli100topic2"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/devexprg/providers/Microsoft.EventGrid/domains/domainCli100/topics/domainCli100topic2"), // Properties: &armeventgrid.DomainTopicProperties{ // ProvisioningState: to.Ptr(armeventgrid.DomainTopicProvisioningStateSucceeded), // }, diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/eventgrid_live_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/eventgrid_live_test.go index 04daebc99804..33bc8702d829 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/eventgrid_live_test.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/eventgrid_live_test.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2/testutil" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" "github.com/stretchr/testify/suite" ) diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/eventsubscriptions_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/eventsubscriptions_client.go index 5ddd63bda359..aa130fd01eed 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/eventsubscriptions_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/eventsubscriptions_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid @@ -35,7 +34,7 @@ type EventSubscriptionsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewEventSubscriptionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*EventSubscriptionsClient, error) { - cl, err := arm.NewClient(moduleName+".EventSubscriptionsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -50,7 +49,7 @@ func NewEventSubscriptionsClient(subscriptionID string, credential azcore.TokenC // the specified scope. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - scope - The identifier of the resource to which the event subscription needs to be created or updated. The scope can be // a subscription, or a resource group, or a top level resource belonging to a resource // provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' @@ -70,9 +69,14 @@ func (client *EventSubscriptionsClient) BeginCreateOrUpdate(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[EventSubscriptionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EventSubscriptionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[EventSubscriptionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EventSubscriptionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -80,20 +84,26 @@ func (client *EventSubscriptionsClient) BeginCreateOrUpdate(ctx context.Context, // specified scope. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *EventSubscriptionsClient) createOrUpdate(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription, options *EventSubscriptionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "EventSubscriptionsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, scope, eventSubscriptionName, eventSubscriptionInfo, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -109,16 +119,19 @@ func (client *EventSubscriptionsClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, eventSubscriptionInfo) + if err := runtime.MarshalAsJSON(req, eventSubscriptionInfo); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete an existing event subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - scope - The scope of the event subscription. The scope can be a subscription, or a resource group, or a top level resource // belonging to a resource provider namespace, or an EventGrid topic. For example, use // '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' @@ -136,29 +149,40 @@ func (client *EventSubscriptionsClient) BeginDelete(ctx context.Context, scope s if err != nil { return nil, err } - return runtime.NewPoller[EventSubscriptionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EventSubscriptionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[EventSubscriptionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EventSubscriptionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Delete - Delete an existing event subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *EventSubscriptionsClient) deleteOperation(ctx context.Context, scope string, eventSubscriptionName string, options *EventSubscriptionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "EventSubscriptionsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, scope, eventSubscriptionName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -174,7 +198,7 @@ func (client *EventSubscriptionsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -182,7 +206,7 @@ func (client *EventSubscriptionsClient) deleteCreateRequest(ctx context.Context, // Get - Get properties of an event subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - scope - The scope of the event subscription. The scope can be a subscription, or a resource group, or a top level resource // belonging to a resource provider namespace, or an EventGrid topic. For example, use // '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' @@ -194,18 +218,25 @@ func (client *EventSubscriptionsClient) deleteCreateRequest(ctx context.Context, // - eventSubscriptionName - Name of the event subscription. // - options - EventSubscriptionsClientGetOptions contains the optional parameters for the EventSubscriptionsClient.Get method. func (client *EventSubscriptionsClient) Get(ctx context.Context, scope string, eventSubscriptionName string, options *EventSubscriptionsClientGetOptions) (EventSubscriptionsClientGetResponse, error) { + var err error + const operationName = "EventSubscriptionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, scope, eventSubscriptionName, options) if err != nil { return EventSubscriptionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return EventSubscriptionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return EventSubscriptionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EventSubscriptionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -221,7 +252,7 @@ func (client *EventSubscriptionsClient) getCreateRequest(ctx context.Context, sc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -239,7 +270,7 @@ func (client *EventSubscriptionsClient) getHandleResponse(resp *http.Response) ( // GetDeliveryAttributes - Get all delivery attributes for an event subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - scope - The scope of the event subscription. The scope can be a subscription, or a resource group, or a top level resource // belonging to a resource provider namespace, or an EventGrid topic. For example, use // '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' @@ -252,18 +283,25 @@ func (client *EventSubscriptionsClient) getHandleResponse(resp *http.Response) ( // - options - EventSubscriptionsClientGetDeliveryAttributesOptions contains the optional parameters for the EventSubscriptionsClient.GetDeliveryAttributes // method. func (client *EventSubscriptionsClient) GetDeliveryAttributes(ctx context.Context, scope string, eventSubscriptionName string, options *EventSubscriptionsClientGetDeliveryAttributesOptions) (EventSubscriptionsClientGetDeliveryAttributesResponse, error) { + var err error + const operationName = "EventSubscriptionsClient.GetDeliveryAttributes" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getDeliveryAttributesCreateRequest(ctx, scope, eventSubscriptionName, options) if err != nil { return EventSubscriptionsClientGetDeliveryAttributesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return EventSubscriptionsClientGetDeliveryAttributesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return EventSubscriptionsClientGetDeliveryAttributesResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EventSubscriptionsClientGetDeliveryAttributesResponse{}, err } - return client.getDeliveryAttributesHandleResponse(resp) + resp, err := client.getDeliveryAttributesHandleResponse(httpResp) + return resp, err } // getDeliveryAttributesCreateRequest creates the GetDeliveryAttributes request. @@ -279,7 +317,7 @@ func (client *EventSubscriptionsClient) getDeliveryAttributesCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -297,7 +335,7 @@ func (client *EventSubscriptionsClient) getDeliveryAttributesHandleResponse(resp // GetFullURL - Get the full endpoint URL for an event subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - scope - The scope of the event subscription. The scope can be a subscription, or a resource group, or a top level resource // belonging to a resource provider namespace, or an EventGrid topic. For example, use // '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' @@ -310,18 +348,25 @@ func (client *EventSubscriptionsClient) getDeliveryAttributesHandleResponse(resp // - options - EventSubscriptionsClientGetFullURLOptions contains the optional parameters for the EventSubscriptionsClient.GetFullURL // method. func (client *EventSubscriptionsClient) GetFullURL(ctx context.Context, scope string, eventSubscriptionName string, options *EventSubscriptionsClientGetFullURLOptions) (EventSubscriptionsClientGetFullURLResponse, error) { + var err error + const operationName = "EventSubscriptionsClient.GetFullURL" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getFullURLCreateRequest(ctx, scope, eventSubscriptionName, options) if err != nil { return EventSubscriptionsClientGetFullURLResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return EventSubscriptionsClientGetFullURLResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return EventSubscriptionsClientGetFullURLResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EventSubscriptionsClientGetFullURLResponse{}, err } - return client.getFullURLHandleResponse(resp) + resp, err := client.getFullURLHandleResponse(httpResp) + return resp, err } // getFullURLCreateRequest creates the GetFullURL request. @@ -337,7 +382,7 @@ func (client *EventSubscriptionsClient) getFullURLCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -354,7 +399,7 @@ func (client *EventSubscriptionsClient) getFullURLHandleResponse(resp *http.Resp // NewListByDomainTopicPager - List all event subscriptions that have been created for a specific domain topic. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the top level domain. // - topicName - Name of the domain topic. @@ -366,25 +411,20 @@ func (client *EventSubscriptionsClient) NewListByDomainTopicPager(resourceGroupN return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *EventSubscriptionsClientListByDomainTopicResponse) (EventSubscriptionsClientListByDomainTopicResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByDomainTopicCreateRequest(ctx, resourceGroupName, domainName, topicName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return EventSubscriptionsClientListByDomainTopicResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EventSubscriptionsClient.NewListByDomainTopicPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByDomainTopicCreateRequest(ctx, resourceGroupName, domainName, topicName, options) + }, nil) if err != nil { return EventSubscriptionsClientListByDomainTopicResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return EventSubscriptionsClientListByDomainTopicResponse{}, runtime.NewResponseError(resp) - } return client.listByDomainTopicHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -412,7 +452,7 @@ func (client *EventSubscriptionsClient) listByDomainTopicCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -435,7 +475,7 @@ func (client *EventSubscriptionsClient) listByDomainTopicHandleResponse(resp *ht // NewListByResourcePager - List all event subscriptions that have been created for a specific resource. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - providerNamespace - Namespace of the provider of the topic. // - resourceTypeName - Name of the resource type. @@ -448,25 +488,20 @@ func (client *EventSubscriptionsClient) NewListByResourcePager(resourceGroupName return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *EventSubscriptionsClientListByResourceResponse) (EventSubscriptionsClientListByResourceResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByResourceCreateRequest(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return EventSubscriptionsClientListByResourceResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EventSubscriptionsClient.NewListByResourcePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceCreateRequest(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName, options) + }, nil) if err != nil { return EventSubscriptionsClientListByResourceResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return EventSubscriptionsClientListByResourceResponse{}, runtime.NewResponseError(resp) - } return client.listByResourceHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -498,7 +533,7 @@ func (client *EventSubscriptionsClient) listByResourceCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -522,7 +557,7 @@ func (client *EventSubscriptionsClient) listByResourceHandleResponse(resp *http. // NewListGlobalByResourceGroupPager - List all global event subscriptions under a specific Azure subscription and resource // group. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - options - EventSubscriptionsClientListGlobalByResourceGroupOptions contains the optional parameters for the EventSubscriptionsClient.NewListGlobalByResourceGroupPager // method. @@ -532,25 +567,20 @@ func (client *EventSubscriptionsClient) NewListGlobalByResourceGroupPager(resour return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *EventSubscriptionsClientListGlobalByResourceGroupResponse) (EventSubscriptionsClientListGlobalByResourceGroupResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listGlobalByResourceGroupCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EventSubscriptionsClient.NewListGlobalByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listGlobalByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) if err != nil { return EventSubscriptionsClientListGlobalByResourceGroupResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EventSubscriptionsClientListGlobalByResourceGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return EventSubscriptionsClientListGlobalByResourceGroupResponse{}, runtime.NewResponseError(resp) - } return client.listGlobalByResourceGroupHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -570,7 +600,7 @@ func (client *EventSubscriptionsClient) listGlobalByResourceGroupCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -594,7 +624,7 @@ func (client *EventSubscriptionsClient) listGlobalByResourceGroupHandleResponse( // NewListGlobalByResourceGroupForTopicTypePager - List all global event subscriptions under a resource group for a specific // topic type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - topicTypeName - Name of the topic type. // - options - EventSubscriptionsClientListGlobalByResourceGroupForTopicTypeOptions contains the optional parameters for the @@ -605,25 +635,20 @@ func (client *EventSubscriptionsClient) NewListGlobalByResourceGroupForTopicType return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *EventSubscriptionsClientListGlobalByResourceGroupForTopicTypeResponse) (EventSubscriptionsClientListGlobalByResourceGroupForTopicTypeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listGlobalByResourceGroupForTopicTypeCreateRequest(ctx, resourceGroupName, topicTypeName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EventSubscriptionsClient.NewListGlobalByResourceGroupForTopicTypePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listGlobalByResourceGroupForTopicTypeCreateRequest(ctx, resourceGroupName, topicTypeName, options) + }, nil) if err != nil { return EventSubscriptionsClientListGlobalByResourceGroupForTopicTypeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EventSubscriptionsClientListGlobalByResourceGroupForTopicTypeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return EventSubscriptionsClientListGlobalByResourceGroupForTopicTypeResponse{}, runtime.NewResponseError(resp) - } return client.listGlobalByResourceGroupForTopicTypeHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -647,7 +672,7 @@ func (client *EventSubscriptionsClient) listGlobalByResourceGroupForTopicTypeCre return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -670,7 +695,7 @@ func (client *EventSubscriptionsClient) listGlobalByResourceGroupForTopicTypeHan // NewListGlobalBySubscriptionPager - List all aggregated global event subscriptions under a specific Azure subscription. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - options - EventSubscriptionsClientListGlobalBySubscriptionOptions contains the optional parameters for the EventSubscriptionsClient.NewListGlobalBySubscriptionPager // method. func (client *EventSubscriptionsClient) NewListGlobalBySubscriptionPager(options *EventSubscriptionsClientListGlobalBySubscriptionOptions) *runtime.Pager[EventSubscriptionsClientListGlobalBySubscriptionResponse] { @@ -679,25 +704,20 @@ func (client *EventSubscriptionsClient) NewListGlobalBySubscriptionPager(options return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *EventSubscriptionsClientListGlobalBySubscriptionResponse) (EventSubscriptionsClientListGlobalBySubscriptionResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listGlobalBySubscriptionCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return EventSubscriptionsClientListGlobalBySubscriptionResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EventSubscriptionsClient.NewListGlobalBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listGlobalBySubscriptionCreateRequest(ctx, options) + }, nil) if err != nil { return EventSubscriptionsClientListGlobalBySubscriptionResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return EventSubscriptionsClientListGlobalBySubscriptionResponse{}, runtime.NewResponseError(resp) - } return client.listGlobalBySubscriptionHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -713,7 +733,7 @@ func (client *EventSubscriptionsClient) listGlobalBySubscriptionCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -737,7 +757,7 @@ func (client *EventSubscriptionsClient) listGlobalBySubscriptionHandleResponse(r // NewListGlobalBySubscriptionForTopicTypePager - List all global event subscriptions under an Azure subscription for a topic // type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - topicTypeName - Name of the topic type. // - options - EventSubscriptionsClientListGlobalBySubscriptionForTopicTypeOptions contains the optional parameters for the // EventSubscriptionsClient.NewListGlobalBySubscriptionForTopicTypePager method. @@ -747,25 +767,20 @@ func (client *EventSubscriptionsClient) NewListGlobalBySubscriptionForTopicTypeP return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *EventSubscriptionsClientListGlobalBySubscriptionForTopicTypeResponse) (EventSubscriptionsClientListGlobalBySubscriptionForTopicTypeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listGlobalBySubscriptionForTopicTypeCreateRequest(ctx, topicTypeName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EventSubscriptionsClient.NewListGlobalBySubscriptionForTopicTypePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listGlobalBySubscriptionForTopicTypeCreateRequest(ctx, topicTypeName, options) + }, nil) if err != nil { return EventSubscriptionsClientListGlobalBySubscriptionForTopicTypeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EventSubscriptionsClientListGlobalBySubscriptionForTopicTypeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return EventSubscriptionsClientListGlobalBySubscriptionForTopicTypeResponse{}, runtime.NewResponseError(resp) - } return client.listGlobalBySubscriptionForTopicTypeHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -785,7 +800,7 @@ func (client *EventSubscriptionsClient) listGlobalBySubscriptionForTopicTypeCrea return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -809,7 +824,7 @@ func (client *EventSubscriptionsClient) listGlobalBySubscriptionForTopicTypeHand // NewListRegionalByResourceGroupPager - List all event subscriptions from the given location under a specific Azure subscription // and resource group. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - location - Name of the location. // - options - EventSubscriptionsClientListRegionalByResourceGroupOptions contains the optional parameters for the EventSubscriptionsClient.NewListRegionalByResourceGroupPager @@ -820,25 +835,20 @@ func (client *EventSubscriptionsClient) NewListRegionalByResourceGroupPager(reso return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *EventSubscriptionsClientListRegionalByResourceGroupResponse) (EventSubscriptionsClientListRegionalByResourceGroupResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listRegionalByResourceGroupCreateRequest(ctx, resourceGroupName, location, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EventSubscriptionsClient.NewListRegionalByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listRegionalByResourceGroupCreateRequest(ctx, resourceGroupName, location, options) + }, nil) if err != nil { return EventSubscriptionsClientListRegionalByResourceGroupResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EventSubscriptionsClientListRegionalByResourceGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return EventSubscriptionsClientListRegionalByResourceGroupResponse{}, runtime.NewResponseError(resp) - } return client.listRegionalByResourceGroupHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -862,7 +872,7 @@ func (client *EventSubscriptionsClient) listRegionalByResourceGroupCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -886,7 +896,7 @@ func (client *EventSubscriptionsClient) listRegionalByResourceGroupHandleRespons // NewListRegionalByResourceGroupForTopicTypePager - List all event subscriptions from the given location under a specific // Azure subscription and resource group and topic type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - location - Name of the location. // - topicTypeName - Name of the topic type. @@ -898,25 +908,20 @@ func (client *EventSubscriptionsClient) NewListRegionalByResourceGroupForTopicTy return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *EventSubscriptionsClientListRegionalByResourceGroupForTopicTypeResponse) (EventSubscriptionsClientListRegionalByResourceGroupForTopicTypeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listRegionalByResourceGroupForTopicTypeCreateRequest(ctx, resourceGroupName, location, topicTypeName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return EventSubscriptionsClientListRegionalByResourceGroupForTopicTypeResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EventSubscriptionsClient.NewListRegionalByResourceGroupForTopicTypePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listRegionalByResourceGroupForTopicTypeCreateRequest(ctx, resourceGroupName, location, topicTypeName, options) + }, nil) if err != nil { return EventSubscriptionsClientListRegionalByResourceGroupForTopicTypeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return EventSubscriptionsClientListRegionalByResourceGroupForTopicTypeResponse{}, runtime.NewResponseError(resp) - } return client.listRegionalByResourceGroupForTopicTypeHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -944,7 +949,7 @@ func (client *EventSubscriptionsClient) listRegionalByResourceGroupForTopicTypeC return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -967,7 +972,7 @@ func (client *EventSubscriptionsClient) listRegionalByResourceGroupForTopicTypeH // NewListRegionalBySubscriptionPager - List all event subscriptions from the given location under a specific Azure subscription. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - location - Name of the location. // - options - EventSubscriptionsClientListRegionalBySubscriptionOptions contains the optional parameters for the EventSubscriptionsClient.NewListRegionalBySubscriptionPager // method. @@ -977,25 +982,20 @@ func (client *EventSubscriptionsClient) NewListRegionalBySubscriptionPager(locat return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *EventSubscriptionsClientListRegionalBySubscriptionResponse) (EventSubscriptionsClientListRegionalBySubscriptionResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listRegionalBySubscriptionCreateRequest(ctx, location, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return EventSubscriptionsClientListRegionalBySubscriptionResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EventSubscriptionsClient.NewListRegionalBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listRegionalBySubscriptionCreateRequest(ctx, location, options) + }, nil) if err != nil { return EventSubscriptionsClientListRegionalBySubscriptionResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return EventSubscriptionsClientListRegionalBySubscriptionResponse{}, runtime.NewResponseError(resp) - } return client.listRegionalBySubscriptionHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -1015,7 +1015,7 @@ func (client *EventSubscriptionsClient) listRegionalBySubscriptionCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -1039,7 +1039,7 @@ func (client *EventSubscriptionsClient) listRegionalBySubscriptionHandleResponse // NewListRegionalBySubscriptionForTopicTypePager - List all event subscriptions from the given location under a specific // Azure subscription and topic type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - location - Name of the location. // - topicTypeName - Name of the topic type. // - options - EventSubscriptionsClientListRegionalBySubscriptionForTopicTypeOptions contains the optional parameters for the @@ -1050,25 +1050,20 @@ func (client *EventSubscriptionsClient) NewListRegionalBySubscriptionForTopicTyp return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *EventSubscriptionsClientListRegionalBySubscriptionForTopicTypeResponse) (EventSubscriptionsClientListRegionalBySubscriptionForTopicTypeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listRegionalBySubscriptionForTopicTypeCreateRequest(ctx, location, topicTypeName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EventSubscriptionsClient.NewListRegionalBySubscriptionForTopicTypePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listRegionalBySubscriptionForTopicTypeCreateRequest(ctx, location, topicTypeName, options) + }, nil) if err != nil { return EventSubscriptionsClientListRegionalBySubscriptionForTopicTypeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EventSubscriptionsClientListRegionalBySubscriptionForTopicTypeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return EventSubscriptionsClientListRegionalBySubscriptionForTopicTypeResponse{}, runtime.NewResponseError(resp) - } return client.listRegionalBySubscriptionForTopicTypeHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -1092,7 +1087,7 @@ func (client *EventSubscriptionsClient) listRegionalBySubscriptionForTopicTypeCr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -1116,7 +1111,7 @@ func (client *EventSubscriptionsClient) listRegionalBySubscriptionForTopicTypeHa // BeginUpdate - Asynchronously updates an existing event subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - scope - The scope of existing event subscription. The scope can be a subscription, or a resource group, or a top level // resource belonging to a resource provider namespace, or an EventGrid topic. For example, // use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' @@ -1135,29 +1130,40 @@ func (client *EventSubscriptionsClient) BeginUpdate(ctx context.Context, scope s if err != nil { return nil, err } - return runtime.NewPoller[EventSubscriptionsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EventSubscriptionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[EventSubscriptionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EventSubscriptionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Update - Asynchronously updates an existing event subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *EventSubscriptionsClient) update(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters, options *EventSubscriptionsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "EventSubscriptionsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, scope, eventSubscriptionName, eventSubscriptionUpdateParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -1173,8 +1179,11 @@ func (client *EventSubscriptionsClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, eventSubscriptionUpdateParameters) + if err := runtime.MarshalAsJSON(req, eventSubscriptionUpdateParameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/eventsubscriptions_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/eventsubscriptions_client_example_test.go index 7a52f4805e62..d29b632a6357 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/eventsubscriptions_client_example_test.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/eventsubscriptions_client_example_test.go @@ -18,53 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetDeliveryAttributes.json -func ExampleEventSubscriptionsClient_GetDeliveryAttributes() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEventSubscriptionsClient().GetDeliveryAttributes(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DeliveryAttributeListResult = armeventgrid.DeliveryAttributeListResult{ - // Value: []armeventgrid.DeliveryAttributeMappingClassification{ - // &armeventgrid.StaticDeliveryAttributeMapping{ - // Name: to.Ptr("header1"), - // Type: to.Ptr(armeventgrid.DeliveryAttributeMappingTypeStatic), - // Properties: &armeventgrid.StaticDeliveryAttributeMappingProperties{ - // IsSecret: to.Ptr(false), - // Value: to.Ptr("NormalValue"), - // }, - // }, - // &armeventgrid.DynamicDeliveryAttributeMapping{ - // Name: to.Ptr("header2"), - // Type: to.Ptr(armeventgrid.DeliveryAttributeMappingTypeDynamic), - // Properties: &armeventgrid.DynamicDeliveryAttributeMappingProperties{ - // SourceField: to.Ptr("data.foo"), - // }, - // }, - // &armeventgrid.StaticDeliveryAttributeMapping{ - // Name: to.Ptr("header3"), - // Type: to.Ptr(armeventgrid.DeliveryAttributeMappingTypeStatic), - // Properties: &armeventgrid.StaticDeliveryAttributeMappingProperties{ - // IsSecret: to.Ptr(true), - // Value: to.Ptr("mySecretValue"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetForCustomTopic.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_GetForCustomTopic.json func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopic() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -75,7 +29,7 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopic() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEventSubscriptionsClient().Get(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", nil) + res, err := clientFactory.NewEventSubscriptionsClient().Get(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -85,7 +39,7 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopic() { // res.EventSubscription = armeventgrid.EventSubscription{ // Name: to.Ptr("examplesubscription1"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -102,12 +56,12 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopic() { // to.Ptr("label1"), // to.Ptr("label2")}, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_AzureFunctionDestination.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_GetForCustomTopic_AzureFunctionDestination.json func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicAzureFunctionDestination() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -118,7 +72,7 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicAzur if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEventSubscriptionsClient().Get(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", nil) + res, err := clientFactory.NewEventSubscriptionsClient().Get(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -128,7 +82,7 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicAzur // res.EventSubscription = armeventgrid.EventSubscription{ // Name: to.Ptr("examplesubscription1"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.AzureFunctionEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeAzureFunction), @@ -145,12 +99,12 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicAzur // to.Ptr("label1"), // to.Ptr("label2")}, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_EventHubDestination.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_GetForCustomTopic_EventHubDestination.json func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicEventHubDestination() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -161,7 +115,7 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicEven if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEventSubscriptionsClient().Get(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", nil) + res, err := clientFactory.NewEventSubscriptionsClient().Get(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -171,7 +125,7 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicEven // res.EventSubscription = armeventgrid.EventSubscription{ // Name: to.Ptr("examplesubscription1"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.EventHubEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeEventHub), @@ -188,12 +142,12 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicEven // to.Ptr("label1"), // to.Ptr("label2")}, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_HybridConnectionDestination.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_GetForCustomTopic_HybridConnectionDestination.json func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicHybridConnectionDestination() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -204,7 +158,7 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicHybr if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEventSubscriptionsClient().Get(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", nil) + res, err := clientFactory.NewEventSubscriptionsClient().Get(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -214,7 +168,7 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicHybr // res.EventSubscription = armeventgrid.EventSubscription{ // Name: to.Ptr("examplesubscription1"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.HybridConnectionEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeHybridConnection), @@ -231,12 +185,12 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicHybr // to.Ptr("label1"), // to.Ptr("label2")}, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_ServiceBusQueueDestination.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_GetForCustomTopic_ServiceBusQueueDestination.json func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicServiceBusQueueDestination() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -247,7 +201,7 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicServ if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEventSubscriptionsClient().Get(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", nil) + res, err := clientFactory.NewEventSubscriptionsClient().Get(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -257,7 +211,7 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicServ // res.EventSubscription = armeventgrid.EventSubscription{ // Name: to.Ptr("examplesubscription1"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.ServiceBusQueueEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeServiceBusQueue), @@ -274,12 +228,12 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicServ // to.Ptr("label1"), // to.Ptr("label2")}, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_ServiceBusTopicDestination.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_GetForCustomTopic_ServiceBusTopicDestination.json func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicServiceBusTopicDestination() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -290,7 +244,7 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicServ if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEventSubscriptionsClient().Get(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", nil) + res, err := clientFactory.NewEventSubscriptionsClient().Get(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -300,7 +254,7 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicServ // res.EventSubscription = armeventgrid.EventSubscription{ // Name: to.Ptr("examplesubscription1"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.ServiceBusTopicEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeServiceBusTopic), @@ -317,12 +271,12 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicServ // to.Ptr("label1"), // to.Ptr("label2")}, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_StorageQueueDestination.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_GetForCustomTopic_StorageQueueDestination.json func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicStorageQueueDestination() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -333,7 +287,7 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicStor if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEventSubscriptionsClient().Get(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", nil) + res, err := clientFactory.NewEventSubscriptionsClient().Get(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -343,7 +297,7 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicStor // res.EventSubscription = armeventgrid.EventSubscription{ // Name: to.Ptr("examplesubscription1"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.StorageQueueEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeStorageQueue), @@ -362,12 +316,12 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicStor // to.Ptr("label1"), // to.Ptr("label2")}, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_WebhookDestination.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_GetForCustomTopic_WebhookDestination.json func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicWebhookDestination() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -378,7 +332,7 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicWebh if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEventSubscriptionsClient().Get(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", nil) + res, err := clientFactory.NewEventSubscriptionsClient().Get(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -388,7 +342,7 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicWebh // res.EventSubscription = armeventgrid.EventSubscription{ // Name: to.Ptr("examplesubscription1"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -405,12 +359,12 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicWebh // to.Ptr("label1"), // to.Ptr("label2")}, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetForResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_GetForResource.json func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForResource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -421,7 +375,7 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForResource() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEventSubscriptionsClient().Get(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", "examplesubscription1", nil) + res, err := clientFactory.NewEventSubscriptionsClient().Get(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", "examplesubscription1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -431,7 +385,7 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForResource() { // res.EventSubscription = armeventgrid.EventSubscription{ // Name: to.Ptr("examplesubscription1"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.EventHubEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeEventHub), @@ -448,12 +402,12 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForResource() { // to.Ptr("label1"), // to.Ptr("label2")}, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetForResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_GetForResourceGroup.json func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForResourceGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -464,7 +418,7 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForResourceGroup() if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEventSubscriptionsClient().Get(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg", "examplesubscription2", nil) + res, err := clientFactory.NewEventSubscriptionsClient().Get(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg", "examplesubscription2", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -474,7 +428,7 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForResourceGroup() // res.EventSubscription = armeventgrid.EventSubscription{ // Name: to.Ptr("examplesubscription2"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription2"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription2"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -491,12 +445,12 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForResourceGroup() // to.Ptr("label1"), // to.Ptr("label2")}, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetForSubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_GetForSubscription.json func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForSubscription() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -507,7 +461,7 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForSubscription() if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEventSubscriptionsClient().Get(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40", "examplesubscription3", nil) + res, err := clientFactory.NewEventSubscriptionsClient().Get(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4", "examplesubscription3", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -517,7 +471,7 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForSubscription() // res.EventSubscription = armeventgrid.EventSubscription{ // Name: to.Ptr("examplesubscription3"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription3"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription3"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -534,12 +488,12 @@ func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForSubscription() // to.Ptr("label1"), // to.Ptr("label2")}, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic.json func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForCustomTopic() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -550,7 +504,7 @@ func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreat if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{ + poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{ Properties: &armeventgrid.EventSubscriptionProperties{ Destination: &armeventgrid.EventHubEventSubscriptionDestination{ EndpointType: to.Ptr(armeventgrid.EndpointTypeEventHub), @@ -574,7 +528,7 @@ func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreat } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_AzureFunctionDestination.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_AzureFunctionDestination.json func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForCustomTopicAzureFunctionDestination() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -585,7 +539,7 @@ func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreat if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{ + poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{ Properties: &armeventgrid.EventSubscriptionProperties{ DeadLetterDestination: &armeventgrid.StorageBlobDeadLetterDestination{ EndpointType: to.Ptr(armeventgrid.DeadLetterEndPointTypeStorageBlob), @@ -616,7 +570,7 @@ func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreat } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_EventHubDestination.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_EventHubDestination.json func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForCustomTopicEventHubDestination() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -627,7 +581,7 @@ func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreat if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{ + poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{ Properties: &armeventgrid.EventSubscriptionProperties{ DeadLetterDestination: &armeventgrid.StorageBlobDeadLetterDestination{ EndpointType: to.Ptr(armeventgrid.DeadLetterEndPointTypeStorageBlob), @@ -658,7 +612,7 @@ func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreat } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_HybridConnectionDestination.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_HybridConnectionDestination.json func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForCustomTopicHybridConnectionDestination() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -669,7 +623,7 @@ func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreat if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{ + poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{ Properties: &armeventgrid.EventSubscriptionProperties{ DeadLetterDestination: &armeventgrid.StorageBlobDeadLetterDestination{ EndpointType: to.Ptr(armeventgrid.DeadLetterEndPointTypeStorageBlob), @@ -700,7 +654,7 @@ func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreat } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusQueueDestination.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusQueueDestination.json func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForCustomTopicServiceBusQueueDestination() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -711,7 +665,7 @@ func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreat if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{ + poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{ Properties: &armeventgrid.EventSubscriptionProperties{ DeadLetterDestination: &armeventgrid.StorageBlobDeadLetterDestination{ EndpointType: to.Ptr(armeventgrid.DeadLetterEndPointTypeStorageBlob), @@ -742,7 +696,7 @@ func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreat } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusTopicDestination.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusTopicDestination.json func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForCustomTopicServiceBusTopicDestination() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -753,7 +707,7 @@ func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreat if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{ + poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{ Properties: &armeventgrid.EventSubscriptionProperties{ DeadLetterDestination: &armeventgrid.StorageBlobDeadLetterDestination{ EndpointType: to.Ptr(armeventgrid.DeadLetterEndPointTypeStorageBlob), @@ -784,7 +738,7 @@ func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreat } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_StorageQueueDestination.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_StorageQueueDestination.json func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForCustomTopicStorageQueueDestination() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -795,7 +749,7 @@ func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreat if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{ + poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{ Properties: &armeventgrid.EventSubscriptionProperties{ DeadLetterDestination: &armeventgrid.StorageBlobDeadLetterDestination{ EndpointType: to.Ptr(armeventgrid.DeadLetterEndPointTypeStorageBlob), @@ -807,9 +761,8 @@ func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreat Destination: &armeventgrid.StorageQueueEventSubscriptionDestination{ EndpointType: to.Ptr(armeventgrid.EndpointTypeStorageQueue), Properties: &armeventgrid.StorageQueueEventSubscriptionDestinationProperties{ - QueueMessageTimeToLiveInSeconds: to.Ptr[int64](300), - QueueName: to.Ptr("queue1"), - ResourceID: to.Ptr("/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"), + QueueName: to.Ptr("queue1"), + ResourceID: to.Ptr("/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"), }, }, Filter: &armeventgrid.EventSubscriptionFilter{ @@ -828,7 +781,7 @@ func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreat } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_WebhookDestination.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_WebhookDestination.json func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForCustomTopicWebhookDestination() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -839,12 +792,12 @@ func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreat if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{ + poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{ Properties: &armeventgrid.EventSubscriptionProperties{ - Destination: &armeventgrid.EventHubEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeEventHub), - Properties: &armeventgrid.EventHubEventSubscriptionDestinationProperties{ - ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.EventHub/namespaces/ContosoNamespace/eventhubs/EH1"), + Destination: &armeventgrid.WebHookEventSubscriptionDestination{ + EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), + Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ + EndpointURL: to.Ptr("https://azurefunctionexample.azurewebsites.net/runtime/webhooks/EventGrid?functionName=EventGridTrigger1&code=PASSWORDCODE"), }, }, Filter: &armeventgrid.EventSubscriptionFilter{ @@ -863,7 +816,7 @@ func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreat } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForResource.json func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForResource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -874,7 +827,7 @@ func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreat if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", "examplesubscription10", armeventgrid.EventSubscription{ + poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", "examplesubscription10", armeventgrid.EventSubscription{ Properties: &armeventgrid.EventSubscriptionProperties{ Destination: &armeventgrid.WebHookEventSubscriptionDestination{ EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -898,7 +851,7 @@ func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreat } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForResourceGroup.json func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForResourceGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -909,7 +862,7 @@ func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreat if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg", "examplesubscription2", armeventgrid.EventSubscription{ + poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg", "examplesubscription2", armeventgrid.EventSubscription{ Properties: &armeventgrid.EventSubscriptionProperties{ Destination: &armeventgrid.WebHookEventSubscriptionDestination{ EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -933,7 +886,7 @@ func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreat } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForSubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_CreateOrUpdateForSubscription.json func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForSubscription() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -944,7 +897,7 @@ func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreat if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40", "examplesubscription3", armeventgrid.EventSubscription{ + poller, err := clientFactory.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4", "examplesubscription3", armeventgrid.EventSubscription{ Properties: &armeventgrid.EventSubscriptionProperties{ Destination: &armeventgrid.WebHookEventSubscriptionDestination{ EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -966,7 +919,7 @@ func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreat } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_DeleteForCustomTopic.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_DeleteForCustomTopic.json func ExampleEventSubscriptionsClient_BeginDelete_eventSubscriptionsDeleteForCustomTopic() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -977,7 +930,7 @@ func ExampleEventSubscriptionsClient_BeginDelete_eventSubscriptionsDeleteForCust if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginDelete(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", nil) + poller, err := clientFactory.NewEventSubscriptionsClient().BeginDelete(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -987,7 +940,7 @@ func ExampleEventSubscriptionsClient_BeginDelete_eventSubscriptionsDeleteForCust } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_DeleteForResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_DeleteForResource.json func ExampleEventSubscriptionsClient_BeginDelete_eventSubscriptionsDeleteForResource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -998,7 +951,7 @@ func ExampleEventSubscriptionsClient_BeginDelete_eventSubscriptionsDeleteForReso if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginDelete(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", "examplesubscription10", nil) + poller, err := clientFactory.NewEventSubscriptionsClient().BeginDelete(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", "examplesubscription10", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -1008,7 +961,7 @@ func ExampleEventSubscriptionsClient_BeginDelete_eventSubscriptionsDeleteForReso } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_DeleteForResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_DeleteForResourceGroup.json func ExampleEventSubscriptionsClient_BeginDelete_eventSubscriptionsDeleteForResourceGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1019,7 +972,7 @@ func ExampleEventSubscriptionsClient_BeginDelete_eventSubscriptionsDeleteForReso if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginDelete(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg", "examplesubscription2", nil) + poller, err := clientFactory.NewEventSubscriptionsClient().BeginDelete(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg", "examplesubscription2", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -1029,7 +982,7 @@ func ExampleEventSubscriptionsClient_BeginDelete_eventSubscriptionsDeleteForReso } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_DeleteForSubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_DeleteForSubscription.json func ExampleEventSubscriptionsClient_BeginDelete_eventSubscriptionsDeleteForSubscription() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1040,7 +993,7 @@ func ExampleEventSubscriptionsClient_BeginDelete_eventSubscriptionsDeleteForSubs if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginDelete(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40", "examplesubscription3", nil) + poller, err := clientFactory.NewEventSubscriptionsClient().BeginDelete(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4", "examplesubscription3", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -1050,7 +1003,7 @@ func ExampleEventSubscriptionsClient_BeginDelete_eventSubscriptionsDeleteForSubs } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_UpdateForCustomTopic.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic.json func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCustomTopic() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1061,7 +1014,7 @@ func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCust if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ + poller, err := clientFactory.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ Destination: &armeventgrid.WebHookEventSubscriptionDestination{ EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ @@ -1086,7 +1039,7 @@ func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCust } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_UpdateForCustomTopic_AzureFunctionDestination.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic_AzureFunctionDestination.json func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCustomTopicAzureFunctionDestination() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1097,7 +1050,7 @@ func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCust if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ + poller, err := clientFactory.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ DeadLetterDestination: &armeventgrid.StorageBlobDeadLetterDestination{ EndpointType: to.Ptr(armeventgrid.DeadLetterEndPointTypeStorageBlob), Properties: &armeventgrid.StorageBlobDeadLetterDestinationProperties{ @@ -1126,7 +1079,7 @@ func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCust } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_UpdateForCustomTopic_EventHubDestination.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic_EventHubDestination.json func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCustomTopicEventHubDestination() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1137,7 +1090,7 @@ func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCust if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ + poller, err := clientFactory.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ Destination: &armeventgrid.EventHubEventSubscriptionDestination{ EndpointType: to.Ptr(armeventgrid.EndpointTypeEventHub), Properties: &armeventgrid.EventHubEventSubscriptionDestinationProperties{ @@ -1162,7 +1115,7 @@ func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCust } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_UpdateForCustomTopic_HybridConnectionDestination.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic_HybridConnectionDestination.json func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCustomTopicHybridConnectionDestination() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1173,7 +1126,7 @@ func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCust if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ + poller, err := clientFactory.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ Destination: &armeventgrid.HybridConnectionEventSubscriptionDestination{ EndpointType: to.Ptr(armeventgrid.EndpointTypeHybridConnection), Properties: &armeventgrid.HybridConnectionEventSubscriptionDestinationProperties{ @@ -1198,7 +1151,7 @@ func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCust } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_UpdateForCustomTopic_ServiceBusQueueDestination.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic_ServiceBusQueueDestination.json func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCustomTopicServiceBusQueueDestination() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1209,7 +1162,7 @@ func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCust if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ + poller, err := clientFactory.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ DeadLetterDestination: &armeventgrid.StorageBlobDeadLetterDestination{ EndpointType: to.Ptr(armeventgrid.DeadLetterEndPointTypeStorageBlob), Properties: &armeventgrid.StorageBlobDeadLetterDestinationProperties{ @@ -1238,7 +1191,7 @@ func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCust } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_UpdateForCustomTopic_ServiceBusTopicDestination.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic_ServiceBusTopicDestination.json func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCustomTopicServiceBusTopicDestination() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1249,7 +1202,7 @@ func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCust if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ + poller, err := clientFactory.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ Destination: &armeventgrid.ServiceBusTopicEventSubscriptionDestination{ EndpointType: to.Ptr(armeventgrid.EndpointTypeServiceBusTopic), Properties: &armeventgrid.ServiceBusTopicEventSubscriptionDestinationProperties{ @@ -1274,7 +1227,7 @@ func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCust } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_UpdateForCustomTopic_StorageQueueDestination.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic_StorageQueueDestination.json func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCustomTopicStorageQueueDestination() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1285,7 +1238,7 @@ func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCust if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ + poller, err := clientFactory.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ DeadLetterDestination: &armeventgrid.StorageBlobDeadLetterDestination{ EndpointType: to.Ptr(armeventgrid.DeadLetterEndPointTypeStorageBlob), Properties: &armeventgrid.StorageBlobDeadLetterDestinationProperties{ @@ -1316,7 +1269,7 @@ func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCust } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_UpdateForCustomTopic_WebhookDestination.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForCustomTopic_WebhookDestination.json func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCustomTopicWebhookDestination() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1327,7 +1280,7 @@ func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCust if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ + poller, err := clientFactory.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ Destination: &armeventgrid.WebHookEventSubscriptionDestination{ EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ @@ -1352,7 +1305,7 @@ func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCust } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_UpdateForResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForResource.json func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForResource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1363,7 +1316,7 @@ func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForReso if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ + poller, err := clientFactory.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ Destination: &armeventgrid.WebHookEventSubscriptionDestination{ EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ @@ -1388,7 +1341,7 @@ func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForReso } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_UpdateForResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForResourceGroup.json func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForResourceGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1399,7 +1352,7 @@ func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForReso if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg", "examplesubscription2", armeventgrid.EventSubscriptionUpdateParameters{ + poller, err := clientFactory.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg", "examplesubscription2", armeventgrid.EventSubscriptionUpdateParameters{ Destination: &armeventgrid.EventHubEventSubscriptionDestination{ EndpointType: to.Ptr(armeventgrid.EndpointTypeEventHub), Properties: &armeventgrid.EventHubEventSubscriptionDestinationProperties{ @@ -1424,7 +1377,7 @@ func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForReso } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_UpdateForSubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_UpdateForSubscription.json func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForSubscription() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1435,7 +1388,7 @@ func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForSubs if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40", "examplesubscription3", armeventgrid.EventSubscriptionUpdateParameters{ + poller, err := clientFactory.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4", "examplesubscription3", armeventgrid.EventSubscriptionUpdateParameters{ Destination: &armeventgrid.WebHookEventSubscriptionDestination{ EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ @@ -1460,7 +1413,7 @@ func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForSubs } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetFullUrlForCustomTopic.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_GetFullUrlForCustomTopic.json func ExampleEventSubscriptionsClient_GetFullURL_eventSubscriptionsGetFullUrlForCustomTopic() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1471,7 +1424,7 @@ func ExampleEventSubscriptionsClient_GetFullURL_eventSubscriptionsGetFullUrlForC if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEventSubscriptionsClient().GetFullURL(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", nil) + res, err := clientFactory.NewEventSubscriptionsClient().GetFullURL(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -1483,7 +1436,7 @@ func ExampleEventSubscriptionsClient_GetFullURL_eventSubscriptionsGetFullUrlForC // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetFullUrlForResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_GetFullUrlForResource.json func ExampleEventSubscriptionsClient_GetFullURL_eventSubscriptionsGetFullUrlForResource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1494,7 +1447,7 @@ func ExampleEventSubscriptionsClient_GetFullURL_eventSubscriptionsGetFullUrlForR if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEventSubscriptionsClient().GetFullURL(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", "examplesubscription1", nil) + res, err := clientFactory.NewEventSubscriptionsClient().GetFullURL(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", "examplesubscription1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -1506,7 +1459,7 @@ func ExampleEventSubscriptionsClient_GetFullURL_eventSubscriptionsGetFullUrlForR // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetFullUrlForResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_GetFullUrlForResourceGroup.json func ExampleEventSubscriptionsClient_GetFullURL_eventSubscriptionsGetFullUrlForResourceGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1517,7 +1470,7 @@ func ExampleEventSubscriptionsClient_GetFullURL_eventSubscriptionsGetFullUrlForR if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEventSubscriptionsClient().GetFullURL(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg", "examplesubscription2", nil) + res, err := clientFactory.NewEventSubscriptionsClient().GetFullURL(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg", "examplesubscription2", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -1529,7 +1482,7 @@ func ExampleEventSubscriptionsClient_GetFullURL_eventSubscriptionsGetFullUrlForR // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_GetFullUrlForSubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_GetFullUrlForSubscription.json func ExampleEventSubscriptionsClient_GetFullURL_eventSubscriptionsGetFullUrlForSubscription() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1540,7 +1493,7 @@ func ExampleEventSubscriptionsClient_GetFullURL_eventSubscriptionsGetFullUrlForS if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEventSubscriptionsClient().GetFullURL(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40", "examplesubscription3", nil) + res, err := clientFactory.NewEventSubscriptionsClient().GetFullURL(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4", "examplesubscription3", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -1552,7 +1505,7 @@ func ExampleEventSubscriptionsClient_GetFullURL_eventSubscriptionsGetFullUrlForS // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_ListGlobalBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_ListGlobalBySubscription.json func ExampleEventSubscriptionsClient_NewListGlobalBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1581,7 +1534,7 @@ func ExampleEventSubscriptionsClient_NewListGlobalBySubscriptionPager() { // { // Name: to.Ptr("examplesubscription2"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription2"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription2"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -1595,13 +1548,13 @@ func ExampleEventSubscriptionsClient_NewListGlobalBySubscriptionPager() { // SubjectEndsWith: to.Ptr(""), // }, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg"), // }, // }, // { // Name: to.Ptr("examplesubscription4"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription4"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription4"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -1615,14 +1568,14 @@ func ExampleEventSubscriptionsClient_NewListGlobalBySubscriptionPager() { // SubjectEndsWith: to.Ptr(""), // }, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg"), // }, // }}, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_ListGlobalBySubscriptionForTopicType.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_ListGlobalBySubscriptionForTopicType.json func ExampleEventSubscriptionsClient_NewListGlobalBySubscriptionForTopicTypePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1651,7 +1604,7 @@ func ExampleEventSubscriptionsClient_NewListGlobalBySubscriptionForTopicTypePage // { // Name: to.Ptr("examplesubscription3"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription3"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription3"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -1668,14 +1621,14 @@ func ExampleEventSubscriptionsClient_NewListGlobalBySubscriptionForTopicTypePage // to.Ptr("Finance"), // to.Ptr("HR")}, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4"), // }, // }}, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_ListGlobalByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_ListGlobalByResourceGroup.json func ExampleEventSubscriptionsClient_NewListGlobalByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1704,7 +1657,7 @@ func ExampleEventSubscriptionsClient_NewListGlobalByResourceGroupPager() { // { // Name: to.Ptr("examplesubscription2"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription2"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription2"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -1718,13 +1671,13 @@ func ExampleEventSubscriptionsClient_NewListGlobalByResourceGroupPager() { // SubjectEndsWith: to.Ptr(""), // }, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg"), // }, // }, // { // Name: to.Ptr("examplesubscription4"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription4"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription4"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -1738,14 +1691,14 @@ func ExampleEventSubscriptionsClient_NewListGlobalByResourceGroupPager() { // SubjectEndsWith: to.Ptr(""), // }, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg"), // }, // }}, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_ListGlobalByResourceGroupForTopicType.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_ListGlobalByResourceGroupForTopicType.json func ExampleEventSubscriptionsClient_NewListGlobalByResourceGroupForTopicTypePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1774,7 +1727,7 @@ func ExampleEventSubscriptionsClient_NewListGlobalByResourceGroupForTopicTypePag // { // Name: to.Ptr("examplesubscription3"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription3"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription3"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -1791,14 +1744,14 @@ func ExampleEventSubscriptionsClient_NewListGlobalByResourceGroupForTopicTypePag // to.Ptr("Finance"), // to.Ptr("HR")}, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg"), // }, // }}, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_ListRegionalBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_ListRegionalBySubscription.json func ExampleEventSubscriptionsClient_NewListRegionalBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1827,7 +1780,7 @@ func ExampleEventSubscriptionsClient_NewListRegionalBySubscriptionPager() { // { // Name: to.Ptr("examplesubscription10"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription10"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription10"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.EventHubEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeEventHub), @@ -1844,13 +1797,13 @@ func ExampleEventSubscriptionsClient_NewListRegionalBySubscriptionPager() { // to.Ptr("Finance"), // to.Ptr("HR")}, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.eventhub/namespaces/examplenamespace1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventhub/namespaces/examplenamespace1"), // }, // }, // { // Name: to.Ptr("examplesubscription11"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription11"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription11"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -1867,14 +1820,14 @@ func ExampleEventSubscriptionsClient_NewListRegionalBySubscriptionPager() { // to.Ptr("Finance"), // to.Ptr("HR")}, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.eventhub/namespaces/examplenamespace1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventhub/namespaces/examplenamespace1"), // }, // }}, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_ListRegionalByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_ListRegionalByResourceGroup.json func ExampleEventSubscriptionsClient_NewListRegionalByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1903,7 +1856,7 @@ func ExampleEventSubscriptionsClient_NewListRegionalByResourceGroupPager() { // { // Name: to.Ptr("examplesubscription10"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription10"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription10"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -1920,13 +1873,13 @@ func ExampleEventSubscriptionsClient_NewListRegionalByResourceGroupPager() { // to.Ptr("Finance"), // to.Ptr("HR")}, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.eventhub/namespaces/examplenamespace1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventhub/namespaces/examplenamespace1"), // }, // }, // { // Name: to.Ptr("examplesubscription11"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription11"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription11"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -1943,14 +1896,14 @@ func ExampleEventSubscriptionsClient_NewListRegionalByResourceGroupPager() { // to.Ptr("Finance"), // to.Ptr("HR")}, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.eventhub/namespaces/examplenamespace1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventhub/namespaces/examplenamespace1"), // }, // }}, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_ListRegionalBySubscriptionForTopicType.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_ListRegionalBySubscriptionForTopicType.json func ExampleEventSubscriptionsClient_NewListRegionalBySubscriptionForTopicTypePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1979,7 +1932,7 @@ func ExampleEventSubscriptionsClient_NewListRegionalBySubscriptionForTopicTypePa // { // Name: to.Ptr("examplesubscription10"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription10"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription10"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -1996,13 +1949,13 @@ func ExampleEventSubscriptionsClient_NewListRegionalBySubscriptionForTopicTypePa // to.Ptr("Finance"), // to.Ptr("HR")}, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.eventhub/namespaces/examplenamespace1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventhub/namespaces/examplenamespace1"), // }, // }, // { // Name: to.Ptr("examplesubscription11"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription11"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription11"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -2019,14 +1972,14 @@ func ExampleEventSubscriptionsClient_NewListRegionalBySubscriptionForTopicTypePa // to.Ptr("Finance"), // to.Ptr("HR")}, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.eventhub/namespaces/examplenamespace1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventhub/namespaces/examplenamespace1"), // }, // }}, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_ListRegionalByResourceGroupForTopicType.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_ListRegionalByResourceGroupForTopicType.json func ExampleEventSubscriptionsClient_NewListRegionalByResourceGroupForTopicTypePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2055,7 +2008,7 @@ func ExampleEventSubscriptionsClient_NewListRegionalByResourceGroupForTopicTypeP // { // Name: to.Ptr("examplesubscription10"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription10"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription10"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -2072,13 +2025,13 @@ func ExampleEventSubscriptionsClient_NewListRegionalByResourceGroupForTopicTypeP // to.Ptr("Finance"), // to.Ptr("HR")}, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.eventhub/namespaces/examplenamespace1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventhub/namespaces/examplenamespace1"), // }, // }, // { // Name: to.Ptr("examplesubscription11"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription11"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription11"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -2095,14 +2048,14 @@ func ExampleEventSubscriptionsClient_NewListRegionalByResourceGroupForTopicTypeP // to.Ptr("Finance"), // to.Ptr("HR")}, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.eventhub/namespaces/examplenamespace1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventhub/namespaces/examplenamespace1"), // }, // }}, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_ListByResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_ListByResource.json func ExampleEventSubscriptionsClient_NewListByResourcePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2131,7 +2084,7 @@ func ExampleEventSubscriptionsClient_NewListByResourcePager() { // { // Name: to.Ptr("examplesubscription1"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -2145,13 +2098,13 @@ func ExampleEventSubscriptionsClient_NewListByResourcePager() { // SubjectEndsWith: to.Ptr(""), // }, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"), // }, // }, // { // Name: to.Ptr("examplesubscription2"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription2"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription2"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -2165,13 +2118,13 @@ func ExampleEventSubscriptionsClient_NewListByResourcePager() { // SubjectEndsWith: to.Ptr(""), // }, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"), // }, // }, // { // Name: to.Ptr("examplesubscription3"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription3"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription3"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -2187,14 +2140,14 @@ func ExampleEventSubscriptionsClient_NewListByResourcePager() { // Labels: []*string{ // }, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventgrid/topics/exampletopic2"), // }, // }}, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/EventSubscriptions_ListByDomainTopic.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_ListByDomainTopic.json func ExampleEventSubscriptionsClient_NewListByDomainTopicPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2223,7 +2176,7 @@ func ExampleEventSubscriptionsClient_NewListByDomainTopicPager() { // { // Name: to.Ptr("examplesubscription1"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/domain1/topics/topic1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/domain1/topics/topic1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -2237,13 +2190,13 @@ func ExampleEventSubscriptionsClient_NewListByDomainTopicPager() { // SubjectEndsWith: to.Ptr(""), // }, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.eventgrid/domains/domain1/topics/topic1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventgrid/domains/domain1/topics/topic1"), // }, // }, // { // Name: to.Ptr("examplesubscription2"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/domain1/topics/topic1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription2"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/domain1/topics/topic1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription2"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -2257,13 +2210,13 @@ func ExampleEventSubscriptionsClient_NewListByDomainTopicPager() { // SubjectEndsWith: to.Ptr(""), // }, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.eventgrid/domains/domain1/topics/topic1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventgrid/domains/domain1/topics/topic1"), // }, // }, // { // Name: to.Ptr("examplesubscription3"), // Type: to.Ptr("Microsoft.EventGrid/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/domain1/topics/topic1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription3"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/domains/domain1/topics/topic1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription3"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -2279,9 +2232,44 @@ func ExampleEventSubscriptionsClient_NewListByDomainTopicPager() { // Labels: []*string{ // }, // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.eventgrid/domains/domain1/topics/topic1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.eventgrid/domains/domain1/topics/topic1"), // }, // }}, // } } } + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/EventSubscriptions_GetDeliveryAttributes.json +func ExampleEventSubscriptionsClient_GetDeliveryAttributes() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEventSubscriptionsClient().GetDeliveryAttributes(ctx, "aaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaa", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.DeliveryAttributeListResult = armeventgrid.DeliveryAttributeListResult{ + // Value: []armeventgrid.DeliveryAttributeMappingClassification{ + // &armeventgrid.StaticDeliveryAttributeMapping{ + // Name: to.Ptr("header1"), + // Type: to.Ptr(armeventgrid.DeliveryAttributeMappingTypeStatic), + // }, + // &armeventgrid.DynamicDeliveryAttributeMapping{ + // Name: to.Ptr("header2"), + // Type: to.Ptr(armeventgrid.DeliveryAttributeMappingTypeDynamic), + // }, + // &armeventgrid.StaticDeliveryAttributeMapping{ + // Name: to.Ptr("header3"), + // Type: to.Ptr(armeventgrid.DeliveryAttributeMappingTypeStatic), + // }}, + // } +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/extensiontopics_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/extensiontopics_client.go index 2044c89f1c93..9bf3b66db229 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/extensiontopics_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/extensiontopics_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid @@ -31,7 +30,7 @@ type ExtensionTopicsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewExtensionTopicsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ExtensionTopicsClient, error) { - cl, err := arm.NewClient(moduleName+".ExtensionTopicsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -44,7 +43,7 @@ func NewExtensionTopicsClient(credential azcore.TokenCredential, options *arm.Cl // Get - Get the properties of an extension topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - scope - The identifier of the resource to which extension topic is queried. The scope can be a subscription, or a resource // group, or a top level resource belonging to a resource provider namespace. For // example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' @@ -53,18 +52,25 @@ func NewExtensionTopicsClient(credential azcore.TokenCredential, options *arm.Cl // for Azure resource. // - options - ExtensionTopicsClientGetOptions contains the optional parameters for the ExtensionTopicsClient.Get method. func (client *ExtensionTopicsClient) Get(ctx context.Context, scope string, options *ExtensionTopicsClientGetOptions) (ExtensionTopicsClientGetResponse, error) { + var err error + const operationName = "ExtensionTopicsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, scope, options) if err != nil { return ExtensionTopicsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ExtensionTopicsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ExtensionTopicsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExtensionTopicsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -79,7 +85,7 @@ func (client *ExtensionTopicsClient) getCreateRequest(ctx context.Context, scope return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/extensiontopics_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/extensiontopics_client_example_test.go index 87b8c901fa0e..ac28b290d5d2 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/extensiontopics_client_example_test.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/extensiontopics_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/ExtensionTopics_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/ExtensionTopics_Get.json func ExampleExtensionTopicsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,7 +28,7 @@ func ExampleExtensionTopicsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewExtensionTopicsClient().Get(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.storage/storageaccounts/exampleResourceName/providers/Microsoft.eventgrid/extensionTopics/default", nil) + res, err := clientFactory.NewExtensionTopicsClient().Get(ctx, "subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.storage/storageaccounts/exampleResourceName/providers/Microsoft.eventgrid/extensionTopics/default", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -38,10 +38,10 @@ func ExampleExtensionTopicsClient_Get() { // res.ExtensionTopic = armeventgrid.ExtensionTopic{ // Name: to.Ptr("default"), // Type: to.Ptr("providers/Microsoft.EventGrid/extensionTopics"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.storage/storageaccounts/exampleResourceName/providers/Microsoft.eventgrid/extensionTopics/default"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.storage/storageaccounts/exampleResourceName/providers/Microsoft.eventgrid/extensionTopics/default"), // Properties: &armeventgrid.ExtensionTopicProperties{ - // Description: to.Ptr("Extension topic for /subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/microsoft.storage/storageaccounts/exampleResourceName/providers/Microsoft.eventgrid/extensionTopics/default that can be used to obtain metrics"), - // SystemTopic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/systemTopics/exampleResourceName-2a41650f-00dd-4790-b3ab-dabd12d227cb"), + // Description: to.Ptr("Extension topic for /subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/microsoft.storage/storageaccounts/exampleResourceName/providers/Microsoft.eventgrid/extensionTopics/default that can be used to obtain metrics"), + // SystemTopic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/systemTopics/exampleResourceName-2a41650f-00dd-4790-b3ab-dabd12d227cb"), // }, // } } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/fake/channels_server.go b/sdk/resourcemanager/eventgrid/armeventgrid/fake/channels_server.go new file mode 100644 index 000000000000..a9e660ec3732 --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/fake/channels_server.go @@ -0,0 +1,377 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// ChannelsServer is a fake server for instances of the armeventgrid.ChannelsClient type. +type ChannelsServer struct { + // CreateOrUpdate is the fake for method ChannelsClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceGroupName string, partnerNamespaceName string, channelName string, channelInfo armeventgrid.Channel, options *armeventgrid.ChannelsClientCreateOrUpdateOptions) (resp azfake.Responder[armeventgrid.ChannelsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ChannelsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, partnerNamespaceName string, channelName string, options *armeventgrid.ChannelsClientBeginDeleteOptions) (resp azfake.PollerResponder[armeventgrid.ChannelsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ChannelsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, partnerNamespaceName string, channelName string, options *armeventgrid.ChannelsClientGetOptions) (resp azfake.Responder[armeventgrid.ChannelsClientGetResponse], errResp azfake.ErrorResponder) + + // GetFullURL is the fake for method ChannelsClient.GetFullURL + // HTTP status codes to indicate success: http.StatusOK + GetFullURL func(ctx context.Context, resourceGroupName string, partnerNamespaceName string, channelName string, options *armeventgrid.ChannelsClientGetFullURLOptions) (resp azfake.Responder[armeventgrid.ChannelsClientGetFullURLResponse], errResp azfake.ErrorResponder) + + // NewListByPartnerNamespacePager is the fake for method ChannelsClient.NewListByPartnerNamespacePager + // HTTP status codes to indicate success: http.StatusOK + NewListByPartnerNamespacePager func(resourceGroupName string, partnerNamespaceName string, options *armeventgrid.ChannelsClientListByPartnerNamespaceOptions) (resp azfake.PagerResponder[armeventgrid.ChannelsClientListByPartnerNamespaceResponse]) + + // Update is the fake for method ChannelsClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, partnerNamespaceName string, channelName string, channelUpdateParameters armeventgrid.ChannelUpdateParameters, options *armeventgrid.ChannelsClientUpdateOptions) (resp azfake.Responder[armeventgrid.ChannelsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewChannelsServerTransport creates a new instance of ChannelsServerTransport with the provided implementation. +// The returned ChannelsServerTransport instance is connected to an instance of armeventgrid.ChannelsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewChannelsServerTransport(srv *ChannelsServer) *ChannelsServerTransport { + return &ChannelsServerTransport{ + srv: srv, + beginDelete: newTracker[azfake.PollerResponder[armeventgrid.ChannelsClientDeleteResponse]](), + newListByPartnerNamespacePager: newTracker[azfake.PagerResponder[armeventgrid.ChannelsClientListByPartnerNamespaceResponse]](), + } +} + +// ChannelsServerTransport connects instances of armeventgrid.ChannelsClient to instances of ChannelsServer. +// Don't use this type directly, use NewChannelsServerTransport instead. +type ChannelsServerTransport struct { + srv *ChannelsServer + beginDelete *tracker[azfake.PollerResponder[armeventgrid.ChannelsClientDeleteResponse]] + newListByPartnerNamespacePager *tracker[azfake.PagerResponder[armeventgrid.ChannelsClientListByPartnerNamespaceResponse]] +} + +// Do implements the policy.Transporter interface for ChannelsServerTransport. +func (c *ChannelsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ChannelsClient.CreateOrUpdate": + resp, err = c.dispatchCreateOrUpdate(req) + case "ChannelsClient.BeginDelete": + resp, err = c.dispatchBeginDelete(req) + case "ChannelsClient.Get": + resp, err = c.dispatchGet(req) + case "ChannelsClient.GetFullURL": + resp, err = c.dispatchGetFullURL(req) + case "ChannelsClient.NewListByPartnerNamespacePager": + resp, err = c.dispatchNewListByPartnerNamespacePager(req) + case "ChannelsClient.Update": + resp, err = c.dispatchUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *ChannelsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if c.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerNamespaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/channels/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.Channel](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerNamespaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerNamespaceName")]) + if err != nil { + return nil, err + } + channelNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("channelName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, partnerNamespaceNameParam, channelNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Channel, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *ChannelsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if c.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := c.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerNamespaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/channels/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerNamespaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerNamespaceName")]) + if err != nil { + return nil, err + } + channelNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("channelName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameParam, partnerNamespaceNameParam, channelNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + c.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + c.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + c.beginDelete.remove(req) + } + + return resp, nil +} + +func (c *ChannelsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerNamespaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/channels/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerNamespaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerNamespaceName")]) + if err != nil { + return nil, err + } + channelNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("channelName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, partnerNamespaceNameParam, channelNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Channel, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *ChannelsServerTransport) dispatchGetFullURL(req *http.Request) (*http.Response, error) { + if c.srv.GetFullURL == nil { + return nil, &nonRetriableError{errors.New("fake for method GetFullURL not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerNamespaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/channels/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getFullUrl` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerNamespaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerNamespaceName")]) + if err != nil { + return nil, err + } + channelNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("channelName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.GetFullURL(req.Context(), resourceGroupNameParam, partnerNamespaceNameParam, channelNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).EventSubscriptionFullURL, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *ChannelsServerTransport) dispatchNewListByPartnerNamespacePager(req *http.Request) (*http.Response, error) { + if c.srv.NewListByPartnerNamespacePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByPartnerNamespacePager not implemented")} + } + newListByPartnerNamespacePager := c.newListByPartnerNamespacePager.get(req) + if newListByPartnerNamespacePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerNamespaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/channels` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerNamespaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerNamespaceName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.ChannelsClientListByPartnerNamespaceOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.ChannelsClientListByPartnerNamespaceOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := c.srv.NewListByPartnerNamespacePager(resourceGroupNameParam, partnerNamespaceNameParam, options) + newListByPartnerNamespacePager = &resp + c.newListByPartnerNamespacePager.add(req, newListByPartnerNamespacePager) + server.PagerResponderInjectNextLinks(newListByPartnerNamespacePager, req, func(page *armeventgrid.ChannelsClientListByPartnerNamespaceResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByPartnerNamespacePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListByPartnerNamespacePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByPartnerNamespacePager) { + c.newListByPartnerNamespacePager.remove(req) + } + return resp, nil +} + +func (c *ChannelsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if c.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerNamespaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/channels/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.ChannelUpdateParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerNamespaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerNamespaceName")]) + if err != nil { + return nil, err + } + channelNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("channelName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Update(req.Context(), resourceGroupNameParam, partnerNamespaceNameParam, channelNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/fake/domaineventsubscriptions_server.go b/sdk/resourcemanager/eventgrid/armeventgrid/fake/domaineventsubscriptions_server.go new file mode 100644 index 000000000000..b6d22fdbacc8 --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/fake/domaineventsubscriptions_server.go @@ -0,0 +1,446 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// DomainEventSubscriptionsServer is a fake server for instances of the armeventgrid.DomainEventSubscriptionsClient type. +type DomainEventSubscriptionsServer struct { + // BeginCreateOrUpdate is the fake for method DomainEventSubscriptionsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, domainName string, eventSubscriptionName string, eventSubscriptionInfo armeventgrid.EventSubscription, options *armeventgrid.DomainEventSubscriptionsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armeventgrid.DomainEventSubscriptionsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method DomainEventSubscriptionsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, domainName string, eventSubscriptionName string, options *armeventgrid.DomainEventSubscriptionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armeventgrid.DomainEventSubscriptionsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method DomainEventSubscriptionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, domainName string, eventSubscriptionName string, options *armeventgrid.DomainEventSubscriptionsClientGetOptions) (resp azfake.Responder[armeventgrid.DomainEventSubscriptionsClientGetResponse], errResp azfake.ErrorResponder) + + // GetDeliveryAttributes is the fake for method DomainEventSubscriptionsClient.GetDeliveryAttributes + // HTTP status codes to indicate success: http.StatusOK + GetDeliveryAttributes func(ctx context.Context, resourceGroupName string, domainName string, eventSubscriptionName string, options *armeventgrid.DomainEventSubscriptionsClientGetDeliveryAttributesOptions) (resp azfake.Responder[armeventgrid.DomainEventSubscriptionsClientGetDeliveryAttributesResponse], errResp azfake.ErrorResponder) + + // GetFullURL is the fake for method DomainEventSubscriptionsClient.GetFullURL + // HTTP status codes to indicate success: http.StatusOK + GetFullURL func(ctx context.Context, resourceGroupName string, domainName string, eventSubscriptionName string, options *armeventgrid.DomainEventSubscriptionsClientGetFullURLOptions) (resp azfake.Responder[armeventgrid.DomainEventSubscriptionsClientGetFullURLResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method DomainEventSubscriptionsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, domainName string, options *armeventgrid.DomainEventSubscriptionsClientListOptions) (resp azfake.PagerResponder[armeventgrid.DomainEventSubscriptionsClientListResponse]) + + // BeginUpdate is the fake for method DomainEventSubscriptionsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusCreated + BeginUpdate func(ctx context.Context, resourceGroupName string, domainName string, eventSubscriptionName string, eventSubscriptionUpdateParameters armeventgrid.EventSubscriptionUpdateParameters, options *armeventgrid.DomainEventSubscriptionsClientBeginUpdateOptions) (resp azfake.PollerResponder[armeventgrid.DomainEventSubscriptionsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewDomainEventSubscriptionsServerTransport creates a new instance of DomainEventSubscriptionsServerTransport with the provided implementation. +// The returned DomainEventSubscriptionsServerTransport instance is connected to an instance of armeventgrid.DomainEventSubscriptionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewDomainEventSubscriptionsServerTransport(srv *DomainEventSubscriptionsServer) *DomainEventSubscriptionsServerTransport { + return &DomainEventSubscriptionsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armeventgrid.DomainEventSubscriptionsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armeventgrid.DomainEventSubscriptionsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armeventgrid.DomainEventSubscriptionsClientListResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armeventgrid.DomainEventSubscriptionsClientUpdateResponse]](), + } +} + +// DomainEventSubscriptionsServerTransport connects instances of armeventgrid.DomainEventSubscriptionsClient to instances of DomainEventSubscriptionsServer. +// Don't use this type directly, use NewDomainEventSubscriptionsServerTransport instead. +type DomainEventSubscriptionsServerTransport struct { + srv *DomainEventSubscriptionsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armeventgrid.DomainEventSubscriptionsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armeventgrid.DomainEventSubscriptionsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armeventgrid.DomainEventSubscriptionsClientListResponse]] + beginUpdate *tracker[azfake.PollerResponder[armeventgrid.DomainEventSubscriptionsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for DomainEventSubscriptionsServerTransport. +func (d *DomainEventSubscriptionsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "DomainEventSubscriptionsClient.BeginCreateOrUpdate": + resp, err = d.dispatchBeginCreateOrUpdate(req) + case "DomainEventSubscriptionsClient.BeginDelete": + resp, err = d.dispatchBeginDelete(req) + case "DomainEventSubscriptionsClient.Get": + resp, err = d.dispatchGet(req) + case "DomainEventSubscriptionsClient.GetDeliveryAttributes": + resp, err = d.dispatchGetDeliveryAttributes(req) + case "DomainEventSubscriptionsClient.GetFullURL": + resp, err = d.dispatchGetFullURL(req) + case "DomainEventSubscriptionsClient.NewListPager": + resp, err = d.dispatchNewListPager(req) + case "DomainEventSubscriptionsClient.BeginUpdate": + resp, err = d.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (d *DomainEventSubscriptionsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if d.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := d.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.EventSubscription](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + domainNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, domainNameParam, eventSubscriptionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + d.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + d.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + d.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (d *DomainEventSubscriptionsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if d.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := d.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + domainNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginDelete(req.Context(), resourceGroupNameParam, domainNameParam, eventSubscriptionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + d.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + d.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + d.beginDelete.remove(req) + } + + return resp, nil +} + +func (d *DomainEventSubscriptionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if d.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + domainNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, domainNameParam, eventSubscriptionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).EventSubscription, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DomainEventSubscriptionsServerTransport) dispatchGetDeliveryAttributes(req *http.Request) (*http.Response, error) { + if d.srv.GetDeliveryAttributes == nil { + return nil, &nonRetriableError{errors.New("fake for method GetDeliveryAttributes not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getDeliveryAttributes` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + domainNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.GetDeliveryAttributes(req.Context(), resourceGroupNameParam, domainNameParam, eventSubscriptionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DeliveryAttributeListResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DomainEventSubscriptionsServerTransport) dispatchGetFullURL(req *http.Request) (*http.Response, error) { + if d.srv.GetFullURL == nil { + return nil, &nonRetriableError{errors.New("fake for method GetFullURL not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getFullUrl` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + domainNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.GetFullURL(req.Context(), resourceGroupNameParam, domainNameParam, eventSubscriptionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).EventSubscriptionFullURL, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DomainEventSubscriptionsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if d.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := d.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + domainNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.DomainEventSubscriptionsClientListOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.DomainEventSubscriptionsClientListOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := d.srv.NewListPager(resourceGroupNameParam, domainNameParam, options) + newListPager = &resp + d.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armeventgrid.DomainEventSubscriptionsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + d.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + d.newListPager.remove(req) + } + return resp, nil +} + +func (d *DomainEventSubscriptionsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if d.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := d.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.EventSubscriptionUpdateParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + domainNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginUpdate(req.Context(), resourceGroupNameParam, domainNameParam, eventSubscriptionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + d.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusCreated}, resp.StatusCode) { + d.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + d.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/fake/domains_server.go b/sdk/resourcemanager/eventgrid/armeventgrid/fake/domains_server.go new file mode 100644 index 000000000000..2cbe89ad1388 --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/fake/domains_server.go @@ -0,0 +1,490 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// DomainsServer is a fake server for instances of the armeventgrid.DomainsClient type. +type DomainsServer struct { + // BeginCreateOrUpdate is the fake for method DomainsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, domainName string, domainInfo armeventgrid.Domain, options *armeventgrid.DomainsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armeventgrid.DomainsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method DomainsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, domainName string, options *armeventgrid.DomainsClientBeginDeleteOptions) (resp azfake.PollerResponder[armeventgrid.DomainsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method DomainsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, domainName string, options *armeventgrid.DomainsClientGetOptions) (resp azfake.Responder[armeventgrid.DomainsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method DomainsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armeventgrid.DomainsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armeventgrid.DomainsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method DomainsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armeventgrid.DomainsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armeventgrid.DomainsClientListBySubscriptionResponse]) + + // ListSharedAccessKeys is the fake for method DomainsClient.ListSharedAccessKeys + // HTTP status codes to indicate success: http.StatusOK + ListSharedAccessKeys func(ctx context.Context, resourceGroupName string, domainName string, options *armeventgrid.DomainsClientListSharedAccessKeysOptions) (resp azfake.Responder[armeventgrid.DomainsClientListSharedAccessKeysResponse], errResp azfake.ErrorResponder) + + // RegenerateKey is the fake for method DomainsClient.RegenerateKey + // HTTP status codes to indicate success: http.StatusOK + RegenerateKey func(ctx context.Context, resourceGroupName string, domainName string, regenerateKeyRequest armeventgrid.DomainRegenerateKeyRequest, options *armeventgrid.DomainsClientRegenerateKeyOptions) (resp azfake.Responder[armeventgrid.DomainsClientRegenerateKeyResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method DomainsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginUpdate func(ctx context.Context, resourceGroupName string, domainName string, domainUpdateParameters armeventgrid.DomainUpdateParameters, options *armeventgrid.DomainsClientBeginUpdateOptions) (resp azfake.PollerResponder[armeventgrid.DomainsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewDomainsServerTransport creates a new instance of DomainsServerTransport with the provided implementation. +// The returned DomainsServerTransport instance is connected to an instance of armeventgrid.DomainsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewDomainsServerTransport(srv *DomainsServer) *DomainsServerTransport { + return &DomainsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armeventgrid.DomainsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armeventgrid.DomainsClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armeventgrid.DomainsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armeventgrid.DomainsClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armeventgrid.DomainsClientUpdateResponse]](), + } +} + +// DomainsServerTransport connects instances of armeventgrid.DomainsClient to instances of DomainsServer. +// Don't use this type directly, use NewDomainsServerTransport instead. +type DomainsServerTransport struct { + srv *DomainsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armeventgrid.DomainsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armeventgrid.DomainsClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armeventgrid.DomainsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armeventgrid.DomainsClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armeventgrid.DomainsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for DomainsServerTransport. +func (d *DomainsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "DomainsClient.BeginCreateOrUpdate": + resp, err = d.dispatchBeginCreateOrUpdate(req) + case "DomainsClient.BeginDelete": + resp, err = d.dispatchBeginDelete(req) + case "DomainsClient.Get": + resp, err = d.dispatchGet(req) + case "DomainsClient.NewListByResourceGroupPager": + resp, err = d.dispatchNewListByResourceGroupPager(req) + case "DomainsClient.NewListBySubscriptionPager": + resp, err = d.dispatchNewListBySubscriptionPager(req) + case "DomainsClient.ListSharedAccessKeys": + resp, err = d.dispatchListSharedAccessKeys(req) + case "DomainsClient.RegenerateKey": + resp, err = d.dispatchRegenerateKey(req) + case "DomainsClient.BeginUpdate": + resp, err = d.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (d *DomainsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if d.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := d.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.Domain](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + domainNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, domainNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + d.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusCreated}, resp.StatusCode) { + d.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + d.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (d *DomainsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if d.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := d.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + domainNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginDelete(req.Context(), resourceGroupNameParam, domainNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + d.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + d.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + d.beginDelete.remove(req) + } + + return resp, nil +} + +func (d *DomainsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if d.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + domainNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, domainNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Domain, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DomainsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if d.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := d.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.DomainsClientListByResourceGroupOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.DomainsClientListByResourceGroupOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := d.srv.NewListByResourceGroupPager(resourceGroupNameParam, options) + newListByResourceGroupPager = &resp + d.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armeventgrid.DomainsClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + d.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + d.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (d *DomainsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if d.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := d.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.DomainsClientListBySubscriptionOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.DomainsClientListBySubscriptionOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := d.srv.NewListBySubscriptionPager(options) + newListBySubscriptionPager = &resp + d.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armeventgrid.DomainsClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + d.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + d.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (d *DomainsServerTransport) dispatchListSharedAccessKeys(req *http.Request) (*http.Response, error) { + if d.srv.ListSharedAccessKeys == nil { + return nil, &nonRetriableError{errors.New("fake for method ListSharedAccessKeys not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listKeys` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + domainNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.ListSharedAccessKeys(req.Context(), resourceGroupNameParam, domainNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DomainSharedAccessKeys, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DomainsServerTransport) dispatchRegenerateKey(req *http.Request) (*http.Response, error) { + if d.srv.RegenerateKey == nil { + return nil, &nonRetriableError{errors.New("fake for method RegenerateKey not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/regenerateKey` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.DomainRegenerateKeyRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + domainNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.RegenerateKey(req.Context(), resourceGroupNameParam, domainNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DomainSharedAccessKeys, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DomainsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if d.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := d.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.DomainUpdateParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + domainNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginUpdate(req.Context(), resourceGroupNameParam, domainNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + d.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + d.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + d.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/fake/domaintopiceventsubscriptions_server.go b/sdk/resourcemanager/eventgrid/armeventgrid/fake/domaintopiceventsubscriptions_server.go new file mode 100644 index 000000000000..3ffbc8198503 --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/fake/domaintopiceventsubscriptions_server.go @@ -0,0 +1,474 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// DomainTopicEventSubscriptionsServer is a fake server for instances of the armeventgrid.DomainTopicEventSubscriptionsClient type. +type DomainTopicEventSubscriptionsServer struct { + // BeginCreateOrUpdate is the fake for method DomainTopicEventSubscriptionsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, domainName string, topicName string, eventSubscriptionName string, eventSubscriptionInfo armeventgrid.EventSubscription, options *armeventgrid.DomainTopicEventSubscriptionsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armeventgrid.DomainTopicEventSubscriptionsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method DomainTopicEventSubscriptionsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, domainName string, topicName string, eventSubscriptionName string, options *armeventgrid.DomainTopicEventSubscriptionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armeventgrid.DomainTopicEventSubscriptionsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method DomainTopicEventSubscriptionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, domainName string, topicName string, eventSubscriptionName string, options *armeventgrid.DomainTopicEventSubscriptionsClientGetOptions) (resp azfake.Responder[armeventgrid.DomainTopicEventSubscriptionsClientGetResponse], errResp azfake.ErrorResponder) + + // GetDeliveryAttributes is the fake for method DomainTopicEventSubscriptionsClient.GetDeliveryAttributes + // HTTP status codes to indicate success: http.StatusOK + GetDeliveryAttributes func(ctx context.Context, resourceGroupName string, domainName string, topicName string, eventSubscriptionName string, options *armeventgrid.DomainTopicEventSubscriptionsClientGetDeliveryAttributesOptions) (resp azfake.Responder[armeventgrid.DomainTopicEventSubscriptionsClientGetDeliveryAttributesResponse], errResp azfake.ErrorResponder) + + // GetFullURL is the fake for method DomainTopicEventSubscriptionsClient.GetFullURL + // HTTP status codes to indicate success: http.StatusOK + GetFullURL func(ctx context.Context, resourceGroupName string, domainName string, topicName string, eventSubscriptionName string, options *armeventgrid.DomainTopicEventSubscriptionsClientGetFullURLOptions) (resp azfake.Responder[armeventgrid.DomainTopicEventSubscriptionsClientGetFullURLResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method DomainTopicEventSubscriptionsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, domainName string, topicName string, options *armeventgrid.DomainTopicEventSubscriptionsClientListOptions) (resp azfake.PagerResponder[armeventgrid.DomainTopicEventSubscriptionsClientListResponse]) + + // BeginUpdate is the fake for method DomainTopicEventSubscriptionsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusCreated + BeginUpdate func(ctx context.Context, resourceGroupName string, domainName string, topicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters armeventgrid.EventSubscriptionUpdateParameters, options *armeventgrid.DomainTopicEventSubscriptionsClientBeginUpdateOptions) (resp azfake.PollerResponder[armeventgrid.DomainTopicEventSubscriptionsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewDomainTopicEventSubscriptionsServerTransport creates a new instance of DomainTopicEventSubscriptionsServerTransport with the provided implementation. +// The returned DomainTopicEventSubscriptionsServerTransport instance is connected to an instance of armeventgrid.DomainTopicEventSubscriptionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewDomainTopicEventSubscriptionsServerTransport(srv *DomainTopicEventSubscriptionsServer) *DomainTopicEventSubscriptionsServerTransport { + return &DomainTopicEventSubscriptionsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armeventgrid.DomainTopicEventSubscriptionsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armeventgrid.DomainTopicEventSubscriptionsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armeventgrid.DomainTopicEventSubscriptionsClientListResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armeventgrid.DomainTopicEventSubscriptionsClientUpdateResponse]](), + } +} + +// DomainTopicEventSubscriptionsServerTransport connects instances of armeventgrid.DomainTopicEventSubscriptionsClient to instances of DomainTopicEventSubscriptionsServer. +// Don't use this type directly, use NewDomainTopicEventSubscriptionsServerTransport instead. +type DomainTopicEventSubscriptionsServerTransport struct { + srv *DomainTopicEventSubscriptionsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armeventgrid.DomainTopicEventSubscriptionsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armeventgrid.DomainTopicEventSubscriptionsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armeventgrid.DomainTopicEventSubscriptionsClientListResponse]] + beginUpdate *tracker[azfake.PollerResponder[armeventgrid.DomainTopicEventSubscriptionsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for DomainTopicEventSubscriptionsServerTransport. +func (d *DomainTopicEventSubscriptionsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "DomainTopicEventSubscriptionsClient.BeginCreateOrUpdate": + resp, err = d.dispatchBeginCreateOrUpdate(req) + case "DomainTopicEventSubscriptionsClient.BeginDelete": + resp, err = d.dispatchBeginDelete(req) + case "DomainTopicEventSubscriptionsClient.Get": + resp, err = d.dispatchGet(req) + case "DomainTopicEventSubscriptionsClient.GetDeliveryAttributes": + resp, err = d.dispatchGetDeliveryAttributes(req) + case "DomainTopicEventSubscriptionsClient.GetFullURL": + resp, err = d.dispatchGetFullURL(req) + case "DomainTopicEventSubscriptionsClient.NewListPager": + resp, err = d.dispatchNewListPager(req) + case "DomainTopicEventSubscriptionsClient.BeginUpdate": + resp, err = d.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (d *DomainTopicEventSubscriptionsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if d.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := d.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/topics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.EventSubscription](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + domainNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainName")]) + if err != nil { + return nil, err + } + topicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, domainNameParam, topicNameParam, eventSubscriptionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + d.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + d.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + d.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (d *DomainTopicEventSubscriptionsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if d.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := d.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/topics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + domainNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainName")]) + if err != nil { + return nil, err + } + topicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginDelete(req.Context(), resourceGroupNameParam, domainNameParam, topicNameParam, eventSubscriptionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + d.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + d.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + d.beginDelete.remove(req) + } + + return resp, nil +} + +func (d *DomainTopicEventSubscriptionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if d.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/topics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + domainNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainName")]) + if err != nil { + return nil, err + } + topicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, domainNameParam, topicNameParam, eventSubscriptionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).EventSubscription, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DomainTopicEventSubscriptionsServerTransport) dispatchGetDeliveryAttributes(req *http.Request) (*http.Response, error) { + if d.srv.GetDeliveryAttributes == nil { + return nil, &nonRetriableError{errors.New("fake for method GetDeliveryAttributes not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/topics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getDeliveryAttributes` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + domainNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainName")]) + if err != nil { + return nil, err + } + topicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.GetDeliveryAttributes(req.Context(), resourceGroupNameParam, domainNameParam, topicNameParam, eventSubscriptionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DeliveryAttributeListResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DomainTopicEventSubscriptionsServerTransport) dispatchGetFullURL(req *http.Request) (*http.Response, error) { + if d.srv.GetFullURL == nil { + return nil, &nonRetriableError{errors.New("fake for method GetFullURL not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/topics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getFullUrl` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + domainNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainName")]) + if err != nil { + return nil, err + } + topicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.GetFullURL(req.Context(), resourceGroupNameParam, domainNameParam, topicNameParam, eventSubscriptionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).EventSubscriptionFullURL, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DomainTopicEventSubscriptionsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if d.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := d.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/topics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + domainNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainName")]) + if err != nil { + return nil, err + } + topicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.DomainTopicEventSubscriptionsClientListOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.DomainTopicEventSubscriptionsClientListOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := d.srv.NewListPager(resourceGroupNameParam, domainNameParam, topicNameParam, options) + newListPager = &resp + d.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armeventgrid.DomainTopicEventSubscriptionsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + d.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + d.newListPager.remove(req) + } + return resp, nil +} + +func (d *DomainTopicEventSubscriptionsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if d.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := d.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/topics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.EventSubscriptionUpdateParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + domainNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainName")]) + if err != nil { + return nil, err + } + topicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginUpdate(req.Context(), resourceGroupNameParam, domainNameParam, topicNameParam, eventSubscriptionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + d.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusCreated}, resp.StatusCode) { + d.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + d.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/fake/domaintopics_server.go b/sdk/resourcemanager/eventgrid/armeventgrid/fake/domaintopics_server.go new file mode 100644 index 000000000000..a42a50320155 --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/fake/domaintopics_server.go @@ -0,0 +1,296 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// DomainTopicsServer is a fake server for instances of the armeventgrid.DomainTopicsClient type. +type DomainTopicsServer struct { + // BeginCreateOrUpdate is the fake for method DomainTopicsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string, options *armeventgrid.DomainTopicsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armeventgrid.DomainTopicsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method DomainTopicsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string, options *armeventgrid.DomainTopicsClientBeginDeleteOptions) (resp azfake.PollerResponder[armeventgrid.DomainTopicsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method DomainTopicsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string, options *armeventgrid.DomainTopicsClientGetOptions) (resp azfake.Responder[armeventgrid.DomainTopicsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByDomainPager is the fake for method DomainTopicsClient.NewListByDomainPager + // HTTP status codes to indicate success: http.StatusOK + NewListByDomainPager func(resourceGroupName string, domainName string, options *armeventgrid.DomainTopicsClientListByDomainOptions) (resp azfake.PagerResponder[armeventgrid.DomainTopicsClientListByDomainResponse]) +} + +// NewDomainTopicsServerTransport creates a new instance of DomainTopicsServerTransport with the provided implementation. +// The returned DomainTopicsServerTransport instance is connected to an instance of armeventgrid.DomainTopicsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewDomainTopicsServerTransport(srv *DomainTopicsServer) *DomainTopicsServerTransport { + return &DomainTopicsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armeventgrid.DomainTopicsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armeventgrid.DomainTopicsClientDeleteResponse]](), + newListByDomainPager: newTracker[azfake.PagerResponder[armeventgrid.DomainTopicsClientListByDomainResponse]](), + } +} + +// DomainTopicsServerTransport connects instances of armeventgrid.DomainTopicsClient to instances of DomainTopicsServer. +// Don't use this type directly, use NewDomainTopicsServerTransport instead. +type DomainTopicsServerTransport struct { + srv *DomainTopicsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armeventgrid.DomainTopicsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armeventgrid.DomainTopicsClientDeleteResponse]] + newListByDomainPager *tracker[azfake.PagerResponder[armeventgrid.DomainTopicsClientListByDomainResponse]] +} + +// Do implements the policy.Transporter interface for DomainTopicsServerTransport. +func (d *DomainTopicsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "DomainTopicsClient.BeginCreateOrUpdate": + resp, err = d.dispatchBeginCreateOrUpdate(req) + case "DomainTopicsClient.BeginDelete": + resp, err = d.dispatchBeginDelete(req) + case "DomainTopicsClient.Get": + resp, err = d.dispatchGet(req) + case "DomainTopicsClient.NewListByDomainPager": + resp, err = d.dispatchNewListByDomainPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (d *DomainTopicsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if d.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := d.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/topics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + domainNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainName")]) + if err != nil { + return nil, err + } + domainTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainTopicName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, domainNameParam, domainTopicNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + d.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusCreated}, resp.StatusCode) { + d.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + d.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (d *DomainTopicsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if d.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := d.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/topics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + domainNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainName")]) + if err != nil { + return nil, err + } + domainTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainTopicName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.BeginDelete(req.Context(), resourceGroupNameParam, domainNameParam, domainTopicNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + d.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + d.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + d.beginDelete.remove(req) + } + + return resp, nil +} + +func (d *DomainTopicsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if d.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/topics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + domainNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainName")]) + if err != nil { + return nil, err + } + domainTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainTopicName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, domainNameParam, domainTopicNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DomainTopic, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DomainTopicsServerTransport) dispatchNewListByDomainPager(req *http.Request) (*http.Response, error) { + if d.srv.NewListByDomainPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByDomainPager not implemented")} + } + newListByDomainPager := d.newListByDomainPager.get(req) + if newListByDomainPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/topics` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + domainNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.DomainTopicsClientListByDomainOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.DomainTopicsClientListByDomainOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := d.srv.NewListByDomainPager(resourceGroupNameParam, domainNameParam, options) + newListByDomainPager = &resp + d.newListByDomainPager.add(req, newListByDomainPager) + server.PagerResponderInjectNextLinks(newListByDomainPager, req, func(page *armeventgrid.DomainTopicsClientListByDomainResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByDomainPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + d.newListByDomainPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByDomainPager) { + d.newListByDomainPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/fake/eventsubscriptions_server.go b/sdk/resourcemanager/eventgrid/armeventgrid/fake/eventsubscriptions_server.go new file mode 100644 index 000000000000..5d453ef7a7e6 --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/fake/eventsubscriptions_server.go @@ -0,0 +1,1102 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// EventSubscriptionsServer is a fake server for instances of the armeventgrid.EventSubscriptionsClient type. +type EventSubscriptionsServer struct { + // BeginCreateOrUpdate is the fake for method EventSubscriptionsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo armeventgrid.EventSubscription, options *armeventgrid.EventSubscriptionsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armeventgrid.EventSubscriptionsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method EventSubscriptionsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, scope string, eventSubscriptionName string, options *armeventgrid.EventSubscriptionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armeventgrid.EventSubscriptionsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method EventSubscriptionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, scope string, eventSubscriptionName string, options *armeventgrid.EventSubscriptionsClientGetOptions) (resp azfake.Responder[armeventgrid.EventSubscriptionsClientGetResponse], errResp azfake.ErrorResponder) + + // GetDeliveryAttributes is the fake for method EventSubscriptionsClient.GetDeliveryAttributes + // HTTP status codes to indicate success: http.StatusOK + GetDeliveryAttributes func(ctx context.Context, scope string, eventSubscriptionName string, options *armeventgrid.EventSubscriptionsClientGetDeliveryAttributesOptions) (resp azfake.Responder[armeventgrid.EventSubscriptionsClientGetDeliveryAttributesResponse], errResp azfake.ErrorResponder) + + // GetFullURL is the fake for method EventSubscriptionsClient.GetFullURL + // HTTP status codes to indicate success: http.StatusOK + GetFullURL func(ctx context.Context, scope string, eventSubscriptionName string, options *armeventgrid.EventSubscriptionsClientGetFullURLOptions) (resp azfake.Responder[armeventgrid.EventSubscriptionsClientGetFullURLResponse], errResp azfake.ErrorResponder) + + // NewListByDomainTopicPager is the fake for method EventSubscriptionsClient.NewListByDomainTopicPager + // HTTP status codes to indicate success: http.StatusOK + NewListByDomainTopicPager func(resourceGroupName string, domainName string, topicName string, options *armeventgrid.EventSubscriptionsClientListByDomainTopicOptions) (resp azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListByDomainTopicResponse]) + + // NewListByResourcePager is the fake for method EventSubscriptionsClient.NewListByResourcePager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourcePager func(resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, options *armeventgrid.EventSubscriptionsClientListByResourceOptions) (resp azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListByResourceResponse]) + + // NewListGlobalByResourceGroupPager is the fake for method EventSubscriptionsClient.NewListGlobalByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListGlobalByResourceGroupPager func(resourceGroupName string, options *armeventgrid.EventSubscriptionsClientListGlobalByResourceGroupOptions) (resp azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListGlobalByResourceGroupResponse]) + + // NewListGlobalByResourceGroupForTopicTypePager is the fake for method EventSubscriptionsClient.NewListGlobalByResourceGroupForTopicTypePager + // HTTP status codes to indicate success: http.StatusOK + NewListGlobalByResourceGroupForTopicTypePager func(resourceGroupName string, topicTypeName string, options *armeventgrid.EventSubscriptionsClientListGlobalByResourceGroupForTopicTypeOptions) (resp azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListGlobalByResourceGroupForTopicTypeResponse]) + + // NewListGlobalBySubscriptionPager is the fake for method EventSubscriptionsClient.NewListGlobalBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListGlobalBySubscriptionPager func(options *armeventgrid.EventSubscriptionsClientListGlobalBySubscriptionOptions) (resp azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListGlobalBySubscriptionResponse]) + + // NewListGlobalBySubscriptionForTopicTypePager is the fake for method EventSubscriptionsClient.NewListGlobalBySubscriptionForTopicTypePager + // HTTP status codes to indicate success: http.StatusOK + NewListGlobalBySubscriptionForTopicTypePager func(topicTypeName string, options *armeventgrid.EventSubscriptionsClientListGlobalBySubscriptionForTopicTypeOptions) (resp azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListGlobalBySubscriptionForTopicTypeResponse]) + + // NewListRegionalByResourceGroupPager is the fake for method EventSubscriptionsClient.NewListRegionalByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListRegionalByResourceGroupPager func(resourceGroupName string, location string, options *armeventgrid.EventSubscriptionsClientListRegionalByResourceGroupOptions) (resp azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListRegionalByResourceGroupResponse]) + + // NewListRegionalByResourceGroupForTopicTypePager is the fake for method EventSubscriptionsClient.NewListRegionalByResourceGroupForTopicTypePager + // HTTP status codes to indicate success: http.StatusOK + NewListRegionalByResourceGroupForTopicTypePager func(resourceGroupName string, location string, topicTypeName string, options *armeventgrid.EventSubscriptionsClientListRegionalByResourceGroupForTopicTypeOptions) (resp azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListRegionalByResourceGroupForTopicTypeResponse]) + + // NewListRegionalBySubscriptionPager is the fake for method EventSubscriptionsClient.NewListRegionalBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListRegionalBySubscriptionPager func(location string, options *armeventgrid.EventSubscriptionsClientListRegionalBySubscriptionOptions) (resp azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListRegionalBySubscriptionResponse]) + + // NewListRegionalBySubscriptionForTopicTypePager is the fake for method EventSubscriptionsClient.NewListRegionalBySubscriptionForTopicTypePager + // HTTP status codes to indicate success: http.StatusOK + NewListRegionalBySubscriptionForTopicTypePager func(location string, topicTypeName string, options *armeventgrid.EventSubscriptionsClientListRegionalBySubscriptionForTopicTypeOptions) (resp azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListRegionalBySubscriptionForTopicTypeResponse]) + + // BeginUpdate is the fake for method EventSubscriptionsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusCreated + BeginUpdate func(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters armeventgrid.EventSubscriptionUpdateParameters, options *armeventgrid.EventSubscriptionsClientBeginUpdateOptions) (resp azfake.PollerResponder[armeventgrid.EventSubscriptionsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewEventSubscriptionsServerTransport creates a new instance of EventSubscriptionsServerTransport with the provided implementation. +// The returned EventSubscriptionsServerTransport instance is connected to an instance of armeventgrid.EventSubscriptionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewEventSubscriptionsServerTransport(srv *EventSubscriptionsServer) *EventSubscriptionsServerTransport { + return &EventSubscriptionsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armeventgrid.EventSubscriptionsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armeventgrid.EventSubscriptionsClientDeleteResponse]](), + newListByDomainTopicPager: newTracker[azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListByDomainTopicResponse]](), + newListByResourcePager: newTracker[azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListByResourceResponse]](), + newListGlobalByResourceGroupPager: newTracker[azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListGlobalByResourceGroupResponse]](), + newListGlobalByResourceGroupForTopicTypePager: newTracker[azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListGlobalByResourceGroupForTopicTypeResponse]](), + newListGlobalBySubscriptionPager: newTracker[azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListGlobalBySubscriptionResponse]](), + newListGlobalBySubscriptionForTopicTypePager: newTracker[azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListGlobalBySubscriptionForTopicTypeResponse]](), + newListRegionalByResourceGroupPager: newTracker[azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListRegionalByResourceGroupResponse]](), + newListRegionalByResourceGroupForTopicTypePager: newTracker[azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListRegionalByResourceGroupForTopicTypeResponse]](), + newListRegionalBySubscriptionPager: newTracker[azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListRegionalBySubscriptionResponse]](), + newListRegionalBySubscriptionForTopicTypePager: newTracker[azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListRegionalBySubscriptionForTopicTypeResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armeventgrid.EventSubscriptionsClientUpdateResponse]](), + } +} + +// EventSubscriptionsServerTransport connects instances of armeventgrid.EventSubscriptionsClient to instances of EventSubscriptionsServer. +// Don't use this type directly, use NewEventSubscriptionsServerTransport instead. +type EventSubscriptionsServerTransport struct { + srv *EventSubscriptionsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armeventgrid.EventSubscriptionsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armeventgrid.EventSubscriptionsClientDeleteResponse]] + newListByDomainTopicPager *tracker[azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListByDomainTopicResponse]] + newListByResourcePager *tracker[azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListByResourceResponse]] + newListGlobalByResourceGroupPager *tracker[azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListGlobalByResourceGroupResponse]] + newListGlobalByResourceGroupForTopicTypePager *tracker[azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListGlobalByResourceGroupForTopicTypeResponse]] + newListGlobalBySubscriptionPager *tracker[azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListGlobalBySubscriptionResponse]] + newListGlobalBySubscriptionForTopicTypePager *tracker[azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListGlobalBySubscriptionForTopicTypeResponse]] + newListRegionalByResourceGroupPager *tracker[azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListRegionalByResourceGroupResponse]] + newListRegionalByResourceGroupForTopicTypePager *tracker[azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListRegionalByResourceGroupForTopicTypeResponse]] + newListRegionalBySubscriptionPager *tracker[azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListRegionalBySubscriptionResponse]] + newListRegionalBySubscriptionForTopicTypePager *tracker[azfake.PagerResponder[armeventgrid.EventSubscriptionsClientListRegionalBySubscriptionForTopicTypeResponse]] + beginUpdate *tracker[azfake.PollerResponder[armeventgrid.EventSubscriptionsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for EventSubscriptionsServerTransport. +func (e *EventSubscriptionsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "EventSubscriptionsClient.BeginCreateOrUpdate": + resp, err = e.dispatchBeginCreateOrUpdate(req) + case "EventSubscriptionsClient.BeginDelete": + resp, err = e.dispatchBeginDelete(req) + case "EventSubscriptionsClient.Get": + resp, err = e.dispatchGet(req) + case "EventSubscriptionsClient.GetDeliveryAttributes": + resp, err = e.dispatchGetDeliveryAttributes(req) + case "EventSubscriptionsClient.GetFullURL": + resp, err = e.dispatchGetFullURL(req) + case "EventSubscriptionsClient.NewListByDomainTopicPager": + resp, err = e.dispatchNewListByDomainTopicPager(req) + case "EventSubscriptionsClient.NewListByResourcePager": + resp, err = e.dispatchNewListByResourcePager(req) + case "EventSubscriptionsClient.NewListGlobalByResourceGroupPager": + resp, err = e.dispatchNewListGlobalByResourceGroupPager(req) + case "EventSubscriptionsClient.NewListGlobalByResourceGroupForTopicTypePager": + resp, err = e.dispatchNewListGlobalByResourceGroupForTopicTypePager(req) + case "EventSubscriptionsClient.NewListGlobalBySubscriptionPager": + resp, err = e.dispatchNewListGlobalBySubscriptionPager(req) + case "EventSubscriptionsClient.NewListGlobalBySubscriptionForTopicTypePager": + resp, err = e.dispatchNewListGlobalBySubscriptionForTopicTypePager(req) + case "EventSubscriptionsClient.NewListRegionalByResourceGroupPager": + resp, err = e.dispatchNewListRegionalByResourceGroupPager(req) + case "EventSubscriptionsClient.NewListRegionalByResourceGroupForTopicTypePager": + resp, err = e.dispatchNewListRegionalByResourceGroupForTopicTypePager(req) + case "EventSubscriptionsClient.NewListRegionalBySubscriptionPager": + resp, err = e.dispatchNewListRegionalBySubscriptionPager(req) + case "EventSubscriptionsClient.NewListRegionalBySubscriptionForTopicTypePager": + resp, err = e.dispatchNewListRegionalBySubscriptionForTopicTypePager(req) + case "EventSubscriptionsClient.BeginUpdate": + resp, err = e.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (e *EventSubscriptionsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if e.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := e.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.EventSubscription](req) + if err != nil { + return nil, err + } + scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginCreateOrUpdate(req.Context(), scopeParam, eventSubscriptionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + e.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusCreated}, resp.StatusCode) { + e.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + e.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (e *EventSubscriptionsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if e.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := e.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginDelete(req.Context(), scopeParam, eventSubscriptionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + e.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + e.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + e.beginDelete.remove(req) + } + + return resp, nil +} + +func (e *EventSubscriptionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if e.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Get(req.Context(), scopeParam, eventSubscriptionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).EventSubscription, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *EventSubscriptionsServerTransport) dispatchGetDeliveryAttributes(req *http.Request) (*http.Response, error) { + if e.srv.GetDeliveryAttributes == nil { + return nil, &nonRetriableError{errors.New("fake for method GetDeliveryAttributes not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getDeliveryAttributes` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.GetDeliveryAttributes(req.Context(), scopeParam, eventSubscriptionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DeliveryAttributeListResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *EventSubscriptionsServerTransport) dispatchGetFullURL(req *http.Request) (*http.Response, error) { + if e.srv.GetFullURL == nil { + return nil, &nonRetriableError{errors.New("fake for method GetFullURL not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getFullUrl` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.GetFullURL(req.Context(), scopeParam, eventSubscriptionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).EventSubscriptionFullURL, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *EventSubscriptionsServerTransport) dispatchNewListByDomainTopicPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListByDomainTopicPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByDomainTopicPager not implemented")} + } + newListByDomainTopicPager := e.newListByDomainTopicPager.get(req) + if newListByDomainTopicPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/domains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/topics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/eventSubscriptions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + domainNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("domainName")]) + if err != nil { + return nil, err + } + topicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.EventSubscriptionsClientListByDomainTopicOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.EventSubscriptionsClientListByDomainTopicOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := e.srv.NewListByDomainTopicPager(resourceGroupNameParam, domainNameParam, topicNameParam, options) + newListByDomainTopicPager = &resp + e.newListByDomainTopicPager.add(req, newListByDomainTopicPager) + server.PagerResponderInjectNextLinks(newListByDomainTopicPager, req, func(page *armeventgrid.EventSubscriptionsClientListByDomainTopicResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByDomainTopicPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListByDomainTopicPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByDomainTopicPager) { + e.newListByDomainTopicPager.remove(req) + } + return resp, nil +} + +func (e *EventSubscriptionsServerTransport) dispatchNewListByResourcePager(req *http.Request) (*http.Response, error) { + if e.srv.NewListByResourcePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourcePager not implemented")} + } + newListByResourcePager := e.newListByResourcePager.get(req) + if newListByResourcePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/eventSubscriptions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + providerNamespaceParam, err := url.PathUnescape(matches[regex.SubexpIndex("providerNamespace")]) + if err != nil { + return nil, err + } + resourceTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceTypeName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.EventSubscriptionsClientListByResourceOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.EventSubscriptionsClientListByResourceOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := e.srv.NewListByResourcePager(resourceGroupNameParam, providerNamespaceParam, resourceTypeNameParam, resourceNameParam, options) + newListByResourcePager = &resp + e.newListByResourcePager.add(req, newListByResourcePager) + server.PagerResponderInjectNextLinks(newListByResourcePager, req, func(page *armeventgrid.EventSubscriptionsClientListByResourceResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourcePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListByResourcePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourcePager) { + e.newListByResourcePager.remove(req) + } + return resp, nil +} + +func (e *EventSubscriptionsServerTransport) dispatchNewListGlobalByResourceGroupPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListGlobalByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListGlobalByResourceGroupPager not implemented")} + } + newListGlobalByResourceGroupPager := e.newListGlobalByResourceGroupPager.get(req) + if newListGlobalByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/eventSubscriptions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.EventSubscriptionsClientListGlobalByResourceGroupOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.EventSubscriptionsClientListGlobalByResourceGroupOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := e.srv.NewListGlobalByResourceGroupPager(resourceGroupNameParam, options) + newListGlobalByResourceGroupPager = &resp + e.newListGlobalByResourceGroupPager.add(req, newListGlobalByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListGlobalByResourceGroupPager, req, func(page *armeventgrid.EventSubscriptionsClientListGlobalByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListGlobalByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListGlobalByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListGlobalByResourceGroupPager) { + e.newListGlobalByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (e *EventSubscriptionsServerTransport) dispatchNewListGlobalByResourceGroupForTopicTypePager(req *http.Request) (*http.Response, error) { + if e.srv.NewListGlobalByResourceGroupForTopicTypePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListGlobalByResourceGroupForTopicTypePager not implemented")} + } + newListGlobalByResourceGroupForTopicTypePager := e.newListGlobalByResourceGroupForTopicTypePager.get(req) + if newListGlobalByResourceGroupForTopicTypePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/topicTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + topicTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicTypeName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.EventSubscriptionsClientListGlobalByResourceGroupForTopicTypeOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.EventSubscriptionsClientListGlobalByResourceGroupForTopicTypeOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := e.srv.NewListGlobalByResourceGroupForTopicTypePager(resourceGroupNameParam, topicTypeNameParam, options) + newListGlobalByResourceGroupForTopicTypePager = &resp + e.newListGlobalByResourceGroupForTopicTypePager.add(req, newListGlobalByResourceGroupForTopicTypePager) + server.PagerResponderInjectNextLinks(newListGlobalByResourceGroupForTopicTypePager, req, func(page *armeventgrid.EventSubscriptionsClientListGlobalByResourceGroupForTopicTypeResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListGlobalByResourceGroupForTopicTypePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListGlobalByResourceGroupForTopicTypePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListGlobalByResourceGroupForTopicTypePager) { + e.newListGlobalByResourceGroupForTopicTypePager.remove(req) + } + return resp, nil +} + +func (e *EventSubscriptionsServerTransport) dispatchNewListGlobalBySubscriptionPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListGlobalBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListGlobalBySubscriptionPager not implemented")} + } + newListGlobalBySubscriptionPager := e.newListGlobalBySubscriptionPager.get(req) + if newListGlobalBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/eventSubscriptions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.EventSubscriptionsClientListGlobalBySubscriptionOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.EventSubscriptionsClientListGlobalBySubscriptionOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := e.srv.NewListGlobalBySubscriptionPager(options) + newListGlobalBySubscriptionPager = &resp + e.newListGlobalBySubscriptionPager.add(req, newListGlobalBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListGlobalBySubscriptionPager, req, func(page *armeventgrid.EventSubscriptionsClientListGlobalBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListGlobalBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListGlobalBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListGlobalBySubscriptionPager) { + e.newListGlobalBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (e *EventSubscriptionsServerTransport) dispatchNewListGlobalBySubscriptionForTopicTypePager(req *http.Request) (*http.Response, error) { + if e.srv.NewListGlobalBySubscriptionForTopicTypePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListGlobalBySubscriptionForTopicTypePager not implemented")} + } + newListGlobalBySubscriptionForTopicTypePager := e.newListGlobalBySubscriptionForTopicTypePager.get(req) + if newListGlobalBySubscriptionForTopicTypePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/topicTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + topicTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicTypeName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.EventSubscriptionsClientListGlobalBySubscriptionForTopicTypeOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.EventSubscriptionsClientListGlobalBySubscriptionForTopicTypeOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := e.srv.NewListGlobalBySubscriptionForTopicTypePager(topicTypeNameParam, options) + newListGlobalBySubscriptionForTopicTypePager = &resp + e.newListGlobalBySubscriptionForTopicTypePager.add(req, newListGlobalBySubscriptionForTopicTypePager) + server.PagerResponderInjectNextLinks(newListGlobalBySubscriptionForTopicTypePager, req, func(page *armeventgrid.EventSubscriptionsClientListGlobalBySubscriptionForTopicTypeResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListGlobalBySubscriptionForTopicTypePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListGlobalBySubscriptionForTopicTypePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListGlobalBySubscriptionForTopicTypePager) { + e.newListGlobalBySubscriptionForTopicTypePager.remove(req) + } + return resp, nil +} + +func (e *EventSubscriptionsServerTransport) dispatchNewListRegionalByResourceGroupPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListRegionalByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListRegionalByResourceGroupPager not implemented")} + } + newListRegionalByResourceGroupPager := e.newListRegionalByResourceGroupPager.get(req) + if newListRegionalByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.EventSubscriptionsClientListRegionalByResourceGroupOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.EventSubscriptionsClientListRegionalByResourceGroupOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := e.srv.NewListRegionalByResourceGroupPager(resourceGroupNameParam, locationParam, options) + newListRegionalByResourceGroupPager = &resp + e.newListRegionalByResourceGroupPager.add(req, newListRegionalByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListRegionalByResourceGroupPager, req, func(page *armeventgrid.EventSubscriptionsClientListRegionalByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListRegionalByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListRegionalByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListRegionalByResourceGroupPager) { + e.newListRegionalByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (e *EventSubscriptionsServerTransport) dispatchNewListRegionalByResourceGroupForTopicTypePager(req *http.Request) (*http.Response, error) { + if e.srv.NewListRegionalByResourceGroupForTopicTypePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListRegionalByResourceGroupForTopicTypePager not implemented")} + } + newListRegionalByResourceGroupForTopicTypePager := e.newListRegionalByResourceGroupForTopicTypePager.get(req) + if newListRegionalByResourceGroupForTopicTypePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/topicTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + topicTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicTypeName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.EventSubscriptionsClientListRegionalByResourceGroupForTopicTypeOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.EventSubscriptionsClientListRegionalByResourceGroupForTopicTypeOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := e.srv.NewListRegionalByResourceGroupForTopicTypePager(resourceGroupNameParam, locationParam, topicTypeNameParam, options) + newListRegionalByResourceGroupForTopicTypePager = &resp + e.newListRegionalByResourceGroupForTopicTypePager.add(req, newListRegionalByResourceGroupForTopicTypePager) + server.PagerResponderInjectNextLinks(newListRegionalByResourceGroupForTopicTypePager, req, func(page *armeventgrid.EventSubscriptionsClientListRegionalByResourceGroupForTopicTypeResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListRegionalByResourceGroupForTopicTypePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListRegionalByResourceGroupForTopicTypePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListRegionalByResourceGroupForTopicTypePager) { + e.newListRegionalByResourceGroupForTopicTypePager.remove(req) + } + return resp, nil +} + +func (e *EventSubscriptionsServerTransport) dispatchNewListRegionalBySubscriptionPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListRegionalBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListRegionalBySubscriptionPager not implemented")} + } + newListRegionalBySubscriptionPager := e.newListRegionalBySubscriptionPager.get(req) + if newListRegionalBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.EventSubscriptionsClientListRegionalBySubscriptionOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.EventSubscriptionsClientListRegionalBySubscriptionOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := e.srv.NewListRegionalBySubscriptionPager(locationParam, options) + newListRegionalBySubscriptionPager = &resp + e.newListRegionalBySubscriptionPager.add(req, newListRegionalBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListRegionalBySubscriptionPager, req, func(page *armeventgrid.EventSubscriptionsClientListRegionalBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListRegionalBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListRegionalBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListRegionalBySubscriptionPager) { + e.newListRegionalBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (e *EventSubscriptionsServerTransport) dispatchNewListRegionalBySubscriptionForTopicTypePager(req *http.Request) (*http.Response, error) { + if e.srv.NewListRegionalBySubscriptionForTopicTypePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListRegionalBySubscriptionForTopicTypePager not implemented")} + } + newListRegionalBySubscriptionForTopicTypePager := e.newListRegionalBySubscriptionForTopicTypePager.get(req) + if newListRegionalBySubscriptionForTopicTypePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/topicTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + topicTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicTypeName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.EventSubscriptionsClientListRegionalBySubscriptionForTopicTypeOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.EventSubscriptionsClientListRegionalBySubscriptionForTopicTypeOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := e.srv.NewListRegionalBySubscriptionForTopicTypePager(locationParam, topicTypeNameParam, options) + newListRegionalBySubscriptionForTopicTypePager = &resp + e.newListRegionalBySubscriptionForTopicTypePager.add(req, newListRegionalBySubscriptionForTopicTypePager) + server.PagerResponderInjectNextLinks(newListRegionalBySubscriptionForTopicTypePager, req, func(page *armeventgrid.EventSubscriptionsClientListRegionalBySubscriptionForTopicTypeResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListRegionalBySubscriptionForTopicTypePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListRegionalBySubscriptionForTopicTypePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListRegionalBySubscriptionForTopicTypePager) { + e.newListRegionalBySubscriptionForTopicTypePager.remove(req) + } + return resp, nil +} + +func (e *EventSubscriptionsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if e.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := e.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.EventSubscriptionUpdateParameters](req) + if err != nil { + return nil, err + } + scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginUpdate(req.Context(), scopeParam, eventSubscriptionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + e.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusCreated}, resp.StatusCode) { + e.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + e.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/fake/extensiontopics_server.go b/sdk/resourcemanager/eventgrid/armeventgrid/fake/extensiontopics_server.go new file mode 100644 index 000000000000..7119b1d80d8b --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/fake/extensiontopics_server.go @@ -0,0 +1,96 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" + "net/http" + "net/url" + "regexp" +) + +// ExtensionTopicsServer is a fake server for instances of the armeventgrid.ExtensionTopicsClient type. +type ExtensionTopicsServer struct { + // Get is the fake for method ExtensionTopicsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, scope string, options *armeventgrid.ExtensionTopicsClientGetOptions) (resp azfake.Responder[armeventgrid.ExtensionTopicsClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewExtensionTopicsServerTransport creates a new instance of ExtensionTopicsServerTransport with the provided implementation. +// The returned ExtensionTopicsServerTransport instance is connected to an instance of armeventgrid.ExtensionTopicsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewExtensionTopicsServerTransport(srv *ExtensionTopicsServer) *ExtensionTopicsServerTransport { + return &ExtensionTopicsServerTransport{srv: srv} +} + +// ExtensionTopicsServerTransport connects instances of armeventgrid.ExtensionTopicsClient to instances of ExtensionTopicsServer. +// Don't use this type directly, use NewExtensionTopicsServerTransport instead. +type ExtensionTopicsServerTransport struct { + srv *ExtensionTopicsServer +} + +// Do implements the policy.Transporter interface for ExtensionTopicsServerTransport. +func (e *ExtensionTopicsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ExtensionTopicsClient.Get": + resp, err = e.dispatchGet(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (e *ExtensionTopicsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if e.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/extensionTopics/default` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Get(req.Context(), scopeParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ExtensionTopic, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/fake/internal.go b/sdk/resourcemanager/eventgrid/armeventgrid/fake/internal.go new file mode 100644 index 000000000000..72f540f217a1 --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/fake/internal.go @@ -0,0 +1,91 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "reflect" + "sync" +) + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func getOptional[T any](v T) *T { + if reflect.ValueOf(v).IsZero() { + return nil + } + return &v +} + +func parseOptional[T any](v string, parse func(v string) (T, error)) (*T, error) { + if v == "" { + return nil, nil + } + t, err := parse(v) + if err != nil { + return nil, err + } + return &t, err +} + +func parseWithCast[T any](v string, parse func(v string) (T, error)) (T, error) { + t, err := parse(v) + if err != nil { + return *new(T), err + } + return t, err +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/fake/operations_server.go b/sdk/resourcemanager/eventgrid/armeventgrid/fake/operations_server.go new file mode 100644 index 000000000000..44cd1373afdf --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/fake/operations_server.go @@ -0,0 +1,92 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" + "net/http" +) + +// OperationsServer is a fake server for instances of the armeventgrid.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armeventgrid.OperationsClientListOptions) (resp azfake.PagerResponder[armeventgrid.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armeventgrid.OperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { + return &OperationsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armeventgrid.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armeventgrid.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armeventgrid.OperationsClientListResponse]] +} + +// Do implements the policy.Transporter interface for OperationsServerTransport. +func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "OperationsClient.NewListPager": + resp, err = o.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := o.newListPager.get(req) + if newListPager == nil { + resp := o.srv.NewListPager(nil) + newListPager = &resp + o.newListPager.add(req, newListPager) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + o.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/fake/partnerconfigurations_server.go b/sdk/resourcemanager/eventgrid/armeventgrid/fake/partnerconfigurations_server.go new file mode 100644 index 000000000000..03eaec50cd6a --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/fake/partnerconfigurations_server.go @@ -0,0 +1,440 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// PartnerConfigurationsServer is a fake server for instances of the armeventgrid.PartnerConfigurationsClient type. +type PartnerConfigurationsServer struct { + // AuthorizePartner is the fake for method PartnerConfigurationsClient.AuthorizePartner + // HTTP status codes to indicate success: http.StatusOK + AuthorizePartner func(ctx context.Context, resourceGroupName string, partnerInfo armeventgrid.Partner, options *armeventgrid.PartnerConfigurationsClientAuthorizePartnerOptions) (resp azfake.Responder[armeventgrid.PartnerConfigurationsClientAuthorizePartnerResponse], errResp azfake.ErrorResponder) + + // BeginCreateOrUpdate is the fake for method PartnerConfigurationsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, partnerConfigurationInfo armeventgrid.PartnerConfiguration, options *armeventgrid.PartnerConfigurationsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armeventgrid.PartnerConfigurationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method PartnerConfigurationsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, options *armeventgrid.PartnerConfigurationsClientBeginDeleteOptions) (resp azfake.PollerResponder[armeventgrid.PartnerConfigurationsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method PartnerConfigurationsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, options *armeventgrid.PartnerConfigurationsClientGetOptions) (resp azfake.Responder[armeventgrid.PartnerConfigurationsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method PartnerConfigurationsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armeventgrid.PartnerConfigurationsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armeventgrid.PartnerConfigurationsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method PartnerConfigurationsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armeventgrid.PartnerConfigurationsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armeventgrid.PartnerConfigurationsClientListBySubscriptionResponse]) + + // UnauthorizePartner is the fake for method PartnerConfigurationsClient.UnauthorizePartner + // HTTP status codes to indicate success: http.StatusOK + UnauthorizePartner func(ctx context.Context, resourceGroupName string, partnerInfo armeventgrid.Partner, options *armeventgrid.PartnerConfigurationsClientUnauthorizePartnerOptions) (resp azfake.Responder[armeventgrid.PartnerConfigurationsClientUnauthorizePartnerResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method PartnerConfigurationsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginUpdate func(ctx context.Context, resourceGroupName string, partnerConfigurationUpdateParameters armeventgrid.PartnerConfigurationUpdateParameters, options *armeventgrid.PartnerConfigurationsClientBeginUpdateOptions) (resp azfake.PollerResponder[armeventgrid.PartnerConfigurationsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewPartnerConfigurationsServerTransport creates a new instance of PartnerConfigurationsServerTransport with the provided implementation. +// The returned PartnerConfigurationsServerTransport instance is connected to an instance of armeventgrid.PartnerConfigurationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPartnerConfigurationsServerTransport(srv *PartnerConfigurationsServer) *PartnerConfigurationsServerTransport { + return &PartnerConfigurationsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armeventgrid.PartnerConfigurationsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armeventgrid.PartnerConfigurationsClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armeventgrid.PartnerConfigurationsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armeventgrid.PartnerConfigurationsClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armeventgrid.PartnerConfigurationsClientUpdateResponse]](), + } +} + +// PartnerConfigurationsServerTransport connects instances of armeventgrid.PartnerConfigurationsClient to instances of PartnerConfigurationsServer. +// Don't use this type directly, use NewPartnerConfigurationsServerTransport instead. +type PartnerConfigurationsServerTransport struct { + srv *PartnerConfigurationsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armeventgrid.PartnerConfigurationsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armeventgrid.PartnerConfigurationsClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armeventgrid.PartnerConfigurationsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armeventgrid.PartnerConfigurationsClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armeventgrid.PartnerConfigurationsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for PartnerConfigurationsServerTransport. +func (p *PartnerConfigurationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "PartnerConfigurationsClient.AuthorizePartner": + resp, err = p.dispatchAuthorizePartner(req) + case "PartnerConfigurationsClient.BeginCreateOrUpdate": + resp, err = p.dispatchBeginCreateOrUpdate(req) + case "PartnerConfigurationsClient.BeginDelete": + resp, err = p.dispatchBeginDelete(req) + case "PartnerConfigurationsClient.Get": + resp, err = p.dispatchGet(req) + case "PartnerConfigurationsClient.NewListByResourceGroupPager": + resp, err = p.dispatchNewListByResourceGroupPager(req) + case "PartnerConfigurationsClient.NewListBySubscriptionPager": + resp, err = p.dispatchNewListBySubscriptionPager(req) + case "PartnerConfigurationsClient.UnauthorizePartner": + resp, err = p.dispatchUnauthorizePartner(req) + case "PartnerConfigurationsClient.BeginUpdate": + resp, err = p.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *PartnerConfigurationsServerTransport) dispatchAuthorizePartner(req *http.Request) (*http.Response, error) { + if p.srv.AuthorizePartner == nil { + return nil, &nonRetriableError{errors.New("fake for method AuthorizePartner not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerConfigurations/default/authorizePartner` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.Partner](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.AuthorizePartner(req.Context(), resourceGroupNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PartnerConfiguration, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PartnerConfigurationsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := p.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerConfigurations/default` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.PartnerConfiguration](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + p.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + p.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + p.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (p *PartnerConfigurationsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if p.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := p.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerConfigurations/default` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + p.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + p.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *PartnerConfigurationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerConfigurations/default` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PartnerConfiguration, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PartnerConfigurationsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := p.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerConfigurations` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + p.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + p.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (p *PartnerConfigurationsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := p.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerConfigurations` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.PartnerConfigurationsClientListBySubscriptionOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.PartnerConfigurationsClientListBySubscriptionOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := p.srv.NewListBySubscriptionPager(options) + newListBySubscriptionPager = &resp + p.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armeventgrid.PartnerConfigurationsClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + p.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (p *PartnerConfigurationsServerTransport) dispatchUnauthorizePartner(req *http.Request) (*http.Response, error) { + if p.srv.UnauthorizePartner == nil { + return nil, &nonRetriableError{errors.New("fake for method UnauthorizePartner not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerConfigurations/default/unauthorizePartner` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.Partner](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.UnauthorizePartner(req.Context(), resourceGroupNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PartnerConfiguration, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PartnerConfigurationsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := p.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerConfigurations/default` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.PartnerConfigurationUpdateParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginUpdate(req.Context(), resourceGroupNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + p.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + p.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + p.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/fake/partnernamespaces_server.go b/sdk/resourcemanager/eventgrid/armeventgrid/fake/partnernamespaces_server.go new file mode 100644 index 000000000000..078961238169 --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/fake/partnernamespaces_server.go @@ -0,0 +1,490 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// PartnerNamespacesServer is a fake server for instances of the armeventgrid.PartnerNamespacesClient type. +type PartnerNamespacesServer struct { + // BeginCreateOrUpdate is the fake for method PartnerNamespacesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceInfo armeventgrid.PartnerNamespace, options *armeventgrid.PartnerNamespacesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armeventgrid.PartnerNamespacesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method PartnerNamespacesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, partnerNamespaceName string, options *armeventgrid.PartnerNamespacesClientBeginDeleteOptions) (resp azfake.PollerResponder[armeventgrid.PartnerNamespacesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method PartnerNamespacesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, partnerNamespaceName string, options *armeventgrid.PartnerNamespacesClientGetOptions) (resp azfake.Responder[armeventgrid.PartnerNamespacesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method PartnerNamespacesClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armeventgrid.PartnerNamespacesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armeventgrid.PartnerNamespacesClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method PartnerNamespacesClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armeventgrid.PartnerNamespacesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armeventgrid.PartnerNamespacesClientListBySubscriptionResponse]) + + // ListSharedAccessKeys is the fake for method PartnerNamespacesClient.ListSharedAccessKeys + // HTTP status codes to indicate success: http.StatusOK + ListSharedAccessKeys func(ctx context.Context, resourceGroupName string, partnerNamespaceName string, options *armeventgrid.PartnerNamespacesClientListSharedAccessKeysOptions) (resp azfake.Responder[armeventgrid.PartnerNamespacesClientListSharedAccessKeysResponse], errResp azfake.ErrorResponder) + + // RegenerateKey is the fake for method PartnerNamespacesClient.RegenerateKey + // HTTP status codes to indicate success: http.StatusOK + RegenerateKey func(ctx context.Context, resourceGroupName string, partnerNamespaceName string, regenerateKeyRequest armeventgrid.PartnerNamespaceRegenerateKeyRequest, options *armeventgrid.PartnerNamespacesClientRegenerateKeyOptions) (resp azfake.Responder[armeventgrid.PartnerNamespacesClientRegenerateKeyResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method PartnerNamespacesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginUpdate func(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceUpdateParameters armeventgrid.PartnerNamespaceUpdateParameters, options *armeventgrid.PartnerNamespacesClientBeginUpdateOptions) (resp azfake.PollerResponder[armeventgrid.PartnerNamespacesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewPartnerNamespacesServerTransport creates a new instance of PartnerNamespacesServerTransport with the provided implementation. +// The returned PartnerNamespacesServerTransport instance is connected to an instance of armeventgrid.PartnerNamespacesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPartnerNamespacesServerTransport(srv *PartnerNamespacesServer) *PartnerNamespacesServerTransport { + return &PartnerNamespacesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armeventgrid.PartnerNamespacesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armeventgrid.PartnerNamespacesClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armeventgrid.PartnerNamespacesClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armeventgrid.PartnerNamespacesClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armeventgrid.PartnerNamespacesClientUpdateResponse]](), + } +} + +// PartnerNamespacesServerTransport connects instances of armeventgrid.PartnerNamespacesClient to instances of PartnerNamespacesServer. +// Don't use this type directly, use NewPartnerNamespacesServerTransport instead. +type PartnerNamespacesServerTransport struct { + srv *PartnerNamespacesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armeventgrid.PartnerNamespacesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armeventgrid.PartnerNamespacesClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armeventgrid.PartnerNamespacesClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armeventgrid.PartnerNamespacesClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armeventgrid.PartnerNamespacesClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for PartnerNamespacesServerTransport. +func (p *PartnerNamespacesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "PartnerNamespacesClient.BeginCreateOrUpdate": + resp, err = p.dispatchBeginCreateOrUpdate(req) + case "PartnerNamespacesClient.BeginDelete": + resp, err = p.dispatchBeginDelete(req) + case "PartnerNamespacesClient.Get": + resp, err = p.dispatchGet(req) + case "PartnerNamespacesClient.NewListByResourceGroupPager": + resp, err = p.dispatchNewListByResourceGroupPager(req) + case "PartnerNamespacesClient.NewListBySubscriptionPager": + resp, err = p.dispatchNewListBySubscriptionPager(req) + case "PartnerNamespacesClient.ListSharedAccessKeys": + resp, err = p.dispatchListSharedAccessKeys(req) + case "PartnerNamespacesClient.RegenerateKey": + resp, err = p.dispatchRegenerateKey(req) + case "PartnerNamespacesClient.BeginUpdate": + resp, err = p.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *PartnerNamespacesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := p.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerNamespaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.PartnerNamespace](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerNamespaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerNamespaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, partnerNamespaceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + p.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusCreated}, resp.StatusCode) { + p.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + p.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (p *PartnerNamespacesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if p.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := p.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerNamespaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerNamespaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerNamespaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, partnerNamespaceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + p.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + p.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *PartnerNamespacesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerNamespaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerNamespaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerNamespaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, partnerNamespaceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PartnerNamespace, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PartnerNamespacesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := p.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerNamespaces` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.PartnerNamespacesClientListByResourceGroupOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.PartnerNamespacesClientListByResourceGroupOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := p.srv.NewListByResourceGroupPager(resourceGroupNameParam, options) + newListByResourceGroupPager = &resp + p.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armeventgrid.PartnerNamespacesClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + p.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (p *PartnerNamespacesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := p.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerNamespaces` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.PartnerNamespacesClientListBySubscriptionOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.PartnerNamespacesClientListBySubscriptionOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := p.srv.NewListBySubscriptionPager(options) + newListBySubscriptionPager = &resp + p.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armeventgrid.PartnerNamespacesClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + p.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (p *PartnerNamespacesServerTransport) dispatchListSharedAccessKeys(req *http.Request) (*http.Response, error) { + if p.srv.ListSharedAccessKeys == nil { + return nil, &nonRetriableError{errors.New("fake for method ListSharedAccessKeys not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerNamespaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listKeys` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerNamespaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerNamespaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.ListSharedAccessKeys(req.Context(), resourceGroupNameParam, partnerNamespaceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PartnerNamespaceSharedAccessKeys, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PartnerNamespacesServerTransport) dispatchRegenerateKey(req *http.Request) (*http.Response, error) { + if p.srv.RegenerateKey == nil { + return nil, &nonRetriableError{errors.New("fake for method RegenerateKey not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerNamespaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/regenerateKey` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.PartnerNamespaceRegenerateKeyRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerNamespaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerNamespaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.RegenerateKey(req.Context(), resourceGroupNameParam, partnerNamespaceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PartnerNamespaceSharedAccessKeys, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PartnerNamespacesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := p.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerNamespaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.PartnerNamespaceUpdateParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerNamespaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerNamespaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginUpdate(req.Context(), resourceGroupNameParam, partnerNamespaceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + p.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + p.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + p.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/fake/partnerregistrations_server.go b/sdk/resourcemanager/eventgrid/armeventgrid/fake/partnerregistrations_server.go new file mode 100644 index 000000000000..a3c3f7362188 --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/fake/partnerregistrations_server.go @@ -0,0 +1,408 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// PartnerRegistrationsServer is a fake server for instances of the armeventgrid.PartnerRegistrationsClient type. +type PartnerRegistrationsServer struct { + // BeginCreateOrUpdate is the fake for method PartnerRegistrationsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationInfo armeventgrid.PartnerRegistration, options *armeventgrid.PartnerRegistrationsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armeventgrid.PartnerRegistrationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method PartnerRegistrationsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, partnerRegistrationName string, options *armeventgrid.PartnerRegistrationsClientBeginDeleteOptions) (resp azfake.PollerResponder[armeventgrid.PartnerRegistrationsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method PartnerRegistrationsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, partnerRegistrationName string, options *armeventgrid.PartnerRegistrationsClientGetOptions) (resp azfake.Responder[armeventgrid.PartnerRegistrationsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method PartnerRegistrationsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armeventgrid.PartnerRegistrationsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armeventgrid.PartnerRegistrationsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method PartnerRegistrationsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armeventgrid.PartnerRegistrationsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armeventgrid.PartnerRegistrationsClientListBySubscriptionResponse]) + + // BeginUpdate is the fake for method PartnerRegistrationsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginUpdate func(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationUpdateParameters armeventgrid.PartnerRegistrationUpdateParameters, options *armeventgrid.PartnerRegistrationsClientBeginUpdateOptions) (resp azfake.PollerResponder[armeventgrid.PartnerRegistrationsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewPartnerRegistrationsServerTransport creates a new instance of PartnerRegistrationsServerTransport with the provided implementation. +// The returned PartnerRegistrationsServerTransport instance is connected to an instance of armeventgrid.PartnerRegistrationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPartnerRegistrationsServerTransport(srv *PartnerRegistrationsServer) *PartnerRegistrationsServerTransport { + return &PartnerRegistrationsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armeventgrid.PartnerRegistrationsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armeventgrid.PartnerRegistrationsClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armeventgrid.PartnerRegistrationsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armeventgrid.PartnerRegistrationsClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armeventgrid.PartnerRegistrationsClientUpdateResponse]](), + } +} + +// PartnerRegistrationsServerTransport connects instances of armeventgrid.PartnerRegistrationsClient to instances of PartnerRegistrationsServer. +// Don't use this type directly, use NewPartnerRegistrationsServerTransport instead. +type PartnerRegistrationsServerTransport struct { + srv *PartnerRegistrationsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armeventgrid.PartnerRegistrationsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armeventgrid.PartnerRegistrationsClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armeventgrid.PartnerRegistrationsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armeventgrid.PartnerRegistrationsClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armeventgrid.PartnerRegistrationsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for PartnerRegistrationsServerTransport. +func (p *PartnerRegistrationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "PartnerRegistrationsClient.BeginCreateOrUpdate": + resp, err = p.dispatchBeginCreateOrUpdate(req) + case "PartnerRegistrationsClient.BeginDelete": + resp, err = p.dispatchBeginDelete(req) + case "PartnerRegistrationsClient.Get": + resp, err = p.dispatchGet(req) + case "PartnerRegistrationsClient.NewListByResourceGroupPager": + resp, err = p.dispatchNewListByResourceGroupPager(req) + case "PartnerRegistrationsClient.NewListBySubscriptionPager": + resp, err = p.dispatchNewListBySubscriptionPager(req) + case "PartnerRegistrationsClient.BeginUpdate": + resp, err = p.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *PartnerRegistrationsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := p.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerRegistrations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.PartnerRegistration](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerRegistrationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerRegistrationName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, partnerRegistrationNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + p.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + p.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + p.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (p *PartnerRegistrationsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if p.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := p.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerRegistrations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerRegistrationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerRegistrationName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, partnerRegistrationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + p.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + p.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *PartnerRegistrationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerRegistrations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerRegistrationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerRegistrationName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, partnerRegistrationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PartnerRegistration, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PartnerRegistrationsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := p.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerRegistrations` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.PartnerRegistrationsClientListByResourceGroupOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.PartnerRegistrationsClientListByResourceGroupOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := p.srv.NewListByResourceGroupPager(resourceGroupNameParam, options) + newListByResourceGroupPager = &resp + p.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armeventgrid.PartnerRegistrationsClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + p.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (p *PartnerRegistrationsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := p.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerRegistrations` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.PartnerRegistrationsClientListBySubscriptionOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.PartnerRegistrationsClientListBySubscriptionOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := p.srv.NewListBySubscriptionPager(options) + newListBySubscriptionPager = &resp + p.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armeventgrid.PartnerRegistrationsClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + p.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (p *PartnerRegistrationsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := p.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerRegistrations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.PartnerRegistrationUpdateParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerRegistrationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerRegistrationName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginUpdate(req.Context(), resourceGroupNameParam, partnerRegistrationNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + p.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + p.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + p.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/fake/partnertopiceventsubscriptions_server.go b/sdk/resourcemanager/eventgrid/armeventgrid/fake/partnertopiceventsubscriptions_server.go new file mode 100644 index 000000000000..b660e58021ac --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/fake/partnertopiceventsubscriptions_server.go @@ -0,0 +1,446 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// PartnerTopicEventSubscriptionsServer is a fake server for instances of the armeventgrid.PartnerTopicEventSubscriptionsClient type. +type PartnerTopicEventSubscriptionsServer struct { + // BeginCreateOrUpdate is the fake for method PartnerTopicEventSubscriptionsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionInfo armeventgrid.EventSubscription, options *armeventgrid.PartnerTopicEventSubscriptionsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armeventgrid.PartnerTopicEventSubscriptionsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method PartnerTopicEventSubscriptionsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, options *armeventgrid.PartnerTopicEventSubscriptionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armeventgrid.PartnerTopicEventSubscriptionsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method PartnerTopicEventSubscriptionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, options *armeventgrid.PartnerTopicEventSubscriptionsClientGetOptions) (resp azfake.Responder[armeventgrid.PartnerTopicEventSubscriptionsClientGetResponse], errResp azfake.ErrorResponder) + + // GetDeliveryAttributes is the fake for method PartnerTopicEventSubscriptionsClient.GetDeliveryAttributes + // HTTP status codes to indicate success: http.StatusOK + GetDeliveryAttributes func(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, options *armeventgrid.PartnerTopicEventSubscriptionsClientGetDeliveryAttributesOptions) (resp azfake.Responder[armeventgrid.PartnerTopicEventSubscriptionsClientGetDeliveryAttributesResponse], errResp azfake.ErrorResponder) + + // GetFullURL is the fake for method PartnerTopicEventSubscriptionsClient.GetFullURL + // HTTP status codes to indicate success: http.StatusOK + GetFullURL func(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, options *armeventgrid.PartnerTopicEventSubscriptionsClientGetFullURLOptions) (resp azfake.Responder[armeventgrid.PartnerTopicEventSubscriptionsClientGetFullURLResponse], errResp azfake.ErrorResponder) + + // NewListByPartnerTopicPager is the fake for method PartnerTopicEventSubscriptionsClient.NewListByPartnerTopicPager + // HTTP status codes to indicate success: http.StatusOK + NewListByPartnerTopicPager func(resourceGroupName string, partnerTopicName string, options *armeventgrid.PartnerTopicEventSubscriptionsClientListByPartnerTopicOptions) (resp azfake.PagerResponder[armeventgrid.PartnerTopicEventSubscriptionsClientListByPartnerTopicResponse]) + + // BeginUpdate is the fake for method PartnerTopicEventSubscriptionsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusCreated + BeginUpdate func(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters armeventgrid.EventSubscriptionUpdateParameters, options *armeventgrid.PartnerTopicEventSubscriptionsClientBeginUpdateOptions) (resp azfake.PollerResponder[armeventgrid.PartnerTopicEventSubscriptionsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewPartnerTopicEventSubscriptionsServerTransport creates a new instance of PartnerTopicEventSubscriptionsServerTransport with the provided implementation. +// The returned PartnerTopicEventSubscriptionsServerTransport instance is connected to an instance of armeventgrid.PartnerTopicEventSubscriptionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPartnerTopicEventSubscriptionsServerTransport(srv *PartnerTopicEventSubscriptionsServer) *PartnerTopicEventSubscriptionsServerTransport { + return &PartnerTopicEventSubscriptionsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armeventgrid.PartnerTopicEventSubscriptionsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armeventgrid.PartnerTopicEventSubscriptionsClientDeleteResponse]](), + newListByPartnerTopicPager: newTracker[azfake.PagerResponder[armeventgrid.PartnerTopicEventSubscriptionsClientListByPartnerTopicResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armeventgrid.PartnerTopicEventSubscriptionsClientUpdateResponse]](), + } +} + +// PartnerTopicEventSubscriptionsServerTransport connects instances of armeventgrid.PartnerTopicEventSubscriptionsClient to instances of PartnerTopicEventSubscriptionsServer. +// Don't use this type directly, use NewPartnerTopicEventSubscriptionsServerTransport instead. +type PartnerTopicEventSubscriptionsServerTransport struct { + srv *PartnerTopicEventSubscriptionsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armeventgrid.PartnerTopicEventSubscriptionsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armeventgrid.PartnerTopicEventSubscriptionsClientDeleteResponse]] + newListByPartnerTopicPager *tracker[azfake.PagerResponder[armeventgrid.PartnerTopicEventSubscriptionsClientListByPartnerTopicResponse]] + beginUpdate *tracker[azfake.PollerResponder[armeventgrid.PartnerTopicEventSubscriptionsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for PartnerTopicEventSubscriptionsServerTransport. +func (p *PartnerTopicEventSubscriptionsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "PartnerTopicEventSubscriptionsClient.BeginCreateOrUpdate": + resp, err = p.dispatchBeginCreateOrUpdate(req) + case "PartnerTopicEventSubscriptionsClient.BeginDelete": + resp, err = p.dispatchBeginDelete(req) + case "PartnerTopicEventSubscriptionsClient.Get": + resp, err = p.dispatchGet(req) + case "PartnerTopicEventSubscriptionsClient.GetDeliveryAttributes": + resp, err = p.dispatchGetDeliveryAttributes(req) + case "PartnerTopicEventSubscriptionsClient.GetFullURL": + resp, err = p.dispatchGetFullURL(req) + case "PartnerTopicEventSubscriptionsClient.NewListByPartnerTopicPager": + resp, err = p.dispatchNewListByPartnerTopicPager(req) + case "PartnerTopicEventSubscriptionsClient.BeginUpdate": + resp, err = p.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *PartnerTopicEventSubscriptionsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := p.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerTopics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.EventSubscription](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerTopicName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, partnerTopicNameParam, eventSubscriptionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + p.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + p.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + p.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (p *PartnerTopicEventSubscriptionsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if p.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := p.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerTopics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerTopicName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, partnerTopicNameParam, eventSubscriptionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + p.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + p.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *PartnerTopicEventSubscriptionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerTopics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerTopicName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, partnerTopicNameParam, eventSubscriptionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).EventSubscription, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PartnerTopicEventSubscriptionsServerTransport) dispatchGetDeliveryAttributes(req *http.Request) (*http.Response, error) { + if p.srv.GetDeliveryAttributes == nil { + return nil, &nonRetriableError{errors.New("fake for method GetDeliveryAttributes not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerTopics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getDeliveryAttributes` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerTopicName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.GetDeliveryAttributes(req.Context(), resourceGroupNameParam, partnerTopicNameParam, eventSubscriptionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DeliveryAttributeListResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PartnerTopicEventSubscriptionsServerTransport) dispatchGetFullURL(req *http.Request) (*http.Response, error) { + if p.srv.GetFullURL == nil { + return nil, &nonRetriableError{errors.New("fake for method GetFullURL not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerTopics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getFullUrl` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerTopicName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.GetFullURL(req.Context(), resourceGroupNameParam, partnerTopicNameParam, eventSubscriptionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).EventSubscriptionFullURL, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PartnerTopicEventSubscriptionsServerTransport) dispatchNewListByPartnerTopicPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListByPartnerTopicPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByPartnerTopicPager not implemented")} + } + newListByPartnerTopicPager := p.newListByPartnerTopicPager.get(req) + if newListByPartnerTopicPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerTopics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerTopicName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.PartnerTopicEventSubscriptionsClientListByPartnerTopicOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.PartnerTopicEventSubscriptionsClientListByPartnerTopicOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := p.srv.NewListByPartnerTopicPager(resourceGroupNameParam, partnerTopicNameParam, options) + newListByPartnerTopicPager = &resp + p.newListByPartnerTopicPager.add(req, newListByPartnerTopicPager) + server.PagerResponderInjectNextLinks(newListByPartnerTopicPager, req, func(page *armeventgrid.PartnerTopicEventSubscriptionsClientListByPartnerTopicResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByPartnerTopicPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListByPartnerTopicPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByPartnerTopicPager) { + p.newListByPartnerTopicPager.remove(req) + } + return resp, nil +} + +func (p *PartnerTopicEventSubscriptionsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := p.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerTopics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.EventSubscriptionUpdateParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerTopicName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginUpdate(req.Context(), resourceGroupNameParam, partnerTopicNameParam, eventSubscriptionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + p.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusCreated}, resp.StatusCode) { + p.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + p.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/fake/partnertopics_server.go b/sdk/resourcemanager/eventgrid/armeventgrid/fake/partnertopics_server.go new file mode 100644 index 000000000000..09aa68e91e7f --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/fake/partnertopics_server.go @@ -0,0 +1,460 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// PartnerTopicsServer is a fake server for instances of the armeventgrid.PartnerTopicsClient type. +type PartnerTopicsServer struct { + // Activate is the fake for method PartnerTopicsClient.Activate + // HTTP status codes to indicate success: http.StatusOK + Activate func(ctx context.Context, resourceGroupName string, partnerTopicName string, options *armeventgrid.PartnerTopicsClientActivateOptions) (resp azfake.Responder[armeventgrid.PartnerTopicsClientActivateResponse], errResp azfake.ErrorResponder) + + // CreateOrUpdate is the fake for method PartnerTopicsClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceGroupName string, partnerTopicName string, partnerTopicInfo armeventgrid.PartnerTopic, options *armeventgrid.PartnerTopicsClientCreateOrUpdateOptions) (resp azfake.Responder[armeventgrid.PartnerTopicsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Deactivate is the fake for method PartnerTopicsClient.Deactivate + // HTTP status codes to indicate success: http.StatusOK + Deactivate func(ctx context.Context, resourceGroupName string, partnerTopicName string, options *armeventgrid.PartnerTopicsClientDeactivateOptions) (resp azfake.Responder[armeventgrid.PartnerTopicsClientDeactivateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method PartnerTopicsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, partnerTopicName string, options *armeventgrid.PartnerTopicsClientBeginDeleteOptions) (resp azfake.PollerResponder[armeventgrid.PartnerTopicsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method PartnerTopicsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, partnerTopicName string, options *armeventgrid.PartnerTopicsClientGetOptions) (resp azfake.Responder[armeventgrid.PartnerTopicsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method PartnerTopicsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armeventgrid.PartnerTopicsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armeventgrid.PartnerTopicsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method PartnerTopicsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armeventgrid.PartnerTopicsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armeventgrid.PartnerTopicsClientListBySubscriptionResponse]) + + // Update is the fake for method PartnerTopicsClient.Update + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + Update func(ctx context.Context, resourceGroupName string, partnerTopicName string, partnerTopicUpdateParameters armeventgrid.PartnerTopicUpdateParameters, options *armeventgrid.PartnerTopicsClientUpdateOptions) (resp azfake.Responder[armeventgrid.PartnerTopicsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewPartnerTopicsServerTransport creates a new instance of PartnerTopicsServerTransport with the provided implementation. +// The returned PartnerTopicsServerTransport instance is connected to an instance of armeventgrid.PartnerTopicsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPartnerTopicsServerTransport(srv *PartnerTopicsServer) *PartnerTopicsServerTransport { + return &PartnerTopicsServerTransport{ + srv: srv, + beginDelete: newTracker[azfake.PollerResponder[armeventgrid.PartnerTopicsClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armeventgrid.PartnerTopicsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armeventgrid.PartnerTopicsClientListBySubscriptionResponse]](), + } +} + +// PartnerTopicsServerTransport connects instances of armeventgrid.PartnerTopicsClient to instances of PartnerTopicsServer. +// Don't use this type directly, use NewPartnerTopicsServerTransport instead. +type PartnerTopicsServerTransport struct { + srv *PartnerTopicsServer + beginDelete *tracker[azfake.PollerResponder[armeventgrid.PartnerTopicsClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armeventgrid.PartnerTopicsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armeventgrid.PartnerTopicsClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for PartnerTopicsServerTransport. +func (p *PartnerTopicsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "PartnerTopicsClient.Activate": + resp, err = p.dispatchActivate(req) + case "PartnerTopicsClient.CreateOrUpdate": + resp, err = p.dispatchCreateOrUpdate(req) + case "PartnerTopicsClient.Deactivate": + resp, err = p.dispatchDeactivate(req) + case "PartnerTopicsClient.BeginDelete": + resp, err = p.dispatchBeginDelete(req) + case "PartnerTopicsClient.Get": + resp, err = p.dispatchGet(req) + case "PartnerTopicsClient.NewListByResourceGroupPager": + resp, err = p.dispatchNewListByResourceGroupPager(req) + case "PartnerTopicsClient.NewListBySubscriptionPager": + resp, err = p.dispatchNewListBySubscriptionPager(req) + case "PartnerTopicsClient.Update": + resp, err = p.dispatchUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *PartnerTopicsServerTransport) dispatchActivate(req *http.Request) (*http.Response, error) { + if p.srv.Activate == nil { + return nil, &nonRetriableError{errors.New("fake for method Activate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerTopics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/activate` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerTopicName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Activate(req.Context(), resourceGroupNameParam, partnerTopicNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PartnerTopic, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PartnerTopicsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if p.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerTopics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.PartnerTopic](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerTopicName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, partnerTopicNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PartnerTopic, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PartnerTopicsServerTransport) dispatchDeactivate(req *http.Request) (*http.Response, error) { + if p.srv.Deactivate == nil { + return nil, &nonRetriableError{errors.New("fake for method Deactivate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerTopics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/deactivate` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerTopicName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Deactivate(req.Context(), resourceGroupNameParam, partnerTopicNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PartnerTopic, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PartnerTopicsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if p.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := p.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerTopics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerTopicName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, partnerTopicNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + p.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + p.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *PartnerTopicsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerTopics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerTopicName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, partnerTopicNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PartnerTopic, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PartnerTopicsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := p.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerTopics` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.PartnerTopicsClientListByResourceGroupOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.PartnerTopicsClientListByResourceGroupOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := p.srv.NewListByResourceGroupPager(resourceGroupNameParam, options) + newListByResourceGroupPager = &resp + p.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armeventgrid.PartnerTopicsClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + p.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (p *PartnerTopicsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := p.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerTopics` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.PartnerTopicsClientListBySubscriptionOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.PartnerTopicsClientListBySubscriptionOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := p.srv.NewListBySubscriptionPager(options) + newListBySubscriptionPager = &resp + p.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armeventgrid.PartnerTopicsClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + p.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (p *PartnerTopicsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if p.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/partnerTopics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.PartnerTopicUpdateParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + partnerTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("partnerTopicName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Update(req.Context(), resourceGroupNameParam, partnerTopicNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PartnerTopic, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/fake/privateendpointconnections_server.go b/sdk/resourcemanager/eventgrid/armeventgrid/fake/privateendpointconnections_server.go new file mode 100644 index 000000000000..ff98384d0c1b --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/fake/privateendpointconnections_server.go @@ -0,0 +1,340 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// PrivateEndpointConnectionsServer is a fake server for instances of the armeventgrid.PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsServer struct { + // BeginDelete is the fake for method PrivateEndpointConnectionsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, parentType armeventgrid.PrivateEndpointConnectionsParentType, parentName string, privateEndpointConnectionName string, options *armeventgrid.PrivateEndpointConnectionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armeventgrid.PrivateEndpointConnectionsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method PrivateEndpointConnectionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, parentType armeventgrid.PrivateEndpointConnectionsParentType, parentName string, privateEndpointConnectionName string, options *armeventgrid.PrivateEndpointConnectionsClientGetOptions) (resp azfake.Responder[armeventgrid.PrivateEndpointConnectionsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourcePager is the fake for method PrivateEndpointConnectionsClient.NewListByResourcePager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourcePager func(resourceGroupName string, parentType armeventgrid.PrivateEndpointConnectionsParentType, parentName string, options *armeventgrid.PrivateEndpointConnectionsClientListByResourceOptions) (resp azfake.PagerResponder[armeventgrid.PrivateEndpointConnectionsClientListByResourceResponse]) + + // BeginUpdate is the fake for method PrivateEndpointConnectionsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginUpdate func(ctx context.Context, resourceGroupName string, parentType armeventgrid.PrivateEndpointConnectionsParentType, parentName string, privateEndpointConnectionName string, privateEndpointConnection armeventgrid.PrivateEndpointConnection, options *armeventgrid.PrivateEndpointConnectionsClientBeginUpdateOptions) (resp azfake.PollerResponder[armeventgrid.PrivateEndpointConnectionsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewPrivateEndpointConnectionsServerTransport creates a new instance of PrivateEndpointConnectionsServerTransport with the provided implementation. +// The returned PrivateEndpointConnectionsServerTransport instance is connected to an instance of armeventgrid.PrivateEndpointConnectionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPrivateEndpointConnectionsServerTransport(srv *PrivateEndpointConnectionsServer) *PrivateEndpointConnectionsServerTransport { + return &PrivateEndpointConnectionsServerTransport{ + srv: srv, + beginDelete: newTracker[azfake.PollerResponder[armeventgrid.PrivateEndpointConnectionsClientDeleteResponse]](), + newListByResourcePager: newTracker[azfake.PagerResponder[armeventgrid.PrivateEndpointConnectionsClientListByResourceResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armeventgrid.PrivateEndpointConnectionsClientUpdateResponse]](), + } +} + +// PrivateEndpointConnectionsServerTransport connects instances of armeventgrid.PrivateEndpointConnectionsClient to instances of PrivateEndpointConnectionsServer. +// Don't use this type directly, use NewPrivateEndpointConnectionsServerTransport instead. +type PrivateEndpointConnectionsServerTransport struct { + srv *PrivateEndpointConnectionsServer + beginDelete *tracker[azfake.PollerResponder[armeventgrid.PrivateEndpointConnectionsClientDeleteResponse]] + newListByResourcePager *tracker[azfake.PagerResponder[armeventgrid.PrivateEndpointConnectionsClientListByResourceResponse]] + beginUpdate *tracker[azfake.PollerResponder[armeventgrid.PrivateEndpointConnectionsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for PrivateEndpointConnectionsServerTransport. +func (p *PrivateEndpointConnectionsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "PrivateEndpointConnectionsClient.BeginDelete": + resp, err = p.dispatchBeginDelete(req) + case "PrivateEndpointConnectionsClient.Get": + resp, err = p.dispatchGet(req) + case "PrivateEndpointConnectionsClient.NewListByResourcePager": + resp, err = p.dispatchNewListByResourcePager(req) + case "PrivateEndpointConnectionsClient.BeginUpdate": + resp, err = p.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if p.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := p.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + parentTypeParam, err := parseWithCast(matches[regex.SubexpIndex("parentType")], func(v string) (armeventgrid.PrivateEndpointConnectionsParentType, error) { + p, unescapeErr := url.PathUnescape(v) + if unescapeErr != nil { + return "", unescapeErr + } + return armeventgrid.PrivateEndpointConnectionsParentType(p), nil + }) + if err != nil { + return nil, err + } + parentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("parentName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, parentTypeParam, parentNameParam, privateEndpointConnectionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + p.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + p.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + parentTypeParam, err := parseWithCast(matches[regex.SubexpIndex("parentType")], func(v string) (armeventgrid.PrivateEndpointConnectionsParentType, error) { + p, unescapeErr := url.PathUnescape(v) + if unescapeErr != nil { + return "", unescapeErr + } + return armeventgrid.PrivateEndpointConnectionsParentType(p), nil + }) + if err != nil { + return nil, err + } + parentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("parentName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, parentTypeParam, parentNameParam, privateEndpointConnectionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnection, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchNewListByResourcePager(req *http.Request) (*http.Response, error) { + if p.srv.NewListByResourcePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourcePager not implemented")} + } + newListByResourcePager := p.newListByResourcePager.get(req) + if newListByResourcePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + parentTypeParam, err := parseWithCast(matches[regex.SubexpIndex("parentType")], func(v string) (armeventgrid.PrivateEndpointConnectionsParentType, error) { + p, unescapeErr := url.PathUnescape(v) + if unescapeErr != nil { + return "", unescapeErr + } + return armeventgrid.PrivateEndpointConnectionsParentType(p), nil + }) + if err != nil { + return nil, err + } + parentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("parentName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.PrivateEndpointConnectionsClientListByResourceOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.PrivateEndpointConnectionsClientListByResourceOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := p.srv.NewListByResourcePager(resourceGroupNameParam, parentTypeParam, parentNameParam, options) + newListByResourcePager = &resp + p.newListByResourcePager.add(req, newListByResourcePager) + server.PagerResponderInjectNextLinks(newListByResourcePager, req, func(page *armeventgrid.PrivateEndpointConnectionsClientListByResourceResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourcePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListByResourcePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourcePager) { + p.newListByResourcePager.remove(req) + } + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := p.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.PrivateEndpointConnection](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + parentTypeParam, err := parseWithCast(matches[regex.SubexpIndex("parentType")], func(v string) (armeventgrid.PrivateEndpointConnectionsParentType, error) { + p, unescapeErr := url.PathUnescape(v) + if unescapeErr != nil { + return "", unescapeErr + } + return armeventgrid.PrivateEndpointConnectionsParentType(p), nil + }) + if err != nil { + return nil, err + } + parentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("parentName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginUpdate(req.Context(), resourceGroupNameParam, parentTypeParam, parentNameParam, privateEndpointConnectionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + p.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + p.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + p.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/fake/privatelinkresources_server.go b/sdk/resourcemanager/eventgrid/armeventgrid/fake/privatelinkresources_server.go new file mode 100644 index 000000000000..c67410de1016 --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/fake/privatelinkresources_server.go @@ -0,0 +1,192 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// PrivateLinkResourcesServer is a fake server for instances of the armeventgrid.PrivateLinkResourcesClient type. +type PrivateLinkResourcesServer struct { + // Get is the fake for method PrivateLinkResourcesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateLinkResourceName string, options *armeventgrid.PrivateLinkResourcesClientGetOptions) (resp azfake.Responder[armeventgrid.PrivateLinkResourcesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourcePager is the fake for method PrivateLinkResourcesClient.NewListByResourcePager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourcePager func(resourceGroupName string, parentType string, parentName string, options *armeventgrid.PrivateLinkResourcesClientListByResourceOptions) (resp azfake.PagerResponder[armeventgrid.PrivateLinkResourcesClientListByResourceResponse]) +} + +// NewPrivateLinkResourcesServerTransport creates a new instance of PrivateLinkResourcesServerTransport with the provided implementation. +// The returned PrivateLinkResourcesServerTransport instance is connected to an instance of armeventgrid.PrivateLinkResourcesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPrivateLinkResourcesServerTransport(srv *PrivateLinkResourcesServer) *PrivateLinkResourcesServerTransport { + return &PrivateLinkResourcesServerTransport{ + srv: srv, + newListByResourcePager: newTracker[azfake.PagerResponder[armeventgrid.PrivateLinkResourcesClientListByResourceResponse]](), + } +} + +// PrivateLinkResourcesServerTransport connects instances of armeventgrid.PrivateLinkResourcesClient to instances of PrivateLinkResourcesServer. +// Don't use this type directly, use NewPrivateLinkResourcesServerTransport instead. +type PrivateLinkResourcesServerTransport struct { + srv *PrivateLinkResourcesServer + newListByResourcePager *tracker[azfake.PagerResponder[armeventgrid.PrivateLinkResourcesClientListByResourceResponse]] +} + +// Do implements the policy.Transporter interface for PrivateLinkResourcesServerTransport. +func (p *PrivateLinkResourcesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "PrivateLinkResourcesClient.Get": + resp, err = p.dispatchGet(req) + case "PrivateLinkResourcesClient.NewListByResourcePager": + resp, err = p.dispatchNewListByResourcePager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *PrivateLinkResourcesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + parentTypeParam, err := url.PathUnescape(matches[regex.SubexpIndex("parentType")]) + if err != nil { + return nil, err + } + parentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("parentName")]) + if err != nil { + return nil, err + } + privateLinkResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateLinkResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, parentTypeParam, parentNameParam, privateLinkResourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateLinkResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PrivateLinkResourcesServerTransport) dispatchNewListByResourcePager(req *http.Request) (*http.Response, error) { + if p.srv.NewListByResourcePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourcePager not implemented")} + } + newListByResourcePager := p.newListByResourcePager.get(req) + if newListByResourcePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + parentTypeParam, err := url.PathUnescape(matches[regex.SubexpIndex("parentType")]) + if err != nil { + return nil, err + } + parentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("parentName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.PrivateLinkResourcesClientListByResourceOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.PrivateLinkResourcesClientListByResourceOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := p.srv.NewListByResourcePager(resourceGroupNameParam, parentTypeParam, parentNameParam, options) + newListByResourcePager = &resp + p.newListByResourcePager.add(req, newListByResourcePager) + server.PagerResponderInjectNextLinks(newListByResourcePager, req, func(page *armeventgrid.PrivateLinkResourcesClientListByResourceResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourcePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListByResourcePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourcePager) { + p.newListByResourcePager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/fake/server_factory.go b/sdk/resourcemanager/eventgrid/armeventgrid/fake/server_factory.go new file mode 100644 index 000000000000..d03b75eeb507 --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/fake/server_factory.go @@ -0,0 +1,203 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the armeventgrid.ClientFactory type. +type ServerFactory struct { + ChannelsServer ChannelsServer + DomainEventSubscriptionsServer DomainEventSubscriptionsServer + DomainTopicEventSubscriptionsServer DomainTopicEventSubscriptionsServer + DomainTopicsServer DomainTopicsServer + DomainsServer DomainsServer + EventSubscriptionsServer EventSubscriptionsServer + ExtensionTopicsServer ExtensionTopicsServer + OperationsServer OperationsServer + PartnerConfigurationsServer PartnerConfigurationsServer + PartnerNamespacesServer PartnerNamespacesServer + PartnerRegistrationsServer PartnerRegistrationsServer + PartnerTopicEventSubscriptionsServer PartnerTopicEventSubscriptionsServer + PartnerTopicsServer PartnerTopicsServer + PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer + PrivateLinkResourcesServer PrivateLinkResourcesServer + SystemTopicEventSubscriptionsServer SystemTopicEventSubscriptionsServer + SystemTopicsServer SystemTopicsServer + TopicEventSubscriptionsServer TopicEventSubscriptionsServer + TopicTypesServer TopicTypesServer + TopicsServer TopicsServer + VerifiedPartnersServer VerifiedPartnersServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armeventgrid.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of armeventgrid.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trChannelsServer *ChannelsServerTransport + trDomainEventSubscriptionsServer *DomainEventSubscriptionsServerTransport + trDomainTopicEventSubscriptionsServer *DomainTopicEventSubscriptionsServerTransport + trDomainTopicsServer *DomainTopicsServerTransport + trDomainsServer *DomainsServerTransport + trEventSubscriptionsServer *EventSubscriptionsServerTransport + trExtensionTopicsServer *ExtensionTopicsServerTransport + trOperationsServer *OperationsServerTransport + trPartnerConfigurationsServer *PartnerConfigurationsServerTransport + trPartnerNamespacesServer *PartnerNamespacesServerTransport + trPartnerRegistrationsServer *PartnerRegistrationsServerTransport + trPartnerTopicEventSubscriptionsServer *PartnerTopicEventSubscriptionsServerTransport + trPartnerTopicsServer *PartnerTopicsServerTransport + trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport + trPrivateLinkResourcesServer *PrivateLinkResourcesServerTransport + trSystemTopicEventSubscriptionsServer *SystemTopicEventSubscriptionsServerTransport + trSystemTopicsServer *SystemTopicsServerTransport + trTopicEventSubscriptionsServer *TopicEventSubscriptionsServerTransport + trTopicTypesServer *TopicTypesServerTransport + trTopicsServer *TopicsServerTransport + trVerifiedPartnersServer *VerifiedPartnersServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "ChannelsClient": + initServer(s, &s.trChannelsServer, func() *ChannelsServerTransport { return NewChannelsServerTransport(&s.srv.ChannelsServer) }) + resp, err = s.trChannelsServer.Do(req) + case "DomainEventSubscriptionsClient": + initServer(s, &s.trDomainEventSubscriptionsServer, func() *DomainEventSubscriptionsServerTransport { + return NewDomainEventSubscriptionsServerTransport(&s.srv.DomainEventSubscriptionsServer) + }) + resp, err = s.trDomainEventSubscriptionsServer.Do(req) + case "DomainTopicEventSubscriptionsClient": + initServer(s, &s.trDomainTopicEventSubscriptionsServer, func() *DomainTopicEventSubscriptionsServerTransport { + return NewDomainTopicEventSubscriptionsServerTransport(&s.srv.DomainTopicEventSubscriptionsServer) + }) + resp, err = s.trDomainTopicEventSubscriptionsServer.Do(req) + case "DomainTopicsClient": + initServer(s, &s.trDomainTopicsServer, func() *DomainTopicsServerTransport { return NewDomainTopicsServerTransport(&s.srv.DomainTopicsServer) }) + resp, err = s.trDomainTopicsServer.Do(req) + case "DomainsClient": + initServer(s, &s.trDomainsServer, func() *DomainsServerTransport { return NewDomainsServerTransport(&s.srv.DomainsServer) }) + resp, err = s.trDomainsServer.Do(req) + case "EventSubscriptionsClient": + initServer(s, &s.trEventSubscriptionsServer, func() *EventSubscriptionsServerTransport { + return NewEventSubscriptionsServerTransport(&s.srv.EventSubscriptionsServer) + }) + resp, err = s.trEventSubscriptionsServer.Do(req) + case "ExtensionTopicsClient": + initServer(s, &s.trExtensionTopicsServer, func() *ExtensionTopicsServerTransport { + return NewExtensionTopicsServerTransport(&s.srv.ExtensionTopicsServer) + }) + resp, err = s.trExtensionTopicsServer.Do(req) + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + case "PartnerConfigurationsClient": + initServer(s, &s.trPartnerConfigurationsServer, func() *PartnerConfigurationsServerTransport { + return NewPartnerConfigurationsServerTransport(&s.srv.PartnerConfigurationsServer) + }) + resp, err = s.trPartnerConfigurationsServer.Do(req) + case "PartnerNamespacesClient": + initServer(s, &s.trPartnerNamespacesServer, func() *PartnerNamespacesServerTransport { + return NewPartnerNamespacesServerTransport(&s.srv.PartnerNamespacesServer) + }) + resp, err = s.trPartnerNamespacesServer.Do(req) + case "PartnerRegistrationsClient": + initServer(s, &s.trPartnerRegistrationsServer, func() *PartnerRegistrationsServerTransport { + return NewPartnerRegistrationsServerTransport(&s.srv.PartnerRegistrationsServer) + }) + resp, err = s.trPartnerRegistrationsServer.Do(req) + case "PartnerTopicEventSubscriptionsClient": + initServer(s, &s.trPartnerTopicEventSubscriptionsServer, func() *PartnerTopicEventSubscriptionsServerTransport { + return NewPartnerTopicEventSubscriptionsServerTransport(&s.srv.PartnerTopicEventSubscriptionsServer) + }) + resp, err = s.trPartnerTopicEventSubscriptionsServer.Do(req) + case "PartnerTopicsClient": + initServer(s, &s.trPartnerTopicsServer, func() *PartnerTopicsServerTransport { + return NewPartnerTopicsServerTransport(&s.srv.PartnerTopicsServer) + }) + resp, err = s.trPartnerTopicsServer.Do(req) + case "PrivateEndpointConnectionsClient": + initServer(s, &s.trPrivateEndpointConnectionsServer, func() *PrivateEndpointConnectionsServerTransport { + return NewPrivateEndpointConnectionsServerTransport(&s.srv.PrivateEndpointConnectionsServer) + }) + resp, err = s.trPrivateEndpointConnectionsServer.Do(req) + case "PrivateLinkResourcesClient": + initServer(s, &s.trPrivateLinkResourcesServer, func() *PrivateLinkResourcesServerTransport { + return NewPrivateLinkResourcesServerTransport(&s.srv.PrivateLinkResourcesServer) + }) + resp, err = s.trPrivateLinkResourcesServer.Do(req) + case "SystemTopicEventSubscriptionsClient": + initServer(s, &s.trSystemTopicEventSubscriptionsServer, func() *SystemTopicEventSubscriptionsServerTransport { + return NewSystemTopicEventSubscriptionsServerTransport(&s.srv.SystemTopicEventSubscriptionsServer) + }) + resp, err = s.trSystemTopicEventSubscriptionsServer.Do(req) + case "SystemTopicsClient": + initServer(s, &s.trSystemTopicsServer, func() *SystemTopicsServerTransport { return NewSystemTopicsServerTransport(&s.srv.SystemTopicsServer) }) + resp, err = s.trSystemTopicsServer.Do(req) + case "TopicEventSubscriptionsClient": + initServer(s, &s.trTopicEventSubscriptionsServer, func() *TopicEventSubscriptionsServerTransport { + return NewTopicEventSubscriptionsServerTransport(&s.srv.TopicEventSubscriptionsServer) + }) + resp, err = s.trTopicEventSubscriptionsServer.Do(req) + case "TopicTypesClient": + initServer(s, &s.trTopicTypesServer, func() *TopicTypesServerTransport { return NewTopicTypesServerTransport(&s.srv.TopicTypesServer) }) + resp, err = s.trTopicTypesServer.Do(req) + case "TopicsClient": + initServer(s, &s.trTopicsServer, func() *TopicsServerTransport { return NewTopicsServerTransport(&s.srv.TopicsServer) }) + resp, err = s.trTopicsServer.Do(req) + case "VerifiedPartnersClient": + initServer(s, &s.trVerifiedPartnersServer, func() *VerifiedPartnersServerTransport { + return NewVerifiedPartnersServerTransport(&s.srv.VerifiedPartnersServer) + }) + resp, err = s.trVerifiedPartnersServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/fake/systemtopiceventsubscriptions_server.go b/sdk/resourcemanager/eventgrid/armeventgrid/fake/systemtopiceventsubscriptions_server.go new file mode 100644 index 000000000000..a5a992ac5f61 --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/fake/systemtopiceventsubscriptions_server.go @@ -0,0 +1,446 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// SystemTopicEventSubscriptionsServer is a fake server for instances of the armeventgrid.SystemTopicEventSubscriptionsClient type. +type SystemTopicEventSubscriptionsServer struct { + // BeginCreateOrUpdate is the fake for method SystemTopicEventSubscriptionsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, eventSubscriptionInfo armeventgrid.EventSubscription, options *armeventgrid.SystemTopicEventSubscriptionsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armeventgrid.SystemTopicEventSubscriptionsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method SystemTopicEventSubscriptionsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, options *armeventgrid.SystemTopicEventSubscriptionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armeventgrid.SystemTopicEventSubscriptionsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SystemTopicEventSubscriptionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, options *armeventgrid.SystemTopicEventSubscriptionsClientGetOptions) (resp azfake.Responder[armeventgrid.SystemTopicEventSubscriptionsClientGetResponse], errResp azfake.ErrorResponder) + + // GetDeliveryAttributes is the fake for method SystemTopicEventSubscriptionsClient.GetDeliveryAttributes + // HTTP status codes to indicate success: http.StatusOK + GetDeliveryAttributes func(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, options *armeventgrid.SystemTopicEventSubscriptionsClientGetDeliveryAttributesOptions) (resp azfake.Responder[armeventgrid.SystemTopicEventSubscriptionsClientGetDeliveryAttributesResponse], errResp azfake.ErrorResponder) + + // GetFullURL is the fake for method SystemTopicEventSubscriptionsClient.GetFullURL + // HTTP status codes to indicate success: http.StatusOK + GetFullURL func(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, options *armeventgrid.SystemTopicEventSubscriptionsClientGetFullURLOptions) (resp azfake.Responder[armeventgrid.SystemTopicEventSubscriptionsClientGetFullURLResponse], errResp azfake.ErrorResponder) + + // NewListBySystemTopicPager is the fake for method SystemTopicEventSubscriptionsClient.NewListBySystemTopicPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySystemTopicPager func(resourceGroupName string, systemTopicName string, options *armeventgrid.SystemTopicEventSubscriptionsClientListBySystemTopicOptions) (resp azfake.PagerResponder[armeventgrid.SystemTopicEventSubscriptionsClientListBySystemTopicResponse]) + + // BeginUpdate is the fake for method SystemTopicEventSubscriptionsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusCreated + BeginUpdate func(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters armeventgrid.EventSubscriptionUpdateParameters, options *armeventgrid.SystemTopicEventSubscriptionsClientBeginUpdateOptions) (resp azfake.PollerResponder[armeventgrid.SystemTopicEventSubscriptionsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewSystemTopicEventSubscriptionsServerTransport creates a new instance of SystemTopicEventSubscriptionsServerTransport with the provided implementation. +// The returned SystemTopicEventSubscriptionsServerTransport instance is connected to an instance of armeventgrid.SystemTopicEventSubscriptionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSystemTopicEventSubscriptionsServerTransport(srv *SystemTopicEventSubscriptionsServer) *SystemTopicEventSubscriptionsServerTransport { + return &SystemTopicEventSubscriptionsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armeventgrid.SystemTopicEventSubscriptionsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armeventgrid.SystemTopicEventSubscriptionsClientDeleteResponse]](), + newListBySystemTopicPager: newTracker[azfake.PagerResponder[armeventgrid.SystemTopicEventSubscriptionsClientListBySystemTopicResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armeventgrid.SystemTopicEventSubscriptionsClientUpdateResponse]](), + } +} + +// SystemTopicEventSubscriptionsServerTransport connects instances of armeventgrid.SystemTopicEventSubscriptionsClient to instances of SystemTopicEventSubscriptionsServer. +// Don't use this type directly, use NewSystemTopicEventSubscriptionsServerTransport instead. +type SystemTopicEventSubscriptionsServerTransport struct { + srv *SystemTopicEventSubscriptionsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armeventgrid.SystemTopicEventSubscriptionsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armeventgrid.SystemTopicEventSubscriptionsClientDeleteResponse]] + newListBySystemTopicPager *tracker[azfake.PagerResponder[armeventgrid.SystemTopicEventSubscriptionsClientListBySystemTopicResponse]] + beginUpdate *tracker[azfake.PollerResponder[armeventgrid.SystemTopicEventSubscriptionsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for SystemTopicEventSubscriptionsServerTransport. +func (s *SystemTopicEventSubscriptionsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "SystemTopicEventSubscriptionsClient.BeginCreateOrUpdate": + resp, err = s.dispatchBeginCreateOrUpdate(req) + case "SystemTopicEventSubscriptionsClient.BeginDelete": + resp, err = s.dispatchBeginDelete(req) + case "SystemTopicEventSubscriptionsClient.Get": + resp, err = s.dispatchGet(req) + case "SystemTopicEventSubscriptionsClient.GetDeliveryAttributes": + resp, err = s.dispatchGetDeliveryAttributes(req) + case "SystemTopicEventSubscriptionsClient.GetFullURL": + resp, err = s.dispatchGetFullURL(req) + case "SystemTopicEventSubscriptionsClient.NewListBySystemTopicPager": + resp, err = s.dispatchNewListBySystemTopicPager(req) + case "SystemTopicEventSubscriptionsClient.BeginUpdate": + resp, err = s.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SystemTopicEventSubscriptionsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := s.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/systemTopics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.EventSubscription](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + systemTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("systemTopicName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, systemTopicNameParam, eventSubscriptionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + s.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusCreated}, resp.StatusCode) { + s.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + s.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (s *SystemTopicEventSubscriptionsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if s.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := s.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/systemTopics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + systemTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("systemTopicName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginDelete(req.Context(), resourceGroupNameParam, systemTopicNameParam, eventSubscriptionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + s.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + s.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + s.beginDelete.remove(req) + } + + return resp, nil +} + +func (s *SystemTopicEventSubscriptionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/systemTopics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + systemTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("systemTopicName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, systemTopicNameParam, eventSubscriptionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).EventSubscription, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SystemTopicEventSubscriptionsServerTransport) dispatchGetDeliveryAttributes(req *http.Request) (*http.Response, error) { + if s.srv.GetDeliveryAttributes == nil { + return nil, &nonRetriableError{errors.New("fake for method GetDeliveryAttributes not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/systemTopics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getDeliveryAttributes` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + systemTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("systemTopicName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.GetDeliveryAttributes(req.Context(), resourceGroupNameParam, systemTopicNameParam, eventSubscriptionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DeliveryAttributeListResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SystemTopicEventSubscriptionsServerTransport) dispatchGetFullURL(req *http.Request) (*http.Response, error) { + if s.srv.GetFullURL == nil { + return nil, &nonRetriableError{errors.New("fake for method GetFullURL not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/systemTopics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getFullUrl` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + systemTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("systemTopicName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.GetFullURL(req.Context(), resourceGroupNameParam, systemTopicNameParam, eventSubscriptionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).EventSubscriptionFullURL, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SystemTopicEventSubscriptionsServerTransport) dispatchNewListBySystemTopicPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListBySystemTopicPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySystemTopicPager not implemented")} + } + newListBySystemTopicPager := s.newListBySystemTopicPager.get(req) + if newListBySystemTopicPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/systemTopics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + systemTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("systemTopicName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.SystemTopicEventSubscriptionsClientListBySystemTopicOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.SystemTopicEventSubscriptionsClientListBySystemTopicOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := s.srv.NewListBySystemTopicPager(resourceGroupNameParam, systemTopicNameParam, options) + newListBySystemTopicPager = &resp + s.newListBySystemTopicPager.add(req, newListBySystemTopicPager) + server.PagerResponderInjectNextLinks(newListBySystemTopicPager, req, func(page *armeventgrid.SystemTopicEventSubscriptionsClientListBySystemTopicResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySystemTopicPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListBySystemTopicPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySystemTopicPager) { + s.newListBySystemTopicPager.remove(req) + } + return resp, nil +} + +func (s *SystemTopicEventSubscriptionsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := s.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/systemTopics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.EventSubscriptionUpdateParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + systemTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("systemTopicName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginUpdate(req.Context(), resourceGroupNameParam, systemTopicNameParam, eventSubscriptionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + s.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusCreated}, resp.StatusCode) { + s.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + s.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/fake/systemtopics_server.go b/sdk/resourcemanager/eventgrid/armeventgrid/fake/systemtopics_server.go new file mode 100644 index 000000000000..1aa552923616 --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/fake/systemtopics_server.go @@ -0,0 +1,408 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// SystemTopicsServer is a fake server for instances of the armeventgrid.SystemTopicsClient type. +type SystemTopicsServer struct { + // BeginCreateOrUpdate is the fake for method SystemTopicsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, systemTopicName string, systemTopicInfo armeventgrid.SystemTopic, options *armeventgrid.SystemTopicsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armeventgrid.SystemTopicsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method SystemTopicsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, systemTopicName string, options *armeventgrid.SystemTopicsClientBeginDeleteOptions) (resp azfake.PollerResponder[armeventgrid.SystemTopicsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SystemTopicsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, systemTopicName string, options *armeventgrid.SystemTopicsClientGetOptions) (resp azfake.Responder[armeventgrid.SystemTopicsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method SystemTopicsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armeventgrid.SystemTopicsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armeventgrid.SystemTopicsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method SystemTopicsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armeventgrid.SystemTopicsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armeventgrid.SystemTopicsClientListBySubscriptionResponse]) + + // BeginUpdate is the fake for method SystemTopicsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginUpdate func(ctx context.Context, resourceGroupName string, systemTopicName string, systemTopicUpdateParameters armeventgrid.SystemTopicUpdateParameters, options *armeventgrid.SystemTopicsClientBeginUpdateOptions) (resp azfake.PollerResponder[armeventgrid.SystemTopicsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewSystemTopicsServerTransport creates a new instance of SystemTopicsServerTransport with the provided implementation. +// The returned SystemTopicsServerTransport instance is connected to an instance of armeventgrid.SystemTopicsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSystemTopicsServerTransport(srv *SystemTopicsServer) *SystemTopicsServerTransport { + return &SystemTopicsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armeventgrid.SystemTopicsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armeventgrid.SystemTopicsClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armeventgrid.SystemTopicsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armeventgrid.SystemTopicsClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armeventgrid.SystemTopicsClientUpdateResponse]](), + } +} + +// SystemTopicsServerTransport connects instances of armeventgrid.SystemTopicsClient to instances of SystemTopicsServer. +// Don't use this type directly, use NewSystemTopicsServerTransport instead. +type SystemTopicsServerTransport struct { + srv *SystemTopicsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armeventgrid.SystemTopicsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armeventgrid.SystemTopicsClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armeventgrid.SystemTopicsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armeventgrid.SystemTopicsClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armeventgrid.SystemTopicsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for SystemTopicsServerTransport. +func (s *SystemTopicsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "SystemTopicsClient.BeginCreateOrUpdate": + resp, err = s.dispatchBeginCreateOrUpdate(req) + case "SystemTopicsClient.BeginDelete": + resp, err = s.dispatchBeginDelete(req) + case "SystemTopicsClient.Get": + resp, err = s.dispatchGet(req) + case "SystemTopicsClient.NewListByResourceGroupPager": + resp, err = s.dispatchNewListByResourceGroupPager(req) + case "SystemTopicsClient.NewListBySubscriptionPager": + resp, err = s.dispatchNewListBySubscriptionPager(req) + case "SystemTopicsClient.BeginUpdate": + resp, err = s.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SystemTopicsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := s.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/systemTopics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.SystemTopic](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + systemTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("systemTopicName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, systemTopicNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + s.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + s.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + s.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (s *SystemTopicsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if s.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := s.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/systemTopics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + systemTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("systemTopicName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginDelete(req.Context(), resourceGroupNameParam, systemTopicNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + s.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + s.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + s.beginDelete.remove(req) + } + + return resp, nil +} + +func (s *SystemTopicsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/systemTopics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + systemTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("systemTopicName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, systemTopicNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SystemTopic, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SystemTopicsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := s.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/systemTopics` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.SystemTopicsClientListByResourceGroupOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.SystemTopicsClientListByResourceGroupOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := s.srv.NewListByResourceGroupPager(resourceGroupNameParam, options) + newListByResourceGroupPager = &resp + s.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armeventgrid.SystemTopicsClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + s.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (s *SystemTopicsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := s.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/systemTopics` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.SystemTopicsClientListBySubscriptionOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.SystemTopicsClientListBySubscriptionOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := s.srv.NewListBySubscriptionPager(options) + newListBySubscriptionPager = &resp + s.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armeventgrid.SystemTopicsClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + s.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (s *SystemTopicsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := s.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/systemTopics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.SystemTopicUpdateParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + systemTopicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("systemTopicName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginUpdate(req.Context(), resourceGroupNameParam, systemTopicNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + s.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + s.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + s.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/fake/time_rfc3339.go b/sdk/resourcemanager/eventgrid/armeventgrid/fake/time_rfc3339.go new file mode 100644 index 000000000000..b0535a7b63e6 --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/fake/time_rfc3339.go @@ -0,0 +1,86 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) + +const ( + utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` + utcDateTime = "2006-01-02T15:04:05.999999999" + dateTimeJSON = `"` + time.RFC3339Nano + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcDateTimeJSON + if tzOffsetRegex.Match(data) { + layout = dateTimeJSON + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + layout := utcDateTime + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/fake/topiceventsubscriptions_server.go b/sdk/resourcemanager/eventgrid/armeventgrid/fake/topiceventsubscriptions_server.go new file mode 100644 index 000000000000..8f78d70252fd --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/fake/topiceventsubscriptions_server.go @@ -0,0 +1,446 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// TopicEventSubscriptionsServer is a fake server for instances of the armeventgrid.TopicEventSubscriptionsClient type. +type TopicEventSubscriptionsServer struct { + // BeginCreateOrUpdate is the fake for method TopicEventSubscriptionsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, topicName string, eventSubscriptionName string, eventSubscriptionInfo armeventgrid.EventSubscription, options *armeventgrid.TopicEventSubscriptionsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armeventgrid.TopicEventSubscriptionsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method TopicEventSubscriptionsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, topicName string, eventSubscriptionName string, options *armeventgrid.TopicEventSubscriptionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armeventgrid.TopicEventSubscriptionsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method TopicEventSubscriptionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, topicName string, eventSubscriptionName string, options *armeventgrid.TopicEventSubscriptionsClientGetOptions) (resp azfake.Responder[armeventgrid.TopicEventSubscriptionsClientGetResponse], errResp azfake.ErrorResponder) + + // GetDeliveryAttributes is the fake for method TopicEventSubscriptionsClient.GetDeliveryAttributes + // HTTP status codes to indicate success: http.StatusOK + GetDeliveryAttributes func(ctx context.Context, resourceGroupName string, topicName string, eventSubscriptionName string, options *armeventgrid.TopicEventSubscriptionsClientGetDeliveryAttributesOptions) (resp azfake.Responder[armeventgrid.TopicEventSubscriptionsClientGetDeliveryAttributesResponse], errResp azfake.ErrorResponder) + + // GetFullURL is the fake for method TopicEventSubscriptionsClient.GetFullURL + // HTTP status codes to indicate success: http.StatusOK + GetFullURL func(ctx context.Context, resourceGroupName string, topicName string, eventSubscriptionName string, options *armeventgrid.TopicEventSubscriptionsClientGetFullURLOptions) (resp azfake.Responder[armeventgrid.TopicEventSubscriptionsClientGetFullURLResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method TopicEventSubscriptionsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, topicName string, options *armeventgrid.TopicEventSubscriptionsClientListOptions) (resp azfake.PagerResponder[armeventgrid.TopicEventSubscriptionsClientListResponse]) + + // BeginUpdate is the fake for method TopicEventSubscriptionsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusCreated + BeginUpdate func(ctx context.Context, resourceGroupName string, topicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters armeventgrid.EventSubscriptionUpdateParameters, options *armeventgrid.TopicEventSubscriptionsClientBeginUpdateOptions) (resp azfake.PollerResponder[armeventgrid.TopicEventSubscriptionsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewTopicEventSubscriptionsServerTransport creates a new instance of TopicEventSubscriptionsServerTransport with the provided implementation. +// The returned TopicEventSubscriptionsServerTransport instance is connected to an instance of armeventgrid.TopicEventSubscriptionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewTopicEventSubscriptionsServerTransport(srv *TopicEventSubscriptionsServer) *TopicEventSubscriptionsServerTransport { + return &TopicEventSubscriptionsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armeventgrid.TopicEventSubscriptionsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armeventgrid.TopicEventSubscriptionsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armeventgrid.TopicEventSubscriptionsClientListResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armeventgrid.TopicEventSubscriptionsClientUpdateResponse]](), + } +} + +// TopicEventSubscriptionsServerTransport connects instances of armeventgrid.TopicEventSubscriptionsClient to instances of TopicEventSubscriptionsServer. +// Don't use this type directly, use NewTopicEventSubscriptionsServerTransport instead. +type TopicEventSubscriptionsServerTransport struct { + srv *TopicEventSubscriptionsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armeventgrid.TopicEventSubscriptionsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armeventgrid.TopicEventSubscriptionsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armeventgrid.TopicEventSubscriptionsClientListResponse]] + beginUpdate *tracker[azfake.PollerResponder[armeventgrid.TopicEventSubscriptionsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for TopicEventSubscriptionsServerTransport. +func (t *TopicEventSubscriptionsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "TopicEventSubscriptionsClient.BeginCreateOrUpdate": + resp, err = t.dispatchBeginCreateOrUpdate(req) + case "TopicEventSubscriptionsClient.BeginDelete": + resp, err = t.dispatchBeginDelete(req) + case "TopicEventSubscriptionsClient.Get": + resp, err = t.dispatchGet(req) + case "TopicEventSubscriptionsClient.GetDeliveryAttributes": + resp, err = t.dispatchGetDeliveryAttributes(req) + case "TopicEventSubscriptionsClient.GetFullURL": + resp, err = t.dispatchGetFullURL(req) + case "TopicEventSubscriptionsClient.NewListPager": + resp, err = t.dispatchNewListPager(req) + case "TopicEventSubscriptionsClient.BeginUpdate": + resp, err = t.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (t *TopicEventSubscriptionsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if t.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := t.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/topics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.EventSubscription](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + topicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, topicNameParam, eventSubscriptionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + t.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + t.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + t.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (t *TopicEventSubscriptionsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if t.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := t.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/topics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + topicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.BeginDelete(req.Context(), resourceGroupNameParam, topicNameParam, eventSubscriptionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + t.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + t.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + t.beginDelete.remove(req) + } + + return resp, nil +} + +func (t *TopicEventSubscriptionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if t.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/topics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + topicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.Get(req.Context(), resourceGroupNameParam, topicNameParam, eventSubscriptionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).EventSubscription, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (t *TopicEventSubscriptionsServerTransport) dispatchGetDeliveryAttributes(req *http.Request) (*http.Response, error) { + if t.srv.GetDeliveryAttributes == nil { + return nil, &nonRetriableError{errors.New("fake for method GetDeliveryAttributes not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/topics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getDeliveryAttributes` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + topicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.GetDeliveryAttributes(req.Context(), resourceGroupNameParam, topicNameParam, eventSubscriptionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DeliveryAttributeListResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (t *TopicEventSubscriptionsServerTransport) dispatchGetFullURL(req *http.Request) (*http.Response, error) { + if t.srv.GetFullURL == nil { + return nil, &nonRetriableError{errors.New("fake for method GetFullURL not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/topics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getFullUrl` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + topicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.GetFullURL(req.Context(), resourceGroupNameParam, topicNameParam, eventSubscriptionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).EventSubscriptionFullURL, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (t *TopicEventSubscriptionsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if t.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := t.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/topics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + topicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.TopicEventSubscriptionsClientListOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.TopicEventSubscriptionsClientListOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := t.srv.NewListPager(resourceGroupNameParam, topicNameParam, options) + newListPager = &resp + t.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armeventgrid.TopicEventSubscriptionsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + t.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + t.newListPager.remove(req) + } + return resp, nil +} + +func (t *TopicEventSubscriptionsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if t.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := t.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/topics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventSubscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.EventSubscriptionUpdateParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + topicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicName")]) + if err != nil { + return nil, err + } + eventSubscriptionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("eventSubscriptionName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.BeginUpdate(req.Context(), resourceGroupNameParam, topicNameParam, eventSubscriptionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + t.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusCreated}, resp.StatusCode) { + t.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + t.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/fake/topics_server.go b/sdk/resourcemanager/eventgrid/armeventgrid/fake/topics_server.go new file mode 100644 index 000000000000..263647ecbde8 --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/fake/topics_server.go @@ -0,0 +1,557 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// TopicsServer is a fake server for instances of the armeventgrid.TopicsClient type. +type TopicsServer struct { + // BeginCreateOrUpdate is the fake for method TopicsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, topicName string, topicInfo armeventgrid.Topic, options *armeventgrid.TopicsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armeventgrid.TopicsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method TopicsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, topicName string, options *armeventgrid.TopicsClientBeginDeleteOptions) (resp azfake.PollerResponder[armeventgrid.TopicsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method TopicsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, topicName string, options *armeventgrid.TopicsClientGetOptions) (resp azfake.Responder[armeventgrid.TopicsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method TopicsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armeventgrid.TopicsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armeventgrid.TopicsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method TopicsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armeventgrid.TopicsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armeventgrid.TopicsClientListBySubscriptionResponse]) + + // NewListEventTypesPager is the fake for method TopicsClient.NewListEventTypesPager + // HTTP status codes to indicate success: http.StatusOK + NewListEventTypesPager func(resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, options *armeventgrid.TopicsClientListEventTypesOptions) (resp azfake.PagerResponder[armeventgrid.TopicsClientListEventTypesResponse]) + + // ListSharedAccessKeys is the fake for method TopicsClient.ListSharedAccessKeys + // HTTP status codes to indicate success: http.StatusOK + ListSharedAccessKeys func(ctx context.Context, resourceGroupName string, topicName string, options *armeventgrid.TopicsClientListSharedAccessKeysOptions) (resp azfake.Responder[armeventgrid.TopicsClientListSharedAccessKeysResponse], errResp azfake.ErrorResponder) + + // BeginRegenerateKey is the fake for method TopicsClient.BeginRegenerateKey + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginRegenerateKey func(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest armeventgrid.TopicRegenerateKeyRequest, options *armeventgrid.TopicsClientBeginRegenerateKeyOptions) (resp azfake.PollerResponder[armeventgrid.TopicsClientRegenerateKeyResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method TopicsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginUpdate func(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters armeventgrid.TopicUpdateParameters, options *armeventgrid.TopicsClientBeginUpdateOptions) (resp azfake.PollerResponder[armeventgrid.TopicsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewTopicsServerTransport creates a new instance of TopicsServerTransport with the provided implementation. +// The returned TopicsServerTransport instance is connected to an instance of armeventgrid.TopicsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewTopicsServerTransport(srv *TopicsServer) *TopicsServerTransport { + return &TopicsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armeventgrid.TopicsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armeventgrid.TopicsClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armeventgrid.TopicsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armeventgrid.TopicsClientListBySubscriptionResponse]](), + newListEventTypesPager: newTracker[azfake.PagerResponder[armeventgrid.TopicsClientListEventTypesResponse]](), + beginRegenerateKey: newTracker[azfake.PollerResponder[armeventgrid.TopicsClientRegenerateKeyResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armeventgrid.TopicsClientUpdateResponse]](), + } +} + +// TopicsServerTransport connects instances of armeventgrid.TopicsClient to instances of TopicsServer. +// Don't use this type directly, use NewTopicsServerTransport instead. +type TopicsServerTransport struct { + srv *TopicsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armeventgrid.TopicsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armeventgrid.TopicsClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armeventgrid.TopicsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armeventgrid.TopicsClientListBySubscriptionResponse]] + newListEventTypesPager *tracker[azfake.PagerResponder[armeventgrid.TopicsClientListEventTypesResponse]] + beginRegenerateKey *tracker[azfake.PollerResponder[armeventgrid.TopicsClientRegenerateKeyResponse]] + beginUpdate *tracker[azfake.PollerResponder[armeventgrid.TopicsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for TopicsServerTransport. +func (t *TopicsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "TopicsClient.BeginCreateOrUpdate": + resp, err = t.dispatchBeginCreateOrUpdate(req) + case "TopicsClient.BeginDelete": + resp, err = t.dispatchBeginDelete(req) + case "TopicsClient.Get": + resp, err = t.dispatchGet(req) + case "TopicsClient.NewListByResourceGroupPager": + resp, err = t.dispatchNewListByResourceGroupPager(req) + case "TopicsClient.NewListBySubscriptionPager": + resp, err = t.dispatchNewListBySubscriptionPager(req) + case "TopicsClient.NewListEventTypesPager": + resp, err = t.dispatchNewListEventTypesPager(req) + case "TopicsClient.ListSharedAccessKeys": + resp, err = t.dispatchListSharedAccessKeys(req) + case "TopicsClient.BeginRegenerateKey": + resp, err = t.dispatchBeginRegenerateKey(req) + case "TopicsClient.BeginUpdate": + resp, err = t.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (t *TopicsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if t.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := t.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/topics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.Topic](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + topicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, topicNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + t.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusCreated}, resp.StatusCode) { + t.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + t.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (t *TopicsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if t.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := t.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/topics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + topicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.BeginDelete(req.Context(), resourceGroupNameParam, topicNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + t.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + t.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + t.beginDelete.remove(req) + } + + return resp, nil +} + +func (t *TopicsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if t.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/topics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + topicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.Get(req.Context(), resourceGroupNameParam, topicNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Topic, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (t *TopicsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if t.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := t.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/topics` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.TopicsClientListByResourceGroupOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.TopicsClientListByResourceGroupOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := t.srv.NewListByResourceGroupPager(resourceGroupNameParam, options) + newListByResourceGroupPager = &resp + t.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armeventgrid.TopicsClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + t.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + t.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (t *TopicsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if t.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := t.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/topics` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.TopicsClientListBySubscriptionOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.TopicsClientListBySubscriptionOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := t.srv.NewListBySubscriptionPager(options) + newListBySubscriptionPager = &resp + t.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armeventgrid.TopicsClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + t.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + t.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (t *TopicsServerTransport) dispatchNewListEventTypesPager(req *http.Request) (*http.Response, error) { + if t.srv.NewListEventTypesPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListEventTypesPager not implemented")} + } + newListEventTypesPager := t.newListEventTypesPager.get(req) + if newListEventTypesPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/eventTypes` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + providerNamespaceParam, err := url.PathUnescape(matches[regex.SubexpIndex("providerNamespace")]) + if err != nil { + return nil, err + } + resourceTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceTypeName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + resp := t.srv.NewListEventTypesPager(resourceGroupNameParam, providerNamespaceParam, resourceTypeNameParam, resourceNameParam, nil) + newListEventTypesPager = &resp + t.newListEventTypesPager.add(req, newListEventTypesPager) + } + resp, err := server.PagerResponderNext(newListEventTypesPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + t.newListEventTypesPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListEventTypesPager) { + t.newListEventTypesPager.remove(req) + } + return resp, nil +} + +func (t *TopicsServerTransport) dispatchListSharedAccessKeys(req *http.Request) (*http.Response, error) { + if t.srv.ListSharedAccessKeys == nil { + return nil, &nonRetriableError{errors.New("fake for method ListSharedAccessKeys not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/topics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listKeys` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + topicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.ListSharedAccessKeys(req.Context(), resourceGroupNameParam, topicNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TopicSharedAccessKeys, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (t *TopicsServerTransport) dispatchBeginRegenerateKey(req *http.Request) (*http.Response, error) { + if t.srv.BeginRegenerateKey == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginRegenerateKey not implemented")} + } + beginRegenerateKey := t.beginRegenerateKey.get(req) + if beginRegenerateKey == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/topics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/regenerateKey` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.TopicRegenerateKeyRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + topicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.BeginRegenerateKey(req.Context(), resourceGroupNameParam, topicNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginRegenerateKey = &respr + t.beginRegenerateKey.add(req, beginRegenerateKey) + } + + resp, err := server.PollerResponderNext(beginRegenerateKey, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + t.beginRegenerateKey.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginRegenerateKey) { + t.beginRegenerateKey.remove(req) + } + + return resp, nil +} + +func (t *TopicsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if t.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := t.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventGrid/topics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventgrid.TopicUpdateParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + topicNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.BeginUpdate(req.Context(), resourceGroupNameParam, topicNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + t.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + t.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + t.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/fake/topictypes_server.go b/sdk/resourcemanager/eventgrid/armeventgrid/fake/topictypes_server.go new file mode 100644 index 000000000000..e8427682bb56 --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/fake/topictypes_server.go @@ -0,0 +1,172 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" + "net/http" + "net/url" + "regexp" +) + +// TopicTypesServer is a fake server for instances of the armeventgrid.TopicTypesClient type. +type TopicTypesServer struct { + // Get is the fake for method TopicTypesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, topicTypeName string, options *armeventgrid.TopicTypesClientGetOptions) (resp azfake.Responder[armeventgrid.TopicTypesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method TopicTypesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armeventgrid.TopicTypesClientListOptions) (resp azfake.PagerResponder[armeventgrid.TopicTypesClientListResponse]) + + // NewListEventTypesPager is the fake for method TopicTypesClient.NewListEventTypesPager + // HTTP status codes to indicate success: http.StatusOK + NewListEventTypesPager func(topicTypeName string, options *armeventgrid.TopicTypesClientListEventTypesOptions) (resp azfake.PagerResponder[armeventgrid.TopicTypesClientListEventTypesResponse]) +} + +// NewTopicTypesServerTransport creates a new instance of TopicTypesServerTransport with the provided implementation. +// The returned TopicTypesServerTransport instance is connected to an instance of armeventgrid.TopicTypesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewTopicTypesServerTransport(srv *TopicTypesServer) *TopicTypesServerTransport { + return &TopicTypesServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armeventgrid.TopicTypesClientListResponse]](), + newListEventTypesPager: newTracker[azfake.PagerResponder[armeventgrid.TopicTypesClientListEventTypesResponse]](), + } +} + +// TopicTypesServerTransport connects instances of armeventgrid.TopicTypesClient to instances of TopicTypesServer. +// Don't use this type directly, use NewTopicTypesServerTransport instead. +type TopicTypesServerTransport struct { + srv *TopicTypesServer + newListPager *tracker[azfake.PagerResponder[armeventgrid.TopicTypesClientListResponse]] + newListEventTypesPager *tracker[azfake.PagerResponder[armeventgrid.TopicTypesClientListEventTypesResponse]] +} + +// Do implements the policy.Transporter interface for TopicTypesServerTransport. +func (t *TopicTypesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "TopicTypesClient.Get": + resp, err = t.dispatchGet(req) + case "TopicTypesClient.NewListPager": + resp, err = t.dispatchNewListPager(req) + case "TopicTypesClient.NewListEventTypesPager": + resp, err = t.dispatchNewListEventTypesPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (t *TopicTypesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if t.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/providers/Microsoft\.EventGrid/topicTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + topicTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicTypeName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.Get(req.Context(), topicTypeNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TopicTypeInfo, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (t *TopicTypesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if t.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := t.newListPager.get(req) + if newListPager == nil { + resp := t.srv.NewListPager(nil) + newListPager = &resp + t.newListPager.add(req, newListPager) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + t.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + t.newListPager.remove(req) + } + return resp, nil +} + +func (t *TopicTypesServerTransport) dispatchNewListEventTypesPager(req *http.Request) (*http.Response, error) { + if t.srv.NewListEventTypesPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListEventTypesPager not implemented")} + } + newListEventTypesPager := t.newListEventTypesPager.get(req) + if newListEventTypesPager == nil { + const regexStr = `/providers/Microsoft\.EventGrid/topicTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/eventTypes` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + topicTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("topicTypeName")]) + if err != nil { + return nil, err + } + resp := t.srv.NewListEventTypesPager(topicTypeNameParam, nil) + newListEventTypesPager = &resp + t.newListEventTypesPager.add(req, newListEventTypesPager) + } + resp, err := server.PagerResponderNext(newListEventTypesPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + t.newListEventTypesPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListEventTypesPager) { + t.newListEventTypesPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/fake/verifiedpartners_server.go b/sdk/resourcemanager/eventgrid/armeventgrid/fake/verifiedpartners_server.go new file mode 100644 index 000000000000..a0a53ea2aeba --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/fake/verifiedpartners_server.go @@ -0,0 +1,162 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// VerifiedPartnersServer is a fake server for instances of the armeventgrid.VerifiedPartnersClient type. +type VerifiedPartnersServer struct { + // Get is the fake for method VerifiedPartnersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, verifiedPartnerName string, options *armeventgrid.VerifiedPartnersClientGetOptions) (resp azfake.Responder[armeventgrid.VerifiedPartnersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method VerifiedPartnersClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armeventgrid.VerifiedPartnersClientListOptions) (resp azfake.PagerResponder[armeventgrid.VerifiedPartnersClientListResponse]) +} + +// NewVerifiedPartnersServerTransport creates a new instance of VerifiedPartnersServerTransport with the provided implementation. +// The returned VerifiedPartnersServerTransport instance is connected to an instance of armeventgrid.VerifiedPartnersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewVerifiedPartnersServerTransport(srv *VerifiedPartnersServer) *VerifiedPartnersServerTransport { + return &VerifiedPartnersServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armeventgrid.VerifiedPartnersClientListResponse]](), + } +} + +// VerifiedPartnersServerTransport connects instances of armeventgrid.VerifiedPartnersClient to instances of VerifiedPartnersServer. +// Don't use this type directly, use NewVerifiedPartnersServerTransport instead. +type VerifiedPartnersServerTransport struct { + srv *VerifiedPartnersServer + newListPager *tracker[azfake.PagerResponder[armeventgrid.VerifiedPartnersClientListResponse]] +} + +// Do implements the policy.Transporter interface for VerifiedPartnersServerTransport. +func (v *VerifiedPartnersServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "VerifiedPartnersClient.Get": + resp, err = v.dispatchGet(req) + case "VerifiedPartnersClient.NewListPager": + resp, err = v.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (v *VerifiedPartnersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if v.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/providers/Microsoft\.EventGrid/verifiedPartners/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + verifiedPartnerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("verifiedPartnerName")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.Get(req.Context(), verifiedPartnerNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).VerifiedPartner, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (v *VerifiedPartnersServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if v.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := v.newListPager.get(req) + if newListPager == nil { + qp := req.URL.Query() + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armeventgrid.VerifiedPartnersClientListOptions + if filterParam != nil || topParam != nil { + options = &armeventgrid.VerifiedPartnersClientListOptions{ + Filter: filterParam, + Top: topParam, + } + } + resp := v.srv.NewListPager(options) + newListPager = &resp + v.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armeventgrid.VerifiedPartnersClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + v.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + v.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/go.mod b/sdk/resourcemanager/eventgrid/armeventgrid/go.mod index 0d5d5486a777..5ad36e2df389 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/go.mod +++ b/sdk/resourcemanager/eventgrid/armeventgrid/go.mod @@ -3,27 +3,27 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventg go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 - github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 - github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 - github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 - github.com/stretchr/testify v1.7.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1 + github.com/stretchr/testify v1.8.4 ) require ( - github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/dnaeon/go-vcr v1.1.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect + github.com/dnaeon/go-vcr v1.2.0 // indirect + github.com/golang-jwt/jwt/v5 v5.0.0 // indirect + github.com/google/uuid v1.3.1 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/go.sum b/sdk/resourcemanager/eventgrid/armeventgrid/go.sum index 57a48677bc2c..88bb72abf2ba 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/go.sum +++ b/sdk/resourcemanager/eventgrid/armeventgrid/go.sum @@ -1,24 +1,25 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 h1:fb8kj/Dh4CSwgsOzHeZY4Xh68cFVbzXx+ONXGMY//4w= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0/go.mod h1:uReU2sSxZExRPBAg3qKzmAucSi51+SP1OhohieR821Q= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 h1:BMAjVKJM0U/CYF27gA0ZMmXGkOcvfFtD0oHVZ1TIPRI= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0/go.mod h1:1fXstnBMas5kzG+S3q8UoJcmyU6nUeunJcMDHcRYHhs= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 h1:d81/ng9rET2YqdVkVwkb6EXeRrLJIwyGnJcAlAWKwhs= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 h1:mLY+pNLjCUeKhgnAJWAKhEUQM+RJQo2H1fuGSw1Ky1E= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2/go.mod h1:FbdwsQ2EzwvXxOPcMFYO8ogEc9uMMIj3YkmCdXdAFmk= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 h1:ECsQtyERDVz3NP3kvDOTLvbQhqWp/x9EsGKtb4ogUr8= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0/go.mod h1:s1tW/At+xHqjNFvWU4G0c0Qv33KOhvbGNj0RCTQDV8s= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0 h1:PTFGRSlMKCQelWwxUyYVEUqseBJVemLyqWJjvMyt0do= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0/go.mod h1:LRr2FzBTQlONPPa5HREE5+RjSCTXl7BwOvYOaWTqCaI= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.0.0 h1:pPvTJ1dY0sA35JOeFq6TsY2xj6Z85Yo23Pj4wCCvu4o= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1 h1:7CBQ+Ei8SP2c6ydQTGCCrS35bDxgTMfoP2miAwK++OU= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1/go.mod h1:c/wcGeGx5FUPbM/JltUYHZcKmigwyVLJlDq+4HdtXaw= +github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 h1:WpB/QDNLpMw72xHJc34BNNykqSOeEJDAWkhf0u12/Jk= +github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= +github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE= +github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= @@ -26,23 +27,21 @@ github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9 github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/interfaces.go b/sdk/resourcemanager/eventgrid/armeventgrid/interfaces.go new file mode 100644 index 000000000000..0678b0e7c9e0 --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/interfaces.go @@ -0,0 +1,60 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armeventgrid + +// AdvancedFilterClassification provides polymorphic access to related types. +// Call the interface's GetAdvancedFilter() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AdvancedFilter, *BoolEqualsAdvancedFilter, *IsNotNullAdvancedFilter, *IsNullOrUndefinedAdvancedFilter, *NumberGreaterThanAdvancedFilter, +// - *NumberGreaterThanOrEqualsAdvancedFilter, *NumberInAdvancedFilter, *NumberInRangeAdvancedFilter, *NumberLessThanAdvancedFilter, +// - *NumberLessThanOrEqualsAdvancedFilter, *NumberNotInAdvancedFilter, *NumberNotInRangeAdvancedFilter, *StringBeginsWithAdvancedFilter, +// - *StringContainsAdvancedFilter, *StringEndsWithAdvancedFilter, *StringInAdvancedFilter, *StringNotBeginsWithAdvancedFilter, +// - *StringNotContainsAdvancedFilter, *StringNotEndsWithAdvancedFilter, *StringNotInAdvancedFilter +type AdvancedFilterClassification interface { + // GetAdvancedFilter returns the AdvancedFilter content of the underlying type. + GetAdvancedFilter() *AdvancedFilter +} + +// DeadLetterDestinationClassification provides polymorphic access to related types. +// Call the interface's GetDeadLetterDestination() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *DeadLetterDestination, *StorageBlobDeadLetterDestination +type DeadLetterDestinationClassification interface { + // GetDeadLetterDestination returns the DeadLetterDestination content of the underlying type. + GetDeadLetterDestination() *DeadLetterDestination +} + +// DeliveryAttributeMappingClassification provides polymorphic access to related types. +// Call the interface's GetDeliveryAttributeMapping() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *DeliveryAttributeMapping, *DynamicDeliveryAttributeMapping, *StaticDeliveryAttributeMapping +type DeliveryAttributeMappingClassification interface { + // GetDeliveryAttributeMapping returns the DeliveryAttributeMapping content of the underlying type. + GetDeliveryAttributeMapping() *DeliveryAttributeMapping +} + +// EventSubscriptionDestinationClassification provides polymorphic access to related types. +// Call the interface's GetEventSubscriptionDestination() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AzureFunctionEventSubscriptionDestination, *EventHubEventSubscriptionDestination, *EventSubscriptionDestination, *HybridConnectionEventSubscriptionDestination, +// - *ServiceBusQueueEventSubscriptionDestination, *ServiceBusTopicEventSubscriptionDestination, *StorageQueueEventSubscriptionDestination, +// - *WebHookEventSubscriptionDestination +type EventSubscriptionDestinationClassification interface { + // GetEventSubscriptionDestination returns the EventSubscriptionDestination content of the underlying type. + GetEventSubscriptionDestination() *EventSubscriptionDestination +} + +// InputSchemaMappingClassification provides polymorphic access to related types. +// Call the interface's GetInputSchemaMapping() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *InputSchemaMapping, *JSONInputSchemaMapping +type InputSchemaMappingClassification interface { + // GetInputSchemaMapping returns the InputSchemaMapping content of the underlying type. + GetInputSchemaMapping() *InputSchemaMapping +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/models.go b/sdk/resourcemanager/eventgrid/armeventgrid/models.go index deeaf01513e5..4b2f22fed68e 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/models.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/models.go @@ -3,27 +3,13 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid import "time" -// AdvancedFilterClassification provides polymorphic access to related types. -// Call the interface's GetAdvancedFilter() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AdvancedFilter, *BoolEqualsAdvancedFilter, *IsNotNullAdvancedFilter, *IsNullOrUndefinedAdvancedFilter, *NumberGreaterThanAdvancedFilter, -// - *NumberGreaterThanOrEqualsAdvancedFilter, *NumberInAdvancedFilter, *NumberInRangeAdvancedFilter, *NumberLessThanAdvancedFilter, -// - *NumberLessThanOrEqualsAdvancedFilter, *NumberNotInAdvancedFilter, *NumberNotInRangeAdvancedFilter, *StringBeginsWithAdvancedFilter, -// - *StringContainsAdvancedFilter, *StringEndsWithAdvancedFilter, *StringInAdvancedFilter, *StringNotBeginsWithAdvancedFilter, -// - *StringNotContainsAdvancedFilter, *StringNotEndsWithAdvancedFilter, *StringNotInAdvancedFilter -type AdvancedFilterClassification interface { - // GetAdvancedFilter returns the AdvancedFilter content of the underlying type. - GetAdvancedFilter() *AdvancedFilter -} - // AdvancedFilter - This is the base type that represents an advanced filter. To configure an advanced filter, do not directly // instantiate an object of this class. Instead, instantiate an object of a derived class such // as BoolEqualsAdvancedFilter, NumberInAdvancedFilter, StringEqualsAdvancedFilter etc. depending on the type of the key based @@ -39,32 +25,6 @@ type AdvancedFilter struct { // GetAdvancedFilter implements the AdvancedFilterClassification interface for type AdvancedFilter. func (a *AdvancedFilter) GetAdvancedFilter() *AdvancedFilter { return a } -// AzureADPartnerClientAuthentication - Azure Active Directory Partner Client Authentication -type AzureADPartnerClientAuthentication struct { - // REQUIRED; Type of client authentication - ClientAuthenticationType *PartnerClientAuthenticationType - - // AzureAD ClientAuthentication Properties - Properties *AzureADPartnerClientAuthenticationProperties -} - -// GetPartnerClientAuthentication implements the PartnerClientAuthenticationClassification interface for type AzureADPartnerClientAuthentication. -func (a *AzureADPartnerClientAuthentication) GetPartnerClientAuthentication() *PartnerClientAuthentication { - return &PartnerClientAuthentication{ - ClientAuthenticationType: a.ClientAuthenticationType, - } -} - -// AzureADPartnerClientAuthenticationProperties - Properties of an Azure Active Directory Partner Client Authentication. -type AzureADPartnerClientAuthenticationProperties struct { - // The Azure Active Directory Application ID or URI to get the access token that will be included as the bearer token in delivery - // requests. - AzureActiveDirectoryApplicationIDOrURI *string - - // The Azure Active Directory Tenant ID to get the access token that will be included as the bearer token in delivery requests. - AzureActiveDirectoryTenantID *string -} - // AzureFunctionEventSubscriptionDestination - Information about the azure function destination for an event subscription. type AzureFunctionEventSubscriptionDestination struct { // REQUIRED; Type of the endpoint for the event subscription destination. @@ -112,109 +72,11 @@ type BoolEqualsAdvancedFilter struct { // GetAdvancedFilter implements the AdvancedFilterClassification interface for type BoolEqualsAdvancedFilter. func (b *BoolEqualsAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { return &AdvancedFilter{ - OperatorType: b.OperatorType, Key: b.Key, - } -} - -// BoolEqualsFilter - BoolEquals Filter. -type BoolEqualsFilter struct { - // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. - OperatorType *FilterOperatorType - - // The field/property in the event based on which you want to filter. - Key *string - - // The boolean filter value. - Value *bool -} - -// GetFilter implements the FilterClassification interface for type BoolEqualsFilter. -func (b *BoolEqualsFilter) GetFilter() *Filter { - return &Filter{ OperatorType: b.OperatorType, - Key: b.Key, } } -// CaCertificate - The CA Certificate resource. -type CaCertificate struct { - // The properties of CA certificate. - Properties *CaCertificateProperties - - // READ-ONLY; Fully qualified identifier of the resource. - ID *string - - // READ-ONLY; Name of the resource. - Name *string - - // READ-ONLY; The system metadata relating to the CaCertificate resource. - SystemData *SystemData - - // READ-ONLY; Type of the resource. - Type *string -} - -// CaCertificateProperties - The properties of CA certificate. -type CaCertificateProperties struct { - // Description for the CA Certificate resource. - Description *string - - // Base64 encoded PEM (Privacy Enhanced Mail) format certificate data. - EncodedCertificate *string - - // READ-ONLY; Certificate expiry time in UTC. This is a read-only field. - ExpiryTimeInUTC *time.Time - - // READ-ONLY; Certificate issue time in UTC. This is a read-only field. - IssueTimeInUTC *time.Time - - // READ-ONLY; Provisioning state of the CA Certificate resource. - ProvisioningState *CaCertificateProvisioningState -} - -// CaCertificatesClientBeginCreateOrUpdateOptions contains the optional parameters for the CaCertificatesClient.BeginCreateOrUpdate -// method. -type CaCertificatesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CaCertificatesClientBeginDeleteOptions contains the optional parameters for the CaCertificatesClient.BeginDelete method. -type CaCertificatesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CaCertificatesClientGetOptions contains the optional parameters for the CaCertificatesClient.Get method. -type CaCertificatesClientGetOptions struct { - // placeholder for future optional parameters -} - -// CaCertificatesClientListByNamespaceOptions contains the optional parameters for the CaCertificatesClient.NewListByNamespacePager -// method. -type CaCertificatesClientListByNamespaceOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// CaCertificatesListResult - Result of the List CA Certificate operation. -type CaCertificatesListResult struct { - // A link for the next page of CA Certificate. - NextLink *string - - // A collection of CA Certificate. - Value []*CaCertificate -} - // Channel info. type Channel struct { // Properties of the Channel. @@ -245,10 +107,6 @@ type ChannelProperties struct { // Context or helpful message that can be used during the approval process by the subscriber. MessageForActivation *string - // This property should be populated when channelType is PartnerDestination and represents information about the partner destination - // resource corresponding to the channel. - PartnerDestinationInfo PartnerDestinationInfoClassification - // This property should be populated when channelType is PartnerTopic and represents information about the partner topic resource // corresponding to the channel. PartnerTopicInfo *PartnerTopicInfo @@ -273,54 +131,10 @@ type ChannelUpdateParametersProperties struct { // destination are deleted. ExpirationTimeIfNotActivatedUTC *time.Time - // Partner destination properties which can be updated if the channel is of type PartnerDestination. - PartnerDestinationInfo PartnerUpdateDestinationInfoClassification - // Partner topic properties which can be updated if the channel is of type PartnerTopic. PartnerTopicInfo *PartnerUpdateTopicInfo } -// ChannelsClientBeginDeleteOptions contains the optional parameters for the ChannelsClient.BeginDelete method. -type ChannelsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ChannelsClientCreateOrUpdateOptions contains the optional parameters for the ChannelsClient.CreateOrUpdate method. -type ChannelsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ChannelsClientGetFullURLOptions contains the optional parameters for the ChannelsClient.GetFullURL method. -type ChannelsClientGetFullURLOptions struct { - // placeholder for future optional parameters -} - -// ChannelsClientGetOptions contains the optional parameters for the ChannelsClient.Get method. -type ChannelsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ChannelsClientListByPartnerNamespaceOptions contains the optional parameters for the ChannelsClient.NewListByPartnerNamespacePager -// method. -type ChannelsClientListByPartnerNamespaceOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// ChannelsClientUpdateOptions contains the optional parameters for the ChannelsClient.Update method. -type ChannelsClientUpdateOptions struct { - // placeholder for future optional parameters -} - // ChannelsListResult - Result of the List Channels operation type ChannelsListResult struct { // A link for the next page of channels. @@ -330,214 +144,6 @@ type ChannelsListResult struct { Value []*Channel } -// Client - The Client resource. -type Client struct { - // The properties of client. - Properties *ClientProperties - - // READ-ONLY; Fully qualified identifier of the resource. - ID *string - - // READ-ONLY; Name of the resource. - Name *string - - // READ-ONLY; The system metadata relating to the Client resource. - SystemData *SystemData - - // READ-ONLY; Type of the resource. - Type *string -} - -// ClientAuthentication - The Authentication properties for the client. -type ClientAuthentication struct { - // The CA certificate subject name used for authentication. - CertificateSubject *ClientCertificateSubjectDistinguishedName - - // The self signed certificate's thumbprints data used for authentication. - CertificateThumbprint *ClientCertificateThumbprint -} - -// ClientAuthenticationSettings - Client authentication settings for namespace resource. -type ClientAuthenticationSettings struct { - // Alternative authentication name sources related to client authentication settings for namespace resource. - AlternativeAuthenticationNameSources []*AlternativeAuthenticationNameSource -} - -// ClientCertificateAuthentication - The certificate authentication properties for the client. -type ClientCertificateAuthentication struct { - // The list of thumbprints that are allowed during client authentication. This property is required only if the validationScheme - // is 'ThumbprintMatch'. - AllowedThumbprints []*string - - // The validation scheme used to authenticate the client. Default value is SubjectMatchesAuthenticationName. - ValidationScheme *ClientCertificateValidationScheme -} - -// ClientCertificateSubjectDistinguishedName - CA certificate subject distinguished name information used by service to authenticate -// clients. For more information, see -// https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.x509certificates.x500distinguishedname?view=net-6.0#remarks -type ClientCertificateSubjectDistinguishedName struct { - // The common name field in the subject name. The allowed limit is 64 characters and it should be specified. - CommonName *string - - // The country code field in the subject name. If present, the country code should be represented by two-letter code defined - // in ISO 2166-1 (alpha-2). For example: 'US'. - CountryCode *string - - // The organization field in the subject name. If present, the allowed limit is 64 characters. - Organization *string - - // The organization unit field in the subject name. If present, the allowed limit is 32 characters. - OrganizationUnit *string -} - -// ClientCertificateThumbprint - Thumbprints are used by the service to validate the device permission when authentication -// is done using self signed certificate. -type ClientCertificateThumbprint struct { - // The primary thumbprint used for validation. - Primary *string - - // The secondary thumbprint used for validation. - Secondary *string -} - -// ClientGroup - The Client group resource. -type ClientGroup struct { - // The properties of client group. - Properties *ClientGroupProperties - - // READ-ONLY; Fully qualified identifier of the resource. - ID *string - - // READ-ONLY; Name of the resource. - Name *string - - // READ-ONLY; The system metadata relating to the ClientGroup resource. - SystemData *SystemData - - // READ-ONLY; Type of the resource. - Type *string -} - -// ClientGroupProperties - The properties of client group. -type ClientGroupProperties struct { - // Description for the Client Group resource. - Description *string - - // The grouping query for the clients. Example : attributes.keyName IN ['a', 'b', 'c']. - Query *string - - // READ-ONLY; Provisioning state of the ClientGroup resource. - ProvisioningState *ClientGroupProvisioningState -} - -// ClientGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the ClientGroupsClient.BeginCreateOrUpdate -// method. -type ClientGroupsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClientGroupsClientBeginDeleteOptions contains the optional parameters for the ClientGroupsClient.BeginDelete method. -type ClientGroupsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClientGroupsClientGetOptions contains the optional parameters for the ClientGroupsClient.Get method. -type ClientGroupsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ClientGroupsClientListByNamespaceOptions contains the optional parameters for the ClientGroupsClient.NewListByNamespacePager -// method. -type ClientGroupsClientListByNamespaceOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// ClientGroupsListResult - Result of the List Client Group operation. -type ClientGroupsListResult struct { - // A link for the next page of Client Group. - NextLink *string - - // A collection of Client Group. - Value []*ClientGroup -} - -// ClientProperties - The properties of client. -type ClientProperties struct { - // Attributes for the client. Supported values are int, bool, string, string[]. Example: "attributes": { "room": "345", "floor": - // 12, "deviceTypes": ["Fan", "Light"] } - Attributes map[string]any - - // Authentication information for the client. - Authentication *ClientAuthentication - - // The name presented by the client for authentication. The default value is the name of the resource. - AuthenticationName *string - - // The client certificate authentication information. - ClientCertificateAuthentication *ClientCertificateAuthentication - - // Description for the Client resource. - Description *string - - // Indicates if the client is enabled or not. Default value is Enabled. - State *ClientState - - // READ-ONLY; Provisioning state of the Client resource. - ProvisioningState *ClientProvisioningState -} - -// ClientsClientBeginCreateOrUpdateOptions contains the optional parameters for the ClientsClient.BeginCreateOrUpdate method. -type ClientsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClientsClientBeginDeleteOptions contains the optional parameters for the ClientsClient.BeginDelete method. -type ClientsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClientsClientGetOptions contains the optional parameters for the ClientsClient.Get method. -type ClientsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ClientsClientListByNamespaceOptions contains the optional parameters for the ClientsClient.NewListByNamespacePager method. -type ClientsClientListByNamespaceOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// ClientsListResult - Result of the List Client operation. -type ClientsListResult struct { - // A link for the next page of Client. - NextLink *string - - // A collection of Client. - Value []*Client -} - // ConnectionState information. type ConnectionState struct { // Actions required (if any). @@ -550,15 +156,6 @@ type ConnectionState struct { Status *PersistedConnectionStatus } -// DeadLetterDestinationClassification provides polymorphic access to related types. -// Call the interface's GetDeadLetterDestination() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *DeadLetterDestination, *StorageBlobDeadLetterDestination -type DeadLetterDestinationClassification interface { - // GetDeadLetterDestination returns the DeadLetterDestination content of the underlying type. - GetDeadLetterDestination() *DeadLetterDestination -} - // DeadLetterDestination - Information about the dead letter destination for an event subscription. To configure a deadletter // destination, do not directly instantiate an object of this class. Instead, instantiate an object of a // derived class. Currently, StorageBlobDeadLetterDestination is the only class that derives from this class. @@ -587,15 +184,6 @@ type DeliveryAttributeListResult struct { Value []DeliveryAttributeMappingClassification } -// DeliveryAttributeMappingClassification provides polymorphic access to related types. -// Call the interface's GetDeliveryAttributeMapping() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *DeliveryAttributeMapping, *DynamicDeliveryAttributeMapping, *StaticDeliveryAttributeMapping -type DeliveryAttributeMappingClassification interface { - // GetDeliveryAttributeMapping returns the DeliveryAttributeMapping content of the underlying type. - GetDeliveryAttributeMapping() *DeliveryAttributeMapping -} - // DeliveryAttributeMapping - Delivery attribute mapping details. type DeliveryAttributeMapping struct { // REQUIRED; Type of the delivery attribute or header name. @@ -608,15 +196,6 @@ type DeliveryAttributeMapping struct { // GetDeliveryAttributeMapping implements the DeliveryAttributeMappingClassification interface for type DeliveryAttributeMapping. func (d *DeliveryAttributeMapping) GetDeliveryAttributeMapping() *DeliveryAttributeMapping { return d } -// DeliveryConfiguration - Properties of the delivery configuration information of the event subscription. -type DeliveryConfiguration struct { - // Delivery mode of the event subscription. - DeliveryMode *DeliveryMode - - // This property should be populated when deliveryMode is queue and represents information about the queue subscription. - Queue *QueueInfo -} - // DeliveryWithResourceIdentity - Information about the delivery for an event subscription with resource identity. type DeliveryWithResourceIdentity struct { // Information about the destination where events have to be delivered for the event subscription. Uses Azure Event Grid's @@ -639,9 +218,6 @@ type Domain struct { // Properties of the Event Grid Domain resource. Properties *DomainProperties - // The Sku pricing tier for the Event Grid Domain resource. - SKU *ResourceSKU - // Tags of the resource. Tags map[string]*string @@ -658,59 +234,6 @@ type Domain struct { Type *string } -// DomainEventSubscriptionsClientBeginCreateOrUpdateOptions contains the optional parameters for the DomainEventSubscriptionsClient.BeginCreateOrUpdate -// method. -type DomainEventSubscriptionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DomainEventSubscriptionsClientBeginDeleteOptions contains the optional parameters for the DomainEventSubscriptionsClient.BeginDelete -// method. -type DomainEventSubscriptionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DomainEventSubscriptionsClientBeginUpdateOptions contains the optional parameters for the DomainEventSubscriptionsClient.BeginUpdate -// method. -type DomainEventSubscriptionsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DomainEventSubscriptionsClientGetDeliveryAttributesOptions contains the optional parameters for the DomainEventSubscriptionsClient.GetDeliveryAttributes -// method. -type DomainEventSubscriptionsClientGetDeliveryAttributesOptions struct { - // placeholder for future optional parameters -} - -// DomainEventSubscriptionsClientGetFullURLOptions contains the optional parameters for the DomainEventSubscriptionsClient.GetFullURL -// method. -type DomainEventSubscriptionsClientGetFullURLOptions struct { - // placeholder for future optional parameters -} - -// DomainEventSubscriptionsClientGetOptions contains the optional parameters for the DomainEventSubscriptionsClient.Get method. -type DomainEventSubscriptionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DomainEventSubscriptionsClientListOptions contains the optional parameters for the DomainEventSubscriptionsClient.NewListPager -// method. -type DomainEventSubscriptionsClientListOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - // DomainProperties - Properties of the Event Grid Domain Resource. type DomainProperties struct { // This Boolean is used to specify the creation mechanism for 'all' the Event Grid Domain Topics associated with this Event @@ -744,10 +267,6 @@ type DomainProperties struct { // token will be used to authenticate if user is allowed to publish to the domain. DisableLocalAuth *bool - // Event Type Information for the domain. This information is provided by the publisher and can be used by the subscriber - // to view different types of events that are published. - EventTypeInfo *EventTypeInfo - // This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess // is enabled. InboundIPRules []*InboundIPRule @@ -758,9 +277,6 @@ type DomainProperties struct { // Information about the InputSchemaMapping which specified the info about mapping event payload. InputSchemaMapping InputSchemaMappingClassification - // Minimum TLS version of the publisher allowed to publish to this domain - MinimumTLSVersionAllowed *TLSVersion - // This determines if traffic is allowed over public network. By default it is enabled. You can further restrict to specific // IPs by configuring PublicNetworkAccess *PublicNetworkAccess @@ -771,7 +287,7 @@ type DomainProperties struct { // READ-ONLY; Metric resource id for the Event Grid Domain Resource. MetricResourceID *string - // READ-ONLY + // READ-ONLY; List of private endpoint connections. PrivateEndpointConnections []*PrivateEndpointConnection // READ-ONLY; Provisioning state of the Event Grid Domain Resource. @@ -811,99 +327,12 @@ type DomainTopic struct { Type *string } -// DomainTopicEventSubscriptionsClientBeginCreateOrUpdateOptions contains the optional parameters for the DomainTopicEventSubscriptionsClient.BeginCreateOrUpdate -// method. -type DomainTopicEventSubscriptionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DomainTopicEventSubscriptionsClientBeginDeleteOptions contains the optional parameters for the DomainTopicEventSubscriptionsClient.BeginDelete -// method. -type DomainTopicEventSubscriptionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DomainTopicEventSubscriptionsClientBeginUpdateOptions contains the optional parameters for the DomainTopicEventSubscriptionsClient.BeginUpdate -// method. -type DomainTopicEventSubscriptionsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DomainTopicEventSubscriptionsClientGetDeliveryAttributesOptions contains the optional parameters for the DomainTopicEventSubscriptionsClient.GetDeliveryAttributes -// method. -type DomainTopicEventSubscriptionsClientGetDeliveryAttributesOptions struct { - // placeholder for future optional parameters -} - -// DomainTopicEventSubscriptionsClientGetFullURLOptions contains the optional parameters for the DomainTopicEventSubscriptionsClient.GetFullURL -// method. -type DomainTopicEventSubscriptionsClientGetFullURLOptions struct { - // placeholder for future optional parameters -} - -// DomainTopicEventSubscriptionsClientGetOptions contains the optional parameters for the DomainTopicEventSubscriptionsClient.Get -// method. -type DomainTopicEventSubscriptionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DomainTopicEventSubscriptionsClientListOptions contains the optional parameters for the DomainTopicEventSubscriptionsClient.NewListPager -// method. -type DomainTopicEventSubscriptionsClientListOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - // DomainTopicProperties - Properties of the Domain Topic. type DomainTopicProperties struct { // READ-ONLY; Provisioning state of the domain topic. ProvisioningState *DomainTopicProvisioningState } -// DomainTopicsClientBeginCreateOrUpdateOptions contains the optional parameters for the DomainTopicsClient.BeginCreateOrUpdate -// method. -type DomainTopicsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DomainTopicsClientBeginDeleteOptions contains the optional parameters for the DomainTopicsClient.BeginDelete method. -type DomainTopicsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DomainTopicsClientGetOptions contains the optional parameters for the DomainTopicsClient.Get method. -type DomainTopicsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DomainTopicsClientListByDomainOptions contains the optional parameters for the DomainTopicsClient.NewListByDomainPager -// method. -type DomainTopicsClientListByDomainOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - // DomainTopicsListResult - Result of the List Domain Topics operation. type DomainTopicsListResult struct { // A link for the next page of domain topics. @@ -946,16 +375,10 @@ type DomainUpdateParameterProperties struct { // token will be used to authenticate if user is allowed to publish to the domain. DisableLocalAuth *bool - // The eventTypeInfo for the domain. - EventTypeInfo *EventTypeInfo - // This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess // is enabled. InboundIPRules []*InboundIPRule - // Minimum TLS version of the publisher allowed to publish to this domain - MinimumTLSVersionAllowed *TLSVersion - // This determines if traffic is allowed over public network. By default it is enabled. You can further restrict to specific // IPs by configuring PublicNetworkAccess *PublicNetworkAccess @@ -969,76 +392,10 @@ type DomainUpdateParameters struct { // Properties of the resource. Properties *DomainUpdateParameterProperties - // The Sku pricing tier for the domain. - SKU *ResourceSKU - // Tags of the domains resource. Tags map[string]*string } -// DomainsClientBeginCreateOrUpdateOptions contains the optional parameters for the DomainsClient.BeginCreateOrUpdate method. -type DomainsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DomainsClientBeginDeleteOptions contains the optional parameters for the DomainsClient.BeginDelete method. -type DomainsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DomainsClientBeginUpdateOptions contains the optional parameters for the DomainsClient.BeginUpdate method. -type DomainsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DomainsClientGetOptions contains the optional parameters for the DomainsClient.Get method. -type DomainsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DomainsClientListByResourceGroupOptions contains the optional parameters for the DomainsClient.NewListByResourceGroupPager -// method. -type DomainsClientListByResourceGroupOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// DomainsClientListBySubscriptionOptions contains the optional parameters for the DomainsClient.NewListBySubscriptionPager -// method. -type DomainsClientListBySubscriptionOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// DomainsClientListSharedAccessKeysOptions contains the optional parameters for the DomainsClient.ListSharedAccessKeys method. -type DomainsClientListSharedAccessKeysOptions struct { - // placeholder for future optional parameters -} - -// DomainsClientRegenerateKeyOptions contains the optional parameters for the DomainsClient.RegenerateKey method. -type DomainsClientRegenerateKeyOptions struct { - // placeholder for future optional parameters -} - // DomainsListResult - Result of the List Domains operation. type DomainsListResult struct { // A link for the next page of domains. @@ -1074,48 +431,6 @@ type DynamicDeliveryAttributeMappingProperties struct { SourceField *string } -type DynamicRoutingEnrichment struct { - // Dynamic routing enrichment key. - Key *string - - // Dynamic routing enrichment value. - Value *string -} - -// ErrorAdditionalInfo - The resource management error additional info. -type ErrorAdditionalInfo struct { - // READ-ONLY; The additional info. - Info any - - // READ-ONLY; The additional info type. - Type *string -} - -// ErrorDetail - The error detail. -type ErrorDetail struct { - // READ-ONLY; The error additional info. - AdditionalInfo []*ErrorAdditionalInfo - - // READ-ONLY; The error code. - Code *string - - // READ-ONLY; The error details. - Details []*ErrorDetail - - // READ-ONLY; The error message. - Message *string - - // READ-ONLY; The error target. - Target *string -} - -// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. -// (This also follows the OData error response format.). -type ErrorResponse struct { - // The error object. - Error *ErrorDetail -} - // EventHubEventSubscriptionDestination - Information about the event hub destination for an event subscription. type EventHubEventSubscriptionDestination struct { // REQUIRED; Type of the endpoint for the event subscription destination. @@ -1141,7 +456,7 @@ type EventHubEventSubscriptionDestinationProperties struct { ResourceID *string } -// EventSubscription - Event Subscription. +// EventSubscription - Event Subscription type EventSubscription struct { // Properties of the event subscription. Properties *EventSubscriptionProperties @@ -1159,17 +474,6 @@ type EventSubscription struct { Type *string } -// EventSubscriptionDestinationClassification provides polymorphic access to related types. -// Call the interface's GetEventSubscriptionDestination() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureFunctionEventSubscriptionDestination, *EventHubEventSubscriptionDestination, *EventSubscriptionDestination, *HybridConnectionEventSubscriptionDestination, -// - *PartnerEventSubscriptionDestination, *ServiceBusQueueEventSubscriptionDestination, *ServiceBusTopicEventSubscriptionDestination, -// - *StorageQueueEventSubscriptionDestination, *WebHookEventSubscriptionDestination -type EventSubscriptionDestinationClassification interface { - // GetEventSubscriptionDestination returns the EventSubscriptionDestination content of the underlying type. - GetEventSubscriptionDestination() *EventSubscriptionDestination -} - // EventSubscriptionDestination - Information about the destination for an event subscription. type EventSubscriptionDestination struct { // REQUIRED; Type of the endpoint for the event subscription destination. @@ -1305,194 +609,6 @@ type EventSubscriptionUpdateParameters struct { RetryPolicy *RetryPolicy } -// EventSubscriptionsClientBeginCreateOrUpdateOptions contains the optional parameters for the EventSubscriptionsClient.BeginCreateOrUpdate -// method. -type EventSubscriptionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// EventSubscriptionsClientBeginDeleteOptions contains the optional parameters for the EventSubscriptionsClient.BeginDelete -// method. -type EventSubscriptionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// EventSubscriptionsClientBeginUpdateOptions contains the optional parameters for the EventSubscriptionsClient.BeginUpdate -// method. -type EventSubscriptionsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// EventSubscriptionsClientGetDeliveryAttributesOptions contains the optional parameters for the EventSubscriptionsClient.GetDeliveryAttributes -// method. -type EventSubscriptionsClientGetDeliveryAttributesOptions struct { - // placeholder for future optional parameters -} - -// EventSubscriptionsClientGetFullURLOptions contains the optional parameters for the EventSubscriptionsClient.GetFullURL -// method. -type EventSubscriptionsClientGetFullURLOptions struct { - // placeholder for future optional parameters -} - -// EventSubscriptionsClientGetOptions contains the optional parameters for the EventSubscriptionsClient.Get method. -type EventSubscriptionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// EventSubscriptionsClientListByDomainTopicOptions contains the optional parameters for the EventSubscriptionsClient.NewListByDomainTopicPager -// method. -type EventSubscriptionsClientListByDomainTopicOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// EventSubscriptionsClientListByResourceOptions contains the optional parameters for the EventSubscriptionsClient.NewListByResourcePager -// method. -type EventSubscriptionsClientListByResourceOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// EventSubscriptionsClientListGlobalByResourceGroupForTopicTypeOptions contains the optional parameters for the EventSubscriptionsClient.NewListGlobalByResourceGroupForTopicTypePager -// method. -type EventSubscriptionsClientListGlobalByResourceGroupForTopicTypeOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// EventSubscriptionsClientListGlobalByResourceGroupOptions contains the optional parameters for the EventSubscriptionsClient.NewListGlobalByResourceGroupPager -// method. -type EventSubscriptionsClientListGlobalByResourceGroupOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// EventSubscriptionsClientListGlobalBySubscriptionForTopicTypeOptions contains the optional parameters for the EventSubscriptionsClient.NewListGlobalBySubscriptionForTopicTypePager -// method. -type EventSubscriptionsClientListGlobalBySubscriptionForTopicTypeOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// EventSubscriptionsClientListGlobalBySubscriptionOptions contains the optional parameters for the EventSubscriptionsClient.NewListGlobalBySubscriptionPager -// method. -type EventSubscriptionsClientListGlobalBySubscriptionOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// EventSubscriptionsClientListRegionalByResourceGroupForTopicTypeOptions contains the optional parameters for the EventSubscriptionsClient.NewListRegionalByResourceGroupForTopicTypePager -// method. -type EventSubscriptionsClientListRegionalByResourceGroupForTopicTypeOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// EventSubscriptionsClientListRegionalByResourceGroupOptions contains the optional parameters for the EventSubscriptionsClient.NewListRegionalByResourceGroupPager -// method. -type EventSubscriptionsClientListRegionalByResourceGroupOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// EventSubscriptionsClientListRegionalBySubscriptionForTopicTypeOptions contains the optional parameters for the EventSubscriptionsClient.NewListRegionalBySubscriptionForTopicTypePager -// method. -type EventSubscriptionsClientListRegionalBySubscriptionForTopicTypeOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// EventSubscriptionsClientListRegionalBySubscriptionOptions contains the optional parameters for the EventSubscriptionsClient.NewListRegionalBySubscriptionPager -// method. -type EventSubscriptionsClientListRegionalBySubscriptionOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - // EventSubscriptionsListResult - Result of the List EventSubscriptions operation type EventSubscriptionsListResult struct { // A link for the next page of event subscriptions @@ -1550,18 +666,9 @@ type EventTypesListResult struct { Value []*EventType } -// ExtendedLocation - Definition of an Extended Location -type ExtendedLocation struct { - // Fully qualified name of the extended location. - Name *string - - // Type of the extended location. - Type *string -} - // ExtensionTopic - Event grid Extension Topic. This is used for getting Event Grid related metrics for Azure resources. type ExtensionTopic struct { - // Properties of the extension topic. + // Properties of the extension topic Properties *ExtensionTopicProperties // READ-ONLY; Fully qualified identifier of the resource. @@ -1586,51 +693,10 @@ type ExtensionTopicProperties struct { SystemTopic *string } -// ExtensionTopicsClientGetOptions contains the optional parameters for the ExtensionTopicsClient.Get method. -type ExtensionTopicsClientGetOptions struct { - // placeholder for future optional parameters -} - -// FilterClassification provides polymorphic access to related types. -// Call the interface's GetFilter() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *BoolEqualsFilter, *Filter, *IsNotNullFilter, *IsNullOrUndefinedFilter, *NumberGreaterThanFilter, *NumberGreaterThanOrEqualsFilter, -// - *NumberInFilter, *NumberInRangeFilter, *NumberLessThanFilter, *NumberLessThanOrEqualsFilter, *NumberNotInFilter, *NumberNotInRangeFilter, -// - *StringBeginsWithFilter, *StringContainsFilter, *StringEndsWithFilter, *StringInFilter, *StringNotBeginsWithFilter, *StringNotContainsFilter, -// - *StringNotEndsWithFilter, *StringNotInFilter -type FilterClassification interface { - // GetFilter returns the Filter content of the underlying type. - GetFilter() *Filter -} - -// Filter - This is the base type that represents a filter. To configure a filter, do not directly instantiate an object of -// this class. Instead, instantiate an object of a derived class such as BoolEqualsFilter, -// NumberInFilter, StringEqualsFilter etc depending on the type of the key based on which you want to filter. -type Filter struct { - // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. - OperatorType *FilterOperatorType - - // The field/property in the event based on which you want to filter. - Key *string -} - -// GetFilter implements the FilterClassification interface for type Filter. -func (f *Filter) GetFilter() *Filter { return f } - -// FiltersConfiguration - Filters configuration for the Event Subscription. -type FiltersConfiguration struct { - // An array of filters that are used for filtering event subscriptions. - Filters []FilterClassification - - // A list of applicable event types that need to be part of the event subscription. If it is desired to subscribe to all default - // event types, set the IncludedEventTypes to null. - IncludedEventTypes []*string -} - -// HybridConnectionEventSubscriptionDestination - Information about the HybridConnection destination for an event subscription. -type HybridConnectionEventSubscriptionDestination struct { - // REQUIRED; Type of the endpoint for the event subscription destination. - EndpointType *EndpointType +// HybridConnectionEventSubscriptionDestination - Information about the HybridConnection destination for an event subscription. +type HybridConnectionEventSubscriptionDestination struct { + // REQUIRED; Type of the endpoint for the event subscription destination. + EndpointType *EndpointType // Hybrid connection Properties of the event subscription destination. Properties *HybridConnectionEventSubscriptionDestinationProperties @@ -1695,15 +761,6 @@ type InlineEventProperties struct { DocumentationURL *string } -// InputSchemaMappingClassification provides polymorphic access to related types. -// Call the interface's GetInputSchemaMapping() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *InputSchemaMapping, *JSONInputSchemaMapping -type InputSchemaMappingClassification interface { - // GetInputSchemaMapping returns the InputSchemaMapping content of the underlying type. - GetInputSchemaMapping() *InputSchemaMapping -} - // InputSchemaMapping - By default, Event Grid expects events to be in the Event Grid event schema. Specifying an input schema // mapping enables publishing to Event Grid using a custom input schema. Currently, the only // supported type of InputSchemaMapping is 'JsonInputSchemaMapping'. @@ -1727,25 +784,8 @@ type IsNotNullAdvancedFilter struct { // GetAdvancedFilter implements the AdvancedFilterClassification interface for type IsNotNullAdvancedFilter. func (i *IsNotNullAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { return &AdvancedFilter{ - OperatorType: i.OperatorType, Key: i.Key, - } -} - -// IsNotNullFilter - IsNotNull Filter. -type IsNotNullFilter struct { - // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. - OperatorType *FilterOperatorType - - // The field/property in the event based on which you want to filter. - Key *string -} - -// GetFilter implements the FilterClassification interface for type IsNotNullFilter. -func (i *IsNotNullFilter) GetFilter() *Filter { - return &Filter{ OperatorType: i.OperatorType, - Key: i.Key, } } @@ -1761,25 +801,8 @@ type IsNullOrUndefinedAdvancedFilter struct { // GetAdvancedFilter implements the AdvancedFilterClassification interface for type IsNullOrUndefinedAdvancedFilter. func (i *IsNullOrUndefinedAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { return &AdvancedFilter{ - OperatorType: i.OperatorType, Key: i.Key, - } -} - -// IsNullOrUndefinedFilter - IsNullOrUndefined Filter. -type IsNullOrUndefinedFilter struct { - // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. - OperatorType *FilterOperatorType - - // The field/property in the event based on which you want to filter. - Key *string -} - -// GetFilter implements the FilterClassification interface for type IsNullOrUndefinedFilter. -func (i *IsNullOrUndefinedFilter) GetFilter() *Filter { - return &Filter{ OperatorType: i.OperatorType, - Key: i.Key, } } @@ -1843,345 +866,6 @@ type JSONInputSchemaMappingProperties struct { Topic *JSONField } -// Namespace resource. -type Namespace struct { - // REQUIRED; Location of the resource. - Location *string - - // Identity information for the Namespace resource. - Identity *IdentityInfo - - // Properties of the Namespace resource. - Properties *NamespaceProperties - - // Represents available Sku pricing tiers. - SKU *NamespaceSKU - - // Tags of the resource. - Tags map[string]*string - - // READ-ONLY; Fully qualified identifier of the resource. - ID *string - - // READ-ONLY; Name of the resource. - Name *string - - // READ-ONLY; The system metadata relating to the namespace resource. - SystemData *SystemData - - // READ-ONLY; Type of the resource. - Type *string -} - -// NamespaceProperties - Properties of the namespace resource. -type NamespaceProperties struct { - // This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess - // is enabled. - InboundIPRules []*InboundIPRule - - // Allows the user to specify if the service is zone-redundant. This is a required property and user needs to specify this - // value explicitly. Once specified, this property cannot be updated. - IsZoneRedundant *bool - - // Minimum TLS version of the publisher allowed to publish to this namespace. Only TLS version 1.2 is supported. - MinimumTLSVersionAllowed *TLSVersion - PrivateEndpointConnections []*PrivateEndpointConnection - - // This determines if traffic is allowed over public network. By default it is enabled. You can further restrict to specific - // IPs by configuring - PublicNetworkAccess *PublicNetworkAccess - - // Topic spaces configuration information for the namespace resource - TopicSpacesConfiguration *TopicSpacesConfiguration - - // Topics configuration information for the namespace resource - TopicsConfiguration *TopicsConfiguration - - // READ-ONLY; Provisioning state of the namespace resource. - ProvisioningState *NamespaceProvisioningState -} - -// NamespaceRegenerateKeyRequest - Namespace regenerate share access key request. -type NamespaceRegenerateKeyRequest struct { - // REQUIRED; Key name to regenerate key1 or key2. - KeyName *string -} - -// NamespaceSKU - Represents available Sku pricing tiers. -type NamespaceSKU struct { - // Specifies the number of Throughput Units that defines the capacity for the namespace. The property default value is 1 which - // signifies 1 Throughput Unit = 1MB/s ingress and 2MB/s egress per namespace. - // Min capacity is 1 and max allowed capacity is 20. - Capacity *int32 - - // The name of the SKU. - Name *SKUName -} - -// NamespaceSharedAccessKeys - Shared access keys of the Namespace. -type NamespaceSharedAccessKeys struct { - // Shared access key1 for the namespace. - Key1 *string - - // Shared access key2 for the namespace. - Key2 *string -} - -// NamespaceTopic - Namespace topic details. -type NamespaceTopic struct { - // Properties of the namespace topic. - Properties *NamespaceTopicProperties - - // READ-ONLY; Fully qualified identifier of the resource. - ID *string - - // READ-ONLY; Name of the resource. - Name *string - - // READ-ONLY; The system metadata relating to namespace topic resource. - SystemData *SystemData - - // READ-ONLY; Type of the resource. - Type *string -} - -// NamespaceTopicEventSubscriptionsClientBeginCreateOrUpdateOptions contains the optional parameters for the NamespaceTopicEventSubscriptionsClient.BeginCreateOrUpdate -// method. -type NamespaceTopicEventSubscriptionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// NamespaceTopicEventSubscriptionsClientBeginDeleteOptions contains the optional parameters for the NamespaceTopicEventSubscriptionsClient.BeginDelete -// method. -type NamespaceTopicEventSubscriptionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// NamespaceTopicEventSubscriptionsClientBeginUpdateOptions contains the optional parameters for the NamespaceTopicEventSubscriptionsClient.BeginUpdate -// method. -type NamespaceTopicEventSubscriptionsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// NamespaceTopicEventSubscriptionsClientGetOptions contains the optional parameters for the NamespaceTopicEventSubscriptionsClient.Get -// method. -type NamespaceTopicEventSubscriptionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// NamespaceTopicEventSubscriptionsClientListByNamespaceTopicOptions contains the optional parameters for the NamespaceTopicEventSubscriptionsClient.NewListByNamespaceTopicPager -// method. -type NamespaceTopicEventSubscriptionsClientListByNamespaceTopicOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// NamespaceTopicProperties - Properties of the namespace topic. -type NamespaceTopicProperties struct { - // Event retention for the namespace topic expressed in days. The property default value is 1 day. Min event retention duration - // value is 1 day and max event retention duration value is 1 day. - EventRetentionInDays *int32 - - // This determines the format that is expected for incoming events published to the topic. - InputSchema *EventInputSchema - - // Publisher type of the namespace topic. - PublisherType *PublisherType - - // READ-ONLY; Provisioning state of the namespace topic. - ProvisioningState *NamespaceTopicProvisioningState -} - -// NamespaceTopicUpdateParameterProperties - Information of namespace topic update parameter properties. -type NamespaceTopicUpdateParameterProperties struct { - // Event retention for the namespace topic expressed in days. The property default value is 1 day. Min event retention duration - // value is 1 day and max event retention duration value is 1 day. - EventRetentionInDays *int32 -} - -// NamespaceTopicUpdateParameters - Properties of the namespace topic update. -type NamespaceTopicUpdateParameters struct { - // Properties of the namespace topic resource. - Properties *NamespaceTopicUpdateParameterProperties -} - -// NamespaceTopicsClientBeginCreateOrUpdateOptions contains the optional parameters for the NamespaceTopicsClient.BeginCreateOrUpdate -// method. -type NamespaceTopicsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// NamespaceTopicsClientBeginDeleteOptions contains the optional parameters for the NamespaceTopicsClient.BeginDelete method. -type NamespaceTopicsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// NamespaceTopicsClientBeginRegenerateKeyOptions contains the optional parameters for the NamespaceTopicsClient.BeginRegenerateKey -// method. -type NamespaceTopicsClientBeginRegenerateKeyOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// NamespaceTopicsClientBeginUpdateOptions contains the optional parameters for the NamespaceTopicsClient.BeginUpdate method. -type NamespaceTopicsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// NamespaceTopicsClientGetOptions contains the optional parameters for the NamespaceTopicsClient.Get method. -type NamespaceTopicsClientGetOptions struct { - // placeholder for future optional parameters -} - -// NamespaceTopicsClientListByNamespaceOptions contains the optional parameters for the NamespaceTopicsClient.NewListByNamespacePager -// method. -type NamespaceTopicsClientListByNamespaceOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// NamespaceTopicsClientListSharedAccessKeysOptions contains the optional parameters for the NamespaceTopicsClient.ListSharedAccessKeys -// method. -type NamespaceTopicsClientListSharedAccessKeysOptions struct { - // placeholder for future optional parameters -} - -// NamespaceTopicsListResult - Result of the List namespace topics operation. -type NamespaceTopicsListResult struct { - // A link for the next page of namespace topics. - NextLink *string - - // A collection of namespace topics. - Value []*NamespaceTopic -} - -// NamespaceUpdateParameterProperties - Information of namespace update parameter properties. -type NamespaceUpdateParameterProperties struct { - // This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess - // is enabled. - InboundIPRules []*InboundIPRule - - // This determines if traffic is allowed over public network. By default it is enabled. You can further restrict to specific - // IPs by configuring - PublicNetworkAccess *PublicNetworkAccess - - // Topic spaces configuration properties that can be updated. - TopicSpacesConfiguration *UpdateTopicSpacesConfigurationInfo -} - -// NamespaceUpdateParameters - Properties to update namespace. -type NamespaceUpdateParameters struct { - // Namespace resource identity information. - Identity *IdentityInfo - - // Properties of the namespace resource. - Properties *NamespaceUpdateParameterProperties - - // Represents available Sku pricing tiers. - SKU *NamespaceSKU - - // Tags of the namespace resource. - Tags map[string]*string -} - -// NamespacesClientBeginCreateOrUpdateOptions contains the optional parameters for the NamespacesClient.BeginCreateOrUpdate -// method. -type NamespacesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// NamespacesClientBeginDeleteOptions contains the optional parameters for the NamespacesClient.BeginDelete method. -type NamespacesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// NamespacesClientBeginRegenerateKeyOptions contains the optional parameters for the NamespacesClient.BeginRegenerateKey -// method. -type NamespacesClientBeginRegenerateKeyOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// NamespacesClientBeginUpdateOptions contains the optional parameters for the NamespacesClient.BeginUpdate method. -type NamespacesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// NamespacesClientGetOptions contains the optional parameters for the NamespacesClient.Get method. -type NamespacesClientGetOptions struct { - // placeholder for future optional parameters -} - -// NamespacesClientListByResourceGroupOptions contains the optional parameters for the NamespacesClient.NewListByResourceGroupPager -// method. -type NamespacesClientListByResourceGroupOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// NamespacesClientListBySubscriptionOptions contains the optional parameters for the NamespacesClient.NewListBySubscriptionPager -// method. -type NamespacesClientListBySubscriptionOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// NamespacesClientListSharedAccessKeysOptions contains the optional parameters for the NamespacesClient.ListSharedAccessKeys -// method. -type NamespacesClientListSharedAccessKeysOptions struct { - // placeholder for future optional parameters -} - -// NamespacesListResult - Result of the List Namespaces operation. -type NamespacesListResult struct { - // A link for the next page of namespaces. - NextLink *string - - // A collection of namespaces. - Value []*Namespace -} - // NumberGreaterThanAdvancedFilter - NumberGreaterThan Advanced Filter. type NumberGreaterThanAdvancedFilter struct { // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. @@ -2197,28 +881,8 @@ type NumberGreaterThanAdvancedFilter struct { // GetAdvancedFilter implements the AdvancedFilterClassification interface for type NumberGreaterThanAdvancedFilter. func (n *NumberGreaterThanAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { return &AdvancedFilter{ - OperatorType: n.OperatorType, Key: n.Key, - } -} - -// NumberGreaterThanFilter - NumberGreaterThan Filter. -type NumberGreaterThanFilter struct { - // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. - OperatorType *FilterOperatorType - - // The field/property in the event based on which you want to filter. - Key *string - - // The filter value. - Value *float64 -} - -// GetFilter implements the FilterClassification interface for type NumberGreaterThanFilter. -func (n *NumberGreaterThanFilter) GetFilter() *Filter { - return &Filter{ OperatorType: n.OperatorType, - Key: n.Key, } } @@ -2237,28 +901,8 @@ type NumberGreaterThanOrEqualsAdvancedFilter struct { // GetAdvancedFilter implements the AdvancedFilterClassification interface for type NumberGreaterThanOrEqualsAdvancedFilter. func (n *NumberGreaterThanOrEqualsAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { return &AdvancedFilter{ - OperatorType: n.OperatorType, Key: n.Key, - } -} - -// NumberGreaterThanOrEqualsFilter - NumberGreaterThanOrEquals Filter. -type NumberGreaterThanOrEqualsFilter struct { - // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. - OperatorType *FilterOperatorType - - // The field/property in the event based on which you want to filter. - Key *string - - // The filter value. - Value *float64 -} - -// GetFilter implements the FilterClassification interface for type NumberGreaterThanOrEqualsFilter. -func (n *NumberGreaterThanOrEqualsFilter) GetFilter() *Filter { - return &Filter{ OperatorType: n.OperatorType, - Key: n.Key, } } @@ -2277,28 +921,8 @@ type NumberInAdvancedFilter struct { // GetAdvancedFilter implements the AdvancedFilterClassification interface for type NumberInAdvancedFilter. func (n *NumberInAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { return &AdvancedFilter{ - OperatorType: n.OperatorType, Key: n.Key, - } -} - -// NumberInFilter - NumberIn Filter. -type NumberInFilter struct { - // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. - OperatorType *FilterOperatorType - - // The field/property in the event based on which you want to filter. - Key *string - - // The set of filter values. - Values []*float64 -} - -// GetFilter implements the FilterClassification interface for type NumberInFilter. -func (n *NumberInFilter) GetFilter() *Filter { - return &Filter{ OperatorType: n.OperatorType, - Key: n.Key, } } @@ -2317,28 +941,8 @@ type NumberInRangeAdvancedFilter struct { // GetAdvancedFilter implements the AdvancedFilterClassification interface for type NumberInRangeAdvancedFilter. func (n *NumberInRangeAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { return &AdvancedFilter{ - OperatorType: n.OperatorType, Key: n.Key, - } -} - -// NumberInRangeFilter - NumberInRange Filter. -type NumberInRangeFilter struct { - // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. - OperatorType *FilterOperatorType - - // The field/property in the event based on which you want to filter. - Key *string - - // The set of filter values. - Values [][]*float64 -} - -// GetFilter implements the FilterClassification interface for type NumberInRangeFilter. -func (n *NumberInRangeFilter) GetFilter() *Filter { - return &Filter{ OperatorType: n.OperatorType, - Key: n.Key, } } @@ -2357,28 +961,8 @@ type NumberLessThanAdvancedFilter struct { // GetAdvancedFilter implements the AdvancedFilterClassification interface for type NumberLessThanAdvancedFilter. func (n *NumberLessThanAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { return &AdvancedFilter{ - OperatorType: n.OperatorType, Key: n.Key, - } -} - -// NumberLessThanFilter - NumberLessThan Filter. -type NumberLessThanFilter struct { - // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. - OperatorType *FilterOperatorType - - // The field/property in the event based on which you want to filter. - Key *string - - // The filter value. - Value *float64 -} - -// GetFilter implements the FilterClassification interface for type NumberLessThanFilter. -func (n *NumberLessThanFilter) GetFilter() *Filter { - return &Filter{ OperatorType: n.OperatorType, - Key: n.Key, } } @@ -2397,28 +981,8 @@ type NumberLessThanOrEqualsAdvancedFilter struct { // GetAdvancedFilter implements the AdvancedFilterClassification interface for type NumberLessThanOrEqualsAdvancedFilter. func (n *NumberLessThanOrEqualsAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { return &AdvancedFilter{ - OperatorType: n.OperatorType, Key: n.Key, - } -} - -// NumberLessThanOrEqualsFilter - NumberLessThanOrEquals Filter. -type NumberLessThanOrEqualsFilter struct { - // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. - OperatorType *FilterOperatorType - - // The field/property in the event based on which you want to filter. - Key *string - - // The filter value. - Value *float64 -} - -// GetFilter implements the FilterClassification interface for type NumberLessThanOrEqualsFilter. -func (n *NumberLessThanOrEqualsFilter) GetFilter() *Filter { - return &Filter{ OperatorType: n.OperatorType, - Key: n.Key, } } @@ -2437,28 +1001,8 @@ type NumberNotInAdvancedFilter struct { // GetAdvancedFilter implements the AdvancedFilterClassification interface for type NumberNotInAdvancedFilter. func (n *NumberNotInAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { return &AdvancedFilter{ - OperatorType: n.OperatorType, Key: n.Key, - } -} - -// NumberNotInFilter - NumberNotIn Filter. -type NumberNotInFilter struct { - // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. - OperatorType *FilterOperatorType - - // The field/property in the event based on which you want to filter. - Key *string - - // The set of filter values. - Values []*float64 -} - -// GetFilter implements the FilterClassification interface for type NumberNotInFilter. -func (n *NumberNotInFilter) GetFilter() *Filter { - return &Filter{ OperatorType: n.OperatorType, - Key: n.Key, } } @@ -2477,28 +1021,8 @@ type NumberNotInRangeAdvancedFilter struct { // GetAdvancedFilter implements the AdvancedFilterClassification interface for type NumberNotInRangeAdvancedFilter. func (n *NumberNotInRangeAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { return &AdvancedFilter{ - OperatorType: n.OperatorType, Key: n.Key, - } -} - -// NumberNotInRangeFilter - NumberNotInRange Filter. -type NumberNotInRangeFilter struct { - // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. - OperatorType *FilterOperatorType - - // The field/property in the event based on which you want to filter. - Key *string - - // The set of filter values. - Values [][]*float64 -} - -// GetFilter implements the FilterClassification interface for type NumberNotInRangeFilter. -func (n *NumberNotInRangeFilter) GetFilter() *Filter { - return &Filter{ OperatorType: n.OperatorType, - Key: n.Key, } } @@ -2535,11 +1059,6 @@ type OperationInfo struct { Resource *string } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - // OperationsListResult - Result of the List Operations operation type OperationsListResult struct { // A collection of operations @@ -2573,26 +1092,6 @@ type PartnerAuthorization struct { DefaultMaximumExpirationTimeInDays *int32 } -// PartnerClientAuthenticationClassification provides polymorphic access to related types. -// Call the interface's GetPartnerClientAuthentication() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureADPartnerClientAuthentication, *PartnerClientAuthentication -type PartnerClientAuthenticationClassification interface { - // GetPartnerClientAuthentication returns the PartnerClientAuthentication content of the underlying type. - GetPartnerClientAuthentication() *PartnerClientAuthentication -} - -// PartnerClientAuthentication - Partner client authentication -type PartnerClientAuthentication struct { - // REQUIRED; Type of client authentication - ClientAuthenticationType *PartnerClientAuthenticationType -} - -// GetPartnerClientAuthentication implements the PartnerClientAuthenticationClassification interface for type PartnerClientAuthentication. -func (p *PartnerClientAuthentication) GetPartnerClientAuthentication() *PartnerClientAuthentication { - return p -} - // PartnerConfiguration - Partner configuration information type PartnerConfiguration struct { // Location of the resource. @@ -2642,65 +1141,6 @@ type PartnerConfigurationUpdateParameters struct { Tags map[string]*string } -// PartnerConfigurationsClientAuthorizePartnerOptions contains the optional parameters for the PartnerConfigurationsClient.AuthorizePartner -// method. -type PartnerConfigurationsClientAuthorizePartnerOptions struct { - // placeholder for future optional parameters -} - -// PartnerConfigurationsClientBeginCreateOrUpdateOptions contains the optional parameters for the PartnerConfigurationsClient.BeginCreateOrUpdate -// method. -type PartnerConfigurationsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PartnerConfigurationsClientBeginDeleteOptions contains the optional parameters for the PartnerConfigurationsClient.BeginDelete -// method. -type PartnerConfigurationsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PartnerConfigurationsClientBeginUpdateOptions contains the optional parameters for the PartnerConfigurationsClient.BeginUpdate -// method. -type PartnerConfigurationsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PartnerConfigurationsClientGetOptions contains the optional parameters for the PartnerConfigurationsClient.Get method. -type PartnerConfigurationsClientGetOptions struct { - // placeholder for future optional parameters -} - -// PartnerConfigurationsClientListByResourceGroupOptions contains the optional parameters for the PartnerConfigurationsClient.NewListByResourceGroupPager -// method. -type PartnerConfigurationsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// PartnerConfigurationsClientListBySubscriptionOptions contains the optional parameters for the PartnerConfigurationsClient.NewListBySubscriptionPager -// method. -type PartnerConfigurationsClientListBySubscriptionOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// PartnerConfigurationsClientUnauthorizePartnerOptions contains the optional parameters for the PartnerConfigurationsClient.UnauthorizePartner -// method. -type PartnerConfigurationsClientUnauthorizePartnerOptions struct { - // placeholder for future optional parameters -} - // PartnerConfigurationsListResult - Result of the List partner configurations operation type PartnerConfigurationsListResult struct { // A link for the next page of partner configurations. @@ -2710,166 +1150,6 @@ type PartnerConfigurationsListResult struct { Value []*PartnerConfiguration } -// PartnerDestination - Event Grid Partner Destination. -type PartnerDestination struct { - // REQUIRED; Location of the resource. - Location *string - - // Properties of the Partner Destination. - Properties *PartnerDestinationProperties - - // Tags of the resource. - Tags map[string]*string - - // READ-ONLY; Fully qualified identifier of the resource. - ID *string - - // READ-ONLY; Name of the resource. - Name *string - - // READ-ONLY; The system metadata relating to Partner Destination resource. - SystemData *SystemData - - // READ-ONLY; Type of the resource. - Type *string -} - -// PartnerDestinationInfoClassification provides polymorphic access to related types. -// Call the interface's GetPartnerDestinationInfo() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *PartnerDestinationInfo, *WebhookPartnerDestinationInfo -type PartnerDestinationInfoClassification interface { - // GetPartnerDestinationInfo returns the PartnerDestinationInfo content of the underlying type. - GetPartnerDestinationInfo() *PartnerDestinationInfo -} - -// PartnerDestinationInfo - Properties of the corresponding partner destination of a Channel. -type PartnerDestinationInfo struct { - // REQUIRED; Type of the endpoint for the partner destination - EndpointType *PartnerEndpointType - - // Azure subscription ID of the subscriber. The partner destination associated with the channel will be created under this - // Azure subscription. - AzureSubscriptionID *string - - // Additional context of the partner destination endpoint. - EndpointServiceContext *string - - // Name of the partner destination associated with the channel. - Name *string - - // Azure Resource Group of the subscriber. The partner destination associated with the channel will be created under this - // resource group. - ResourceGroupName *string - - // Change history of the resource move. - ResourceMoveChangeHistory []*ResourceMoveChangeHistory -} - -// GetPartnerDestinationInfo implements the PartnerDestinationInfoClassification interface for type PartnerDestinationInfo. -func (p *PartnerDestinationInfo) GetPartnerDestinationInfo() *PartnerDestinationInfo { return p } - -// PartnerDestinationProperties - Properties of the Partner Destination. -type PartnerDestinationProperties struct { - // Activation state of the partner destination. - ActivationState *PartnerDestinationActivationState - - // Endpoint Base URL of the partner destination - EndpointBaseURL *string - - // Endpoint context associated with this partner destination. - EndpointServiceContext *string - - // Expiration time of the partner destination. If this timer expires and the partner destination was never activated, the - // partner destination and corresponding channel are deleted. - ExpirationTimeIfNotActivatedUTC *time.Time - - // Context or helpful message that can be used during the approval process. - MessageForActivation *string - - // The immutable Id of the corresponding partner registration. - PartnerRegistrationImmutableID *string - - // READ-ONLY; Provisioning state of the partner destination. - ProvisioningState *PartnerDestinationProvisioningState -} - -// PartnerDestinationUpdateParameters - Properties of the Partner Destination that can be updated. -type PartnerDestinationUpdateParameters struct { - // Tags of the Partner Destination resource. - Tags map[string]*string -} - -// PartnerDestinationsClientActivateOptions contains the optional parameters for the PartnerDestinationsClient.Activate method. -type PartnerDestinationsClientActivateOptions struct { - // placeholder for future optional parameters -} - -// PartnerDestinationsClientBeginCreateOrUpdateOptions contains the optional parameters for the PartnerDestinationsClient.BeginCreateOrUpdate -// method. -type PartnerDestinationsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PartnerDestinationsClientBeginDeleteOptions contains the optional parameters for the PartnerDestinationsClient.BeginDelete -// method. -type PartnerDestinationsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PartnerDestinationsClientBeginUpdateOptions contains the optional parameters for the PartnerDestinationsClient.BeginUpdate -// method. -type PartnerDestinationsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PartnerDestinationsClientGetOptions contains the optional parameters for the PartnerDestinationsClient.Get method. -type PartnerDestinationsClientGetOptions struct { - // placeholder for future optional parameters -} - -// PartnerDestinationsClientListByResourceGroupOptions contains the optional parameters for the PartnerDestinationsClient.NewListByResourceGroupPager -// method. -type PartnerDestinationsClientListByResourceGroupOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// PartnerDestinationsClientListBySubscriptionOptions contains the optional parameters for the PartnerDestinationsClient.NewListBySubscriptionPager -// method. -type PartnerDestinationsClientListBySubscriptionOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// PartnerDestinationsListResult - Result of the List Partner Destinations operation. -type PartnerDestinationsListResult struct { - // A link for the next page of partner destinations. - NextLink *string - - // A collection of partner destinations. - Value []*PartnerDestination -} - // PartnerDetails - Information about the partner. type PartnerDetails struct { // This is short description about the partner. The length of this description should not exceed 256 characters. @@ -2882,26 +1162,6 @@ type PartnerDetails struct { SetupURI *string } -type PartnerEventSubscriptionDestination struct { - // REQUIRED; Type of the endpoint for the event subscription destination. - EndpointType *EndpointType - - // Partner Destination Properties of the event subscription destination. - Properties *PartnerEventSubscriptionDestinationProperties -} - -// GetEventSubscriptionDestination implements the EventSubscriptionDestinationClassification interface for type PartnerEventSubscriptionDestination. -func (p *PartnerEventSubscriptionDestination) GetEventSubscriptionDestination() *EventSubscriptionDestination { - return &EventSubscriptionDestination{ - EndpointType: p.EndpointType, - } -} - -type PartnerEventSubscriptionDestinationProperties struct { - // The Azure Resource Id that represents the endpoint of a Partner Destination of an event subscription. - ResourceID *string -} - // PartnerNamespace - EventGrid Partner Namespace. type PartnerNamespace struct { // REQUIRED; Location of the resource. @@ -2937,9 +1197,6 @@ type PartnerNamespaceProperties struct { // is enabled. InboundIPRules []*InboundIPRule - // Minimum TLS version of the publisher allowed to publish to this partner namespace - MinimumTLSVersionAllowed *TLSVersion - // The fully qualified ARM Id of the partner registration that should be associated with this partner namespace. This takes // the following format: // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}. @@ -2990,89 +1247,18 @@ type PartnerNamespaceUpdateParameterProperties struct { // is enabled. InboundIPRules []*InboundIPRule - // Minimum TLS version of the publisher allowed to publish to this domain - MinimumTLSVersionAllowed *TLSVersion - // This determines if traffic is allowed over public network. By default it is enabled. You can further restrict to specific // IPs by configuring PublicNetworkAccess *PublicNetworkAccess } -// PartnerNamespaceUpdateParameters - Properties of the Partner Namespace update. -type PartnerNamespaceUpdateParameters struct { - // Properties of the Partner Namespace. - Properties *PartnerNamespaceUpdateParameterProperties - - // Tags of the Partner Namespace. - Tags map[string]*string -} - -// PartnerNamespacesClientBeginCreateOrUpdateOptions contains the optional parameters for the PartnerNamespacesClient.BeginCreateOrUpdate -// method. -type PartnerNamespacesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PartnerNamespacesClientBeginDeleteOptions contains the optional parameters for the PartnerNamespacesClient.BeginDelete -// method. -type PartnerNamespacesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PartnerNamespacesClientBeginUpdateOptions contains the optional parameters for the PartnerNamespacesClient.BeginUpdate -// method. -type PartnerNamespacesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PartnerNamespacesClientGetOptions contains the optional parameters for the PartnerNamespacesClient.Get method. -type PartnerNamespacesClientGetOptions struct { - // placeholder for future optional parameters -} - -// PartnerNamespacesClientListByResourceGroupOptions contains the optional parameters for the PartnerNamespacesClient.NewListByResourceGroupPager -// method. -type PartnerNamespacesClientListByResourceGroupOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// PartnerNamespacesClientListBySubscriptionOptions contains the optional parameters for the PartnerNamespacesClient.NewListBySubscriptionPager -// method. -type PartnerNamespacesClientListBySubscriptionOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// PartnerNamespacesClientListSharedAccessKeysOptions contains the optional parameters for the PartnerNamespacesClient.ListSharedAccessKeys -// method. -type PartnerNamespacesClientListSharedAccessKeysOptions struct { - // placeholder for future optional parameters -} +// PartnerNamespaceUpdateParameters - Properties of the Partner Namespace update. +type PartnerNamespaceUpdateParameters struct { + // Properties of the Partner Namespace. + Properties *PartnerNamespaceUpdateParameterProperties -// PartnerNamespacesClientRegenerateKeyOptions contains the optional parameters for the PartnerNamespacesClient.RegenerateKey -// method. -type PartnerNamespacesClientRegenerateKeyOptions struct { - // placeholder for future optional parameters + // Tags of the Partner Namespace. + Tags map[string]*string } // PartnerNamespacesListResult - Result of the List Partner Namespaces operation @@ -3124,62 +1310,6 @@ type PartnerRegistrationUpdateParameters struct { Tags map[string]*string } -// PartnerRegistrationsClientBeginCreateOrUpdateOptions contains the optional parameters for the PartnerRegistrationsClient.BeginCreateOrUpdate -// method. -type PartnerRegistrationsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PartnerRegistrationsClientBeginDeleteOptions contains the optional parameters for the PartnerRegistrationsClient.BeginDelete -// method. -type PartnerRegistrationsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PartnerRegistrationsClientBeginUpdateOptions contains the optional parameters for the PartnerRegistrationsClient.BeginUpdate -// method. -type PartnerRegistrationsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PartnerRegistrationsClientGetOptions contains the optional parameters for the PartnerRegistrationsClient.Get method. -type PartnerRegistrationsClientGetOptions struct { - // placeholder for future optional parameters -} - -// PartnerRegistrationsClientListByResourceGroupOptions contains the optional parameters for the PartnerRegistrationsClient.NewListByResourceGroupPager -// method. -type PartnerRegistrationsClientListByResourceGroupOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// PartnerRegistrationsClientListBySubscriptionOptions contains the optional parameters for the PartnerRegistrationsClient.NewListBySubscriptionPager -// method. -type PartnerRegistrationsClientListBySubscriptionOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - // PartnerRegistrationsListResult - Result of the List Partner Registrations operation. type PartnerRegistrationsListResult struct { // A link for the next page of partner registrations. @@ -3216,60 +1346,6 @@ type PartnerTopic struct { Type *string } -// PartnerTopicEventSubscriptionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PartnerTopicEventSubscriptionsClient.BeginCreateOrUpdate -// method. -type PartnerTopicEventSubscriptionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PartnerTopicEventSubscriptionsClientBeginDeleteOptions contains the optional parameters for the PartnerTopicEventSubscriptionsClient.BeginDelete -// method. -type PartnerTopicEventSubscriptionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PartnerTopicEventSubscriptionsClientBeginUpdateOptions contains the optional parameters for the PartnerTopicEventSubscriptionsClient.BeginUpdate -// method. -type PartnerTopicEventSubscriptionsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PartnerTopicEventSubscriptionsClientGetDeliveryAttributesOptions contains the optional parameters for the PartnerTopicEventSubscriptionsClient.GetDeliveryAttributes -// method. -type PartnerTopicEventSubscriptionsClientGetDeliveryAttributesOptions struct { - // placeholder for future optional parameters -} - -// PartnerTopicEventSubscriptionsClientGetFullURLOptions contains the optional parameters for the PartnerTopicEventSubscriptionsClient.GetFullURL -// method. -type PartnerTopicEventSubscriptionsClientGetFullURLOptions struct { - // placeholder for future optional parameters -} - -// PartnerTopicEventSubscriptionsClientGetOptions contains the optional parameters for the PartnerTopicEventSubscriptionsClient.Get -// method. -type PartnerTopicEventSubscriptionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// PartnerTopicEventSubscriptionsClientListByPartnerTopicOptions contains the optional parameters for the PartnerTopicEventSubscriptionsClient.NewListByPartnerTopicPager -// method. -type PartnerTopicEventSubscriptionsClientListByPartnerTopicOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - // PartnerTopicInfo - Properties of the corresponding partner topic of a Channel. type PartnerTopicInfo struct { // Azure subscription ID of the subscriber. The partner topic associated with the channel will be created under this Azure @@ -3332,67 +1408,6 @@ type PartnerTopicUpdateParameters struct { Tags map[string]*string } -// PartnerTopicsClientActivateOptions contains the optional parameters for the PartnerTopicsClient.Activate method. -type PartnerTopicsClientActivateOptions struct { - // placeholder for future optional parameters -} - -// PartnerTopicsClientBeginDeleteOptions contains the optional parameters for the PartnerTopicsClient.BeginDelete method. -type PartnerTopicsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PartnerTopicsClientCreateOrUpdateOptions contains the optional parameters for the PartnerTopicsClient.CreateOrUpdate method. -type PartnerTopicsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// PartnerTopicsClientDeactivateOptions contains the optional parameters for the PartnerTopicsClient.Deactivate method. -type PartnerTopicsClientDeactivateOptions struct { - // placeholder for future optional parameters -} - -// PartnerTopicsClientGetOptions contains the optional parameters for the PartnerTopicsClient.Get method. -type PartnerTopicsClientGetOptions struct { - // placeholder for future optional parameters -} - -// PartnerTopicsClientListByResourceGroupOptions contains the optional parameters for the PartnerTopicsClient.NewListByResourceGroupPager -// method. -type PartnerTopicsClientListByResourceGroupOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// PartnerTopicsClientListBySubscriptionOptions contains the optional parameters for the PartnerTopicsClient.NewListBySubscriptionPager -// method. -type PartnerTopicsClientListBySubscriptionOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// PartnerTopicsClientUpdateOptions contains the optional parameters for the PartnerTopicsClient.Update method. -type PartnerTopicsClientUpdateOptions struct { - // placeholder for future optional parameters -} - // PartnerTopicsListResult - Result of the List Partner Topics operation. type PartnerTopicsListResult struct { // A link for the next page of partner topics. @@ -3402,113 +1417,12 @@ type PartnerTopicsListResult struct { Value []*PartnerTopic } -// PartnerUpdateDestinationInfoClassification provides polymorphic access to related types. -// Call the interface's GetPartnerUpdateDestinationInfo() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *PartnerUpdateDestinationInfo, *WebhookUpdatePartnerDestinationInfo -type PartnerUpdateDestinationInfoClassification interface { - // GetPartnerUpdateDestinationInfo returns the PartnerUpdateDestinationInfo content of the underlying type. - GetPartnerUpdateDestinationInfo() *PartnerUpdateDestinationInfo -} - -// PartnerUpdateDestinationInfo - Properties of the corresponding partner destination of a Channel. -type PartnerUpdateDestinationInfo struct { - // REQUIRED; Type of the endpoint for the partner destination - EndpointType *PartnerEndpointType -} - -// GetPartnerUpdateDestinationInfo implements the PartnerUpdateDestinationInfoClassification interface for type PartnerUpdateDestinationInfo. -func (p *PartnerUpdateDestinationInfo) GetPartnerUpdateDestinationInfo() *PartnerUpdateDestinationInfo { - return p -} - // PartnerUpdateTopicInfo - Update properties for the corresponding partner topic of a channel. type PartnerUpdateTopicInfo struct { // Event type info for the partner topic EventTypeInfo *EventTypeInfo } -// PermissionBinding - The Permission binding resource. -type PermissionBinding struct { - // The properties of permission binding. - Properties *PermissionBindingProperties - - // READ-ONLY; Fully qualified identifier of the resource. - ID *string - - // READ-ONLY; Name of the resource. - Name *string - - // READ-ONLY; The system metadata relating to the PermissionBinding resource. - SystemData *SystemData - - // READ-ONLY; Type of the resource. - Type *string -} - -// PermissionBindingProperties - The properties of permission binding. -type PermissionBindingProperties struct { - // The name of the client group resource that the permission is bound to. The client group needs to be a resource under the - // same namespace the permission binding is a part of. - ClientGroupName *string - - // Description for the Permission Binding resource. - Description *string - - // The allowed permission. - Permission *PermissionType - - // The name of the Topic Space resource that the permission is bound to. The Topic space needs to be a resource under the - // same namespace the permission binding is a part of. - TopicSpaceName *string - - // READ-ONLY; Provisioning state of the PermissionBinding resource. - ProvisioningState *PermissionBindingProvisioningState -} - -// PermissionBindingsClientBeginCreateOrUpdateOptions contains the optional parameters for the PermissionBindingsClient.BeginCreateOrUpdate -// method. -type PermissionBindingsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PermissionBindingsClientBeginDeleteOptions contains the optional parameters for the PermissionBindingsClient.BeginDelete -// method. -type PermissionBindingsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PermissionBindingsClientGetOptions contains the optional parameters for the PermissionBindingsClient.Get method. -type PermissionBindingsClientGetOptions struct { - // placeholder for future optional parameters -} - -// PermissionBindingsClientListByNamespaceOptions contains the optional parameters for the PermissionBindingsClient.NewListByNamespacePager -// method. -type PermissionBindingsClientListByNamespaceOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// PermissionBindingsListResult - Result of the List Permission Binding operation. -type PermissionBindingsListResult struct { - // A link for the next page of Permission Binding. - NextLink *string - - // A collection of Permission Binding. - Value []*PermissionBinding -} - // PrivateEndpoint information. type PrivateEndpoint struct { // The ARM identifier for Private Endpoint. @@ -3553,41 +1467,6 @@ type PrivateEndpointConnectionProperties struct { ProvisioningState *ResourceProvisioningState } -// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete -// method. -type PrivateEndpointConnectionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionsClientBeginUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginUpdate -// method. -type PrivateEndpointConnectionsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get -// method. -type PrivateEndpointConnectionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByResourcePager -// method. -type PrivateEndpointConnectionsClientListByResourceOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - // PrivateLinkResource - Information of the private link resource. type PrivateLinkResource struct { // Fully qualified identifier of the resource. @@ -3610,26 +1489,6 @@ type PrivateLinkResourceProperties struct { RequiredZoneNames []*string } -// PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get method. -type PrivateLinkResourcesClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkResourcesClientListByResourceOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByResourcePager -// method. -type PrivateLinkResourcesClientListByResourceOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - // PrivateLinkResourcesListResult - Result of the List private link resources operation. type PrivateLinkResourcesListResult struct { // A link for the next page of private link resources. @@ -3639,41 +1498,6 @@ type PrivateLinkResourcesListResult struct { Value []*PrivateLinkResource } -// QueueInfo - Properties of the Queue info for event subscription. -type QueueInfo struct { - // The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to - // the dead letter destination. Uses the managed identity setup on the parent - // resource (namely, topic) to acquire the authentication tokens being used during delivery / dead-lettering. - DeadLetterDestinationWithResourceIdentity *DeadLetterWithResourceIdentity - - // Time span duration in ISO 8601 format that determines how long messages are available to the subscription from the time - // the message was published. This duration value is expressed using the following - // format: \'P(n)Y(n)M(n)DT(n)H(n)M(n)S\', where: - (n) is replaced by the value of each time element that follows the (n). - // - P is the duration (or Period) designator and is always placed at the - // beginning of the duration. - Y is the year designator, and it follows the value for the number of years. - M is the month - // designator, and it follows the value for the number of months. - W is the week - // designator, and it follows the value for the number of weeks. - D is the day designator, and it follows the value for the - // number of days. - T is the time designator, and it precedes the time - // components. - H is the hour designator, and it follows the value for the number of hours. - M is the minute designator, - // and it follows the value for the number of minutes. - S is the second - // designator, and it follows the value for the number of seconds. This duration value cannot be set greater than the topic’s - // EventRetentionInDays. It is is an optional field where its minimum value is 1 - // minute, and its maximum is determined by topic’s EventRetentionInDays value. The followings are examples of valid values: - // - \'P0DT23H12M\' or \'PT23H12M\': for duration of 23 hours and 12 minutes. - - // \'P1D\' or \'P1DT0H0M0S\': for duration of 1 day. - EventTimeToLive *string - - // The maximum delivery count of the events. - MaxDeliveryCount *int32 - - // Maximum period in seconds in which once the message is in received (by the client) state and waiting to be accepted, released - // or rejected. If this time elapsed after a message has been received by the - // client and not transitioned into accepted (not processed), released or rejected, the message is available for redelivery. - // This is an optional field, where default is 60 seconds, minimum is 60 seconds - // and maximum is 300 seconds. - ReceiveLockDurationInSeconds *int32 -} - // Resource - Definition of a Resource. type Resource struct { // READ-ONLY; Fully qualified identifier of the resource. @@ -3686,24 +1510,6 @@ type Resource struct { Type *string } -// ResourceMoveChangeHistory - The change history of the resource move. -type ResourceMoveChangeHistory struct { - // Azure subscription ID of the resource. - AzureSubscriptionID *string - - // UTC timestamp of when the resource was changed. - ChangedTimeUTC *time.Time - - // Azure Resource Group of the resource. - ResourceGroupName *string -} - -// ResourceSKU - Describes an EventGrid Resource Sku. -type ResourceSKU struct { - // The Sku name of the resource. The possible values are: Basic or Premium. - Name *SKU -} - // RetryPolicy - Information about the retry policy for an event subscription. type RetryPolicy struct { // Time To Live (in minutes) for events. @@ -3713,17 +1519,6 @@ type RetryPolicy struct { MaxDeliveryAttempts *int32 } -type RoutingEnrichments struct { - Dynamic []*DynamicRoutingEnrichment - Static []*StaticRoutingEnrichment -} - -// RoutingIdentityInfo - Routing identity info for topic spaces configuration. -type RoutingIdentityInfo struct { - Type *RoutingIdentityType - UserAssignedIdentity *string -} - // ServiceBusQueueEventSubscriptionDestination - Information about the service bus destination for an event subscription. type ServiceBusQueueEventSubscriptionDestination struct { // REQUIRED; Type of the endpoint for the event subscription destination. @@ -3805,14 +1600,6 @@ type StaticDeliveryAttributeMappingProperties struct { Value *string } -type StaticRoutingEnrichment struct { - // Static routing enrichment key. - Key *string - - // Static routing enrichment value type. For e.g. this property value can be 'String'. - ValueType *StaticRoutingEnrichmentType -} - // StorageBlobDeadLetterDestination - Information about the storage blob based dead letter destination. type StorageBlobDeadLetterDestination struct { // REQUIRED; Type of the endpoint for the dead letter destination @@ -3856,8 +1643,7 @@ func (s *StorageQueueEventSubscriptionDestination) GetEventSubscriptionDestinati // StorageQueueEventSubscriptionDestinationProperties - The properties for a storage queue destination. type StorageQueueEventSubscriptionDestinationProperties struct { - // Storage queue message time to live in seconds. This value cannot be zero or negative with the exception of using -1 to - // indicate that the Time To Live of the message is Infinite. + // Storage queue message time to live in seconds. QueueMessageTimeToLiveInSeconds *int64 // The name of the Storage queue under a storage account that is the destination of an event subscription. @@ -3882,175 +1668,15 @@ type StringBeginsWithAdvancedFilter struct { // GetAdvancedFilter implements the AdvancedFilterClassification interface for type StringBeginsWithAdvancedFilter. func (s *StringBeginsWithAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { return &AdvancedFilter{ - OperatorType: s.OperatorType, - Key: s.Key, - } -} - -// StringBeginsWithFilter - StringBeginsWith Filter. -type StringBeginsWithFilter struct { - // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. - OperatorType *FilterOperatorType - - // The field/property in the event based on which you want to filter. - Key *string - - // The set of filter values. - Values []*string -} - -// GetFilter implements the FilterClassification interface for type StringBeginsWithFilter. -func (s *StringBeginsWithFilter) GetFilter() *Filter { - return &Filter{ - OperatorType: s.OperatorType, - Key: s.Key, - } -} - -// StringContainsAdvancedFilter - StringContains Advanced Filter. -type StringContainsAdvancedFilter struct { - // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. - OperatorType *AdvancedFilterOperatorType - - // The field/property in the event based on which you want to filter. - Key *string - - // The set of filter values. - Values []*string -} - -// GetAdvancedFilter implements the AdvancedFilterClassification interface for type StringContainsAdvancedFilter. -func (s *StringContainsAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { - return &AdvancedFilter{ - OperatorType: s.OperatorType, - Key: s.Key, - } -} - -// StringContainsFilter - StringContains Filter. -type StringContainsFilter struct { - // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. - OperatorType *FilterOperatorType - - // The field/property in the event based on which you want to filter. - Key *string - - // The set of filter values. - Values []*string -} - -// GetFilter implements the FilterClassification interface for type StringContainsFilter. -func (s *StringContainsFilter) GetFilter() *Filter { - return &Filter{ - OperatorType: s.OperatorType, - Key: s.Key, - } -} - -// StringEndsWithAdvancedFilter - StringEndsWith Advanced Filter. -type StringEndsWithAdvancedFilter struct { - // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. - OperatorType *AdvancedFilterOperatorType - - // The field/property in the event based on which you want to filter. - Key *string - - // The set of filter values. - Values []*string -} - -// GetAdvancedFilter implements the AdvancedFilterClassification interface for type StringEndsWithAdvancedFilter. -func (s *StringEndsWithAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { - return &AdvancedFilter{ - OperatorType: s.OperatorType, - Key: s.Key, - } -} - -// StringEndsWithFilter - StringEndsWith Filter. -type StringEndsWithFilter struct { - // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. - OperatorType *FilterOperatorType - - // The field/property in the event based on which you want to filter. - Key *string - - // The set of filter values. - Values []*string -} - -// GetFilter implements the FilterClassification interface for type StringEndsWithFilter. -func (s *StringEndsWithFilter) GetFilter() *Filter { - return &Filter{ - OperatorType: s.OperatorType, - Key: s.Key, - } -} - -// StringInAdvancedFilter - StringIn Advanced Filter. -type StringInAdvancedFilter struct { - // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. - OperatorType *AdvancedFilterOperatorType - - // The field/property in the event based on which you want to filter. - Key *string - - // The set of filter values. - Values []*string -} - -// GetAdvancedFilter implements the AdvancedFilterClassification interface for type StringInAdvancedFilter. -func (s *StringInAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { - return &AdvancedFilter{ - OperatorType: s.OperatorType, - Key: s.Key, - } -} - -// StringInFilter - StringIn Filter. -type StringInFilter struct { - // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. - OperatorType *FilterOperatorType - - // The field/property in the event based on which you want to filter. - Key *string - - // The set of filter values. - Values []*string -} - -// GetFilter implements the FilterClassification interface for type StringInFilter. -func (s *StringInFilter) GetFilter() *Filter { - return &Filter{ - OperatorType: s.OperatorType, Key: s.Key, - } -} - -// StringNotBeginsWithAdvancedFilter - StringNotBeginsWith Advanced Filter. -type StringNotBeginsWithAdvancedFilter struct { - // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. - OperatorType *AdvancedFilterOperatorType - - // The field/property in the event based on which you want to filter. - Key *string - - // The set of filter values. - Values []*string -} - -// GetAdvancedFilter implements the AdvancedFilterClassification interface for type StringNotBeginsWithAdvancedFilter. -func (s *StringNotBeginsWithAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { - return &AdvancedFilter{ OperatorType: s.OperatorType, - Key: s.Key, } } -// StringNotBeginsWithFilter - StringNotBeginsWith Filter. -type StringNotBeginsWithFilter struct { +// StringContainsAdvancedFilter - StringContains Advanced Filter. +type StringContainsAdvancedFilter struct { // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. - OperatorType *FilterOperatorType + OperatorType *AdvancedFilterOperatorType // The field/property in the event based on which you want to filter. Key *string @@ -4059,16 +1685,16 @@ type StringNotBeginsWithFilter struct { Values []*string } -// GetFilter implements the FilterClassification interface for type StringNotBeginsWithFilter. -func (s *StringNotBeginsWithFilter) GetFilter() *Filter { - return &Filter{ - OperatorType: s.OperatorType, +// GetAdvancedFilter implements the AdvancedFilterClassification interface for type StringContainsAdvancedFilter. +func (s *StringContainsAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { + return &AdvancedFilter{ Key: s.Key, + OperatorType: s.OperatorType, } } -// StringNotContainsAdvancedFilter - StringNotContains Advanced Filter. -type StringNotContainsAdvancedFilter struct { +// StringEndsWithAdvancedFilter - StringEndsWith Advanced Filter. +type StringEndsWithAdvancedFilter struct { // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. OperatorType *AdvancedFilterOperatorType @@ -4079,18 +1705,18 @@ type StringNotContainsAdvancedFilter struct { Values []*string } -// GetAdvancedFilter implements the AdvancedFilterClassification interface for type StringNotContainsAdvancedFilter. -func (s *StringNotContainsAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { +// GetAdvancedFilter implements the AdvancedFilterClassification interface for type StringEndsWithAdvancedFilter. +func (s *StringEndsWithAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { return &AdvancedFilter{ - OperatorType: s.OperatorType, Key: s.Key, + OperatorType: s.OperatorType, } } -// StringNotContainsFilter - StringNotContains Filter. -type StringNotContainsFilter struct { +// StringInAdvancedFilter - StringIn Advanced Filter. +type StringInAdvancedFilter struct { // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. - OperatorType *FilterOperatorType + OperatorType *AdvancedFilterOperatorType // The field/property in the event based on which you want to filter. Key *string @@ -4099,16 +1725,16 @@ type StringNotContainsFilter struct { Values []*string } -// GetFilter implements the FilterClassification interface for type StringNotContainsFilter. -func (s *StringNotContainsFilter) GetFilter() *Filter { - return &Filter{ - OperatorType: s.OperatorType, +// GetAdvancedFilter implements the AdvancedFilterClassification interface for type StringInAdvancedFilter. +func (s *StringInAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { + return &AdvancedFilter{ Key: s.Key, + OperatorType: s.OperatorType, } } -// StringNotEndsWithAdvancedFilter - StringNotEndsWith Advanced Filter. -type StringNotEndsWithAdvancedFilter struct { +// StringNotBeginsWithAdvancedFilter - StringNotBeginsWith Advanced Filter. +type StringNotBeginsWithAdvancedFilter struct { // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. OperatorType *AdvancedFilterOperatorType @@ -4119,18 +1745,18 @@ type StringNotEndsWithAdvancedFilter struct { Values []*string } -// GetAdvancedFilter implements the AdvancedFilterClassification interface for type StringNotEndsWithAdvancedFilter. -func (s *StringNotEndsWithAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { +// GetAdvancedFilter implements the AdvancedFilterClassification interface for type StringNotBeginsWithAdvancedFilter. +func (s *StringNotBeginsWithAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { return &AdvancedFilter{ - OperatorType: s.OperatorType, Key: s.Key, + OperatorType: s.OperatorType, } } -// StringNotEndsWithFilter - StringNotEndsWith Filter. -type StringNotEndsWithFilter struct { +// StringNotContainsAdvancedFilter - StringNotContains Advanced Filter. +type StringNotContainsAdvancedFilter struct { // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. - OperatorType *FilterOperatorType + OperatorType *AdvancedFilterOperatorType // The field/property in the event based on which you want to filter. Key *string @@ -4139,16 +1765,16 @@ type StringNotEndsWithFilter struct { Values []*string } -// GetFilter implements the FilterClassification interface for type StringNotEndsWithFilter. -func (s *StringNotEndsWithFilter) GetFilter() *Filter { - return &Filter{ - OperatorType: s.OperatorType, +// GetAdvancedFilter implements the AdvancedFilterClassification interface for type StringNotContainsAdvancedFilter. +func (s *StringNotContainsAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { + return &AdvancedFilter{ Key: s.Key, + OperatorType: s.OperatorType, } } -// StringNotInAdvancedFilter - StringNotIn Advanced Filter. -type StringNotInAdvancedFilter struct { +// StringNotEndsWithAdvancedFilter - StringNotEndsWith Advanced Filter. +type StringNotEndsWithAdvancedFilter struct { // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. OperatorType *AdvancedFilterOperatorType @@ -4159,18 +1785,18 @@ type StringNotInAdvancedFilter struct { Values []*string } -// GetAdvancedFilter implements the AdvancedFilterClassification interface for type StringNotInAdvancedFilter. -func (s *StringNotInAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { +// GetAdvancedFilter implements the AdvancedFilterClassification interface for type StringNotEndsWithAdvancedFilter. +func (s *StringNotEndsWithAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { return &AdvancedFilter{ - OperatorType: s.OperatorType, Key: s.Key, + OperatorType: s.OperatorType, } } -// StringNotInFilter - StringNotIn Filter. -type StringNotInFilter struct { +// StringNotInAdvancedFilter - StringNotIn Advanced Filter. +type StringNotInAdvancedFilter struct { // REQUIRED; The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. - OperatorType *FilterOperatorType + OperatorType *AdvancedFilterOperatorType // The field/property in the event based on which you want to filter. Key *string @@ -4179,74 +1805,14 @@ type StringNotInFilter struct { Values []*string } -// GetFilter implements the FilterClassification interface for type StringNotInFilter. -func (s *StringNotInFilter) GetFilter() *Filter { - return &Filter{ - OperatorType: s.OperatorType, +// GetAdvancedFilter implements the AdvancedFilterClassification interface for type StringNotInAdvancedFilter. +func (s *StringNotInAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { + return &AdvancedFilter{ Key: s.Key, + OperatorType: s.OperatorType, } } -// Subscription - Event Subscription. -type Subscription struct { - // Properties of the event subscription. - Properties *SubscriptionProperties - - // READ-ONLY; Fully qualified identifier of the resource. - ID *string - - // READ-ONLY; Name of the resource. - Name *string - - // READ-ONLY; The system metadata relating to Event Subscription resource. - SystemData *SystemData - - // READ-ONLY; Type of the resource. - Type *string -} - -// SubscriptionProperties - Properties of the event subscription. -type SubscriptionProperties struct { - // Information about the delivery configuration of the event subscription. - DeliveryConfiguration *DeliveryConfiguration - - // The event delivery schema for the event subscription. - EventDeliverySchema *DeliverySchema - - // Information about the filter for the event subscription. - FiltersConfiguration *FiltersConfiguration - - // READ-ONLY; Provisioning state of the event subscription. - ProvisioningState *SubscriptionProvisioningState -} - -// SubscriptionUpdateParameters - Properties of the Event Subscription update. -type SubscriptionUpdateParameters struct { - // Properties of the Event Subscription update parameters. - Properties *SubscriptionUpdateParametersProperties -} - -// SubscriptionUpdateParametersProperties - Properties of the Event Subscription update parameters. -type SubscriptionUpdateParametersProperties struct { - // Information about the delivery configuration of the event subscription. - DeliveryConfiguration *DeliveryConfiguration - - // The event delivery schema for the event subscription. - EventDeliverySchema *DeliverySchema - - // Information about the filter for the event subscription. - FiltersConfiguration *FiltersConfiguration -} - -// SubscriptionsListResult - Result of the List event subscriptions operation. -type SubscriptionsListResult struct { - // A link for the next page of event subscriptions - NextLink *string - - // A collection of Subscriptions. - Value []*Subscription -} - // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). @@ -4295,60 +1861,6 @@ type SystemTopic struct { Type *string } -// SystemTopicEventSubscriptionsClientBeginCreateOrUpdateOptions contains the optional parameters for the SystemTopicEventSubscriptionsClient.BeginCreateOrUpdate -// method. -type SystemTopicEventSubscriptionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SystemTopicEventSubscriptionsClientBeginDeleteOptions contains the optional parameters for the SystemTopicEventSubscriptionsClient.BeginDelete -// method. -type SystemTopicEventSubscriptionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SystemTopicEventSubscriptionsClientBeginUpdateOptions contains the optional parameters for the SystemTopicEventSubscriptionsClient.BeginUpdate -// method. -type SystemTopicEventSubscriptionsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SystemTopicEventSubscriptionsClientGetDeliveryAttributesOptions contains the optional parameters for the SystemTopicEventSubscriptionsClient.GetDeliveryAttributes -// method. -type SystemTopicEventSubscriptionsClientGetDeliveryAttributesOptions struct { - // placeholder for future optional parameters -} - -// SystemTopicEventSubscriptionsClientGetFullURLOptions contains the optional parameters for the SystemTopicEventSubscriptionsClient.GetFullURL -// method. -type SystemTopicEventSubscriptionsClientGetFullURLOptions struct { - // placeholder for future optional parameters -} - -// SystemTopicEventSubscriptionsClientGetOptions contains the optional parameters for the SystemTopicEventSubscriptionsClient.Get -// method. -type SystemTopicEventSubscriptionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// SystemTopicEventSubscriptionsClientListBySystemTopicOptions contains the optional parameters for the SystemTopicEventSubscriptionsClient.NewListBySystemTopicPager -// method. -type SystemTopicEventSubscriptionsClientListBySystemTopicOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - // SystemTopicProperties - Properties of the System Topic. type SystemTopicProperties struct { // Source for the system topic. @@ -4373,60 +1885,6 @@ type SystemTopicUpdateParameters struct { Tags map[string]*string } -// SystemTopicsClientBeginCreateOrUpdateOptions contains the optional parameters for the SystemTopicsClient.BeginCreateOrUpdate -// method. -type SystemTopicsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SystemTopicsClientBeginDeleteOptions contains the optional parameters for the SystemTopicsClient.BeginDelete method. -type SystemTopicsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SystemTopicsClientBeginUpdateOptions contains the optional parameters for the SystemTopicsClient.BeginUpdate method. -type SystemTopicsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SystemTopicsClientGetOptions contains the optional parameters for the SystemTopicsClient.Get method. -type SystemTopicsClientGetOptions struct { - // placeholder for future optional parameters -} - -// SystemTopicsClientListByResourceGroupOptions contains the optional parameters for the SystemTopicsClient.NewListByResourceGroupPager -// method. -type SystemTopicsClientListByResourceGroupOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// SystemTopicsClientListBySubscriptionOptions contains the optional parameters for the SystemTopicsClient.NewListBySubscriptionPager -// method. -type SystemTopicsClientListBySubscriptionOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - // SystemTopicsListResult - Result of the List System topics operation. type SystemTopicsListResult struct { // A link for the next page of topics. @@ -4441,21 +1899,12 @@ type Topic struct { // REQUIRED; Location of the resource. Location *string - // Extended location of the resource. - ExtendedLocation *ExtendedLocation - // Identity information for the resource. Identity *IdentityInfo - // Kind of the resource. - Kind *ResourceKind - // Properties of the topic. Properties *TopicProperties - // The Sku pricing tier for the topic. - SKU *ResourceSKU - // Tags of the resource. Tags map[string]*string @@ -4472,59 +1921,6 @@ type Topic struct { Type *string } -// TopicEventSubscriptionsClientBeginCreateOrUpdateOptions contains the optional parameters for the TopicEventSubscriptionsClient.BeginCreateOrUpdate -// method. -type TopicEventSubscriptionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// TopicEventSubscriptionsClientBeginDeleteOptions contains the optional parameters for the TopicEventSubscriptionsClient.BeginDelete -// method. -type TopicEventSubscriptionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// TopicEventSubscriptionsClientBeginUpdateOptions contains the optional parameters for the TopicEventSubscriptionsClient.BeginUpdate -// method. -type TopicEventSubscriptionsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// TopicEventSubscriptionsClientGetDeliveryAttributesOptions contains the optional parameters for the TopicEventSubscriptionsClient.GetDeliveryAttributes -// method. -type TopicEventSubscriptionsClientGetDeliveryAttributesOptions struct { - // placeholder for future optional parameters -} - -// TopicEventSubscriptionsClientGetFullURLOptions contains the optional parameters for the TopicEventSubscriptionsClient.GetFullURL -// method. -type TopicEventSubscriptionsClientGetFullURLOptions struct { - // placeholder for future optional parameters -} - -// TopicEventSubscriptionsClientGetOptions contains the optional parameters for the TopicEventSubscriptionsClient.Get method. -type TopicEventSubscriptionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// TopicEventSubscriptionsClientListOptions contains the optional parameters for the TopicEventSubscriptionsClient.NewListPager -// method. -type TopicEventSubscriptionsClientListOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - // TopicProperties - Properties of the Topic. type TopicProperties struct { // Data Residency Boundary of the resource. @@ -4534,10 +1930,6 @@ type TopicProperties struct { // token will be used to authenticate if user is allowed to publish to the topic. DisableLocalAuth *bool - // Event Type Information for the user topic. This information is provided by the publisher and can be used by the subscriber - // to view different types of events that are published. - EventTypeInfo *EventTypeInfo - // This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess // is enabled. InboundIPRules []*InboundIPRule @@ -4549,9 +1941,6 @@ type TopicProperties struct { // a source schema to various required properties of the EventGridEvent schema. InputSchemaMapping InputSchemaMappingClassification - // Minimum TLS version of the publisher allowed to publish to this topic - MinimumTLSVersionAllowed *TLSVersion - // This determines if traffic is allowed over public network. By default it is enabled. You can further restrict to specific // IPs by configuring PublicNetworkAccess *PublicNetworkAccess @@ -4584,111 +1973,6 @@ type TopicSharedAccessKeys struct { Key2 *string } -// TopicSpace - The Topic space resource. -type TopicSpace struct { - // The properties of topic space. - Properties *TopicSpaceProperties - - // READ-ONLY; Fully qualified identifier of the resource. - ID *string - - // READ-ONLY; Name of the resource. - Name *string - - // READ-ONLY; The system metadata relating to the TopicSpace resource. - SystemData *SystemData - - // READ-ONLY; Type of the resource. - Type *string -} - -// TopicSpaceProperties - The properties of topic space. -type TopicSpaceProperties struct { - // Description for the Topic Space resource. - Description *string - - // The topic filters in the topic space. Example: "topicTemplates": [ "devices/foo/bar", "devices/topic1/+", "devices/${principal.name}/${principal.attributes.keyName}" - // ]. - TopicTemplates []*string - - // READ-ONLY; Provisioning state of the TopicSpace resource. - ProvisioningState *TopicSpaceProvisioningState -} - -// TopicSpacesClientBeginCreateOrUpdateOptions contains the optional parameters for the TopicSpacesClient.BeginCreateOrUpdate -// method. -type TopicSpacesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// TopicSpacesClientBeginDeleteOptions contains the optional parameters for the TopicSpacesClient.BeginDelete method. -type TopicSpacesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// TopicSpacesClientGetOptions contains the optional parameters for the TopicSpacesClient.Get method. -type TopicSpacesClientGetOptions struct { - // placeholder for future optional parameters -} - -// TopicSpacesClientListByNamespaceOptions contains the optional parameters for the TopicSpacesClient.NewListByNamespacePager -// method. -type TopicSpacesClientListByNamespaceOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// TopicSpacesConfiguration - Properties of the Topic Spaces Configuration. -type TopicSpacesConfiguration struct { - // Client authentication settings for topic spaces configuration. - ClientAuthentication *ClientAuthenticationSettings - - // The maximum number of sessions per authentication name. The property default value is 1. Min allowed value is 1 and max - // allowed value is 100. - MaximumClientSessionsPerAuthenticationName *int32 - - // The maximum session expiry in hours. The property default value is 1 hour. Min allowed value is 1 hour and max allowed - // value is 8 hours. - MaximumSessionExpiryInHours *int32 - - // Fully qualified Azure Resource Id for the Event Grid Topic to which events will be routed to from TopicSpaces under a namespace. - // This property should be in the following format - // '/subscriptions/{subId}/resourcegroups/{resourceGroupName}/providers/microsoft.EventGrid/topics/{topicName}'. This topic - // should reside in the same region where namespace is located. - RouteTopicResourceID *string - - // Routing enrichments for topic spaces configuration - RoutingEnrichments *RoutingEnrichments - - // Routing identity info for topic spaces configuration. - RoutingIdentityInfo *RoutingIdentityInfo - - // Indicate if Topic Spaces Configuration is enabled for the namespace. Default is Disabled. - State *TopicSpacesConfigurationState - - // READ-ONLY; The endpoint for the topic spaces configuration. This is a read-only property. - Hostname *string -} - -// TopicSpacesListResult - Result of the List Topic Space operation. -type TopicSpacesListResult struct { - // A link for the next page of Topic Space. - NextLink *string - - // A collection of Topic Space. - Value []*TopicSpace -} - // TopicTypeInfo - Properties of a topic type info. type TopicTypeInfo struct { // Properties of the topic type info @@ -4706,9 +1990,6 @@ type TopicTypeInfo struct { // TopicTypeProperties - Properties of a topic type. type TopicTypeProperties struct { - // Flag to indicate that a topic type can support both regional or global system topics - AreRegionalAndGlobalSourcesSupported *bool - // Description of the topic type. Description *string @@ -4734,22 +2015,6 @@ type TopicTypeProperties struct { SupportedScopesForSource []*TopicTypeSourceScope } -// TopicTypesClientGetOptions contains the optional parameters for the TopicTypesClient.Get method. -type TopicTypesClientGetOptions struct { - // placeholder for future optional parameters -} - -// TopicTypesClientListEventTypesOptions contains the optional parameters for the TopicTypesClient.NewListEventTypesPager -// method. -type TopicTypesClientListEventTypesOptions struct { - // placeholder for future optional parameters -} - -// TopicTypesClientListOptions contains the optional parameters for the TopicTypesClient.NewListPager method. -type TopicTypesClientListOptions struct { - // placeholder for future optional parameters -} - // TopicTypesListResult - Result of the List Topic Types operation type TopicTypesListResult struct { // A collection of topic types @@ -4765,16 +2030,10 @@ type TopicUpdateParameterProperties struct { // token will be used to authenticate if user is allowed to publish to the topic. DisableLocalAuth *bool - // The eventTypeInfo for the topic. - EventTypeInfo *EventTypeInfo - // This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess // is enabled. InboundIPRules []*InboundIPRule - // Minimum TLS version of the publisher allowed to publish to this domain - MinimumTLSVersionAllowed *TLSVersion - // This determines if traffic is allowed over public network. By default it is enabled. You can further restrict to specific // IPs by configuring PublicNetworkAccess *PublicNetworkAccess @@ -4788,88 +2047,10 @@ type TopicUpdateParameters struct { // Properties of the Topic resource. Properties *TopicUpdateParameterProperties - // The Sku pricing tier for the topic. - SKU *ResourceSKU - // Tags of the Topic resource. Tags map[string]*string } -// TopicsClientBeginCreateOrUpdateOptions contains the optional parameters for the TopicsClient.BeginCreateOrUpdate method. -type TopicsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// TopicsClientBeginDeleteOptions contains the optional parameters for the TopicsClient.BeginDelete method. -type TopicsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// TopicsClientBeginRegenerateKeyOptions contains the optional parameters for the TopicsClient.BeginRegenerateKey method. -type TopicsClientBeginRegenerateKeyOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// TopicsClientBeginUpdateOptions contains the optional parameters for the TopicsClient.BeginUpdate method. -type TopicsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// TopicsClientGetOptions contains the optional parameters for the TopicsClient.Get method. -type TopicsClientGetOptions struct { - // placeholder for future optional parameters -} - -// TopicsClientListByResourceGroupOptions contains the optional parameters for the TopicsClient.NewListByResourceGroupPager -// method. -type TopicsClientListByResourceGroupOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// TopicsClientListBySubscriptionOptions contains the optional parameters for the TopicsClient.NewListBySubscriptionPager -// method. -type TopicsClientListBySubscriptionOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - -// TopicsClientListEventTypesOptions contains the optional parameters for the TopicsClient.NewListEventTypesPager method. -type TopicsClientListEventTypesOptions struct { - // placeholder for future optional parameters -} - -// TopicsClientListSharedAccessKeysOptions contains the optional parameters for the TopicsClient.ListSharedAccessKeys method. -type TopicsClientListSharedAccessKeysOptions struct { - // placeholder for future optional parameters -} - -// TopicsConfiguration - Properties of the Topics Configuration. -type TopicsConfiguration struct { - // READ-ONLY; The hostname for the topics configuration. This is a read-only property. - Hostname *string -} - // TopicsListResult - Result of the List Topics operation type TopicsListResult struct { // A link for the next page of topics @@ -4897,32 +2078,6 @@ type TrackedResource struct { Type *string } -// UpdateTopicSpacesConfigurationInfo - Properties of the topic spaces configuration info of a namespace. -type UpdateTopicSpacesConfigurationInfo struct { - // Client authentication settings for topic spaces configuration. - ClientAuthentication *ClientAuthenticationSettings - - // The maximum number of sessions per authentication name. The property default value is 1. Min allowed value is 1 and max - // allowed value is 100. - MaximumClientSessionsPerAuthenticationName *int32 - - // The maximum session expiry in hours. The property default value is 1 hour. Min allowed value is 1 hour and max allowed - // value is 8 hours. - MaximumSessionExpiryInHours *int32 - - // This property is used to specify custom topic to which events will be routed to from topic spaces configuration under namespace. - RouteTopicResourceID *string - - // Routing enrichments for topic spaces configuration. - RoutingEnrichments *RoutingEnrichments - - // Routing identity info for topic spaces configuration. - RoutingIdentityInfo *RoutingIdentityInfo - - // Indicate if Topic Spaces Configuration is enabled for the namespace. Default is Disabled. - State *TopicSpacesConfigurationState -} - // UserIdentityProperties - The information about the user identity. type UserIdentityProperties struct { // The client id of user assigned identity. @@ -4955,9 +2110,6 @@ type VerifiedPartnerProperties struct { // Official name of the Partner. OrganizationName *string - // Details of the partner destination scenario. - PartnerDestinationDetails *PartnerDetails - // Display name of the verified partner. PartnerDisplayName *string @@ -4971,25 +2123,6 @@ type VerifiedPartnerProperties struct { ProvisioningState *VerifiedPartnerProvisioningState } -// VerifiedPartnersClientGetOptions contains the optional parameters for the VerifiedPartnersClient.Get method. -type VerifiedPartnersClientGetOptions struct { - // placeholder for future optional parameters -} - -// VerifiedPartnersClientListOptions contains the optional parameters for the VerifiedPartnersClient.NewListPager method. -type VerifiedPartnersClientListOptions struct { - // 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'. - Filter *string - // 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. - Top *int32 -} - // VerifiedPartnersListResult - Result of the List verified partners operation type VerifiedPartnersListResult struct { // A link for the next page of verified partners if any. @@ -5033,78 +2166,9 @@ type WebHookEventSubscriptionDestinationProperties struct { // Maximum number of events per batch. MaxEventsPerBatch *int32 - // Minimum TLS version that should be supported by webhook endpoint - MinimumTLSVersionAllowed *TLSVersion - // Preferred batch size in Kilobytes. PreferredBatchSizeInKilobytes *int32 // READ-ONLY; The base URL that represents the endpoint of the destination of an event subscription. EndpointBaseURL *string } - -// WebhookPartnerDestinationInfo - Information about the WebHook of the partner destination. -type WebhookPartnerDestinationInfo struct { - // REQUIRED; Type of the endpoint for the partner destination - EndpointType *PartnerEndpointType - - // Azure subscription ID of the subscriber. The partner destination associated with the channel will be created under this - // Azure subscription. - AzureSubscriptionID *string - - // Additional context of the partner destination endpoint. - EndpointServiceContext *string - - // Name of the partner destination associated with the channel. - Name *string - - // WebHook Properties of the partner destination. - Properties *WebhookPartnerDestinationProperties - - // Azure Resource Group of the subscriber. The partner destination associated with the channel will be created under this - // resource group. - ResourceGroupName *string - - // Change history of the resource move. - ResourceMoveChangeHistory []*ResourceMoveChangeHistory -} - -// GetPartnerDestinationInfo implements the PartnerDestinationInfoClassification interface for type WebhookPartnerDestinationInfo. -func (w *WebhookPartnerDestinationInfo) GetPartnerDestinationInfo() *PartnerDestinationInfo { - return &PartnerDestinationInfo{ - AzureSubscriptionID: w.AzureSubscriptionID, - ResourceGroupName: w.ResourceGroupName, - Name: w.Name, - EndpointType: w.EndpointType, - EndpointServiceContext: w.EndpointServiceContext, - ResourceMoveChangeHistory: w.ResourceMoveChangeHistory, - } -} - -// WebhookPartnerDestinationProperties - Properties of a partner destination webhook. -type WebhookPartnerDestinationProperties struct { - // Partner client authentication - ClientAuthentication PartnerClientAuthenticationClassification - - // The base URL that represents the endpoint of the partner destination. - EndpointBaseURL *string - - // The URL that represents the endpoint of the partner destination. - EndpointURL *string -} - -// WebhookUpdatePartnerDestinationInfo - Information about the update of the WebHook of the partner destination. -type WebhookUpdatePartnerDestinationInfo struct { - // REQUIRED; Type of the endpoint for the partner destination - EndpointType *PartnerEndpointType - - // WebHook Properties of the partner destination. - Properties *WebhookPartnerDestinationProperties -} - -// GetPartnerUpdateDestinationInfo implements the PartnerUpdateDestinationInfoClassification interface for type WebhookUpdatePartnerDestinationInfo. -func (w *WebhookUpdatePartnerDestinationInfo) GetPartnerUpdateDestinationInfo() *PartnerUpdateDestinationInfo { - return &PartnerUpdateDestinationInfo{ - EndpointType: w.EndpointType, - } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/models_serde.go b/sdk/resourcemanager/eventgrid/armeventgrid/models_serde.go index 8359738815c0..ad6c89dcb3b0 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/models_serde.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/models_serde.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid @@ -47,68 +46,6 @@ func (a *AdvancedFilter) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureADPartnerClientAuthentication. -func (a AzureADPartnerClientAuthentication) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["clientAuthenticationType"] = PartnerClientAuthenticationTypeAzureAD - populate(objectMap, "properties", a.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureADPartnerClientAuthentication. -func (a *AzureADPartnerClientAuthentication) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "clientAuthenticationType": - err = unpopulate(val, "ClientAuthenticationType", &a.ClientAuthenticationType) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureADPartnerClientAuthenticationProperties. -func (a AzureADPartnerClientAuthenticationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "azureActiveDirectoryApplicationIdOrUri", a.AzureActiveDirectoryApplicationIDOrURI) - populate(objectMap, "azureActiveDirectoryTenantId", a.AzureActiveDirectoryTenantID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureADPartnerClientAuthenticationProperties. -func (a *AzureADPartnerClientAuthenticationProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "azureActiveDirectoryApplicationIdOrUri": - err = unpopulate(val, "AzureActiveDirectoryApplicationIDOrURI", &a.AzureActiveDirectoryApplicationIDOrURI) - delete(rawMsg, key) - case "azureActiveDirectoryTenantId": - err = unpopulate(val, "AzureActiveDirectoryTenantID", &a.AzureActiveDirectoryTenantID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type AzureFunctionEventSubscriptionDestination. func (a AzureFunctionEventSubscriptionDestination) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -214,158 +151,6 @@ func (b *BoolEqualsAdvancedFilter) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type BoolEqualsFilter. -func (b BoolEqualsFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "key", b.Key) - objectMap["operatorType"] = FilterOperatorTypeBoolEquals - populate(objectMap, "value", b.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BoolEqualsFilter. -func (b *BoolEqualsFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "key": - err = unpopulate(val, "Key", &b.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &b.OperatorType) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &b.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CaCertificate. -func (c CaCertificate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", c.ID) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "systemData", c.SystemData) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CaCertificate. -func (c *CaCertificate) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &c.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CaCertificateProperties. -func (c CaCertificateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", c.Description) - populate(objectMap, "encodedCertificate", c.EncodedCertificate) - populateTimeRFC3339(objectMap, "expiryTimeInUtc", c.ExpiryTimeInUTC) - populateTimeRFC3339(objectMap, "issueTimeInUtc", c.IssueTimeInUTC) - populate(objectMap, "provisioningState", c.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CaCertificateProperties. -func (c *CaCertificateProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &c.Description) - delete(rawMsg, key) - case "encodedCertificate": - err = unpopulate(val, "EncodedCertificate", &c.EncodedCertificate) - delete(rawMsg, key) - case "expiryTimeInUtc": - err = unpopulateTimeRFC3339(val, "ExpiryTimeInUTC", &c.ExpiryTimeInUTC) - delete(rawMsg, key) - case "issueTimeInUtc": - err = unpopulateTimeRFC3339(val, "IssueTimeInUTC", &c.IssueTimeInUTC) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CaCertificatesListResult. -func (c CaCertificatesListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CaCertificatesListResult. -func (c *CaCertificatesListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &c.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &c.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type Channel. func (c Channel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -413,9 +198,8 @@ func (c *Channel) UnmarshalJSON(data []byte) error { func (c ChannelProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "channelType", c.ChannelType) - populateTimeRFC3339(objectMap, "expirationTimeIfNotActivatedUtc", c.ExpirationTimeIfNotActivatedUTC) + populateDateTimeRFC3339(objectMap, "expirationTimeIfNotActivatedUtc", c.ExpirationTimeIfNotActivatedUTC) populate(objectMap, "messageForActivation", c.MessageForActivation) - populate(objectMap, "partnerDestinationInfo", c.PartnerDestinationInfo) populate(objectMap, "partnerTopicInfo", c.PartnerTopicInfo) populate(objectMap, "provisioningState", c.ProvisioningState) populate(objectMap, "readinessState", c.ReadinessState) @@ -435,14 +219,11 @@ func (c *ChannelProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "ChannelType", &c.ChannelType) delete(rawMsg, key) case "expirationTimeIfNotActivatedUtc": - err = unpopulateTimeRFC3339(val, "ExpirationTimeIfNotActivatedUTC", &c.ExpirationTimeIfNotActivatedUTC) + err = unpopulateDateTimeRFC3339(val, "ExpirationTimeIfNotActivatedUTC", &c.ExpirationTimeIfNotActivatedUTC) delete(rawMsg, key) case "messageForActivation": err = unpopulate(val, "MessageForActivation", &c.MessageForActivation) delete(rawMsg, key) - case "partnerDestinationInfo": - c.PartnerDestinationInfo, err = unmarshalPartnerDestinationInfoClassification(val) - delete(rawMsg, key) case "partnerTopicInfo": err = unpopulate(val, "PartnerTopicInfo", &c.PartnerTopicInfo) delete(rawMsg, key) @@ -490,8 +271,7 @@ func (c *ChannelUpdateParameters) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ChannelUpdateParametersProperties. func (c ChannelUpdateParametersProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "expirationTimeIfNotActivatedUtc", c.ExpirationTimeIfNotActivatedUTC) - populate(objectMap, "partnerDestinationInfo", c.PartnerDestinationInfo) + populateDateTimeRFC3339(objectMap, "expirationTimeIfNotActivatedUtc", c.ExpirationTimeIfNotActivatedUTC) populate(objectMap, "partnerTopicInfo", c.PartnerTopicInfo) return json.Marshal(objectMap) } @@ -506,10 +286,7 @@ func (c *ChannelUpdateParametersProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "expirationTimeIfNotActivatedUtc": - err = unpopulateTimeRFC3339(val, "ExpirationTimeIfNotActivatedUTC", &c.ExpirationTimeIfNotActivatedUTC) - delete(rawMsg, key) - case "partnerDestinationInfo": - c.PartnerDestinationInfo, err = unmarshalPartnerUpdateDestinationInfoClassification(val) + err = unpopulateDateTimeRFC3339(val, "ExpirationTimeIfNotActivatedUTC", &c.ExpirationTimeIfNotActivatedUTC) delete(rawMsg, key) case "partnerTopicInfo": err = unpopulate(val, "PartnerTopicInfo", &c.PartnerTopicInfo) @@ -553,19 +330,17 @@ func (c *ChannelsListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Client. -func (c Client) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ConnectionState. +func (c ConnectionState) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", c.ID) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "systemData", c.SystemData) - populate(objectMap, "type", c.Type) + populate(objectMap, "actionsRequired", c.ActionsRequired) + populate(objectMap, "description", c.Description) + populate(objectMap, "status", c.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Client. -func (c *Client) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionState. +func (c *ConnectionState) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -573,20 +348,14 @@ func (c *Client) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) + case "actionsRequired": + err = unpopulate(val, "ActionsRequired", &c.ActionsRequired) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &c.SystemData) + case "description": + err = unpopulate(val, "Description", &c.Description) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) + case "status": + err = unpopulate(val, "Status", &c.Status) delete(rawMsg, key) } if err != nil { @@ -596,400 +365,417 @@ func (c *Client) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ClientAuthentication. -func (c ClientAuthentication) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeadLetterDestination. +func (d DeadLetterDestination) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "certificateSubject", c.CertificateSubject) - populate(objectMap, "certificateThumbprint", c.CertificateThumbprint) + objectMap["endpointType"] = d.EndpointType return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientAuthentication. -func (c *ClientAuthentication) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeadLetterDestination. +func (d *DeadLetterDestination) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "certificateSubject": - err = unpopulate(val, "CertificateSubject", &c.CertificateSubject) - delete(rawMsg, key) - case "certificateThumbprint": - err = unpopulate(val, "CertificateThumbprint", &c.CertificateThumbprint) + case "endpointType": + err = unpopulate(val, "EndpointType", &d.EndpointType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ClientAuthenticationSettings. -func (c ClientAuthenticationSettings) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeadLetterWithResourceIdentity. +func (d DeadLetterWithResourceIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "alternativeAuthenticationNameSources", c.AlternativeAuthenticationNameSources) + populate(objectMap, "deadLetterDestination", d.DeadLetterDestination) + populate(objectMap, "identity", d.Identity) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientAuthenticationSettings. -func (c *ClientAuthenticationSettings) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeadLetterWithResourceIdentity. +func (d *DeadLetterWithResourceIdentity) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "alternativeAuthenticationNameSources": - err = unpopulate(val, "AlternativeAuthenticationNameSources", &c.AlternativeAuthenticationNameSources) + case "deadLetterDestination": + d.DeadLetterDestination, err = unmarshalDeadLetterDestinationClassification(val) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &d.Identity) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ClientCertificateAuthentication. -func (c ClientCertificateAuthentication) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeliveryAttributeListResult. +func (d DeliveryAttributeListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "allowedThumbprints", c.AllowedThumbprints) - populate(objectMap, "validationScheme", c.ValidationScheme) + populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientCertificateAuthentication. -func (c *ClientCertificateAuthentication) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeliveryAttributeListResult. +func (d *DeliveryAttributeListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "allowedThumbprints": - err = unpopulate(val, "AllowedThumbprints", &c.AllowedThumbprints) - delete(rawMsg, key) - case "validationScheme": - err = unpopulate(val, "ValidationScheme", &c.ValidationScheme) + case "value": + d.Value, err = unmarshalDeliveryAttributeMappingClassificationArray(val) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ClientCertificateSubjectDistinguishedName. -func (c ClientCertificateSubjectDistinguishedName) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeliveryAttributeMapping. +func (d DeliveryAttributeMapping) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "commonName", c.CommonName) - populate(objectMap, "countryCode", c.CountryCode) - populate(objectMap, "organization", c.Organization) - populate(objectMap, "organizationUnit", c.OrganizationUnit) + populate(objectMap, "name", d.Name) + objectMap["type"] = d.Type return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientCertificateSubjectDistinguishedName. -func (c *ClientCertificateSubjectDistinguishedName) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeliveryAttributeMapping. +func (d *DeliveryAttributeMapping) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "commonName": - err = unpopulate(val, "CommonName", &c.CommonName) + case "name": + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) - case "countryCode": - err = unpopulate(val, "CountryCode", &c.CountryCode) - delete(rawMsg, key) - case "organization": - err = unpopulate(val, "Organization", &c.Organization) - delete(rawMsg, key) - case "organizationUnit": - err = unpopulate(val, "OrganizationUnit", &c.OrganizationUnit) + case "type": + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ClientCertificateThumbprint. -func (c ClientCertificateThumbprint) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeliveryWithResourceIdentity. +func (d DeliveryWithResourceIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "primary", c.Primary) - populate(objectMap, "secondary", c.Secondary) + populate(objectMap, "destination", d.Destination) + populate(objectMap, "identity", d.Identity) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientCertificateThumbprint. -func (c *ClientCertificateThumbprint) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeliveryWithResourceIdentity. +func (d *DeliveryWithResourceIdentity) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "primary": - err = unpopulate(val, "Primary", &c.Primary) + case "destination": + d.Destination, err = unmarshalEventSubscriptionDestinationClassification(val) delete(rawMsg, key) - case "secondary": - err = unpopulate(val, "Secondary", &c.Secondary) + case "identity": + err = unpopulate(val, "Identity", &d.Identity) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ClientGroup. -func (c ClientGroup) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Domain. +func (d Domain) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", c.ID) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "systemData", c.SystemData) - populate(objectMap, "type", c.Type) + populate(objectMap, "id", d.ID) + populate(objectMap, "identity", d.Identity) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientGroup. -func (c *ClientGroup) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Domain. +func (d *Domain) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &c.ID) + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &d.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &c.Name) + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &c.Properties) + err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &c.SystemData) + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &c.Type) + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ClientGroupProperties. -func (c ClientGroupProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DomainProperties. +func (d DomainProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", c.Description) - populate(objectMap, "provisioningState", c.ProvisioningState) - populate(objectMap, "query", c.Query) + populate(objectMap, "autoCreateTopicWithFirstSubscription", d.AutoCreateTopicWithFirstSubscription) + populate(objectMap, "autoDeleteTopicWithLastSubscription", d.AutoDeleteTopicWithLastSubscription) + populate(objectMap, "dataResidencyBoundary", d.DataResidencyBoundary) + populate(objectMap, "disableLocalAuth", d.DisableLocalAuth) + populate(objectMap, "endpoint", d.Endpoint) + populate(objectMap, "inboundIpRules", d.InboundIPRules) + populate(objectMap, "inputSchema", d.InputSchema) + populate(objectMap, "inputSchemaMapping", d.InputSchemaMapping) + populate(objectMap, "metricResourceId", d.MetricResourceID) + populate(objectMap, "privateEndpointConnections", d.PrivateEndpointConnections) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "publicNetworkAccess", d.PublicNetworkAccess) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientGroupProperties. -func (c *ClientGroupProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DomainProperties. +func (d *DomainProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &c.Description) + case "autoCreateTopicWithFirstSubscription": + err = unpopulate(val, "AutoCreateTopicWithFirstSubscription", &d.AutoCreateTopicWithFirstSubscription) + delete(rawMsg, key) + case "autoDeleteTopicWithLastSubscription": + err = unpopulate(val, "AutoDeleteTopicWithLastSubscription", &d.AutoDeleteTopicWithLastSubscription) + delete(rawMsg, key) + case "dataResidencyBoundary": + err = unpopulate(val, "DataResidencyBoundary", &d.DataResidencyBoundary) + delete(rawMsg, key) + case "disableLocalAuth": + err = unpopulate(val, "DisableLocalAuth", &d.DisableLocalAuth) + delete(rawMsg, key) + case "endpoint": + err = unpopulate(val, "Endpoint", &d.Endpoint) + delete(rawMsg, key) + case "inboundIpRules": + err = unpopulate(val, "InboundIPRules", &d.InboundIPRules) + delete(rawMsg, key) + case "inputSchema": + err = unpopulate(val, "InputSchema", &d.InputSchema) + delete(rawMsg, key) + case "inputSchemaMapping": + d.InputSchemaMapping, err = unmarshalInputSchemaMappingClassification(val) + delete(rawMsg, key) + case "metricResourceId": + err = unpopulate(val, "MetricResourceID", &d.MetricResourceID) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &d.PrivateEndpointConnections) delete(rawMsg, key) case "provisioningState": - err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) delete(rawMsg, key) - case "query": - err = unpopulate(val, "Query", &c.Query) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &d.PublicNetworkAccess) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ClientGroupsListResult. -func (c ClientGroupsListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DomainRegenerateKeyRequest. +func (d DomainRegenerateKeyRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) + populate(objectMap, "keyName", d.KeyName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientGroupsListResult. -func (c *ClientGroupsListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DomainRegenerateKeyRequest. +func (d *DomainRegenerateKeyRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &c.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &c.Value) + case "keyName": + err = unpopulate(val, "KeyName", &d.KeyName) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ClientProperties. -func (c ClientProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DomainSharedAccessKeys. +func (d DomainSharedAccessKeys) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "attributes", c.Attributes) - populate(objectMap, "authentication", c.Authentication) - populate(objectMap, "authenticationName", c.AuthenticationName) - populate(objectMap, "clientCertificateAuthentication", c.ClientCertificateAuthentication) - populate(objectMap, "description", c.Description) - populate(objectMap, "provisioningState", c.ProvisioningState) - populate(objectMap, "state", c.State) + populate(objectMap, "key1", d.Key1) + populate(objectMap, "key2", d.Key2) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientProperties. -func (c *ClientProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DomainSharedAccessKeys. +func (d *DomainSharedAccessKeys) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "attributes": - err = unpopulate(val, "Attributes", &c.Attributes) - delete(rawMsg, key) - case "authentication": - err = unpopulate(val, "Authentication", &c.Authentication) - delete(rawMsg, key) - case "authenticationName": - err = unpopulate(val, "AuthenticationName", &c.AuthenticationName) - delete(rawMsg, key) - case "clientCertificateAuthentication": - err = unpopulate(val, "ClientCertificateAuthentication", &c.ClientCertificateAuthentication) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &c.Description) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + case "key1": + err = unpopulate(val, "Key1", &d.Key1) delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &c.State) + case "key2": + err = unpopulate(val, "Key2", &d.Key2) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ClientsListResult. -func (c ClientsListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DomainTopic. +func (d DomainTopic) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientsListResult. -func (c *ClientsListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DomainTopic. +func (d *DomainTopic) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &c.NextLink) + case "id": + err = unpopulate(val, "ID", &d.ID) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &c.Value) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ConnectionState. -func (c ConnectionState) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DomainTopicProperties. +func (d DomainTopicProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "actionsRequired", c.ActionsRequired) - populate(objectMap, "description", c.Description) - populate(objectMap, "status", c.Status) + populate(objectMap, "provisioningState", d.ProvisioningState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionState. -func (c *ConnectionState) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DomainTopicProperties. +func (d *DomainTopicProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "actionsRequired": - err = unpopulate(val, "ActionsRequired", &c.ActionsRequired) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &c.Description) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &c.Status) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DeadLetterDestination. -func (d DeadLetterDestination) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DomainTopicsListResult. +func (d DomainTopicsListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["endpointType"] = d.EndpointType + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DeadLetterDestination. -func (d *DeadLetterDestination) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DomainTopicsListResult. +func (d *DomainTopicsListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -997,8 +783,11 @@ func (d *DeadLetterDestination) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "endpointType": - err = unpopulate(val, "EndpointType", &d.EndpointType) + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) delete(rawMsg, key) } if err != nil { @@ -1008,16 +797,20 @@ func (d *DeadLetterDestination) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DeadLetterWithResourceIdentity. -func (d DeadLetterWithResourceIdentity) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DomainUpdateParameterProperties. +func (d DomainUpdateParameterProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "deadLetterDestination", d.DeadLetterDestination) - populate(objectMap, "identity", d.Identity) + populate(objectMap, "autoCreateTopicWithFirstSubscription", d.AutoCreateTopicWithFirstSubscription) + populate(objectMap, "autoDeleteTopicWithLastSubscription", d.AutoDeleteTopicWithLastSubscription) + populate(objectMap, "dataResidencyBoundary", d.DataResidencyBoundary) + populate(objectMap, "disableLocalAuth", d.DisableLocalAuth) + populate(objectMap, "inboundIpRules", d.InboundIPRules) + populate(objectMap, "publicNetworkAccess", d.PublicNetworkAccess) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DeadLetterWithResourceIdentity. -func (d *DeadLetterWithResourceIdentity) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DomainUpdateParameterProperties. +func (d *DomainUpdateParameterProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -1025,11 +818,23 @@ func (d *DeadLetterWithResourceIdentity) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "deadLetterDestination": - d.DeadLetterDestination, err = unmarshalDeadLetterDestinationClassification(val) + case "autoCreateTopicWithFirstSubscription": + err = unpopulate(val, "AutoCreateTopicWithFirstSubscription", &d.AutoCreateTopicWithFirstSubscription) delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &d.Identity) + case "autoDeleteTopicWithLastSubscription": + err = unpopulate(val, "AutoDeleteTopicWithLastSubscription", &d.AutoDeleteTopicWithLastSubscription) + delete(rawMsg, key) + case "dataResidencyBoundary": + err = unpopulate(val, "DataResidencyBoundary", &d.DataResidencyBoundary) + delete(rawMsg, key) + case "disableLocalAuth": + err = unpopulate(val, "DisableLocalAuth", &d.DisableLocalAuth) + delete(rawMsg, key) + case "inboundIpRules": + err = unpopulate(val, "InboundIPRules", &d.InboundIPRules) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &d.PublicNetworkAccess) delete(rawMsg, key) } if err != nil { @@ -1039,15 +844,17 @@ func (d *DeadLetterWithResourceIdentity) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DeliveryAttributeListResult. -func (d DeliveryAttributeListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DomainUpdateParameters. +func (d DomainUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", d.Value) + populate(objectMap, "identity", d.Identity) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "tags", d.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DeliveryAttributeListResult. -func (d *DeliveryAttributeListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DomainUpdateParameters. +func (d *DomainUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -1055,8 +862,14 @@ func (d *DeliveryAttributeListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "value": - d.Value, err = unmarshalDeliveryAttributeMappingClassificationArray(val) + case "identity": + err = unpopulate(val, "Identity", &d.Identity) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) delete(rawMsg, key) } if err != nil { @@ -1066,16 +879,16 @@ func (d *DeliveryAttributeListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DeliveryAttributeMapping. -func (d DeliveryAttributeMapping) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DomainsListResult. +func (d DomainsListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", d.Name) - objectMap["type"] = d.Type + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DeliveryAttributeMapping. -func (d *DeliveryAttributeMapping) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DomainsListResult. +func (d *DomainsListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -1083,11 +896,11 @@ func (d *DeliveryAttributeMapping) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &d.Name) + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) + case "value": + err = unpopulate(val, "Value", &d.Value) delete(rawMsg, key) } if err != nil { @@ -1097,16 +910,17 @@ func (d *DeliveryAttributeMapping) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DeliveryConfiguration. -func (d DeliveryConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DynamicDeliveryAttributeMapping. +func (d DynamicDeliveryAttributeMapping) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "deliveryMode", d.DeliveryMode) - populate(objectMap, "queue", d.Queue) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + objectMap["type"] = DeliveryAttributeMappingTypeDynamic return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DeliveryConfiguration. -func (d *DeliveryConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DynamicDeliveryAttributeMapping. +func (d *DynamicDeliveryAttributeMapping) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -1114,11 +928,14 @@ func (d *DeliveryConfiguration) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "deliveryMode": - err = unpopulate(val, "DeliveryMode", &d.DeliveryMode) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) - case "queue": - err = unpopulate(val, "Queue", &d.Queue) + case "type": + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { @@ -1128,16 +945,15 @@ func (d *DeliveryConfiguration) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DeliveryWithResourceIdentity. -func (d DeliveryWithResourceIdentity) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DynamicDeliveryAttributeMappingProperties. +func (d DynamicDeliveryAttributeMappingProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "destination", d.Destination) - populate(objectMap, "identity", d.Identity) + populate(objectMap, "sourceField", d.SourceField) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DeliveryWithResourceIdentity. -func (d *DeliveryWithResourceIdentity) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DynamicDeliveryAttributeMappingProperties. +func (d *DynamicDeliveryAttributeMappingProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -1145,11 +961,8 @@ func (d *DeliveryWithResourceIdentity) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "destination": - d.Destination, err = unmarshalEventSubscriptionDestinationClassification(val) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &d.Identity) + case "sourceField": + err = unpopulate(val, "SourceField", &d.SourceField) delete(rawMsg, key) } if err != nil { @@ -1159,531 +972,518 @@ func (d *DeliveryWithResourceIdentity) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Domain. -func (d Domain) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventHubEventSubscriptionDestination. +func (e EventHubEventSubscriptionDestination) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) - populate(objectMap, "identity", d.Identity) - populate(objectMap, "location", d.Location) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "sku", d.SKU) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "tags", d.Tags) - populate(objectMap, "type", d.Type) + objectMap["endpointType"] = EndpointTypeEventHub + populate(objectMap, "properties", e.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Domain. -func (d *Domain) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubEventSubscriptionDestination. +func (e *EventHubEventSubscriptionDestination) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &d.Identity) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &d.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) + case "endpointType": + err = unpopulate(val, "EndpointType", &e.EndpointType) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) - case "sku": - err = unpopulate(val, "SKU", &d.SKU) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &d.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) + err = unpopulate(val, "Properties", &e.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DomainProperties. -func (d DomainProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventHubEventSubscriptionDestinationProperties. +func (e EventHubEventSubscriptionDestinationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "autoCreateTopicWithFirstSubscription", d.AutoCreateTopicWithFirstSubscription) - populate(objectMap, "autoDeleteTopicWithLastSubscription", d.AutoDeleteTopicWithLastSubscription) - populate(objectMap, "dataResidencyBoundary", d.DataResidencyBoundary) - populate(objectMap, "disableLocalAuth", d.DisableLocalAuth) - populate(objectMap, "endpoint", d.Endpoint) - populate(objectMap, "eventTypeInfo", d.EventTypeInfo) - populate(objectMap, "inboundIpRules", d.InboundIPRules) - populate(objectMap, "inputSchema", d.InputSchema) - populate(objectMap, "inputSchemaMapping", d.InputSchemaMapping) - populate(objectMap, "metricResourceId", d.MetricResourceID) - populate(objectMap, "minimumTlsVersionAllowed", d.MinimumTLSVersionAllowed) - populate(objectMap, "privateEndpointConnections", d.PrivateEndpointConnections) - populate(objectMap, "provisioningState", d.ProvisioningState) - populate(objectMap, "publicNetworkAccess", d.PublicNetworkAccess) + populate(objectMap, "deliveryAttributeMappings", e.DeliveryAttributeMappings) + populate(objectMap, "resourceId", e.ResourceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DomainProperties. -func (d *DomainProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubEventSubscriptionDestinationProperties. +func (e *EventHubEventSubscriptionDestinationProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "autoCreateTopicWithFirstSubscription": - err = unpopulate(val, "AutoCreateTopicWithFirstSubscription", &d.AutoCreateTopicWithFirstSubscription) - delete(rawMsg, key) - case "autoDeleteTopicWithLastSubscription": - err = unpopulate(val, "AutoDeleteTopicWithLastSubscription", &d.AutoDeleteTopicWithLastSubscription) - delete(rawMsg, key) - case "dataResidencyBoundary": - err = unpopulate(val, "DataResidencyBoundary", &d.DataResidencyBoundary) - delete(rawMsg, key) - case "disableLocalAuth": - err = unpopulate(val, "DisableLocalAuth", &d.DisableLocalAuth) - delete(rawMsg, key) - case "endpoint": - err = unpopulate(val, "Endpoint", &d.Endpoint) - delete(rawMsg, key) - case "eventTypeInfo": - err = unpopulate(val, "EventTypeInfo", &d.EventTypeInfo) - delete(rawMsg, key) - case "inboundIpRules": - err = unpopulate(val, "InboundIPRules", &d.InboundIPRules) - delete(rawMsg, key) - case "inputSchema": - err = unpopulate(val, "InputSchema", &d.InputSchema) - delete(rawMsg, key) - case "inputSchemaMapping": - d.InputSchemaMapping, err = unmarshalInputSchemaMappingClassification(val) - delete(rawMsg, key) - case "metricResourceId": - err = unpopulate(val, "MetricResourceID", &d.MetricResourceID) - delete(rawMsg, key) - case "minimumTlsVersionAllowed": - err = unpopulate(val, "MinimumTLSVersionAllowed", &d.MinimumTLSVersionAllowed) - delete(rawMsg, key) - case "privateEndpointConnections": - err = unpopulate(val, "PrivateEndpointConnections", &d.PrivateEndpointConnections) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + case "deliveryAttributeMappings": + e.DeliveryAttributeMappings, err = unmarshalDeliveryAttributeMappingClassificationArray(val) delete(rawMsg, key) - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &d.PublicNetworkAccess) + case "resourceId": + err = unpopulate(val, "ResourceID", &e.ResourceID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DomainRegenerateKeyRequest. -func (d DomainRegenerateKeyRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventSubscription. +func (e EventSubscription) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "keyName", d.KeyName) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DomainRegenerateKeyRequest. -func (d *DomainRegenerateKeyRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventSubscription. +func (e *EventSubscription) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "keyName": - err = unpopulate(val, "KeyName", &d.KeyName) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DomainSharedAccessKeys. -func (d DomainSharedAccessKeys) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventSubscriptionDestination. +func (e EventSubscriptionDestination) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "key1", d.Key1) - populate(objectMap, "key2", d.Key2) + objectMap["endpointType"] = e.EndpointType return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DomainSharedAccessKeys. -func (d *DomainSharedAccessKeys) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventSubscriptionDestination. +func (e *EventSubscriptionDestination) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "key1": - err = unpopulate(val, "Key1", &d.Key1) - delete(rawMsg, key) - case "key2": - err = unpopulate(val, "Key2", &d.Key2) + case "endpointType": + err = unpopulate(val, "EndpointType", &e.EndpointType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DomainTopic. -func (d DomainTopic) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventSubscriptionFilter. +func (e EventSubscriptionFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "type", d.Type) + populate(objectMap, "advancedFilters", e.AdvancedFilters) + populate(objectMap, "enableAdvancedFilteringOnArrays", e.EnableAdvancedFilteringOnArrays) + populate(objectMap, "includedEventTypes", e.IncludedEventTypes) + populate(objectMap, "isSubjectCaseSensitive", e.IsSubjectCaseSensitive) + populate(objectMap, "subjectBeginsWith", e.SubjectBeginsWith) + populate(objectMap, "subjectEndsWith", e.SubjectEndsWith) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DomainTopic. -func (d *DomainTopic) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventSubscriptionFilter. +func (e *EventSubscriptionFilter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) + case "advancedFilters": + e.AdvancedFilters, err = unmarshalAdvancedFilterClassificationArray(val) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) + case "enableAdvancedFilteringOnArrays": + err = unpopulate(val, "EnableAdvancedFilteringOnArrays", &e.EnableAdvancedFilteringOnArrays) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) + case "includedEventTypes": + err = unpopulate(val, "IncludedEventTypes", &e.IncludedEventTypes) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) + case "isSubjectCaseSensitive": + err = unpopulate(val, "IsSubjectCaseSensitive", &e.IsSubjectCaseSensitive) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) + case "subjectBeginsWith": + err = unpopulate(val, "SubjectBeginsWith", &e.SubjectBeginsWith) + delete(rawMsg, key) + case "subjectEndsWith": + err = unpopulate(val, "SubjectEndsWith", &e.SubjectEndsWith) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DomainTopicProperties. -func (d DomainTopicProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventSubscriptionFullURL. +func (e EventSubscriptionFullURL) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "endpointUrl", e.EndpointURL) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DomainTopicProperties. -func (d *DomainTopicProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventSubscriptionFullURL. +func (e *EventSubscriptionFullURL) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + case "endpointUrl": + err = unpopulate(val, "EndpointURL", &e.EndpointURL) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DomainTopicsListResult. -func (d DomainTopicsListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventSubscriptionIdentity. +func (e EventSubscriptionIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) + populate(objectMap, "type", e.Type) + populate(objectMap, "userAssignedIdentity", e.UserAssignedIdentity) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DomainTopicsListResult. -func (d *DomainTopicsListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventSubscriptionIdentity. +func (e *EventSubscriptionIdentity) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &d.Value) + case "userAssignedIdentity": + err = unpopulate(val, "UserAssignedIdentity", &e.UserAssignedIdentity) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DomainUpdateParameterProperties. -func (d DomainUpdateParameterProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventSubscriptionProperties. +func (e EventSubscriptionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "autoCreateTopicWithFirstSubscription", d.AutoCreateTopicWithFirstSubscription) - populate(objectMap, "autoDeleteTopicWithLastSubscription", d.AutoDeleteTopicWithLastSubscription) - populate(objectMap, "dataResidencyBoundary", d.DataResidencyBoundary) - populate(objectMap, "disableLocalAuth", d.DisableLocalAuth) - populate(objectMap, "eventTypeInfo", d.EventTypeInfo) - populate(objectMap, "inboundIpRules", d.InboundIPRules) - populate(objectMap, "minimumTlsVersionAllowed", d.MinimumTLSVersionAllowed) - populate(objectMap, "publicNetworkAccess", d.PublicNetworkAccess) + populate(objectMap, "deadLetterDestination", e.DeadLetterDestination) + populate(objectMap, "deadLetterWithResourceIdentity", e.DeadLetterWithResourceIdentity) + populate(objectMap, "deliveryWithResourceIdentity", e.DeliveryWithResourceIdentity) + populate(objectMap, "destination", e.Destination) + populate(objectMap, "eventDeliverySchema", e.EventDeliverySchema) + populateDateTimeRFC3339(objectMap, "expirationTimeUtc", e.ExpirationTimeUTC) + populate(objectMap, "filter", e.Filter) + populate(objectMap, "labels", e.Labels) + populate(objectMap, "provisioningState", e.ProvisioningState) + populate(objectMap, "retryPolicy", e.RetryPolicy) + populate(objectMap, "topic", e.Topic) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DomainUpdateParameterProperties. -func (d *DomainUpdateParameterProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventSubscriptionProperties. +func (e *EventSubscriptionProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "autoCreateTopicWithFirstSubscription": - err = unpopulate(val, "AutoCreateTopicWithFirstSubscription", &d.AutoCreateTopicWithFirstSubscription) + case "deadLetterDestination": + e.DeadLetterDestination, err = unmarshalDeadLetterDestinationClassification(val) delete(rawMsg, key) - case "autoDeleteTopicWithLastSubscription": - err = unpopulate(val, "AutoDeleteTopicWithLastSubscription", &d.AutoDeleteTopicWithLastSubscription) + case "deadLetterWithResourceIdentity": + err = unpopulate(val, "DeadLetterWithResourceIdentity", &e.DeadLetterWithResourceIdentity) delete(rawMsg, key) - case "dataResidencyBoundary": - err = unpopulate(val, "DataResidencyBoundary", &d.DataResidencyBoundary) + case "deliveryWithResourceIdentity": + err = unpopulate(val, "DeliveryWithResourceIdentity", &e.DeliveryWithResourceIdentity) delete(rawMsg, key) - case "disableLocalAuth": - err = unpopulate(val, "DisableLocalAuth", &d.DisableLocalAuth) + case "destination": + e.Destination, err = unmarshalEventSubscriptionDestinationClassification(val) delete(rawMsg, key) - case "eventTypeInfo": - err = unpopulate(val, "EventTypeInfo", &d.EventTypeInfo) + case "eventDeliverySchema": + err = unpopulate(val, "EventDeliverySchema", &e.EventDeliverySchema) delete(rawMsg, key) - case "inboundIpRules": - err = unpopulate(val, "InboundIPRules", &d.InboundIPRules) + case "expirationTimeUtc": + err = unpopulateDateTimeRFC3339(val, "ExpirationTimeUTC", &e.ExpirationTimeUTC) delete(rawMsg, key) - case "minimumTlsVersionAllowed": - err = unpopulate(val, "MinimumTLSVersionAllowed", &d.MinimumTLSVersionAllowed) + case "filter": + err = unpopulate(val, "Filter", &e.Filter) delete(rawMsg, key) - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &d.PublicNetworkAccess) + case "labels": + err = unpopulate(val, "Labels", &e.Labels) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + case "retryPolicy": + err = unpopulate(val, "RetryPolicy", &e.RetryPolicy) + delete(rawMsg, key) + case "topic": + err = unpopulate(val, "Topic", &e.Topic) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DomainUpdateParameters. -func (d DomainUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventSubscriptionUpdateParameters. +func (e EventSubscriptionUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "identity", d.Identity) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "sku", d.SKU) - populate(objectMap, "tags", d.Tags) + populate(objectMap, "deadLetterDestination", e.DeadLetterDestination) + populate(objectMap, "deadLetterWithResourceIdentity", e.DeadLetterWithResourceIdentity) + populate(objectMap, "deliveryWithResourceIdentity", e.DeliveryWithResourceIdentity) + populate(objectMap, "destination", e.Destination) + populate(objectMap, "eventDeliverySchema", e.EventDeliverySchema) + populateDateTimeRFC3339(objectMap, "expirationTimeUtc", e.ExpirationTimeUTC) + populate(objectMap, "filter", e.Filter) + populate(objectMap, "labels", e.Labels) + populate(objectMap, "retryPolicy", e.RetryPolicy) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DomainUpdateParameters. -func (d *DomainUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventSubscriptionUpdateParameters. +func (e *EventSubscriptionUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "identity": - err = unpopulate(val, "Identity", &d.Identity) + case "deadLetterDestination": + e.DeadLetterDestination, err = unmarshalDeadLetterDestinationClassification(val) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) + case "deadLetterWithResourceIdentity": + err = unpopulate(val, "DeadLetterWithResourceIdentity", &e.DeadLetterWithResourceIdentity) delete(rawMsg, key) - case "sku": - err = unpopulate(val, "SKU", &d.SKU) + case "deliveryWithResourceIdentity": + err = unpopulate(val, "DeliveryWithResourceIdentity", &e.DeliveryWithResourceIdentity) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &d.Tags) + case "destination": + e.Destination, err = unmarshalEventSubscriptionDestinationClassification(val) + delete(rawMsg, key) + case "eventDeliverySchema": + err = unpopulate(val, "EventDeliverySchema", &e.EventDeliverySchema) + delete(rawMsg, key) + case "expirationTimeUtc": + err = unpopulateDateTimeRFC3339(val, "ExpirationTimeUTC", &e.ExpirationTimeUTC) + delete(rawMsg, key) + case "filter": + err = unpopulate(val, "Filter", &e.Filter) + delete(rawMsg, key) + case "labels": + err = unpopulate(val, "Labels", &e.Labels) + delete(rawMsg, key) + case "retryPolicy": + err = unpopulate(val, "RetryPolicy", &e.RetryPolicy) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DomainsListResult. -func (d DomainsListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventSubscriptionsListResult. +func (e EventSubscriptionsListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DomainsListResult. -func (d *DomainsListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventSubscriptionsListResult. +func (e *EventSubscriptionsListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) + err = unpopulate(val, "NextLink", &e.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &d.Value) + err = unpopulate(val, "Value", &e.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DynamicDeliveryAttributeMapping. -func (d DynamicDeliveryAttributeMapping) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventType. +func (e EventType) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - objectMap["type"] = DeliveryAttributeMappingTypeDynamic + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DynamicDeliveryAttributeMapping. -func (d *DynamicDeliveryAttributeMapping) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventType. +func (e *EventType) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &d.Name) + err = unpopulate(val, "Name", &e.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &d.Properties) + err = unpopulate(val, "Properties", &e.Properties) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &d.Type) + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DynamicDeliveryAttributeMappingProperties. -func (d DynamicDeliveryAttributeMappingProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventTypeInfo. +func (e EventTypeInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "sourceField", d.SourceField) + populate(objectMap, "inlineEventTypes", e.InlineEventTypes) + populate(objectMap, "kind", e.Kind) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DynamicDeliveryAttributeMappingProperties. -func (d *DynamicDeliveryAttributeMappingProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventTypeInfo. +func (e *EventTypeInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "sourceField": - err = unpopulate(val, "SourceField", &d.SourceField) + case "inlineEventTypes": + err = unpopulate(val, "InlineEventTypes", &e.InlineEventTypes) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &e.Kind) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DynamicRoutingEnrichment. -func (d DynamicRoutingEnrichment) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventTypeProperties. +func (e EventTypeProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "key", d.Key) - populate(objectMap, "value", d.Value) + populate(objectMap, "description", e.Description) + populate(objectMap, "displayName", e.DisplayName) + populate(objectMap, "isInDefaultSet", e.IsInDefaultSet) + populate(objectMap, "schemaUrl", e.SchemaURL) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DynamicRoutingEnrichment. -func (d *DynamicRoutingEnrichment) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventTypeProperties. +func (e *EventTypeProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "key": - err = unpopulate(val, "Key", &d.Key) + case "description": + err = unpopulate(val, "Description", &e.Description) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &d.Value) + case "displayName": + err = unpopulate(val, "DisplayName", &e.DisplayName) + delete(rawMsg, key) + case "isInDefaultSet": + err = unpopulate(val, "IsInDefaultSet", &e.IsInDefaultSet) + delete(rawMsg, key) + case "schemaUrl": + err = unpopulate(val, "SchemaURL", &e.SchemaURL) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. -func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventTypesListResult. +func (e EventTypesListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateAny(objectMap, "info", e.Info) - populate(objectMap, "type", e.Type) + populate(objectMap, "value", e.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. -func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventTypesListResult. +func (e *EventTypesListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -1691,11 +1491,8 @@ func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "info": - err = unpopulate(val, "Info", &e.Info) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "value": + err = unpopulate(val, "Value", &e.Value) delete(rawMsg, key) } if err != nil { @@ -1705,19 +1502,19 @@ func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. -func (e ErrorDetail) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionTopic. +func (e ExtensionTopic) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "additionalInfo", e.AdditionalInfo) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. -func (e *ErrorDetail) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionTopic. +func (e *ExtensionTopic) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -1725,20 +1522,20 @@ func (e *ErrorDetail) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "additionalInfo": - err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + case "id": + err = unpopulate(val, "ID", &e.ID) delete(rawMsg, key) - case "code": - err = unpopulate(val, "Code", &e.Code) + case "name": + err = unpopulate(val, "Name", &e.Name) delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &e.Details) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { @@ -1748,15 +1545,16 @@ func (e *ErrorDetail) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionTopicProperties. +func (e ExtensionTopicProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) + populate(objectMap, "description", e.Description) + populate(objectMap, "systemTopic", e.SystemTopic) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. -func (e *ErrorResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionTopicProperties. +func (e *ExtensionTopicProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -1764,8 +1562,11 @@ func (e *ErrorResponse) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) + case "description": + err = unpopulate(val, "Description", &e.Description) + delete(rawMsg, key) + case "systemTopic": + err = unpopulate(val, "SystemTopic", &e.SystemTopic) delete(rawMsg, key) } if err != nil { @@ -1775,3502 +1576,802 @@ func (e *ErrorResponse) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type EventHubEventSubscriptionDestination. -func (e EventHubEventSubscriptionDestination) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type HybridConnectionEventSubscriptionDestination. +func (h HybridConnectionEventSubscriptionDestination) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["endpointType"] = EndpointTypeEventHub - populate(objectMap, "properties", e.Properties) + objectMap["endpointType"] = EndpointTypeHybridConnection + populate(objectMap, "properties", h.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubEventSubscriptionDestination. -func (e *EventHubEventSubscriptionDestination) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type HybridConnectionEventSubscriptionDestination. +func (h *HybridConnectionEventSubscriptionDestination) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", h, err) } for key, val := range rawMsg { var err error switch key { case "endpointType": - err = unpopulate(val, "EndpointType", &e.EndpointType) + err = unpopulate(val, "EndpointType", &h.EndpointType) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &e.Properties) + err = unpopulate(val, "Properties", &h.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", h, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EventHubEventSubscriptionDestinationProperties. -func (e EventHubEventSubscriptionDestinationProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type HybridConnectionEventSubscriptionDestinationProperties. +func (h HybridConnectionEventSubscriptionDestinationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "deliveryAttributeMappings", e.DeliveryAttributeMappings) - populate(objectMap, "resourceId", e.ResourceID) + populate(objectMap, "deliveryAttributeMappings", h.DeliveryAttributeMappings) + populate(objectMap, "resourceId", h.ResourceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubEventSubscriptionDestinationProperties. -func (e *EventHubEventSubscriptionDestinationProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type HybridConnectionEventSubscriptionDestinationProperties. +func (h *HybridConnectionEventSubscriptionDestinationProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", h, err) } for key, val := range rawMsg { var err error switch key { case "deliveryAttributeMappings": - e.DeliveryAttributeMappings, err = unmarshalDeliveryAttributeMappingClassificationArray(val) + h.DeliveryAttributeMappings, err = unmarshalDeliveryAttributeMappingClassificationArray(val) delete(rawMsg, key) case "resourceId": - err = unpopulate(val, "ResourceID", &e.ResourceID) + err = unpopulate(val, "ResourceID", &h.ResourceID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", h, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EventSubscription. -func (e EventSubscription) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IdentityInfo. +func (i IdentityInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", e.ID) - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "systemData", e.SystemData) - populate(objectMap, "type", e.Type) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + populate(objectMap, "type", i.Type) + populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EventSubscription. -func (e *EventSubscription) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityInfo. +func (i *IdentityInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &e.Properties) + case "principalId": + err = unpopulate(val, "PrincipalID", &i.PrincipalID) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &e.SystemData) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &e.Type) + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &i.UserAssignedIdentities) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EventSubscriptionDestination. -func (e EventSubscriptionDestination) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type InboundIPRule. +func (i InboundIPRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["endpointType"] = e.EndpointType + populate(objectMap, "action", i.Action) + populate(objectMap, "ipMask", i.IPMask) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EventSubscriptionDestination. -func (e *EventSubscriptionDestination) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type InboundIPRule. +func (i *InboundIPRule) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "endpointType": - err = unpopulate(val, "EndpointType", &e.EndpointType) + case "action": + err = unpopulate(val, "Action", &i.Action) + delete(rawMsg, key) + case "ipMask": + err = unpopulate(val, "IPMask", &i.IPMask) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EventSubscriptionFilter. -func (e EventSubscriptionFilter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type InlineEventProperties. +func (i InlineEventProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "advancedFilters", e.AdvancedFilters) - populate(objectMap, "enableAdvancedFilteringOnArrays", e.EnableAdvancedFilteringOnArrays) - populate(objectMap, "includedEventTypes", e.IncludedEventTypes) - populate(objectMap, "isSubjectCaseSensitive", e.IsSubjectCaseSensitive) - populate(objectMap, "subjectBeginsWith", e.SubjectBeginsWith) - populate(objectMap, "subjectEndsWith", e.SubjectEndsWith) + populate(objectMap, "dataSchemaUrl", i.DataSchemaURL) + populate(objectMap, "description", i.Description) + populate(objectMap, "displayName", i.DisplayName) + populate(objectMap, "documentationUrl", i.DocumentationURL) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EventSubscriptionFilter. -func (e *EventSubscriptionFilter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type InlineEventProperties. +func (i *InlineEventProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "advancedFilters": - e.AdvancedFilters, err = unmarshalAdvancedFilterClassificationArray(val) - delete(rawMsg, key) - case "enableAdvancedFilteringOnArrays": - err = unpopulate(val, "EnableAdvancedFilteringOnArrays", &e.EnableAdvancedFilteringOnArrays) - delete(rawMsg, key) - case "includedEventTypes": - err = unpopulate(val, "IncludedEventTypes", &e.IncludedEventTypes) + case "dataSchemaUrl": + err = unpopulate(val, "DataSchemaURL", &i.DataSchemaURL) delete(rawMsg, key) - case "isSubjectCaseSensitive": - err = unpopulate(val, "IsSubjectCaseSensitive", &e.IsSubjectCaseSensitive) + case "description": + err = unpopulate(val, "Description", &i.Description) delete(rawMsg, key) - case "subjectBeginsWith": - err = unpopulate(val, "SubjectBeginsWith", &e.SubjectBeginsWith) + case "displayName": + err = unpopulate(val, "DisplayName", &i.DisplayName) delete(rawMsg, key) - case "subjectEndsWith": - err = unpopulate(val, "SubjectEndsWith", &e.SubjectEndsWith) + case "documentationUrl": + err = unpopulate(val, "DocumentationURL", &i.DocumentationURL) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EventSubscriptionFullURL. -func (e EventSubscriptionFullURL) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type InputSchemaMapping. +func (i InputSchemaMapping) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "endpointUrl", e.EndpointURL) + objectMap["inputSchemaMappingType"] = i.InputSchemaMappingType return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EventSubscriptionFullURL. -func (e *EventSubscriptionFullURL) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type InputSchemaMapping. +func (i *InputSchemaMapping) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "endpointUrl": - err = unpopulate(val, "EndpointURL", &e.EndpointURL) + case "inputSchemaMappingType": + err = unpopulate(val, "InputSchemaMappingType", &i.InputSchemaMappingType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EventSubscriptionIdentity. -func (e EventSubscriptionIdentity) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IsNotNullAdvancedFilter. +func (i IsNotNullAdvancedFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "type", e.Type) - populate(objectMap, "userAssignedIdentity", e.UserAssignedIdentity) + populate(objectMap, "key", i.Key) + objectMap["operatorType"] = AdvancedFilterOperatorTypeIsNotNull return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EventSubscriptionIdentity. -func (e *EventSubscriptionIdentity) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IsNotNullAdvancedFilter. +func (i *IsNotNullAdvancedFilter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "type": - err = unpopulate(val, "Type", &e.Type) + case "key": + err = unpopulate(val, "Key", &i.Key) delete(rawMsg, key) - case "userAssignedIdentity": - err = unpopulate(val, "UserAssignedIdentity", &e.UserAssignedIdentity) + case "operatorType": + err = unpopulate(val, "OperatorType", &i.OperatorType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EventSubscriptionProperties. -func (e EventSubscriptionProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IsNullOrUndefinedAdvancedFilter. +func (i IsNullOrUndefinedAdvancedFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "deadLetterDestination", e.DeadLetterDestination) - populate(objectMap, "deadLetterWithResourceIdentity", e.DeadLetterWithResourceIdentity) - populate(objectMap, "deliveryWithResourceIdentity", e.DeliveryWithResourceIdentity) - populate(objectMap, "destination", e.Destination) - populate(objectMap, "eventDeliverySchema", e.EventDeliverySchema) - populateTimeRFC3339(objectMap, "expirationTimeUtc", e.ExpirationTimeUTC) - populate(objectMap, "filter", e.Filter) - populate(objectMap, "labels", e.Labels) - populate(objectMap, "provisioningState", e.ProvisioningState) - populate(objectMap, "retryPolicy", e.RetryPolicy) - populate(objectMap, "topic", e.Topic) + populate(objectMap, "key", i.Key) + objectMap["operatorType"] = AdvancedFilterOperatorTypeIsNullOrUndefined return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EventSubscriptionProperties. -func (e *EventSubscriptionProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IsNullOrUndefinedAdvancedFilter. +func (i *IsNullOrUndefinedAdvancedFilter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "deadLetterDestination": - e.DeadLetterDestination, err = unmarshalDeadLetterDestinationClassification(val) - delete(rawMsg, key) - case "deadLetterWithResourceIdentity": - err = unpopulate(val, "DeadLetterWithResourceIdentity", &e.DeadLetterWithResourceIdentity) - delete(rawMsg, key) - case "deliveryWithResourceIdentity": - err = unpopulate(val, "DeliveryWithResourceIdentity", &e.DeliveryWithResourceIdentity) - delete(rawMsg, key) - case "destination": - e.Destination, err = unmarshalEventSubscriptionDestinationClassification(val) - delete(rawMsg, key) - case "eventDeliverySchema": - err = unpopulate(val, "EventDeliverySchema", &e.EventDeliverySchema) - delete(rawMsg, key) - case "expirationTimeUtc": - err = unpopulateTimeRFC3339(val, "ExpirationTimeUTC", &e.ExpirationTimeUTC) - delete(rawMsg, key) - case "filter": - err = unpopulate(val, "Filter", &e.Filter) - delete(rawMsg, key) - case "labels": - err = unpopulate(val, "Labels", &e.Labels) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) - delete(rawMsg, key) - case "retryPolicy": - err = unpopulate(val, "RetryPolicy", &e.RetryPolicy) + case "key": + err = unpopulate(val, "Key", &i.Key) delete(rawMsg, key) - case "topic": - err = unpopulate(val, "Topic", &e.Topic) + case "operatorType": + err = unpopulate(val, "OperatorType", &i.OperatorType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EventSubscriptionUpdateParameters. -func (e EventSubscriptionUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type JSONField. +func (j JSONField) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "deadLetterDestination", e.DeadLetterDestination) - populate(objectMap, "deadLetterWithResourceIdentity", e.DeadLetterWithResourceIdentity) - populate(objectMap, "deliveryWithResourceIdentity", e.DeliveryWithResourceIdentity) - populate(objectMap, "destination", e.Destination) - populate(objectMap, "eventDeliverySchema", e.EventDeliverySchema) - populateTimeRFC3339(objectMap, "expirationTimeUtc", e.ExpirationTimeUTC) - populate(objectMap, "filter", e.Filter) - populate(objectMap, "labels", e.Labels) - populate(objectMap, "retryPolicy", e.RetryPolicy) + populate(objectMap, "sourceField", j.SourceField) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EventSubscriptionUpdateParameters. -func (e *EventSubscriptionUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type JSONField. +func (j *JSONField) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } for key, val := range rawMsg { var err error switch key { - case "deadLetterDestination": - e.DeadLetterDestination, err = unmarshalDeadLetterDestinationClassification(val) - delete(rawMsg, key) - case "deadLetterWithResourceIdentity": - err = unpopulate(val, "DeadLetterWithResourceIdentity", &e.DeadLetterWithResourceIdentity) - delete(rawMsg, key) - case "deliveryWithResourceIdentity": - err = unpopulate(val, "DeliveryWithResourceIdentity", &e.DeliveryWithResourceIdentity) - delete(rawMsg, key) - case "destination": - e.Destination, err = unmarshalEventSubscriptionDestinationClassification(val) - delete(rawMsg, key) - case "eventDeliverySchema": - err = unpopulate(val, "EventDeliverySchema", &e.EventDeliverySchema) - delete(rawMsg, key) - case "expirationTimeUtc": - err = unpopulateTimeRFC3339(val, "ExpirationTimeUTC", &e.ExpirationTimeUTC) - delete(rawMsg, key) - case "filter": - err = unpopulate(val, "Filter", &e.Filter) - delete(rawMsg, key) - case "labels": - err = unpopulate(val, "Labels", &e.Labels) - delete(rawMsg, key) - case "retryPolicy": - err = unpopulate(val, "RetryPolicy", &e.RetryPolicy) + case "sourceField": + err = unpopulate(val, "SourceField", &j.SourceField) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EventSubscriptionsListResult. -func (e EventSubscriptionsListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type JSONFieldWithDefault. +func (j JSONFieldWithDefault) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", e.NextLink) - populate(objectMap, "value", e.Value) + populate(objectMap, "defaultValue", j.DefaultValue) + populate(objectMap, "sourceField", j.SourceField) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EventSubscriptionsListResult. -func (e *EventSubscriptionsListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type JSONFieldWithDefault. +func (j *JSONFieldWithDefault) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &e.NextLink) + case "defaultValue": + err = unpopulate(val, "DefaultValue", &j.DefaultValue) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &e.Value) + case "sourceField": + err = unpopulate(val, "SourceField", &j.SourceField) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EventType. -func (e EventType) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type JSONInputSchemaMapping. +func (j JSONInputSchemaMapping) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", e.ID) - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "type", e.Type) + objectMap["inputSchemaMappingType"] = InputSchemaMappingTypeJSON + populate(objectMap, "properties", j.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EventType. -func (e *EventType) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type JSONInputSchemaMapping. +func (j *JSONInputSchemaMapping) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) + case "inputSchemaMappingType": + err = unpopulate(val, "InputSchemaMappingType", &j.InputSchemaMappingType) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &e.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EventTypeInfo. -func (e EventTypeInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "inlineEventTypes", e.InlineEventTypes) - populate(objectMap, "kind", e.Kind) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventTypeInfo. -func (e *EventTypeInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "inlineEventTypes": - err = unpopulate(val, "InlineEventTypes", &e.InlineEventTypes) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &e.Kind) + err = unpopulate(val, "Properties", &j.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EventTypeProperties. -func (e EventTypeProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type JSONInputSchemaMappingProperties. +func (j JSONInputSchemaMappingProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", e.Description) - populate(objectMap, "displayName", e.DisplayName) - populate(objectMap, "isInDefaultSet", e.IsInDefaultSet) - populate(objectMap, "schemaUrl", e.SchemaURL) + populate(objectMap, "dataVersion", j.DataVersion) + populate(objectMap, "eventTime", j.EventTime) + populate(objectMap, "eventType", j.EventType) + populate(objectMap, "id", j.ID) + populate(objectMap, "subject", j.Subject) + populate(objectMap, "topic", j.Topic) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EventTypeProperties. -func (e *EventTypeProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type JSONInputSchemaMappingProperties. +func (j *JSONInputSchemaMappingProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &e.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &e.DisplayName) - delete(rawMsg, key) - case "isInDefaultSet": - err = unpopulate(val, "IsInDefaultSet", &e.IsInDefaultSet) + case "dataVersion": + err = unpopulate(val, "DataVersion", &j.DataVersion) delete(rawMsg, key) - case "schemaUrl": - err = unpopulate(val, "SchemaURL", &e.SchemaURL) + case "eventTime": + err = unpopulate(val, "EventTime", &j.EventTime) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EventTypesListResult. -func (e EventTypesListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", e.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventTypesListResult. -func (e *EventTypesListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &e.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ExtendedLocation. -func (e ExtendedLocation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", e.Name) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExtendedLocation. -func (e *ExtendedLocation) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ExtensionTopic. -func (e ExtensionTopic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", e.ID) - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "systemData", e.SystemData) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionTopic. -func (e *ExtensionTopic) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &e.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &e.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ExtensionTopicProperties. -func (e ExtensionTopicProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", e.Description) - populate(objectMap, "systemTopic", e.SystemTopic) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionTopicProperties. -func (e *ExtensionTopicProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &e.Description) - delete(rawMsg, key) - case "systemTopic": - err = unpopulate(val, "SystemTopic", &e.SystemTopic) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Filter. -func (f Filter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "key", f.Key) - objectMap["operatorType"] = f.OperatorType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Filter. -func (f *Filter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "key": - err = unpopulate(val, "Key", &f.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &f.OperatorType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type FiltersConfiguration. -func (f FiltersConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "filters", f.Filters) - populate(objectMap, "includedEventTypes", f.IncludedEventTypes) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FiltersConfiguration. -func (f *FiltersConfiguration) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "filters": - f.Filters, err = unmarshalFilterClassificationArray(val) - delete(rawMsg, key) - case "includedEventTypes": - err = unpopulate(val, "IncludedEventTypes", &f.IncludedEventTypes) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type HybridConnectionEventSubscriptionDestination. -func (h HybridConnectionEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["endpointType"] = EndpointTypeHybridConnection - populate(objectMap, "properties", h.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type HybridConnectionEventSubscriptionDestination. -func (h *HybridConnectionEventSubscriptionDestination) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endpointType": - err = unpopulate(val, "EndpointType", &h.EndpointType) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &h.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type HybridConnectionEventSubscriptionDestinationProperties. -func (h HybridConnectionEventSubscriptionDestinationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "deliveryAttributeMappings", h.DeliveryAttributeMappings) - populate(objectMap, "resourceId", h.ResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type HybridConnectionEventSubscriptionDestinationProperties. -func (h *HybridConnectionEventSubscriptionDestinationProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "deliveryAttributeMappings": - h.DeliveryAttributeMappings, err = unmarshalDeliveryAttributeMappingClassificationArray(val) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &h.ResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IdentityInfo. -func (i IdentityInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "principalId", i.PrincipalID) - populate(objectMap, "tenantId", i.TenantID) - populate(objectMap, "type", i.Type) - populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityInfo. -func (i *IdentityInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &i.PrincipalID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &i.TenantID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) - delete(rawMsg, key) - case "userAssignedIdentities": - err = unpopulate(val, "UserAssignedIdentities", &i.UserAssignedIdentities) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type InboundIPRule. -func (i InboundIPRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "action", i.Action) - populate(objectMap, "ipMask", i.IPMask) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type InboundIPRule. -func (i *InboundIPRule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "action": - err = unpopulate(val, "Action", &i.Action) - delete(rawMsg, key) - case "ipMask": - err = unpopulate(val, "IPMask", &i.IPMask) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type InlineEventProperties. -func (i InlineEventProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataSchemaUrl", i.DataSchemaURL) - populate(objectMap, "description", i.Description) - populate(objectMap, "displayName", i.DisplayName) - populate(objectMap, "documentationUrl", i.DocumentationURL) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type InlineEventProperties. -func (i *InlineEventProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataSchemaUrl": - err = unpopulate(val, "DataSchemaURL", &i.DataSchemaURL) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &i.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &i.DisplayName) - delete(rawMsg, key) - case "documentationUrl": - err = unpopulate(val, "DocumentationURL", &i.DocumentationURL) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type InputSchemaMapping. -func (i InputSchemaMapping) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["inputSchemaMappingType"] = i.InputSchemaMappingType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type InputSchemaMapping. -func (i *InputSchemaMapping) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "inputSchemaMappingType": - err = unpopulate(val, "InputSchemaMappingType", &i.InputSchemaMappingType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IsNotNullAdvancedFilter. -func (i IsNotNullAdvancedFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "key", i.Key) - objectMap["operatorType"] = AdvancedFilterOperatorTypeIsNotNull - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IsNotNullAdvancedFilter. -func (i *IsNotNullAdvancedFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "key": - err = unpopulate(val, "Key", &i.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &i.OperatorType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IsNotNullFilter. -func (i IsNotNullFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "key", i.Key) - objectMap["operatorType"] = FilterOperatorTypeIsNotNull - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IsNotNullFilter. -func (i *IsNotNullFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "key": - err = unpopulate(val, "Key", &i.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &i.OperatorType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IsNullOrUndefinedAdvancedFilter. -func (i IsNullOrUndefinedAdvancedFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "key", i.Key) - objectMap["operatorType"] = AdvancedFilterOperatorTypeIsNullOrUndefined - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IsNullOrUndefinedAdvancedFilter. -func (i *IsNullOrUndefinedAdvancedFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "key": - err = unpopulate(val, "Key", &i.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &i.OperatorType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IsNullOrUndefinedFilter. -func (i IsNullOrUndefinedFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "key", i.Key) - objectMap["operatorType"] = FilterOperatorTypeIsNullOrUndefined - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IsNullOrUndefinedFilter. -func (i *IsNullOrUndefinedFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "key": - err = unpopulate(val, "Key", &i.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &i.OperatorType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type JSONField. -func (j JSONField) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "sourceField", j.SourceField) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JSONField. -func (j *JSONField) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "sourceField": - err = unpopulate(val, "SourceField", &j.SourceField) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type JSONFieldWithDefault. -func (j JSONFieldWithDefault) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "defaultValue", j.DefaultValue) - populate(objectMap, "sourceField", j.SourceField) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JSONFieldWithDefault. -func (j *JSONFieldWithDefault) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "defaultValue": - err = unpopulate(val, "DefaultValue", &j.DefaultValue) - delete(rawMsg, key) - case "sourceField": - err = unpopulate(val, "SourceField", &j.SourceField) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type JSONInputSchemaMapping. -func (j JSONInputSchemaMapping) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["inputSchemaMappingType"] = InputSchemaMappingTypeJSON - populate(objectMap, "properties", j.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JSONInputSchemaMapping. -func (j *JSONInputSchemaMapping) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "inputSchemaMappingType": - err = unpopulate(val, "InputSchemaMappingType", &j.InputSchemaMappingType) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &j.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type JSONInputSchemaMappingProperties. -func (j JSONInputSchemaMappingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataVersion", j.DataVersion) - populate(objectMap, "eventTime", j.EventTime) - populate(objectMap, "eventType", j.EventType) - populate(objectMap, "id", j.ID) - populate(objectMap, "subject", j.Subject) - populate(objectMap, "topic", j.Topic) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JSONInputSchemaMappingProperties. -func (j *JSONInputSchemaMappingProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataVersion": - err = unpopulate(val, "DataVersion", &j.DataVersion) - delete(rawMsg, key) - case "eventTime": - err = unpopulate(val, "EventTime", &j.EventTime) - delete(rawMsg, key) - case "eventType": - err = unpopulate(val, "EventType", &j.EventType) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &j.ID) - delete(rawMsg, key) - case "subject": - err = unpopulate(val, "Subject", &j.Subject) - delete(rawMsg, key) - case "topic": - err = unpopulate(val, "Topic", &j.Topic) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Namespace. -func (n Namespace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", n.ID) - populate(objectMap, "identity", n.Identity) - populate(objectMap, "location", n.Location) - populate(objectMap, "name", n.Name) - populate(objectMap, "properties", n.Properties) - populate(objectMap, "sku", n.SKU) - populate(objectMap, "systemData", n.SystemData) - populate(objectMap, "tags", n.Tags) - populate(objectMap, "type", n.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Namespace. -func (n *Namespace) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &n.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &n.Identity) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &n.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &n.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &n.Properties) - delete(rawMsg, key) - case "sku": - err = unpopulate(val, "SKU", &n.SKU) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &n.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &n.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &n.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NamespaceProperties. -func (n NamespaceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "inboundIpRules", n.InboundIPRules) - populate(objectMap, "isZoneRedundant", n.IsZoneRedundant) - populate(objectMap, "minimumTlsVersionAllowed", n.MinimumTLSVersionAllowed) - populate(objectMap, "privateEndpointConnections", n.PrivateEndpointConnections) - populate(objectMap, "provisioningState", n.ProvisioningState) - populate(objectMap, "publicNetworkAccess", n.PublicNetworkAccess) - populate(objectMap, "topicSpacesConfiguration", n.TopicSpacesConfiguration) - populate(objectMap, "topicsConfiguration", n.TopicsConfiguration) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NamespaceProperties. -func (n *NamespaceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "inboundIpRules": - err = unpopulate(val, "InboundIPRules", &n.InboundIPRules) - delete(rawMsg, key) - case "isZoneRedundant": - err = unpopulate(val, "IsZoneRedundant", &n.IsZoneRedundant) - delete(rawMsg, key) - case "minimumTlsVersionAllowed": - err = unpopulate(val, "MinimumTLSVersionAllowed", &n.MinimumTLSVersionAllowed) - delete(rawMsg, key) - case "privateEndpointConnections": - err = unpopulate(val, "PrivateEndpointConnections", &n.PrivateEndpointConnections) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &n.ProvisioningState) - delete(rawMsg, key) - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &n.PublicNetworkAccess) - delete(rawMsg, key) - case "topicSpacesConfiguration": - err = unpopulate(val, "TopicSpacesConfiguration", &n.TopicSpacesConfiguration) - delete(rawMsg, key) - case "topicsConfiguration": - err = unpopulate(val, "TopicsConfiguration", &n.TopicsConfiguration) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NamespaceRegenerateKeyRequest. -func (n NamespaceRegenerateKeyRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "keyName", n.KeyName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NamespaceRegenerateKeyRequest. -func (n *NamespaceRegenerateKeyRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "keyName": - err = unpopulate(val, "KeyName", &n.KeyName) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NamespaceSKU. -func (n NamespaceSKU) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "capacity", n.Capacity) - populate(objectMap, "name", n.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NamespaceSKU. -func (n *NamespaceSKU) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "capacity": - err = unpopulate(val, "Capacity", &n.Capacity) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &n.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NamespaceSharedAccessKeys. -func (n NamespaceSharedAccessKeys) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "key1", n.Key1) - populate(objectMap, "key2", n.Key2) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NamespaceSharedAccessKeys. -func (n *NamespaceSharedAccessKeys) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "key1": - err = unpopulate(val, "Key1", &n.Key1) - delete(rawMsg, key) - case "key2": - err = unpopulate(val, "Key2", &n.Key2) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NamespaceTopic. -func (n NamespaceTopic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", n.ID) - populate(objectMap, "name", n.Name) - populate(objectMap, "properties", n.Properties) - populate(objectMap, "systemData", n.SystemData) - populate(objectMap, "type", n.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NamespaceTopic. -func (n *NamespaceTopic) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &n.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &n.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &n.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &n.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &n.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NamespaceTopicProperties. -func (n NamespaceTopicProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eventRetentionInDays", n.EventRetentionInDays) - populate(objectMap, "inputSchema", n.InputSchema) - populate(objectMap, "provisioningState", n.ProvisioningState) - populate(objectMap, "publisherType", n.PublisherType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NamespaceTopicProperties. -func (n *NamespaceTopicProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eventRetentionInDays": - err = unpopulate(val, "EventRetentionInDays", &n.EventRetentionInDays) - delete(rawMsg, key) - case "inputSchema": - err = unpopulate(val, "InputSchema", &n.InputSchema) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &n.ProvisioningState) - delete(rawMsg, key) - case "publisherType": - err = unpopulate(val, "PublisherType", &n.PublisherType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NamespaceTopicUpdateParameterProperties. -func (n NamespaceTopicUpdateParameterProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eventRetentionInDays", n.EventRetentionInDays) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NamespaceTopicUpdateParameterProperties. -func (n *NamespaceTopicUpdateParameterProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eventRetentionInDays": - err = unpopulate(val, "EventRetentionInDays", &n.EventRetentionInDays) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NamespaceTopicUpdateParameters. -func (n NamespaceTopicUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "properties", n.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NamespaceTopicUpdateParameters. -func (n *NamespaceTopicUpdateParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "properties": - err = unpopulate(val, "Properties", &n.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NamespaceTopicsListResult. -func (n NamespaceTopicsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", n.NextLink) - populate(objectMap, "value", n.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NamespaceTopicsListResult. -func (n *NamespaceTopicsListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &n.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &n.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NamespaceUpdateParameterProperties. -func (n NamespaceUpdateParameterProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "inboundIpRules", n.InboundIPRules) - populate(objectMap, "publicNetworkAccess", n.PublicNetworkAccess) - populate(objectMap, "topicSpacesConfiguration", n.TopicSpacesConfiguration) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NamespaceUpdateParameterProperties. -func (n *NamespaceUpdateParameterProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "inboundIpRules": - err = unpopulate(val, "InboundIPRules", &n.InboundIPRules) - delete(rawMsg, key) - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &n.PublicNetworkAccess) - delete(rawMsg, key) - case "topicSpacesConfiguration": - err = unpopulate(val, "TopicSpacesConfiguration", &n.TopicSpacesConfiguration) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NamespaceUpdateParameters. -func (n NamespaceUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "identity", n.Identity) - populate(objectMap, "properties", n.Properties) - populate(objectMap, "sku", n.SKU) - populate(objectMap, "tags", n.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NamespaceUpdateParameters. -func (n *NamespaceUpdateParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "identity": - err = unpopulate(val, "Identity", &n.Identity) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &n.Properties) - delete(rawMsg, key) - case "sku": - err = unpopulate(val, "SKU", &n.SKU) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &n.Tags) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NamespacesListResult. -func (n NamespacesListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", n.NextLink) - populate(objectMap, "value", n.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NamespacesListResult. -func (n *NamespacesListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &n.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &n.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NumberGreaterThanAdvancedFilter. -func (n NumberGreaterThanAdvancedFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "key", n.Key) - objectMap["operatorType"] = AdvancedFilterOperatorTypeNumberGreaterThan - populate(objectMap, "value", n.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NumberGreaterThanAdvancedFilter. -func (n *NumberGreaterThanAdvancedFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "key": - err = unpopulate(val, "Key", &n.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &n.OperatorType) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &n.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NumberGreaterThanFilter. -func (n NumberGreaterThanFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "key", n.Key) - objectMap["operatorType"] = FilterOperatorTypeNumberGreaterThan - populate(objectMap, "value", n.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NumberGreaterThanFilter. -func (n *NumberGreaterThanFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "key": - err = unpopulate(val, "Key", &n.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &n.OperatorType) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &n.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NumberGreaterThanOrEqualsAdvancedFilter. -func (n NumberGreaterThanOrEqualsAdvancedFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "key", n.Key) - objectMap["operatorType"] = AdvancedFilterOperatorTypeNumberGreaterThanOrEquals - populate(objectMap, "value", n.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NumberGreaterThanOrEqualsAdvancedFilter. -func (n *NumberGreaterThanOrEqualsAdvancedFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "key": - err = unpopulate(val, "Key", &n.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &n.OperatorType) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &n.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NumberGreaterThanOrEqualsFilter. -func (n NumberGreaterThanOrEqualsFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "key", n.Key) - objectMap["operatorType"] = FilterOperatorTypeNumberGreaterThanOrEquals - populate(objectMap, "value", n.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NumberGreaterThanOrEqualsFilter. -func (n *NumberGreaterThanOrEqualsFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "key": - err = unpopulate(val, "Key", &n.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &n.OperatorType) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &n.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NumberInAdvancedFilter. -func (n NumberInAdvancedFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "key", n.Key) - objectMap["operatorType"] = AdvancedFilterOperatorTypeNumberIn - populate(objectMap, "values", n.Values) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NumberInAdvancedFilter. -func (n *NumberInAdvancedFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "key": - err = unpopulate(val, "Key", &n.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &n.OperatorType) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &n.Values) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NumberInFilter. -func (n NumberInFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "key", n.Key) - objectMap["operatorType"] = FilterOperatorTypeNumberIn - populate(objectMap, "values", n.Values) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NumberInFilter. -func (n *NumberInFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "key": - err = unpopulate(val, "Key", &n.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &n.OperatorType) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &n.Values) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NumberInRangeAdvancedFilter. -func (n NumberInRangeAdvancedFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "key", n.Key) - objectMap["operatorType"] = AdvancedFilterOperatorTypeNumberInRange - populate(objectMap, "values", n.Values) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NumberInRangeAdvancedFilter. -func (n *NumberInRangeAdvancedFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "key": - err = unpopulate(val, "Key", &n.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &n.OperatorType) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &n.Values) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NumberInRangeFilter. -func (n NumberInRangeFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "key", n.Key) - objectMap["operatorType"] = FilterOperatorTypeNumberInRange - populate(objectMap, "values", n.Values) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NumberInRangeFilter. -func (n *NumberInRangeFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "key": - err = unpopulate(val, "Key", &n.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &n.OperatorType) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &n.Values) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NumberLessThanAdvancedFilter. -func (n NumberLessThanAdvancedFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "key", n.Key) - objectMap["operatorType"] = AdvancedFilterOperatorTypeNumberLessThan - populate(objectMap, "value", n.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NumberLessThanAdvancedFilter. -func (n *NumberLessThanAdvancedFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "key": - err = unpopulate(val, "Key", &n.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &n.OperatorType) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &n.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NumberLessThanFilter. -func (n NumberLessThanFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "key", n.Key) - objectMap["operatorType"] = FilterOperatorTypeNumberLessThan - populate(objectMap, "value", n.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NumberLessThanFilter. -func (n *NumberLessThanFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "key": - err = unpopulate(val, "Key", &n.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &n.OperatorType) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &n.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NumberLessThanOrEqualsAdvancedFilter. -func (n NumberLessThanOrEqualsAdvancedFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "key", n.Key) - objectMap["operatorType"] = AdvancedFilterOperatorTypeNumberLessThanOrEquals - populate(objectMap, "value", n.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NumberLessThanOrEqualsAdvancedFilter. -func (n *NumberLessThanOrEqualsAdvancedFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "key": - err = unpopulate(val, "Key", &n.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &n.OperatorType) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &n.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NumberLessThanOrEqualsFilter. -func (n NumberLessThanOrEqualsFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "key", n.Key) - objectMap["operatorType"] = FilterOperatorTypeNumberLessThanOrEquals - populate(objectMap, "value", n.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NumberLessThanOrEqualsFilter. -func (n *NumberLessThanOrEqualsFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "key": - err = unpopulate(val, "Key", &n.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &n.OperatorType) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &n.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NumberNotInAdvancedFilter. -func (n NumberNotInAdvancedFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "key", n.Key) - objectMap["operatorType"] = AdvancedFilterOperatorTypeNumberNotIn - populate(objectMap, "values", n.Values) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NumberNotInAdvancedFilter. -func (n *NumberNotInAdvancedFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "key": - err = unpopulate(val, "Key", &n.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &n.OperatorType) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &n.Values) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NumberNotInFilter. -func (n NumberNotInFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "key", n.Key) - objectMap["operatorType"] = FilterOperatorTypeNumberNotIn - populate(objectMap, "values", n.Values) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NumberNotInFilter. -func (n *NumberNotInFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "key": - err = unpopulate(val, "Key", &n.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &n.OperatorType) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &n.Values) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NumberNotInRangeAdvancedFilter. -func (n NumberNotInRangeAdvancedFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "key", n.Key) - objectMap["operatorType"] = AdvancedFilterOperatorTypeNumberNotInRange - populate(objectMap, "values", n.Values) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NumberNotInRangeAdvancedFilter. -func (n *NumberNotInRangeAdvancedFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "key": - err = unpopulate(val, "Key", &n.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &n.OperatorType) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &n.Values) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NumberNotInRangeFilter. -func (n NumberNotInRangeFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "key", n.Key) - objectMap["operatorType"] = FilterOperatorTypeNumberNotInRange - populate(objectMap, "values", n.Values) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NumberNotInRangeFilter. -func (n *NumberNotInRangeFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "key": - err = unpopulate(val, "Key", &n.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &n.OperatorType) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &n.Values) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "display", o.Display) - populate(objectMap, "isDataAction", o.IsDataAction) - populate(objectMap, "name", o.Name) - populate(objectMap, "origin", o.Origin) - populateAny(objectMap, "properties", o.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. -func (o *Operation) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "display": - err = unpopulate(val, "Display", &o.Display) - delete(rawMsg, key) - case "isDataAction": - err = unpopulate(val, "IsDataAction", &o.IsDataAction) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "origin": - err = unpopulate(val, "Origin", &o.Origin) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &o.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationInfo. -func (o OperationInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", o.Description) - populate(objectMap, "operation", o.Operation) - populate(objectMap, "provider", o.Provider) - populate(objectMap, "resource", o.Resource) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationInfo. -func (o *OperationInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &o.Description) - delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &o.Operation) - delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &o.Provider) - delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &o.Resource) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationsListResult. -func (o OperationsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationsListResult. -func (o *OperationsListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &o.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Partner. -func (p Partner) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "authorizationExpirationTimeInUtc", p.AuthorizationExpirationTimeInUTC) - populate(objectMap, "partnerName", p.PartnerName) - populate(objectMap, "partnerRegistrationImmutableId", p.PartnerRegistrationImmutableID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Partner. -func (p *Partner) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "authorizationExpirationTimeInUtc": - err = unpopulateTimeRFC3339(val, "AuthorizationExpirationTimeInUTC", &p.AuthorizationExpirationTimeInUTC) - delete(rawMsg, key) - case "partnerName": - err = unpopulate(val, "PartnerName", &p.PartnerName) - delete(rawMsg, key) - case "partnerRegistrationImmutableId": - err = unpopulate(val, "PartnerRegistrationImmutableID", &p.PartnerRegistrationImmutableID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerAuthorization. -func (p PartnerAuthorization) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "authorizedPartnersList", p.AuthorizedPartnersList) - populate(objectMap, "defaultMaximumExpirationTimeInDays", p.DefaultMaximumExpirationTimeInDays) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerAuthorization. -func (p *PartnerAuthorization) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "authorizedPartnersList": - err = unpopulate(val, "AuthorizedPartnersList", &p.AuthorizedPartnersList) - delete(rawMsg, key) - case "defaultMaximumExpirationTimeInDays": - err = unpopulate(val, "DefaultMaximumExpirationTimeInDays", &p.DefaultMaximumExpirationTimeInDays) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerClientAuthentication. -func (p PartnerClientAuthentication) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["clientAuthenticationType"] = p.ClientAuthenticationType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerClientAuthentication. -func (p *PartnerClientAuthentication) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "clientAuthenticationType": - err = unpopulate(val, "ClientAuthenticationType", &p.ClientAuthenticationType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerConfiguration. -func (p PartnerConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "systemData", p.SystemData) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerConfiguration. -func (p *PartnerConfiguration) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &p.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &p.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &p.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerConfigurationProperties. -func (p PartnerConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "partnerAuthorization", p.PartnerAuthorization) - populate(objectMap, "provisioningState", p.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerConfigurationProperties. -func (p *PartnerConfigurationProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "partnerAuthorization": - err = unpopulate(val, "PartnerAuthorization", &p.PartnerAuthorization) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerConfigurationUpdateParameterProperties. -func (p PartnerConfigurationUpdateParameterProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "defaultMaximumExpirationTimeInDays", p.DefaultMaximumExpirationTimeInDays) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerConfigurationUpdateParameterProperties. -func (p *PartnerConfigurationUpdateParameterProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "defaultMaximumExpirationTimeInDays": - err = unpopulate(val, "DefaultMaximumExpirationTimeInDays", &p.DefaultMaximumExpirationTimeInDays) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerConfigurationUpdateParameters. -func (p PartnerConfigurationUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "tags", p.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerConfigurationUpdateParameters. -func (p *PartnerConfigurationUpdateParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "properties": - err = unpopulate(val, "Properties", &p.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &p.Tags) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerConfigurationsListResult. -func (p PartnerConfigurationsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerConfigurationsListResult. -func (p *PartnerConfigurationsListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerDestination. -func (p PartnerDestination) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "systemData", p.SystemData) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerDestination. -func (p *PartnerDestination) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &p.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &p.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &p.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerDestinationInfo. -func (p PartnerDestinationInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "azureSubscriptionId", p.AzureSubscriptionID) - populate(objectMap, "endpointServiceContext", p.EndpointServiceContext) - objectMap["endpointType"] = p.EndpointType - populate(objectMap, "name", p.Name) - populate(objectMap, "resourceGroupName", p.ResourceGroupName) - populate(objectMap, "resourceMoveChangeHistory", p.ResourceMoveChangeHistory) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerDestinationInfo. -func (p *PartnerDestinationInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "azureSubscriptionId": - err = unpopulate(val, "AzureSubscriptionID", &p.AzureSubscriptionID) - delete(rawMsg, key) - case "endpointServiceContext": - err = unpopulate(val, "EndpointServiceContext", &p.EndpointServiceContext) - delete(rawMsg, key) - case "endpointType": - err = unpopulate(val, "EndpointType", &p.EndpointType) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "resourceGroupName": - err = unpopulate(val, "ResourceGroupName", &p.ResourceGroupName) - delete(rawMsg, key) - case "resourceMoveChangeHistory": - err = unpopulate(val, "ResourceMoveChangeHistory", &p.ResourceMoveChangeHistory) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerDestinationProperties. -func (p PartnerDestinationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "activationState", p.ActivationState) - populate(objectMap, "endpointBaseUrl", p.EndpointBaseURL) - populate(objectMap, "endpointServiceContext", p.EndpointServiceContext) - populateTimeRFC3339(objectMap, "expirationTimeIfNotActivatedUtc", p.ExpirationTimeIfNotActivatedUTC) - populate(objectMap, "messageForActivation", p.MessageForActivation) - populate(objectMap, "partnerRegistrationImmutableId", p.PartnerRegistrationImmutableID) - populate(objectMap, "provisioningState", p.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerDestinationProperties. -func (p *PartnerDestinationProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "activationState": - err = unpopulate(val, "ActivationState", &p.ActivationState) - delete(rawMsg, key) - case "endpointBaseUrl": - err = unpopulate(val, "EndpointBaseURL", &p.EndpointBaseURL) - delete(rawMsg, key) - case "endpointServiceContext": - err = unpopulate(val, "EndpointServiceContext", &p.EndpointServiceContext) - delete(rawMsg, key) - case "expirationTimeIfNotActivatedUtc": - err = unpopulateTimeRFC3339(val, "ExpirationTimeIfNotActivatedUTC", &p.ExpirationTimeIfNotActivatedUTC) - delete(rawMsg, key) - case "messageForActivation": - err = unpopulate(val, "MessageForActivation", &p.MessageForActivation) - delete(rawMsg, key) - case "partnerRegistrationImmutableId": - err = unpopulate(val, "PartnerRegistrationImmutableID", &p.PartnerRegistrationImmutableID) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerDestinationUpdateParameters. -func (p PartnerDestinationUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "tags", p.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerDestinationUpdateParameters. -func (p *PartnerDestinationUpdateParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "tags": - err = unpopulate(val, "Tags", &p.Tags) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerDestinationsListResult. -func (p PartnerDestinationsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerDestinationsListResult. -func (p *PartnerDestinationsListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerDetails. -func (p PartnerDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", p.Description) - populate(objectMap, "longDescription", p.LongDescription) - populate(objectMap, "setupUri", p.SetupURI) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerDetails. -func (p *PartnerDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &p.Description) - delete(rawMsg, key) - case "longDescription": - err = unpopulate(val, "LongDescription", &p.LongDescription) - delete(rawMsg, key) - case "setupUri": - err = unpopulate(val, "SetupURI", &p.SetupURI) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerEventSubscriptionDestination. -func (p PartnerEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["endpointType"] = EndpointTypePartnerDestination - populate(objectMap, "properties", p.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerEventSubscriptionDestination. -func (p *PartnerEventSubscriptionDestination) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endpointType": - err = unpopulate(val, "EndpointType", &p.EndpointType) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerEventSubscriptionDestinationProperties. -func (p PartnerEventSubscriptionDestinationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "resourceId", p.ResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerEventSubscriptionDestinationProperties. -func (p *PartnerEventSubscriptionDestinationProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "resourceId": - err = unpopulate(val, "ResourceID", &p.ResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerNamespace. -func (p PartnerNamespace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "systemData", p.SystemData) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerNamespace. -func (p *PartnerNamespace) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &p.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &p.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &p.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerNamespaceProperties. -func (p PartnerNamespaceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "disableLocalAuth", p.DisableLocalAuth) - populate(objectMap, "endpoint", p.Endpoint) - populate(objectMap, "inboundIpRules", p.InboundIPRules) - populate(objectMap, "minimumTlsVersionAllowed", p.MinimumTLSVersionAllowed) - populate(objectMap, "partnerRegistrationFullyQualifiedId", p.PartnerRegistrationFullyQualifiedID) - populate(objectMap, "partnerTopicRoutingMode", p.PartnerTopicRoutingMode) - populate(objectMap, "privateEndpointConnections", p.PrivateEndpointConnections) - populate(objectMap, "provisioningState", p.ProvisioningState) - populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerNamespaceProperties. -func (p *PartnerNamespaceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "disableLocalAuth": - err = unpopulate(val, "DisableLocalAuth", &p.DisableLocalAuth) - delete(rawMsg, key) - case "endpoint": - err = unpopulate(val, "Endpoint", &p.Endpoint) - delete(rawMsg, key) - case "inboundIpRules": - err = unpopulate(val, "InboundIPRules", &p.InboundIPRules) - delete(rawMsg, key) - case "minimumTlsVersionAllowed": - err = unpopulate(val, "MinimumTLSVersionAllowed", &p.MinimumTLSVersionAllowed) - delete(rawMsg, key) - case "partnerRegistrationFullyQualifiedId": - err = unpopulate(val, "PartnerRegistrationFullyQualifiedID", &p.PartnerRegistrationFullyQualifiedID) - delete(rawMsg, key) - case "partnerTopicRoutingMode": - err = unpopulate(val, "PartnerTopicRoutingMode", &p.PartnerTopicRoutingMode) - delete(rawMsg, key) - case "privateEndpointConnections": - err = unpopulate(val, "PrivateEndpointConnections", &p.PrivateEndpointConnections) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) - delete(rawMsg, key) - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &p.PublicNetworkAccess) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerNamespaceRegenerateKeyRequest. -func (p PartnerNamespaceRegenerateKeyRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "keyName", p.KeyName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerNamespaceRegenerateKeyRequest. -func (p *PartnerNamespaceRegenerateKeyRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "keyName": - err = unpopulate(val, "KeyName", &p.KeyName) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerNamespaceSharedAccessKeys. -func (p PartnerNamespaceSharedAccessKeys) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "key1", p.Key1) - populate(objectMap, "key2", p.Key2) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerNamespaceSharedAccessKeys. -func (p *PartnerNamespaceSharedAccessKeys) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "key1": - err = unpopulate(val, "Key1", &p.Key1) - delete(rawMsg, key) - case "key2": - err = unpopulate(val, "Key2", &p.Key2) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerNamespaceUpdateParameterProperties. -func (p PartnerNamespaceUpdateParameterProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "disableLocalAuth", p.DisableLocalAuth) - populate(objectMap, "inboundIpRules", p.InboundIPRules) - populate(objectMap, "minimumTlsVersionAllowed", p.MinimumTLSVersionAllowed) - populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerNamespaceUpdateParameterProperties. -func (p *PartnerNamespaceUpdateParameterProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "disableLocalAuth": - err = unpopulate(val, "DisableLocalAuth", &p.DisableLocalAuth) - delete(rawMsg, key) - case "inboundIpRules": - err = unpopulate(val, "InboundIPRules", &p.InboundIPRules) + case "eventType": + err = unpopulate(val, "EventType", &j.EventType) delete(rawMsg, key) - case "minimumTlsVersionAllowed": - err = unpopulate(val, "MinimumTLSVersionAllowed", &p.MinimumTLSVersionAllowed) + case "id": + err = unpopulate(val, "ID", &j.ID) delete(rawMsg, key) - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &p.PublicNetworkAccess) + case "subject": + err = unpopulate(val, "Subject", &j.Subject) + delete(rawMsg, key) + case "topic": + err = unpopulate(val, "Topic", &j.Topic) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", j, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PartnerNamespaceUpdateParameters. -func (p PartnerNamespaceUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NumberGreaterThanAdvancedFilter. +func (n NumberGreaterThanAdvancedFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "tags", p.Tags) + populate(objectMap, "key", n.Key) + objectMap["operatorType"] = AdvancedFilterOperatorTypeNumberGreaterThan + populate(objectMap, "value", n.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerNamespaceUpdateParameters. -func (p *PartnerNamespaceUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NumberGreaterThanAdvancedFilter. +func (n *NumberGreaterThanAdvancedFilter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &p.Properties) + case "key": + err = unpopulate(val, "Key", &n.Key) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &p.Tags) + case "operatorType": + err = unpopulate(val, "OperatorType", &n.OperatorType) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &n.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PartnerNamespacesListResult. -func (p PartnerNamespacesListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NumberGreaterThanOrEqualsAdvancedFilter. +func (n NumberGreaterThanOrEqualsAdvancedFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) + populate(objectMap, "key", n.Key) + objectMap["operatorType"] = AdvancedFilterOperatorTypeNumberGreaterThanOrEquals + populate(objectMap, "value", n.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerNamespacesListResult. -func (p *PartnerNamespacesListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NumberGreaterThanOrEqualsAdvancedFilter. +func (n *NumberGreaterThanOrEqualsAdvancedFilter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) + case "key": + err = unpopulate(val, "Key", &n.Key) + delete(rawMsg, key) + case "operatorType": + err = unpopulate(val, "OperatorType", &n.OperatorType) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &p.Value) + err = unpopulate(val, "Value", &n.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PartnerRegistration. -func (p PartnerRegistration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NumberInAdvancedFilter. +func (n NumberInAdvancedFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "systemData", p.SystemData) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) + populate(objectMap, "key", n.Key) + objectMap["operatorType"] = AdvancedFilterOperatorTypeNumberIn + populate(objectMap, "values", n.Values) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerRegistration. -func (p *PartnerRegistration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NumberInAdvancedFilter. +func (n *NumberInAdvancedFilter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &p.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &p.SystemData) + case "key": + err = unpopulate(val, "Key", &n.Key) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &p.Tags) + case "operatorType": + err = unpopulate(val, "OperatorType", &n.OperatorType) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "values": + err = unpopulate(val, "Values", &n.Values) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PartnerRegistrationProperties. -func (p PartnerRegistrationProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NumberInRangeAdvancedFilter. +func (n NumberInRangeAdvancedFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "partnerRegistrationImmutableId", p.PartnerRegistrationImmutableID) - populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "key", n.Key) + objectMap["operatorType"] = AdvancedFilterOperatorTypeNumberInRange + populate(objectMap, "values", n.Values) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerRegistrationProperties. -func (p *PartnerRegistrationProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NumberInRangeAdvancedFilter. +func (n *NumberInRangeAdvancedFilter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "partnerRegistrationImmutableId": - err = unpopulate(val, "PartnerRegistrationImmutableID", &p.PartnerRegistrationImmutableID) + case "key": + err = unpopulate(val, "Key", &n.Key) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + case "operatorType": + err = unpopulate(val, "OperatorType", &n.OperatorType) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &n.Values) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PartnerRegistrationUpdateParameters. -func (p PartnerRegistrationUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NumberLessThanAdvancedFilter. +func (n NumberLessThanAdvancedFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "tags", p.Tags) + populate(objectMap, "key", n.Key) + objectMap["operatorType"] = AdvancedFilterOperatorTypeNumberLessThan + populate(objectMap, "value", n.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerRegistrationUpdateParameters. -func (p *PartnerRegistrationUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NumberLessThanAdvancedFilter. +func (n *NumberLessThanAdvancedFilter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "tags": - err = unpopulate(val, "Tags", &p.Tags) + case "key": + err = unpopulate(val, "Key", &n.Key) + delete(rawMsg, key) + case "operatorType": + err = unpopulate(val, "OperatorType", &n.OperatorType) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &n.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PartnerRegistrationsListResult. -func (p PartnerRegistrationsListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NumberLessThanOrEqualsAdvancedFilter. +func (n NumberLessThanOrEqualsAdvancedFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) + populate(objectMap, "key", n.Key) + objectMap["operatorType"] = AdvancedFilterOperatorTypeNumberLessThanOrEquals + populate(objectMap, "value", n.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerRegistrationsListResult. -func (p *PartnerRegistrationsListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NumberLessThanOrEqualsAdvancedFilter. +func (n *NumberLessThanOrEqualsAdvancedFilter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) + case "key": + err = unpopulate(val, "Key", &n.Key) + delete(rawMsg, key) + case "operatorType": + err = unpopulate(val, "OperatorType", &n.OperatorType) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &p.Value) + err = unpopulate(val, "Value", &n.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PartnerTopic. -func (p PartnerTopic) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NumberNotInAdvancedFilter. +func (n NumberNotInAdvancedFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "identity", p.Identity) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "systemData", p.SystemData) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) + populate(objectMap, "key", n.Key) + objectMap["operatorType"] = AdvancedFilterOperatorTypeNumberNotIn + populate(objectMap, "values", n.Values) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerTopic. -func (p *PartnerTopic) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NumberNotInAdvancedFilter. +func (n *NumberNotInAdvancedFilter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &p.Identity) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &p.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &p.SystemData) + case "key": + err = unpopulate(val, "Key", &n.Key) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &p.Tags) + case "operatorType": + err = unpopulate(val, "OperatorType", &n.OperatorType) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "values": + err = unpopulate(val, "Values", &n.Values) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PartnerTopicInfo. -func (p PartnerTopicInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NumberNotInRangeAdvancedFilter. +func (n NumberNotInRangeAdvancedFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "azureSubscriptionId", p.AzureSubscriptionID) - populate(objectMap, "eventTypeInfo", p.EventTypeInfo) - populate(objectMap, "name", p.Name) - populate(objectMap, "resourceGroupName", p.ResourceGroupName) - populate(objectMap, "source", p.Source) + populate(objectMap, "key", n.Key) + objectMap["operatorType"] = AdvancedFilterOperatorTypeNumberNotInRange + populate(objectMap, "values", n.Values) return json.Marshal(objectMap) } - -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerTopicInfo. -func (p *PartnerTopicInfo) UnmarshalJSON(data []byte) error { + +// UnmarshalJSON implements the json.Unmarshaller interface for type NumberNotInRangeAdvancedFilter. +func (n *NumberNotInRangeAdvancedFilter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "azureSubscriptionId": - err = unpopulate(val, "AzureSubscriptionID", &p.AzureSubscriptionID) - delete(rawMsg, key) - case "eventTypeInfo": - err = unpopulate(val, "EventTypeInfo", &p.EventTypeInfo) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) + case "key": + err = unpopulate(val, "Key", &n.Key) delete(rawMsg, key) - case "resourceGroupName": - err = unpopulate(val, "ResourceGroupName", &p.ResourceGroupName) + case "operatorType": + err = unpopulate(val, "OperatorType", &n.OperatorType) delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &p.Source) + case "values": + err = unpopulate(val, "Values", &n.Values) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PartnerTopicProperties. -func (p PartnerTopicProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "activationState", p.ActivationState) - populate(objectMap, "eventTypeInfo", p.EventTypeInfo) - populateTimeRFC3339(objectMap, "expirationTimeIfNotActivatedUtc", p.ExpirationTimeIfNotActivatedUTC) - populate(objectMap, "messageForActivation", p.MessageForActivation) - populate(objectMap, "partnerRegistrationImmutableId", p.PartnerRegistrationImmutableID) - populate(objectMap, "partnerTopicFriendlyDescription", p.PartnerTopicFriendlyDescription) - populate(objectMap, "provisioningState", p.ProvisioningState) - populate(objectMap, "source", p.Source) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + populateAny(objectMap, "properties", o.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerTopicProperties. -func (p *PartnerTopicProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "activationState": - err = unpopulate(val, "ActivationState", &p.ActivationState) - delete(rawMsg, key) - case "eventTypeInfo": - err = unpopulate(val, "EventTypeInfo", &p.EventTypeInfo) - delete(rawMsg, key) - case "expirationTimeIfNotActivatedUtc": - err = unpopulateTimeRFC3339(val, "ExpirationTimeIfNotActivatedUTC", &p.ExpirationTimeIfNotActivatedUTC) - delete(rawMsg, key) - case "messageForActivation": - err = unpopulate(val, "MessageForActivation", &p.MessageForActivation) + case "display": + err = unpopulate(val, "Display", &o.Display) delete(rawMsg, key) - case "partnerRegistrationImmutableId": - err = unpopulate(val, "PartnerRegistrationImmutableID", &p.PartnerRegistrationImmutableID) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) delete(rawMsg, key) - case "partnerTopicFriendlyDescription": - err = unpopulate(val, "PartnerTopicFriendlyDescription", &p.PartnerTopicFriendlyDescription) + case "name": + err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &p.Source) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PartnerTopicUpdateParameters. -func (p PartnerTopicUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationInfo. +func (o OperationInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "identity", p.Identity) - populate(objectMap, "tags", p.Tags) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerTopicUpdateParameters. -func (p *PartnerTopicUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationInfo. +func (o *OperationInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "identity": - err = unpopulate(val, "Identity", &p.Identity) + case "description": + err = unpopulate(val, "Description", &o.Description) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &p.Tags) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PartnerTopicsListResult. -func (p PartnerTopicsListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationsListResult. +func (o OperationsListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) + populate(objectMap, "value", o.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerTopicsListResult. -func (p *PartnerTopicsListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationsListResult. +func (o *OperationsListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) - delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &p.Value) + err = unpopulate(val, "Value", &o.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PartnerUpdateDestinationInfo. -func (p PartnerUpdateDestinationInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Partner. +func (p Partner) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["endpointType"] = p.EndpointType + populateDateTimeRFC3339(objectMap, "authorizationExpirationTimeInUtc", p.AuthorizationExpirationTimeInUTC) + populate(objectMap, "partnerName", p.PartnerName) + populate(objectMap, "partnerRegistrationImmutableId", p.PartnerRegistrationImmutableID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerUpdateDestinationInfo. -func (p *PartnerUpdateDestinationInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Partner. +func (p *Partner) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -5278,8 +2379,14 @@ func (p *PartnerUpdateDestinationInfo) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "endpointType": - err = unpopulate(val, "EndpointType", &p.EndpointType) + case "authorizationExpirationTimeInUtc": + err = unpopulateDateTimeRFC3339(val, "AuthorizationExpirationTimeInUTC", &p.AuthorizationExpirationTimeInUTC) + delete(rawMsg, key) + case "partnerName": + err = unpopulate(val, "PartnerName", &p.PartnerName) + delete(rawMsg, key) + case "partnerRegistrationImmutableId": + err = unpopulate(val, "PartnerRegistrationImmutableID", &p.PartnerRegistrationImmutableID) delete(rawMsg, key) } if err != nil { @@ -5289,15 +2396,16 @@ func (p *PartnerUpdateDestinationInfo) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PartnerUpdateTopicInfo. -func (p PartnerUpdateTopicInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PartnerAuthorization. +func (p PartnerAuthorization) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eventTypeInfo", p.EventTypeInfo) + populate(objectMap, "authorizedPartnersList", p.AuthorizedPartnersList) + populate(objectMap, "defaultMaximumExpirationTimeInDays", p.DefaultMaximumExpirationTimeInDays) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerUpdateTopicInfo. -func (p *PartnerUpdateTopicInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerAuthorization. +func (p *PartnerAuthorization) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -5305,8 +2413,11 @@ func (p *PartnerUpdateTopicInfo) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "eventTypeInfo": - err = unpopulate(val, "EventTypeInfo", &p.EventTypeInfo) + case "authorizedPartnersList": + err = unpopulate(val, "AuthorizedPartnersList", &p.AuthorizedPartnersList) + delete(rawMsg, key) + case "defaultMaximumExpirationTimeInDays": + err = unpopulate(val, "DefaultMaximumExpirationTimeInDays", &p.DefaultMaximumExpirationTimeInDays) delete(rawMsg, key) } if err != nil { @@ -5316,19 +2427,21 @@ func (p *PartnerUpdateTopicInfo) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PermissionBinding. -func (p PermissionBinding) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PartnerConfiguration. +func (p PartnerConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "tags", p.Tags) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PermissionBinding. -func (p *PermissionBinding) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerConfiguration. +func (p *PartnerConfiguration) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -5339,6 +2452,9 @@ func (p *PermissionBinding) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) @@ -5348,6 +2464,9 @@ func (p *PermissionBinding) UnmarshalJSON(data []byte) error { case "systemData": err = unpopulate(val, "SystemData", &p.SystemData) delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) @@ -5359,19 +2478,16 @@ func (p *PermissionBinding) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PermissionBindingProperties. -func (p PermissionBindingProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PartnerConfigurationProperties. +func (p PartnerConfigurationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "clientGroupName", p.ClientGroupName) - populate(objectMap, "description", p.Description) - populate(objectMap, "permission", p.Permission) + populate(objectMap, "partnerAuthorization", p.PartnerAuthorization) populate(objectMap, "provisioningState", p.ProvisioningState) - populate(objectMap, "topicSpaceName", p.TopicSpaceName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PermissionBindingProperties. -func (p *PermissionBindingProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerConfigurationProperties. +func (p *PartnerConfigurationProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -5379,20 +2495,69 @@ func (p *PermissionBindingProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "clientGroupName": - err = unpopulate(val, "ClientGroupName", &p.ClientGroupName) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &p.Description) - delete(rawMsg, key) - case "permission": - err = unpopulate(val, "Permission", &p.Permission) + case "partnerAuthorization": + err = unpopulate(val, "PartnerAuthorization", &p.PartnerAuthorization) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) delete(rawMsg, key) - case "topicSpaceName": - err = unpopulate(val, "TopicSpaceName", &p.TopicSpaceName) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PartnerConfigurationUpdateParameterProperties. +func (p PartnerConfigurationUpdateParameterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "defaultMaximumExpirationTimeInDays", p.DefaultMaximumExpirationTimeInDays) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerConfigurationUpdateParameterProperties. +func (p *PartnerConfigurationUpdateParameterProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "defaultMaximumExpirationTimeInDays": + err = unpopulate(val, "DefaultMaximumExpirationTimeInDays", &p.DefaultMaximumExpirationTimeInDays) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PartnerConfigurationUpdateParameters. +func (p PartnerConfigurationUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", p.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerConfigurationUpdateParameters. +func (p *PartnerConfigurationUpdateParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) delete(rawMsg, key) } if err != nil { @@ -5402,16 +2567,16 @@ func (p *PermissionBindingProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PermissionBindingsListResult. -func (p PermissionBindingsListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PartnerConfigurationsListResult. +func (p PartnerConfigurationsListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", p.NextLink) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PermissionBindingsListResult. -func (p *PermissionBindingsListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerConfigurationsListResult. +func (p *PartnerConfigurationsListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -5433,15 +2598,17 @@ func (p *PermissionBindingsListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. -func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PartnerDetails. +func (p PartnerDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) + populate(objectMap, "description", p.Description) + populate(objectMap, "longDescription", p.LongDescription) + populate(objectMap, "setupUri", p.SetupURI) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. -func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerDetails. +func (p *PartnerDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -5449,8 +2616,14 @@ func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "longDescription": + err = unpopulate(val, "LongDescription", &p.LongDescription) + delete(rawMsg, key) + case "setupUri": + err = unpopulate(val, "SetupURI", &p.SetupURI) delete(rawMsg, key) } if err != nil { @@ -5460,18 +2633,21 @@ func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. -func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PartnerNamespace. +func (p PartnerNamespace) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "tags", p.Tags) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. -func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerNamespace. +func (p *PartnerNamespace) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -5482,12 +2658,21 @@ func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) @@ -5499,16 +2684,22 @@ func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. -func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PartnerNamespaceProperties. +func (p PartnerNamespaceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) + populate(objectMap, "disableLocalAuth", p.DisableLocalAuth) + populate(objectMap, "endpoint", p.Endpoint) + populate(objectMap, "inboundIpRules", p.InboundIPRules) + populate(objectMap, "partnerRegistrationFullyQualifiedId", p.PartnerRegistrationFullyQualifiedID) + populate(objectMap, "partnerTopicRoutingMode", p.PartnerTopicRoutingMode) + populate(objectMap, "privateEndpointConnections", p.PrivateEndpointConnections) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. -func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerNamespaceProperties. +func (p *PartnerNamespaceProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -5516,11 +2707,29 @@ func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) + case "disableLocalAuth": + err = unpopulate(val, "DisableLocalAuth", &p.DisableLocalAuth) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) + case "endpoint": + err = unpopulate(val, "Endpoint", &p.Endpoint) + delete(rawMsg, key) + case "inboundIpRules": + err = unpopulate(val, "InboundIPRules", &p.InboundIPRules) + delete(rawMsg, key) + case "partnerRegistrationFullyQualifiedId": + err = unpopulate(val, "PartnerRegistrationFullyQualifiedID", &p.PartnerRegistrationFullyQualifiedID) + delete(rawMsg, key) + case "partnerTopicRoutingMode": + err = unpopulate(val, "PartnerTopicRoutingMode", &p.PartnerTopicRoutingMode) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &p.PrivateEndpointConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &p.PublicNetworkAccess) delete(rawMsg, key) } if err != nil { @@ -5530,18 +2739,15 @@ func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. -func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PartnerNamespaceRegenerateKeyRequest. +func (p PartnerNamespaceRegenerateKeyRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "groupIds", p.GroupIDs) - populate(objectMap, "privateEndpoint", p.PrivateEndpoint) - populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) - populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "keyName", p.KeyName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. -func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerNamespaceRegenerateKeyRequest. +func (p *PartnerNamespaceRegenerateKeyRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -5549,17 +2755,8 @@ func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "groupIds": - err = unpopulate(val, "GroupIDs", &p.GroupIDs) - delete(rawMsg, key) - case "privateEndpoint": - err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) - delete(rawMsg, key) - case "privateLinkServiceConnectionState": - err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + case "keyName": + err = unpopulate(val, "KeyName", &p.KeyName) delete(rawMsg, key) } if err != nil { @@ -5569,18 +2766,16 @@ func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. -func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PartnerNamespaceSharedAccessKeys. +func (p PartnerNamespaceSharedAccessKeys) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) + populate(objectMap, "key1", p.Key1) + populate(objectMap, "key2", p.Key2) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. -func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerNamespaceSharedAccessKeys. +func (p *PartnerNamespaceSharedAccessKeys) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -5588,17 +2783,11 @@ func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) + case "key1": + err = unpopulate(val, "Key1", &p.Key1) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "key2": + err = unpopulate(val, "Key2", &p.Key2) delete(rawMsg, key) } if err != nil { @@ -5608,18 +2797,17 @@ func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. -func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PartnerNamespaceUpdateParameterProperties. +func (p PartnerNamespaceUpdateParameterProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "groupId", p.GroupID) - populate(objectMap, "requiredMembers", p.RequiredMembers) - populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + populate(objectMap, "disableLocalAuth", p.DisableLocalAuth) + populate(objectMap, "inboundIpRules", p.InboundIPRules) + populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. -func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerNamespaceUpdateParameterProperties. +func (p *PartnerNamespaceUpdateParameterProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -5627,17 +2815,14 @@ func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "groupId": - err = unpopulate(val, "GroupID", &p.GroupID) + case "disableLocalAuth": + err = unpopulate(val, "DisableLocalAuth", &p.DisableLocalAuth) delete(rawMsg, key) - case "requiredMembers": - err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + case "inboundIpRules": + err = unpopulate(val, "InboundIPRules", &p.InboundIPRules) delete(rawMsg, key) - case "requiredZoneNames": - err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &p.PublicNetworkAccess) delete(rawMsg, key) } if err != nil { @@ -5647,16 +2832,16 @@ func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourcesListResult. -func (p PrivateLinkResourcesListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PartnerNamespaceUpdateParameters. +func (p PartnerNamespaceUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", p.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourcesListResult. -func (p *PrivateLinkResourcesListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerNamespaceUpdateParameters. +func (p *PartnerNamespaceUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -5664,11 +2849,11 @@ func (p *PrivateLinkResourcesListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) delete(rawMsg, key) } if err != nil { @@ -5678,715 +2863,752 @@ func (p *PrivateLinkResourcesListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type QueueInfo. -func (q QueueInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PartnerNamespacesListResult. +func (p PartnerNamespacesListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "deadLetterDestinationWithResourceIdentity", q.DeadLetterDestinationWithResourceIdentity) - populate(objectMap, "eventTimeToLive", q.EventTimeToLive) - populate(objectMap, "maxDeliveryCount", q.MaxDeliveryCount) - populate(objectMap, "receiveLockDurationInSeconds", q.ReceiveLockDurationInSeconds) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type QueueInfo. -func (q *QueueInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerNamespacesListResult. +func (p *PartnerNamespacesListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "deadLetterDestinationWithResourceIdentity": - err = unpopulate(val, "DeadLetterDestinationWithResourceIdentity", &q.DeadLetterDestinationWithResourceIdentity) - delete(rawMsg, key) - case "eventTimeToLive": - err = unpopulate(val, "EventTimeToLive", &q.EventTimeToLive) - delete(rawMsg, key) - case "maxDeliveryCount": - err = unpopulate(val, "MaxDeliveryCount", &q.MaxDeliveryCount) + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) - case "receiveLockDurationInSeconds": - err = unpopulate(val, "ReceiveLockDurationInSeconds", &q.ReceiveLockDurationInSeconds) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PartnerRegistration. +func (p PartnerRegistration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "type", r.Type) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. -func (r *Resource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerRegistration. +func (p *PartnerRegistration) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &r.ID) + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &r.Name) + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceMoveChangeHistory. -func (r ResourceMoveChangeHistory) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "azureSubscriptionId", r.AzureSubscriptionID) - populateTimeRFC3339(objectMap, "changedTimeUtc", r.ChangedTimeUTC) - populate(objectMap, "resourceGroupName", r.ResourceGroupName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceMoveChangeHistory. -func (r *ResourceMoveChangeHistory) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "azureSubscriptionId": - err = unpopulate(val, "AzureSubscriptionID", &r.AzureSubscriptionID) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) delete(rawMsg, key) - case "changedTimeUtc": - err = unpopulateTimeRFC3339(val, "ChangedTimeUTC", &r.ChangedTimeUTC) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) delete(rawMsg, key) - case "resourceGroupName": - err = unpopulate(val, "ResourceGroupName", &r.ResourceGroupName) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceSKU. -func (r ResourceSKU) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PartnerRegistrationProperties. +func (p PartnerRegistrationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", r.Name) + populate(objectMap, "partnerRegistrationImmutableId", p.PartnerRegistrationImmutableID) + populate(objectMap, "provisioningState", p.ProvisioningState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKU. -func (r *ResourceSKU) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerRegistrationProperties. +func (p *PartnerRegistrationProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &r.Name) + case "partnerRegistrationImmutableId": + err = unpopulate(val, "PartnerRegistrationImmutableID", &p.PartnerRegistrationImmutableID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RetryPolicy. -func (r RetryPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PartnerRegistrationUpdateParameters. +func (p PartnerRegistrationUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eventTimeToLiveInMinutes", r.EventTimeToLiveInMinutes) - populate(objectMap, "maxDeliveryAttempts", r.MaxDeliveryAttempts) + populate(objectMap, "tags", p.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RetryPolicy. -func (r *RetryPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerRegistrationUpdateParameters. +func (p *PartnerRegistrationUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "eventTimeToLiveInMinutes": - err = unpopulate(val, "EventTimeToLiveInMinutes", &r.EventTimeToLiveInMinutes) - delete(rawMsg, key) - case "maxDeliveryAttempts": - err = unpopulate(val, "MaxDeliveryAttempts", &r.MaxDeliveryAttempts) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoutingEnrichments. -func (r RoutingEnrichments) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PartnerRegistrationsListResult. +func (p PartnerRegistrationsListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dynamic", r.Dynamic) - populate(objectMap, "static", r.Static) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingEnrichments. -func (r *RoutingEnrichments) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerRegistrationsListResult. +func (p *PartnerRegistrationsListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "dynamic": - err = unpopulate(val, "Dynamic", &r.Dynamic) + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) - case "static": - err = unpopulate(val, "Static", &r.Static) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoutingIdentityInfo. -func (r RoutingIdentityInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PartnerTopic. +func (p PartnerTopic) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "type", r.Type) - populate(objectMap, "userAssignedIdentity", r.UserAssignedIdentity) + populate(objectMap, "id", p.ID) + populate(objectMap, "identity", p.Identity) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingIdentityInfo. -func (r *RoutingIdentityInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerTopic. +func (p *PartnerTopic) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "type": - err = unpopulate(val, "Type", &r.Type) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) - case "userAssignedIdentity": - err = unpopulate(val, "UserAssignedIdentity", &r.UserAssignedIdentity) + case "identity": + err = unpopulate(val, "Identity", &p.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ServiceBusQueueEventSubscriptionDestination. -func (s ServiceBusQueueEventSubscriptionDestination) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PartnerTopicInfo. +func (p PartnerTopicInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["endpointType"] = EndpointTypeServiceBusQueue - populate(objectMap, "properties", s.Properties) + populate(objectMap, "azureSubscriptionId", p.AzureSubscriptionID) + populate(objectMap, "eventTypeInfo", p.EventTypeInfo) + populate(objectMap, "name", p.Name) + populate(objectMap, "resourceGroupName", p.ResourceGroupName) + populate(objectMap, "source", p.Source) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceBusQueueEventSubscriptionDestination. -func (s *ServiceBusQueueEventSubscriptionDestination) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerTopicInfo. +func (p *PartnerTopicInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "endpointType": - err = unpopulate(val, "EndpointType", &s.EndpointType) + case "azureSubscriptionId": + err = unpopulate(val, "AzureSubscriptionID", &p.AzureSubscriptionID) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) + case "eventTypeInfo": + err = unpopulate(val, "EventTypeInfo", &p.EventTypeInfo) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "resourceGroupName": + err = unpopulate(val, "ResourceGroupName", &p.ResourceGroupName) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &p.Source) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ServiceBusQueueEventSubscriptionDestinationProperties. -func (s ServiceBusQueueEventSubscriptionDestinationProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PartnerTopicProperties. +func (p PartnerTopicProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "deliveryAttributeMappings", s.DeliveryAttributeMappings) - populate(objectMap, "resourceId", s.ResourceID) + populate(objectMap, "activationState", p.ActivationState) + populate(objectMap, "eventTypeInfo", p.EventTypeInfo) + populateDateTimeRFC3339(objectMap, "expirationTimeIfNotActivatedUtc", p.ExpirationTimeIfNotActivatedUTC) + populate(objectMap, "messageForActivation", p.MessageForActivation) + populate(objectMap, "partnerRegistrationImmutableId", p.PartnerRegistrationImmutableID) + populate(objectMap, "partnerTopicFriendlyDescription", p.PartnerTopicFriendlyDescription) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "source", p.Source) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceBusQueueEventSubscriptionDestinationProperties. -func (s *ServiceBusQueueEventSubscriptionDestinationProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerTopicProperties. +func (p *PartnerTopicProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "deliveryAttributeMappings": - s.DeliveryAttributeMappings, err = unmarshalDeliveryAttributeMappingClassificationArray(val) + case "activationState": + err = unpopulate(val, "ActivationState", &p.ActivationState) delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &s.ResourceID) + case "eventTypeInfo": + err = unpopulate(val, "EventTypeInfo", &p.EventTypeInfo) + delete(rawMsg, key) + case "expirationTimeIfNotActivatedUtc": + err = unpopulateDateTimeRFC3339(val, "ExpirationTimeIfNotActivatedUTC", &p.ExpirationTimeIfNotActivatedUTC) + delete(rawMsg, key) + case "messageForActivation": + err = unpopulate(val, "MessageForActivation", &p.MessageForActivation) + delete(rawMsg, key) + case "partnerRegistrationImmutableId": + err = unpopulate(val, "PartnerRegistrationImmutableID", &p.PartnerRegistrationImmutableID) + delete(rawMsg, key) + case "partnerTopicFriendlyDescription": + err = unpopulate(val, "PartnerTopicFriendlyDescription", &p.PartnerTopicFriendlyDescription) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &p.Source) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ServiceBusTopicEventSubscriptionDestination. -func (s ServiceBusTopicEventSubscriptionDestination) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PartnerTopicUpdateParameters. +func (p PartnerTopicUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["endpointType"] = EndpointTypeServiceBusTopic - populate(objectMap, "properties", s.Properties) + populate(objectMap, "identity", p.Identity) + populate(objectMap, "tags", p.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceBusTopicEventSubscriptionDestination. -func (s *ServiceBusTopicEventSubscriptionDestination) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerTopicUpdateParameters. +func (p *PartnerTopicUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "endpointType": - err = unpopulate(val, "EndpointType", &s.EndpointType) + case "identity": + err = unpopulate(val, "Identity", &p.Identity) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ServiceBusTopicEventSubscriptionDestinationProperties. -func (s ServiceBusTopicEventSubscriptionDestinationProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PartnerTopicsListResult. +func (p PartnerTopicsListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "deliveryAttributeMappings", s.DeliveryAttributeMappings) - populate(objectMap, "resourceId", s.ResourceID) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceBusTopicEventSubscriptionDestinationProperties. -func (s *ServiceBusTopicEventSubscriptionDestinationProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerTopicsListResult. +func (p *PartnerTopicsListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "deliveryAttributeMappings": - s.DeliveryAttributeMappings, err = unmarshalDeliveryAttributeMappingClassificationArray(val) + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &s.ResourceID) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StaticDeliveryAttributeMapping. -func (s StaticDeliveryAttributeMapping) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PartnerUpdateTopicInfo. +func (p PartnerUpdateTopicInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - objectMap["type"] = DeliveryAttributeMappingTypeStatic + populate(objectMap, "eventTypeInfo", p.EventTypeInfo) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StaticDeliveryAttributeMapping. -func (s *StaticDeliveryAttributeMapping) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerUpdateTopicInfo. +func (p *PartnerUpdateTopicInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) + case "eventTypeInfo": + err = unpopulate(val, "EventTypeInfo", &p.EventTypeInfo) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StaticDeliveryAttributeMappingProperties. -func (s StaticDeliveryAttributeMappingProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. +func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "isSecret", s.IsSecret) - populate(objectMap, "value", s.Value) + populate(objectMap, "id", p.ID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StaticDeliveryAttributeMappingProperties. -func (s *StaticDeliveryAttributeMappingProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. +func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "isSecret": - err = unpopulate(val, "IsSecret", &s.IsSecret) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StaticRoutingEnrichment. -func (s StaticRoutingEnrichment) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "key", s.Key) - populate(objectMap, "valueType", s.ValueType) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StaticRoutingEnrichment. -func (s *StaticRoutingEnrichment) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "key": - err = unpopulate(val, "Key", &s.Key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) - case "valueType": - err = unpopulate(val, "ValueType", &s.ValueType) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageBlobDeadLetterDestination. -func (s StorageBlobDeadLetterDestination) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["endpointType"] = DeadLetterEndPointTypeStorageBlob - populate(objectMap, "properties", s.Properties) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageBlobDeadLetterDestination. -func (s *StorageBlobDeadLetterDestination) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. +func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "endpointType": - err = unpopulate(val, "EndpointType", &s.EndpointType) + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageBlobDeadLetterDestinationProperties. -func (s StorageBlobDeadLetterDestinationProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "blobContainerName", s.BlobContainerName) - populate(objectMap, "resourceId", s.ResourceID) + populate(objectMap, "groupIds", p.GroupIDs) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageBlobDeadLetterDestinationProperties. -func (s *StorageBlobDeadLetterDestinationProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. +func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "blobContainerName": - err = unpopulate(val, "BlobContainerName", &s.BlobContainerName) + case "groupIds": + err = unpopulate(val, "GroupIDs", &p.GroupIDs) delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &s.ResourceID) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageQueueEventSubscriptionDestination. -func (s StorageQueueEventSubscriptionDestination) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["endpointType"] = EndpointTypeStorageQueue - populate(objectMap, "properties", s.Properties) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageQueueEventSubscriptionDestination. -func (s *StorageQueueEventSubscriptionDestination) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. +func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "endpointType": - err = unpopulate(val, "EndpointType", &s.EndpointType) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &s.Properties) + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageQueueEventSubscriptionDestinationProperties. -func (s StorageQueueEventSubscriptionDestinationProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "queueMessageTimeToLiveInSeconds", s.QueueMessageTimeToLiveInSeconds) - populate(objectMap, "queueName", s.QueueName) - populate(objectMap, "resourceId", s.ResourceID) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageQueueEventSubscriptionDestinationProperties. -func (s *StorageQueueEventSubscriptionDestinationProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. +func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "queueMessageTimeToLiveInSeconds": - err = unpopulate(val, "QueueMessageTimeToLiveInSeconds", &s.QueueMessageTimeToLiveInSeconds) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) delete(rawMsg, key) - case "queueName": - err = unpopulate(val, "QueueName", &s.QueueName) + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &s.ResourceID) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StringBeginsWithAdvancedFilter. -func (s StringBeginsWithAdvancedFilter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourcesListResult. +func (p PrivateLinkResourcesListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "key", s.Key) - objectMap["operatorType"] = AdvancedFilterOperatorTypeStringBeginsWith - populate(objectMap, "values", s.Values) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StringBeginsWithAdvancedFilter. -func (s *StringBeginsWithAdvancedFilter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourcesListResult. +func (p *PrivateLinkResourcesListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "key": - err = unpopulate(val, "Key", &s.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &s.OperatorType) + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &s.Values) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StringBeginsWithFilter. -func (s StringBeginsWithFilter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "key", s.Key) - objectMap["operatorType"] = FilterOperatorTypeStringBeginsWith - populate(objectMap, "values", s.Values) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StringBeginsWithFilter. -func (s *StringBeginsWithFilter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "key": - err = unpopulate(val, "Key", &s.Key) + case "id": + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &s.OperatorType) + case "name": + err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &s.Values) + case "type": + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StringContainsAdvancedFilter. -func (s StringContainsAdvancedFilter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RetryPolicy. +func (r RetryPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "key", s.Key) - objectMap["operatorType"] = AdvancedFilterOperatorTypeStringContains - populate(objectMap, "values", s.Values) + populate(objectMap, "eventTimeToLiveInMinutes", r.EventTimeToLiveInMinutes) + populate(objectMap, "maxDeliveryAttempts", r.MaxDeliveryAttempts) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StringContainsAdvancedFilter. -func (s *StringContainsAdvancedFilter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RetryPolicy. +func (r *RetryPolicy) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "key": - err = unpopulate(val, "Key", &s.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &s.OperatorType) + case "eventTimeToLiveInMinutes": + err = unpopulate(val, "EventTimeToLiveInMinutes", &r.EventTimeToLiveInMinutes) delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &s.Values) + case "maxDeliveryAttempts": + err = unpopulate(val, "MaxDeliveryAttempts", &r.MaxDeliveryAttempts) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StringContainsFilter. -func (s StringContainsFilter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServiceBusQueueEventSubscriptionDestination. +func (s ServiceBusQueueEventSubscriptionDestination) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "key", s.Key) - objectMap["operatorType"] = FilterOperatorTypeStringContains - populate(objectMap, "values", s.Values) + objectMap["endpointType"] = EndpointTypeServiceBusQueue + populate(objectMap, "properties", s.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StringContainsFilter. -func (s *StringContainsFilter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceBusQueueEventSubscriptionDestination. +func (s *ServiceBusQueueEventSubscriptionDestination) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error - switch key { - case "key": - err = unpopulate(val, "Key", &s.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &s.OperatorType) + switch key { + case "endpointType": + err = unpopulate(val, "EndpointType", &s.EndpointType) delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &s.Values) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) } if err != nil { @@ -6396,17 +3618,16 @@ func (s *StringContainsFilter) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type StringEndsWithAdvancedFilter. -func (s StringEndsWithAdvancedFilter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServiceBusQueueEventSubscriptionDestinationProperties. +func (s ServiceBusQueueEventSubscriptionDestinationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "key", s.Key) - objectMap["operatorType"] = AdvancedFilterOperatorTypeStringEndsWith - populate(objectMap, "values", s.Values) + populate(objectMap, "deliveryAttributeMappings", s.DeliveryAttributeMappings) + populate(objectMap, "resourceId", s.ResourceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StringEndsWithAdvancedFilter. -func (s *StringEndsWithAdvancedFilter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceBusQueueEventSubscriptionDestinationProperties. +func (s *ServiceBusQueueEventSubscriptionDestinationProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -6414,14 +3635,11 @@ func (s *StringEndsWithAdvancedFilter) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "key": - err = unpopulate(val, "Key", &s.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &s.OperatorType) + case "deliveryAttributeMappings": + s.DeliveryAttributeMappings, err = unmarshalDeliveryAttributeMappingClassificationArray(val) delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &s.Values) + case "resourceId": + err = unpopulate(val, "ResourceID", &s.ResourceID) delete(rawMsg, key) } if err != nil { @@ -6431,17 +3649,16 @@ func (s *StringEndsWithAdvancedFilter) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type StringEndsWithFilter. -func (s StringEndsWithFilter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServiceBusTopicEventSubscriptionDestination. +func (s ServiceBusTopicEventSubscriptionDestination) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "key", s.Key) - objectMap["operatorType"] = FilterOperatorTypeStringEndsWith - populate(objectMap, "values", s.Values) + objectMap["endpointType"] = EndpointTypeServiceBusTopic + populate(objectMap, "properties", s.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StringEndsWithFilter. -func (s *StringEndsWithFilter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceBusTopicEventSubscriptionDestination. +func (s *ServiceBusTopicEventSubscriptionDestination) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -6449,14 +3666,11 @@ func (s *StringEndsWithFilter) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "key": - err = unpopulate(val, "Key", &s.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &s.OperatorType) + case "endpointType": + err = unpopulate(val, "EndpointType", &s.EndpointType) delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &s.Values) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) } if err != nil { @@ -6466,17 +3680,16 @@ func (s *StringEndsWithFilter) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type StringInAdvancedFilter. -func (s StringInAdvancedFilter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServiceBusTopicEventSubscriptionDestinationProperties. +func (s ServiceBusTopicEventSubscriptionDestinationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "key", s.Key) - objectMap["operatorType"] = AdvancedFilterOperatorTypeStringIn - populate(objectMap, "values", s.Values) + populate(objectMap, "deliveryAttributeMappings", s.DeliveryAttributeMappings) + populate(objectMap, "resourceId", s.ResourceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StringInAdvancedFilter. -func (s *StringInAdvancedFilter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceBusTopicEventSubscriptionDestinationProperties. +func (s *ServiceBusTopicEventSubscriptionDestinationProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -6484,14 +3697,11 @@ func (s *StringInAdvancedFilter) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "key": - err = unpopulate(val, "Key", &s.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &s.OperatorType) + case "deliveryAttributeMappings": + s.DeliveryAttributeMappings, err = unmarshalDeliveryAttributeMappingClassificationArray(val) delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &s.Values) + case "resourceId": + err = unpopulate(val, "ResourceID", &s.ResourceID) delete(rawMsg, key) } if err != nil { @@ -6501,17 +3711,17 @@ func (s *StringInAdvancedFilter) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type StringInFilter. -func (s StringInFilter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StaticDeliveryAttributeMapping. +func (s StaticDeliveryAttributeMapping) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "key", s.Key) - objectMap["operatorType"] = FilterOperatorTypeStringIn - populate(objectMap, "values", s.Values) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + objectMap["type"] = DeliveryAttributeMappingTypeStatic return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StringInFilter. -func (s *StringInFilter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StaticDeliveryAttributeMapping. +func (s *StaticDeliveryAttributeMapping) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -6519,14 +3729,14 @@ func (s *StringInFilter) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "key": - err = unpopulate(val, "Key", &s.Key) + case "name": + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &s.OperatorType) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &s.Values) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { @@ -6536,17 +3746,16 @@ func (s *StringInFilter) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type StringNotBeginsWithAdvancedFilter. -func (s StringNotBeginsWithAdvancedFilter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StaticDeliveryAttributeMappingProperties. +func (s StaticDeliveryAttributeMappingProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "key", s.Key) - objectMap["operatorType"] = AdvancedFilterOperatorTypeStringNotBeginsWith - populate(objectMap, "values", s.Values) + populate(objectMap, "isSecret", s.IsSecret) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StringNotBeginsWithAdvancedFilter. -func (s *StringNotBeginsWithAdvancedFilter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StaticDeliveryAttributeMappingProperties. +func (s *StaticDeliveryAttributeMappingProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -6554,14 +3763,11 @@ func (s *StringNotBeginsWithAdvancedFilter) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "key": - err = unpopulate(val, "Key", &s.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &s.OperatorType) + case "isSecret": + err = unpopulate(val, "IsSecret", &s.IsSecret) delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &s.Values) + case "value": + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { @@ -6571,17 +3777,16 @@ func (s *StringNotBeginsWithAdvancedFilter) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type StringNotBeginsWithFilter. -func (s StringNotBeginsWithFilter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StorageBlobDeadLetterDestination. +func (s StorageBlobDeadLetterDestination) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "key", s.Key) - objectMap["operatorType"] = FilterOperatorTypeStringNotBeginsWith - populate(objectMap, "values", s.Values) + objectMap["endpointType"] = DeadLetterEndPointTypeStorageBlob + populate(objectMap, "properties", s.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StringNotBeginsWithFilter. -func (s *StringNotBeginsWithFilter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageBlobDeadLetterDestination. +func (s *StorageBlobDeadLetterDestination) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -6589,14 +3794,11 @@ func (s *StringNotBeginsWithFilter) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "key": - err = unpopulate(val, "Key", &s.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &s.OperatorType) + case "endpointType": + err = unpopulate(val, "EndpointType", &s.EndpointType) delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &s.Values) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) } if err != nil { @@ -6606,17 +3808,16 @@ func (s *StringNotBeginsWithFilter) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type StringNotContainsAdvancedFilter. -func (s StringNotContainsAdvancedFilter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StorageBlobDeadLetterDestinationProperties. +func (s StorageBlobDeadLetterDestinationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "key", s.Key) - objectMap["operatorType"] = AdvancedFilterOperatorTypeStringNotContains - populate(objectMap, "values", s.Values) + populate(objectMap, "blobContainerName", s.BlobContainerName) + populate(objectMap, "resourceId", s.ResourceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StringNotContainsAdvancedFilter. -func (s *StringNotContainsAdvancedFilter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageBlobDeadLetterDestinationProperties. +func (s *StorageBlobDeadLetterDestinationProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -6624,14 +3825,11 @@ func (s *StringNotContainsAdvancedFilter) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "key": - err = unpopulate(val, "Key", &s.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &s.OperatorType) + case "blobContainerName": + err = unpopulate(val, "BlobContainerName", &s.BlobContainerName) delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &s.Values) + case "resourceId": + err = unpopulate(val, "ResourceID", &s.ResourceID) delete(rawMsg, key) } if err != nil { @@ -6641,17 +3839,16 @@ func (s *StringNotContainsAdvancedFilter) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type StringNotContainsFilter. -func (s StringNotContainsFilter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StorageQueueEventSubscriptionDestination. +func (s StorageQueueEventSubscriptionDestination) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "key", s.Key) - objectMap["operatorType"] = FilterOperatorTypeStringNotContains - populate(objectMap, "values", s.Values) + objectMap["endpointType"] = EndpointTypeStorageQueue + populate(objectMap, "properties", s.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StringNotContainsFilter. -func (s *StringNotContainsFilter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageQueueEventSubscriptionDestination. +func (s *StorageQueueEventSubscriptionDestination) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -6659,14 +3856,11 @@ func (s *StringNotContainsFilter) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "key": - err = unpopulate(val, "Key", &s.Key) - delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &s.OperatorType) + case "endpointType": + err = unpopulate(val, "EndpointType", &s.EndpointType) delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &s.Values) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) } if err != nil { @@ -6676,17 +3870,17 @@ func (s *StringNotContainsFilter) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type StringNotEndsWithAdvancedFilter. -func (s StringNotEndsWithAdvancedFilter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StorageQueueEventSubscriptionDestinationProperties. +func (s StorageQueueEventSubscriptionDestinationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "key", s.Key) - objectMap["operatorType"] = AdvancedFilterOperatorTypeStringNotEndsWith - populate(objectMap, "values", s.Values) + populate(objectMap, "queueMessageTimeToLiveInSeconds", s.QueueMessageTimeToLiveInSeconds) + populate(objectMap, "queueName", s.QueueName) + populate(objectMap, "resourceId", s.ResourceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StringNotEndsWithAdvancedFilter. -func (s *StringNotEndsWithAdvancedFilter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageQueueEventSubscriptionDestinationProperties. +func (s *StorageQueueEventSubscriptionDestinationProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -6694,14 +3888,14 @@ func (s *StringNotEndsWithAdvancedFilter) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "key": - err = unpopulate(val, "Key", &s.Key) + case "queueMessageTimeToLiveInSeconds": + err = unpopulate(val, "QueueMessageTimeToLiveInSeconds", &s.QueueMessageTimeToLiveInSeconds) delete(rawMsg, key) - case "operatorType": - err = unpopulate(val, "OperatorType", &s.OperatorType) + case "queueName": + err = unpopulate(val, "QueueName", &s.QueueName) delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &s.Values) + case "resourceId": + err = unpopulate(val, "ResourceID", &s.ResourceID) delete(rawMsg, key) } if err != nil { @@ -6711,17 +3905,17 @@ func (s *StringNotEndsWithAdvancedFilter) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type StringNotEndsWithFilter. -func (s StringNotEndsWithFilter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StringBeginsWithAdvancedFilter. +func (s StringBeginsWithAdvancedFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "key", s.Key) - objectMap["operatorType"] = FilterOperatorTypeStringNotEndsWith + objectMap["operatorType"] = AdvancedFilterOperatorTypeStringBeginsWith populate(objectMap, "values", s.Values) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StringNotEndsWithFilter. -func (s *StringNotEndsWithFilter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StringBeginsWithAdvancedFilter. +func (s *StringBeginsWithAdvancedFilter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -6746,17 +3940,17 @@ func (s *StringNotEndsWithFilter) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type StringNotInAdvancedFilter. -func (s StringNotInAdvancedFilter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StringContainsAdvancedFilter. +func (s StringContainsAdvancedFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "key", s.Key) - objectMap["operatorType"] = AdvancedFilterOperatorTypeStringNotIn + objectMap["operatorType"] = AdvancedFilterOperatorTypeStringContains populate(objectMap, "values", s.Values) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StringNotInAdvancedFilter. -func (s *StringNotInAdvancedFilter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StringContainsAdvancedFilter. +func (s *StringContainsAdvancedFilter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -6781,17 +3975,17 @@ func (s *StringNotInAdvancedFilter) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type StringNotInFilter. -func (s StringNotInFilter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StringEndsWithAdvancedFilter. +func (s StringEndsWithAdvancedFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "key", s.Key) - objectMap["operatorType"] = FilterOperatorTypeStringNotIn + objectMap["operatorType"] = AdvancedFilterOperatorTypeStringEndsWith populate(objectMap, "values", s.Values) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StringNotInFilter. -func (s *StringNotInFilter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StringEndsWithAdvancedFilter. +func (s *StringEndsWithAdvancedFilter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -6816,19 +4010,17 @@ func (s *StringNotInFilter) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Subscription. -func (s Subscription) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StringInAdvancedFilter. +func (s StringInAdvancedFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "systemData", s.SystemData) - populate(objectMap, "type", s.Type) + populate(objectMap, "key", s.Key) + objectMap["operatorType"] = AdvancedFilterOperatorTypeStringIn + populate(objectMap, "values", s.Values) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Subscription. -func (s *Subscription) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StringInAdvancedFilter. +func (s *StringInAdvancedFilter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -6836,20 +4028,14 @@ func (s *Subscription) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) + case "key": + err = unpopulate(val, "Key", &s.Key) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &s.SystemData) + case "operatorType": + err = unpopulate(val, "OperatorType", &s.OperatorType) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) + case "values": + err = unpopulate(val, "Values", &s.Values) delete(rawMsg, key) } if err != nil { @@ -6859,18 +4045,17 @@ func (s *Subscription) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SubscriptionProperties. -func (s SubscriptionProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StringNotBeginsWithAdvancedFilter. +func (s StringNotBeginsWithAdvancedFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "deliveryConfiguration", s.DeliveryConfiguration) - populate(objectMap, "eventDeliverySchema", s.EventDeliverySchema) - populate(objectMap, "filtersConfiguration", s.FiltersConfiguration) - populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "key", s.Key) + objectMap["operatorType"] = AdvancedFilterOperatorTypeStringNotBeginsWith + populate(objectMap, "values", s.Values) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionProperties. -func (s *SubscriptionProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StringNotBeginsWithAdvancedFilter. +func (s *StringNotBeginsWithAdvancedFilter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -6878,17 +4063,14 @@ func (s *SubscriptionProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "deliveryConfiguration": - err = unpopulate(val, "DeliveryConfiguration", &s.DeliveryConfiguration) - delete(rawMsg, key) - case "eventDeliverySchema": - err = unpopulate(val, "EventDeliverySchema", &s.EventDeliverySchema) + case "key": + err = unpopulate(val, "Key", &s.Key) delete(rawMsg, key) - case "filtersConfiguration": - err = unpopulate(val, "FiltersConfiguration", &s.FiltersConfiguration) + case "operatorType": + err = unpopulate(val, "OperatorType", &s.OperatorType) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + case "values": + err = unpopulate(val, "Values", &s.Values) delete(rawMsg, key) } if err != nil { @@ -6898,15 +4080,17 @@ func (s *SubscriptionProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SubscriptionUpdateParameters. -func (s SubscriptionUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StringNotContainsAdvancedFilter. +func (s StringNotContainsAdvancedFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", s.Properties) + populate(objectMap, "key", s.Key) + objectMap["operatorType"] = AdvancedFilterOperatorTypeStringNotContains + populate(objectMap, "values", s.Values) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionUpdateParameters. -func (s *SubscriptionUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StringNotContainsAdvancedFilter. +func (s *StringNotContainsAdvancedFilter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -6914,8 +4098,14 @@ func (s *SubscriptionUpdateParameters) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &s.Properties) + case "key": + err = unpopulate(val, "Key", &s.Key) + delete(rawMsg, key) + case "operatorType": + err = unpopulate(val, "OperatorType", &s.OperatorType) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &s.Values) delete(rawMsg, key) } if err != nil { @@ -6925,17 +4115,17 @@ func (s *SubscriptionUpdateParameters) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SubscriptionUpdateParametersProperties. -func (s SubscriptionUpdateParametersProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StringNotEndsWithAdvancedFilter. +func (s StringNotEndsWithAdvancedFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "deliveryConfiguration", s.DeliveryConfiguration) - populate(objectMap, "eventDeliverySchema", s.EventDeliverySchema) - populate(objectMap, "filtersConfiguration", s.FiltersConfiguration) + populate(objectMap, "key", s.Key) + objectMap["operatorType"] = AdvancedFilterOperatorTypeStringNotEndsWith + populate(objectMap, "values", s.Values) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionUpdateParametersProperties. -func (s *SubscriptionUpdateParametersProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StringNotEndsWithAdvancedFilter. +func (s *StringNotEndsWithAdvancedFilter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -6943,14 +4133,14 @@ func (s *SubscriptionUpdateParametersProperties) UnmarshalJSON(data []byte) erro for key, val := range rawMsg { var err error switch key { - case "deliveryConfiguration": - err = unpopulate(val, "DeliveryConfiguration", &s.DeliveryConfiguration) + case "key": + err = unpopulate(val, "Key", &s.Key) delete(rawMsg, key) - case "eventDeliverySchema": - err = unpopulate(val, "EventDeliverySchema", &s.EventDeliverySchema) + case "operatorType": + err = unpopulate(val, "OperatorType", &s.OperatorType) delete(rawMsg, key) - case "filtersConfiguration": - err = unpopulate(val, "FiltersConfiguration", &s.FiltersConfiguration) + case "values": + err = unpopulate(val, "Values", &s.Values) delete(rawMsg, key) } if err != nil { @@ -6960,16 +4150,17 @@ func (s *SubscriptionUpdateParametersProperties) UnmarshalJSON(data []byte) erro return nil } -// MarshalJSON implements the json.Marshaller interface for type SubscriptionsListResult. -func (s SubscriptionsListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StringNotInAdvancedFilter. +func (s StringNotInAdvancedFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) + populate(objectMap, "key", s.Key) + objectMap["operatorType"] = AdvancedFilterOperatorTypeStringNotIn + populate(objectMap, "values", s.Values) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionsListResult. -func (s *SubscriptionsListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StringNotInAdvancedFilter. +func (s *StringNotInAdvancedFilter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -6977,11 +4168,14 @@ func (s *SubscriptionsListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) + case "key": + err = unpopulate(val, "Key", &s.Key) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) + case "operatorType": + err = unpopulate(val, "OperatorType", &s.OperatorType) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &s.Values) delete(rawMsg, key) } if err != nil { @@ -6994,10 +4188,10 @@ func (s *SubscriptionsListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -7013,7 +4207,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, "CreatedBy", &s.CreatedBy) @@ -7022,7 +4216,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, "CreatedByType", &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) @@ -7152,257 +4346,64 @@ func (s *SystemTopicUpdateParameters) UnmarshalJSON(data []byte) error { case "identity": err = unpopulate(val, "Identity", &s.Identity) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &s.Tags) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SystemTopicsListResult. -func (s SystemTopicsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemTopicsListResult. -func (s *SystemTopicsListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Topic. -func (t Topic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "extendedLocation", t.ExtendedLocation) - populate(objectMap, "id", t.ID) - populate(objectMap, "identity", t.Identity) - populate(objectMap, "kind", t.Kind) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "properties", t.Properties) - populate(objectMap, "sku", t.SKU) - populate(objectMap, "systemData", t.SystemData) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Topic. -func (t *Topic) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "extendedLocation": - err = unpopulate(val, "ExtendedLocation", &t.ExtendedLocation) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &t.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &t.Identity) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &t.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &t.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &t.Properties) - delete(rawMsg, key) - case "sku": - err = unpopulate(val, "SKU", &t.SKU) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &t.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &t.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TopicProperties. -func (t TopicProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataResidencyBoundary", t.DataResidencyBoundary) - populate(objectMap, "disableLocalAuth", t.DisableLocalAuth) - populate(objectMap, "endpoint", t.Endpoint) - populate(objectMap, "eventTypeInfo", t.EventTypeInfo) - populate(objectMap, "inboundIpRules", t.InboundIPRules) - populate(objectMap, "inputSchema", t.InputSchema) - populate(objectMap, "inputSchemaMapping", t.InputSchemaMapping) - populate(objectMap, "metricResourceId", t.MetricResourceID) - populate(objectMap, "minimumTlsVersionAllowed", t.MinimumTLSVersionAllowed) - populate(objectMap, "privateEndpointConnections", t.PrivateEndpointConnections) - populate(objectMap, "provisioningState", t.ProvisioningState) - populate(objectMap, "publicNetworkAccess", t.PublicNetworkAccess) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TopicProperties. -func (t *TopicProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataResidencyBoundary": - err = unpopulate(val, "DataResidencyBoundary", &t.DataResidencyBoundary) - delete(rawMsg, key) - case "disableLocalAuth": - err = unpopulate(val, "DisableLocalAuth", &t.DisableLocalAuth) - delete(rawMsg, key) - case "endpoint": - err = unpopulate(val, "Endpoint", &t.Endpoint) - delete(rawMsg, key) - case "eventTypeInfo": - err = unpopulate(val, "EventTypeInfo", &t.EventTypeInfo) - delete(rawMsg, key) - case "inboundIpRules": - err = unpopulate(val, "InboundIPRules", &t.InboundIPRules) - delete(rawMsg, key) - case "inputSchema": - err = unpopulate(val, "InputSchema", &t.InputSchema) - delete(rawMsg, key) - case "inputSchemaMapping": - t.InputSchemaMapping, err = unmarshalInputSchemaMappingClassification(val) - delete(rawMsg, key) - case "metricResourceId": - err = unpopulate(val, "MetricResourceID", &t.MetricResourceID) - delete(rawMsg, key) - case "minimumTlsVersionAllowed": - err = unpopulate(val, "MinimumTLSVersionAllowed", &t.MinimumTLSVersionAllowed) - delete(rawMsg, key) - case "privateEndpointConnections": - err = unpopulate(val, "PrivateEndpointConnections", &t.PrivateEndpointConnections) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) - delete(rawMsg, key) - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &t.PublicNetworkAccess) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TopicRegenerateKeyRequest. -func (t TopicRegenerateKeyRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "keyName", t.KeyName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TopicRegenerateKeyRequest. -func (t *TopicRegenerateKeyRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "keyName": - err = unpopulate(val, "KeyName", &t.KeyName) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TopicSharedAccessKeys. -func (t TopicSharedAccessKeys) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SystemTopicsListResult. +func (s SystemTopicsListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "key1", t.Key1) - populate(objectMap, "key2", t.Key2) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TopicSharedAccessKeys. -func (t *TopicSharedAccessKeys) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemTopicsListResult. +func (s *SystemTopicsListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "key1": - err = unpopulate(val, "Key1", &t.Key1) + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) - case "key2": - err = unpopulate(val, "Key2", &t.Key2) + case "value": + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TopicSpace. -func (t TopicSpace) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Topic. +func (t Topic) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", t.ID) + populate(objectMap, "identity", t.Identity) + populate(objectMap, "location", t.Location) populate(objectMap, "name", t.Name) populate(objectMap, "properties", t.Properties) populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "tags", t.Tags) populate(objectMap, "type", t.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TopicSpace. -func (t *TopicSpace) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Topic. +func (t *Topic) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -7413,6 +4414,12 @@ func (t *TopicSpace) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &t.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &t.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &t.Name) delete(rawMsg, key) @@ -7422,6 +4429,9 @@ func (t *TopicSpace) UnmarshalJSON(data []byte) error { case "systemData": err = unpopulate(val, "SystemData", &t.SystemData) delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &t.Type) delete(rawMsg, key) @@ -7433,17 +4443,24 @@ func (t *TopicSpace) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TopicSpaceProperties. -func (t TopicSpaceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TopicProperties. +func (t TopicProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", t.Description) + populate(objectMap, "dataResidencyBoundary", t.DataResidencyBoundary) + populate(objectMap, "disableLocalAuth", t.DisableLocalAuth) + populate(objectMap, "endpoint", t.Endpoint) + populate(objectMap, "inboundIpRules", t.InboundIPRules) + populate(objectMap, "inputSchema", t.InputSchema) + populate(objectMap, "inputSchemaMapping", t.InputSchemaMapping) + populate(objectMap, "metricResourceId", t.MetricResourceID) + populate(objectMap, "privateEndpointConnections", t.PrivateEndpointConnections) populate(objectMap, "provisioningState", t.ProvisioningState) - populate(objectMap, "topicTemplates", t.TopicTemplates) + populate(objectMap, "publicNetworkAccess", t.PublicNetworkAccess) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TopicSpaceProperties. -func (t *TopicSpaceProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TopicProperties. +func (t *TopicProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -7451,14 +4468,35 @@ func (t *TopicSpaceProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &t.Description) + case "dataResidencyBoundary": + err = unpopulate(val, "DataResidencyBoundary", &t.DataResidencyBoundary) + delete(rawMsg, key) + case "disableLocalAuth": + err = unpopulate(val, "DisableLocalAuth", &t.DisableLocalAuth) + delete(rawMsg, key) + case "endpoint": + err = unpopulate(val, "Endpoint", &t.Endpoint) + delete(rawMsg, key) + case "inboundIpRules": + err = unpopulate(val, "InboundIPRules", &t.InboundIPRules) + delete(rawMsg, key) + case "inputSchema": + err = unpopulate(val, "InputSchema", &t.InputSchema) + delete(rawMsg, key) + case "inputSchemaMapping": + t.InputSchemaMapping, err = unmarshalInputSchemaMappingClassification(val) + delete(rawMsg, key) + case "metricResourceId": + err = unpopulate(val, "MetricResourceID", &t.MetricResourceID) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &t.PrivateEndpointConnections) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) delete(rawMsg, key) - case "topicTemplates": - err = unpopulate(val, "TopicTemplates", &t.TopicTemplates) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &t.PublicNetworkAccess) delete(rawMsg, key) } if err != nil { @@ -7468,22 +4506,15 @@ func (t *TopicSpaceProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TopicSpacesConfiguration. -func (t TopicSpacesConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TopicRegenerateKeyRequest. +func (t TopicRegenerateKeyRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "clientAuthentication", t.ClientAuthentication) - populate(objectMap, "hostname", t.Hostname) - populate(objectMap, "maximumClientSessionsPerAuthenticationName", t.MaximumClientSessionsPerAuthenticationName) - populate(objectMap, "maximumSessionExpiryInHours", t.MaximumSessionExpiryInHours) - populate(objectMap, "routeTopicResourceId", t.RouteTopicResourceID) - populate(objectMap, "routingEnrichments", t.RoutingEnrichments) - populate(objectMap, "routingIdentityInfo", t.RoutingIdentityInfo) - populate(objectMap, "state", t.State) + populate(objectMap, "keyName", t.KeyName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TopicSpacesConfiguration. -func (t *TopicSpacesConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TopicRegenerateKeyRequest. +func (t *TopicRegenerateKeyRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -7491,29 +4522,8 @@ func (t *TopicSpacesConfiguration) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "clientAuthentication": - err = unpopulate(val, "ClientAuthentication", &t.ClientAuthentication) - delete(rawMsg, key) - case "hostname": - err = unpopulate(val, "Hostname", &t.Hostname) - delete(rawMsg, key) - case "maximumClientSessionsPerAuthenticationName": - err = unpopulate(val, "MaximumClientSessionsPerAuthenticationName", &t.MaximumClientSessionsPerAuthenticationName) - delete(rawMsg, key) - case "maximumSessionExpiryInHours": - err = unpopulate(val, "MaximumSessionExpiryInHours", &t.MaximumSessionExpiryInHours) - delete(rawMsg, key) - case "routeTopicResourceId": - err = unpopulate(val, "RouteTopicResourceID", &t.RouteTopicResourceID) - delete(rawMsg, key) - case "routingEnrichments": - err = unpopulate(val, "RoutingEnrichments", &t.RoutingEnrichments) - delete(rawMsg, key) - case "routingIdentityInfo": - err = unpopulate(val, "RoutingIdentityInfo", &t.RoutingIdentityInfo) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &t.State) + case "keyName": + err = unpopulate(val, "KeyName", &t.KeyName) delete(rawMsg, key) } if err != nil { @@ -7523,16 +4533,16 @@ func (t *TopicSpacesConfiguration) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TopicSpacesListResult. -func (t TopicSpacesListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TopicSharedAccessKeys. +func (t TopicSharedAccessKeys) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", t.NextLink) - populate(objectMap, "value", t.Value) + populate(objectMap, "key1", t.Key1) + populate(objectMap, "key2", t.Key2) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TopicSpacesListResult. -func (t *TopicSpacesListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TopicSharedAccessKeys. +func (t *TopicSharedAccessKeys) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -7540,11 +4550,11 @@ func (t *TopicSpacesListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &t.NextLink) + case "key1": + err = unpopulate(val, "Key1", &t.Key1) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &t.Value) + case "key2": + err = unpopulate(val, "Key2", &t.Key2) delete(rawMsg, key) } if err != nil { @@ -7596,7 +4606,6 @@ func (t *TopicTypeInfo) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TopicTypeProperties. func (t TopicTypeProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "areRegionalAndGlobalSourcesSupported", t.AreRegionalAndGlobalSourcesSupported) populate(objectMap, "description", t.Description) populate(objectMap, "displayName", t.DisplayName) populate(objectMap, "provider", t.Provider) @@ -7617,9 +4626,6 @@ func (t *TopicTypeProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "areRegionalAndGlobalSourcesSupported": - err = unpopulate(val, "AreRegionalAndGlobalSourcesSupported", &t.AreRegionalAndGlobalSourcesSupported) - delete(rawMsg, key) case "description": err = unpopulate(val, "Description", &t.Description) delete(rawMsg, key) @@ -7684,9 +4690,7 @@ func (t TopicUpdateParameterProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "dataResidencyBoundary", t.DataResidencyBoundary) populate(objectMap, "disableLocalAuth", t.DisableLocalAuth) - populate(objectMap, "eventTypeInfo", t.EventTypeInfo) populate(objectMap, "inboundIpRules", t.InboundIPRules) - populate(objectMap, "minimumTlsVersionAllowed", t.MinimumTLSVersionAllowed) populate(objectMap, "publicNetworkAccess", t.PublicNetworkAccess) return json.Marshal(objectMap) } @@ -7706,15 +4710,9 @@ func (t *TopicUpdateParameterProperties) UnmarshalJSON(data []byte) error { case "disableLocalAuth": err = unpopulate(val, "DisableLocalAuth", &t.DisableLocalAuth) delete(rawMsg, key) - case "eventTypeInfo": - err = unpopulate(val, "EventTypeInfo", &t.EventTypeInfo) - delete(rawMsg, key) case "inboundIpRules": err = unpopulate(val, "InboundIPRules", &t.InboundIPRules) delete(rawMsg, key) - case "minimumTlsVersionAllowed": - err = unpopulate(val, "MinimumTLSVersionAllowed", &t.MinimumTLSVersionAllowed) - delete(rawMsg, key) case "publicNetworkAccess": err = unpopulate(val, "PublicNetworkAccess", &t.PublicNetworkAccess) delete(rawMsg, key) @@ -7731,7 +4729,6 @@ func (t TopicUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "identity", t.Identity) populate(objectMap, "properties", t.Properties) - populate(objectMap, "sku", t.SKU) populate(objectMap, "tags", t.Tags) return json.Marshal(objectMap) } @@ -7751,9 +4748,6 @@ func (t *TopicUpdateParameters) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &t.Properties) delete(rawMsg, key) - case "sku": - err = unpopulate(val, "SKU", &t.SKU) - delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &t.Tags) delete(rawMsg, key) @@ -7765,33 +4759,6 @@ func (t *TopicUpdateParameters) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TopicsConfiguration. -func (t TopicsConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "hostname", t.Hostname) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TopicsConfiguration. -func (t *TopicsConfiguration) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "hostname": - err = unpopulate(val, "Hostname", &t.Hostname) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type TopicsListResult. func (t TopicsListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -7866,57 +4833,6 @@ func (t *TrackedResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type UpdateTopicSpacesConfigurationInfo. -func (u UpdateTopicSpacesConfigurationInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "clientAuthentication", u.ClientAuthentication) - populate(objectMap, "maximumClientSessionsPerAuthenticationName", u.MaximumClientSessionsPerAuthenticationName) - populate(objectMap, "maximumSessionExpiryInHours", u.MaximumSessionExpiryInHours) - populate(objectMap, "routeTopicResourceId", u.RouteTopicResourceID) - populate(objectMap, "routingEnrichments", u.RoutingEnrichments) - populate(objectMap, "routingIdentityInfo", u.RoutingIdentityInfo) - populate(objectMap, "state", u.State) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateTopicSpacesConfigurationInfo. -func (u *UpdateTopicSpacesConfigurationInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "clientAuthentication": - err = unpopulate(val, "ClientAuthentication", &u.ClientAuthentication) - delete(rawMsg, key) - case "maximumClientSessionsPerAuthenticationName": - err = unpopulate(val, "MaximumClientSessionsPerAuthenticationName", &u.MaximumClientSessionsPerAuthenticationName) - delete(rawMsg, key) - case "maximumSessionExpiryInHours": - err = unpopulate(val, "MaximumSessionExpiryInHours", &u.MaximumSessionExpiryInHours) - delete(rawMsg, key) - case "routeTopicResourceId": - err = unpopulate(val, "RouteTopicResourceID", &u.RouteTopicResourceID) - delete(rawMsg, key) - case "routingEnrichments": - err = unpopulate(val, "RoutingEnrichments", &u.RoutingEnrichments) - delete(rawMsg, key) - case "routingIdentityInfo": - err = unpopulate(val, "RoutingIdentityInfo", &u.RoutingIdentityInfo) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &u.State) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type UserIdentityProperties. func (u UserIdentityProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -7995,7 +4911,6 @@ func (v *VerifiedPartner) UnmarshalJSON(data []byte) error { func (v VerifiedPartnerProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "organizationName", v.OrganizationName) - populate(objectMap, "partnerDestinationDetails", v.PartnerDestinationDetails) populate(objectMap, "partnerDisplayName", v.PartnerDisplayName) populate(objectMap, "partnerRegistrationImmutableId", v.PartnerRegistrationImmutableID) populate(objectMap, "partnerTopicDetails", v.PartnerTopicDetails) @@ -8015,9 +4930,6 @@ func (v *VerifiedPartnerProperties) UnmarshalJSON(data []byte) error { case "organizationName": err = unpopulate(val, "OrganizationName", &v.OrganizationName) delete(rawMsg, key) - case "partnerDestinationDetails": - err = unpopulate(val, "PartnerDestinationDetails", &v.PartnerDestinationDetails) - delete(rawMsg, key) case "partnerDisplayName": err = unpopulate(val, "PartnerDisplayName", &v.PartnerDisplayName) delete(rawMsg, key) @@ -8109,7 +5021,6 @@ func (w WebHookEventSubscriptionDestinationProperties) MarshalJSON() ([]byte, er populate(objectMap, "endpointBaseUrl", w.EndpointBaseURL) populate(objectMap, "endpointUrl", w.EndpointURL) populate(objectMap, "maxEventsPerBatch", w.MaxEventsPerBatch) - populate(objectMap, "minimumTlsVersionAllowed", w.MinimumTLSVersionAllowed) populate(objectMap, "preferredBatchSizeInKilobytes", w.PreferredBatchSizeInKilobytes) return json.Marshal(objectMap) } @@ -8141,9 +5052,6 @@ func (w *WebHookEventSubscriptionDestinationProperties) UnmarshalJSON(data []byt case "maxEventsPerBatch": err = unpopulate(val, "MaxEventsPerBatch", &w.MaxEventsPerBatch) delete(rawMsg, key) - case "minimumTlsVersionAllowed": - err = unpopulate(val, "MinimumTLSVersionAllowed", &w.MinimumTLSVersionAllowed) - delete(rawMsg, key) case "preferredBatchSizeInKilobytes": err = unpopulate(val, "PreferredBatchSizeInKilobytes", &w.PreferredBatchSizeInKilobytes) delete(rawMsg, key) @@ -8155,123 +5063,6 @@ func (w *WebHookEventSubscriptionDestinationProperties) UnmarshalJSON(data []byt return nil } -// MarshalJSON implements the json.Marshaller interface for type WebhookPartnerDestinationInfo. -func (w WebhookPartnerDestinationInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "azureSubscriptionId", w.AzureSubscriptionID) - populate(objectMap, "endpointServiceContext", w.EndpointServiceContext) - objectMap["endpointType"] = PartnerEndpointTypeWebHook - populate(objectMap, "name", w.Name) - populate(objectMap, "properties", w.Properties) - populate(objectMap, "resourceGroupName", w.ResourceGroupName) - populate(objectMap, "resourceMoveChangeHistory", w.ResourceMoveChangeHistory) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookPartnerDestinationInfo. -func (w *WebhookPartnerDestinationInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "azureSubscriptionId": - err = unpopulate(val, "AzureSubscriptionID", &w.AzureSubscriptionID) - delete(rawMsg, key) - case "endpointServiceContext": - err = unpopulate(val, "EndpointServiceContext", &w.EndpointServiceContext) - delete(rawMsg, key) - case "endpointType": - err = unpopulate(val, "EndpointType", &w.EndpointType) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &w.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &w.Properties) - delete(rawMsg, key) - case "resourceGroupName": - err = unpopulate(val, "ResourceGroupName", &w.ResourceGroupName) - delete(rawMsg, key) - case "resourceMoveChangeHistory": - err = unpopulate(val, "ResourceMoveChangeHistory", &w.ResourceMoveChangeHistory) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WebhookPartnerDestinationProperties. -func (w WebhookPartnerDestinationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "clientAuthentication", w.ClientAuthentication) - populate(objectMap, "endpointBaseUrl", w.EndpointBaseURL) - populate(objectMap, "endpointUrl", w.EndpointURL) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookPartnerDestinationProperties. -func (w *WebhookPartnerDestinationProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "clientAuthentication": - w.ClientAuthentication, err = unmarshalPartnerClientAuthenticationClassification(val) - delete(rawMsg, key) - case "endpointBaseUrl": - err = unpopulate(val, "EndpointBaseURL", &w.EndpointBaseURL) - delete(rawMsg, key) - case "endpointUrl": - err = unpopulate(val, "EndpointURL", &w.EndpointURL) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WebhookUpdatePartnerDestinationInfo. -func (w WebhookUpdatePartnerDestinationInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["endpointType"] = PartnerEndpointTypeWebHook - populate(objectMap, "properties", w.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookUpdatePartnerDestinationInfo. -func (w *WebhookUpdatePartnerDestinationInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endpointType": - err = unpopulate(val, "EndpointType", &w.EndpointType) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &w.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - func populate(m map[string]any, k string, v any) { if v == nil { return diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/namespaces_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/namespaces_client.go deleted file mode 100644 index 6c54f0b4530a..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/namespaces_client.go +++ /dev/null @@ -1,568 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armeventgrid - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strconv" - "strings" -) - -// NamespacesClient contains the methods for the Namespaces group. -// Don't use this type directly, use NewNamespacesClient() instead. -type NamespacesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewNamespacesClient creates a new instance of NamespacesClient with the specified values. -// - subscriptionID - Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewNamespacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*NamespacesClient, error) { - cl, err := arm.NewClient(moduleName+".NamespacesClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &NamespacesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreateOrUpdate - Asynchronously creates or updates a new namespace with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - namespaceInfo - Namespace information. -// - options - NamespacesClientBeginCreateOrUpdateOptions contains the optional parameters for the NamespacesClient.BeginCreateOrUpdate -// method. -func (client *NamespacesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, namespaceInfo Namespace, options *NamespacesClientBeginCreateOrUpdateOptions) (*runtime.Poller[NamespacesClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, namespaceName, namespaceInfo, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespacesClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[NamespacesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// CreateOrUpdate - Asynchronously creates or updates a new namespace with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *NamespacesClient) createOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, namespaceInfo Namespace, options *NamespacesClientBeginCreateOrUpdateOptions) (*http.Response, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, namespaceName, namespaceInfo, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *NamespacesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, namespaceInfo Namespace, options *NamespacesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, namespaceInfo) -} - -// BeginDelete - Delete existing namespace. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - options - NamespacesClientBeginDeleteOptions contains the optional parameters for the NamespacesClient.BeginDelete method. -func (client *NamespacesClient) BeginDelete(ctx context.Context, resourceGroupName string, namespaceName string, options *NamespacesClientBeginDeleteOptions) (*runtime.Poller[NamespacesClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, namespaceName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespacesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[NamespacesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Delete - Delete existing namespace. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *NamespacesClient) deleteOperation(ctx context.Context, resourceGroupName string, namespaceName string, options *NamespacesClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, namespaceName, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *NamespacesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, options *NamespacesClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get properties of a namespace. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - options - NamespacesClientGetOptions contains the optional parameters for the NamespacesClient.Get method. -func (client *NamespacesClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, options *NamespacesClientGetOptions) (NamespacesClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, namespaceName, options) - if err != nil { - return NamespacesClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return NamespacesClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return NamespacesClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *NamespacesClient) getCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, options *NamespacesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *NamespacesClient) getHandleResponse(resp *http.Response) (NamespacesClientGetResponse, error) { - result := NamespacesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Namespace); err != nil { - return NamespacesClientGetResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - List all the namespaces under a resource group. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - options - NamespacesClientListByResourceGroupOptions contains the optional parameters for the NamespacesClient.NewListByResourceGroupPager -// method. -func (client *NamespacesClient) NewListByResourceGroupPager(resourceGroupName string, options *NamespacesClientListByResourceGroupOptions) *runtime.Pager[NamespacesClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[NamespacesClientListByResourceGroupResponse]{ - More: func(page NamespacesClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *NamespacesClientListByResourceGroupResponse) (NamespacesClientListByResourceGroupResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return NamespacesClientListByResourceGroupResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return NamespacesClientListByResourceGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return NamespacesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } - return client.listByResourceGroupHandleResponse(resp) - }, - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *NamespacesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *NamespacesClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *NamespacesClient) listByResourceGroupHandleResponse(resp *http.Response) (NamespacesClientListByResourceGroupResponse, error) { - result := NamespacesClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.NamespacesListResult); err != nil { - return NamespacesClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - List all the namespaces under an Azure subscription. -// -// Generated from API version 2023-06-01-preview -// - options - NamespacesClientListBySubscriptionOptions contains the optional parameters for the NamespacesClient.NewListBySubscriptionPager -// method. -func (client *NamespacesClient) NewListBySubscriptionPager(options *NamespacesClientListBySubscriptionOptions) *runtime.Pager[NamespacesClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[NamespacesClientListBySubscriptionResponse]{ - More: func(page NamespacesClientListBySubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *NamespacesClientListBySubscriptionResponse) (NamespacesClientListBySubscriptionResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listBySubscriptionCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return NamespacesClientListBySubscriptionResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return NamespacesClientListBySubscriptionResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return NamespacesClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) - } - return client.listBySubscriptionHandleResponse(resp) - }, - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *NamespacesClient) listBySubscriptionCreateRequest(ctx context.Context, options *NamespacesClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/namespaces" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *NamespacesClient) listBySubscriptionHandleResponse(resp *http.Response) (NamespacesClientListBySubscriptionResponse, error) { - result := NamespacesClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.NamespacesListResult); err != nil { - return NamespacesClientListBySubscriptionResponse{}, err - } - return result, nil -} - -// ListSharedAccessKeys - List the two keys used to publish to a namespace. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - options - NamespacesClientListSharedAccessKeysOptions contains the optional parameters for the NamespacesClient.ListSharedAccessKeys -// method. -func (client *NamespacesClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, namespaceName string, options *NamespacesClientListSharedAccessKeysOptions) (NamespacesClientListSharedAccessKeysResponse, error) { - req, err := client.listSharedAccessKeysCreateRequest(ctx, resourceGroupName, namespaceName, options) - if err != nil { - return NamespacesClientListSharedAccessKeysResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return NamespacesClientListSharedAccessKeysResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return NamespacesClientListSharedAccessKeysResponse{}, runtime.NewResponseError(resp) - } - return client.listSharedAccessKeysHandleResponse(resp) -} - -// listSharedAccessKeysCreateRequest creates the ListSharedAccessKeys request. -func (client *NamespacesClient) listSharedAccessKeysCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, options *NamespacesClientListSharedAccessKeysOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/listKeys" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listSharedAccessKeysHandleResponse handles the ListSharedAccessKeys response. -func (client *NamespacesClient) listSharedAccessKeysHandleResponse(resp *http.Response) (NamespacesClientListSharedAccessKeysResponse, error) { - result := NamespacesClientListSharedAccessKeysResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.NamespaceSharedAccessKeys); err != nil { - return NamespacesClientListSharedAccessKeysResponse{}, err - } - return result, nil -} - -// BeginRegenerateKey - Regenerate a shared access key for a namespace. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the Namespace. -// - regenerateKeyRequest - Request body to regenerate key. -// - options - NamespacesClientBeginRegenerateKeyOptions contains the optional parameters for the NamespacesClient.BeginRegenerateKey -// method. -func (client *NamespacesClient) BeginRegenerateKey(ctx context.Context, resourceGroupName string, namespaceName string, regenerateKeyRequest NamespaceRegenerateKeyRequest, options *NamespacesClientBeginRegenerateKeyOptions) (*runtime.Poller[NamespacesClientRegenerateKeyResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.regenerateKey(ctx, resourceGroupName, namespaceName, regenerateKeyRequest, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespacesClientRegenerateKeyResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[NamespacesClientRegenerateKeyResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// RegenerateKey - Regenerate a shared access key for a namespace. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *NamespacesClient) regenerateKey(ctx context.Context, resourceGroupName string, namespaceName string, regenerateKeyRequest NamespaceRegenerateKeyRequest, options *NamespacesClientBeginRegenerateKeyOptions) (*http.Response, error) { - req, err := client.regenerateKeyCreateRequest(ctx, resourceGroupName, namespaceName, regenerateKeyRequest, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// regenerateKeyCreateRequest creates the RegenerateKey request. -func (client *NamespacesClient) regenerateKeyCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, regenerateKeyRequest NamespaceRegenerateKeyRequest, options *NamespacesClientBeginRegenerateKeyOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/regenerateKey" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, regenerateKeyRequest) -} - -// BeginUpdate - Asynchronously updates a namespace with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - namespaceUpdateParameters - Namespace update information. -// - options - NamespacesClientBeginUpdateOptions contains the optional parameters for the NamespacesClient.BeginUpdate method. -func (client *NamespacesClient) BeginUpdate(ctx context.Context, resourceGroupName string, namespaceName string, namespaceUpdateParameters NamespaceUpdateParameters, options *NamespacesClientBeginUpdateOptions) (*runtime.Poller[NamespacesClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, namespaceName, namespaceUpdateParameters, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespacesClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[NamespacesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Update - Asynchronously updates a namespace with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *NamespacesClient) update(ctx context.Context, resourceGroupName string, namespaceName string, namespaceUpdateParameters NamespaceUpdateParameters, options *NamespacesClientBeginUpdateOptions) (*http.Response, error) { - req, err := client.updateCreateRequest(ctx, resourceGroupName, namespaceName, namespaceUpdateParameters, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// updateCreateRequest creates the Update request. -func (client *NamespacesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, namespaceUpdateParameters NamespaceUpdateParameters, options *NamespacesClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, namespaceUpdateParameters) -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/namespaces_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/namespaces_client_example_test.go deleted file mode 100644 index 9f92cdad50ee..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/namespaces_client_example_test.go +++ /dev/null @@ -1,326 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armeventgrid_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Namespaces_Get.json -func ExampleNamespacesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNamespacesClient().Get(ctx, "examplerg", "exampleNamespaceName1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Namespace = armeventgrid.Namespace{ - // Name: to.Ptr("exampleNamespaceName1"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/exampleNamespaceName1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // "key3": to.Ptr("value3"), - // }, - // Properties: &armeventgrid.NamespaceProperties{ - // ProvisioningState: to.Ptr(armeventgrid.NamespaceProvisioningStateSucceeded), - // TopicSpacesConfiguration: &armeventgrid.TopicSpacesConfiguration{ - // Hostname: to.Ptr("exampleNamespaceName1.westus-1.mqtt.eventgrid-int.azure.net"), - // RouteTopicResourceID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampleTopic1"), - // State: to.Ptr(armeventgrid.TopicSpacesConfigurationStateEnabled), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Namespaces_CreateOrUpdate.json -func ExampleNamespacesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNamespacesClient().BeginCreateOrUpdate(ctx, "examplerg", "exampleNamespaceName1", armeventgrid.Namespace{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "tag1": to.Ptr("value11"), - "tag2": to.Ptr("value22"), - }, - Properties: &armeventgrid.NamespaceProperties{ - TopicSpacesConfiguration: &armeventgrid.TopicSpacesConfiguration{ - RouteTopicResourceID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampleTopic1"), - State: to.Ptr(armeventgrid.TopicSpacesConfigurationStateEnabled), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Namespace = armeventgrid.Namespace{ - // Name: to.Ptr("exampleNamespaceName1"), - // Type: to.Ptr("Microsoft.EventGrid/Namespaces"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/exampleNamespaceName1"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value11"), - // "key2": to.Ptr("value22"), - // }, - // Properties: &armeventgrid.NamespaceProperties{ - // ProvisioningState: to.Ptr(armeventgrid.NamespaceProvisioningStateSucceeded), - // TopicSpacesConfiguration: &armeventgrid.TopicSpacesConfiguration{ - // RouteTopicResourceID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampleTopic1"), - // State: to.Ptr(armeventgrid.TopicSpacesConfigurationStateEnabled), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Namespaces_Delete.json -func ExampleNamespacesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNamespacesClient().BeginDelete(ctx, "examplerg", "exampleNamespaceName1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Namespaces_Update.json -func ExampleNamespacesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNamespacesClient().BeginUpdate(ctx, "examplerg", "exampleNamespaceName1", armeventgrid.NamespaceUpdateParameters{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1Updated"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Namespace = armeventgrid.Namespace{ - // Name: to.Ptr("exampleNamespaceName1"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/exampleNamespaceName1"), - // Location: to.Ptr("westus"), - // Properties: &armeventgrid.NamespaceProperties{ - // ProvisioningState: to.Ptr(armeventgrid.NamespaceProvisioningStateSucceeded), - // TopicSpacesConfiguration: &armeventgrid.TopicSpacesConfiguration{ - // Hostname: to.Ptr("exampleNamespaceName1.westus-1.mqtt.eventgrid-int.azure.net"), - // RouteTopicResourceID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampleTopic1"), - // State: to.Ptr(armeventgrid.TopicSpacesConfigurationStateEnabled), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Namespaces_ListBySubscription.json -func ExampleNamespacesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewNamespacesClient().NewListBySubscriptionPager(&armeventgrid.NamespacesClientListBySubscriptionOptions{Filter: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.NamespacesListResult = armeventgrid.NamespacesListResult{ - // Value: []*armeventgrid.Namespace{ - // { - // Name: to.Ptr("exampleNamespaceName1"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/exampleNamespaceName1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // "key3": to.Ptr("value3"), - // }, - // Properties: &armeventgrid.NamespaceProperties{ - // ProvisioningState: to.Ptr(armeventgrid.NamespaceProvisioningStateSucceeded), - // TopicSpacesConfiguration: &armeventgrid.TopicSpacesConfiguration{ - // Hostname: to.Ptr("exampleNamespaceName1.westus-1.mqtt.eventgrid-int.azure.net"), - // RouteTopicResourceID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampleTopic1"), - // State: to.Ptr(armeventgrid.TopicSpacesConfigurationStateEnabled), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Namespaces_ListByResourceGroup.json -func ExampleNamespacesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewNamespacesClient().NewListByResourceGroupPager("examplerg", &armeventgrid.NamespacesClientListByResourceGroupOptions{Filter: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.NamespacesListResult = armeventgrid.NamespacesListResult{ - // Value: []*armeventgrid.Namespace{ - // { - // Name: to.Ptr("exampleNamespaceName1"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/exampleNamespaceName1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // "key3": to.Ptr("value3"), - // }, - // Properties: &armeventgrid.NamespaceProperties{ - // ProvisioningState: to.Ptr(armeventgrid.NamespaceProvisioningStateSucceeded), - // TopicSpacesConfiguration: &armeventgrid.TopicSpacesConfiguration{ - // Hostname: to.Ptr("exampleNamespaceName1.westus-1.mqtt.eventgrid-int.azure.net"), - // RouteTopicResourceID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampleTopic1"), - // State: to.Ptr(armeventgrid.TopicSpacesConfigurationStateEnabled), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Namespaces_ListSharedAccessKeys.json -func ExampleNamespacesClient_ListSharedAccessKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNamespacesClient().ListSharedAccessKeys(ctx, "examplerg", "exampleNamespaceName1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NamespaceSharedAccessKeys = armeventgrid.NamespaceSharedAccessKeys{ - // Key1: to.Ptr("testKey1Value"), - // Key2: to.Ptr("testKey2Value"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Namespaces_RegenerateKey.json -func ExampleNamespacesClient_BeginRegenerateKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNamespacesClient().BeginRegenerateKey(ctx, "examplerg", "exampleNamespaceName1", armeventgrid.NamespaceRegenerateKeyRequest{ - KeyName: to.Ptr("key1"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NamespaceSharedAccessKeys = armeventgrid.NamespaceSharedAccessKeys{ - // Key1: to.Ptr("testKey1Value"), - // Key2: to.Ptr("testKey2Value"), - // } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/namespacetopiceventsubscriptions_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/namespacetopiceventsubscriptions_client.go deleted file mode 100644 index 862824db5744..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/namespacetopiceventsubscriptions_client.go +++ /dev/null @@ -1,435 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armeventgrid - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strconv" - "strings" -) - -// NamespaceTopicEventSubscriptionsClient contains the methods for the NamespaceTopicEventSubscriptions group. -// Don't use this type directly, use NewNamespaceTopicEventSubscriptionsClient() instead. -type NamespaceTopicEventSubscriptionsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewNamespaceTopicEventSubscriptionsClient creates a new instance of NamespaceTopicEventSubscriptionsClient with the specified values. -// - subscriptionID - Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewNamespaceTopicEventSubscriptionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*NamespaceTopicEventSubscriptionsClient, error) { - cl, err := arm.NewClient(moduleName+".NamespaceTopicEventSubscriptionsClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &NamespaceTopicEventSubscriptionsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreateOrUpdate - Asynchronously creates or updates an event subscription of a namespace topic with the specified parameters. -// Existing event subscriptions will be updated with this API. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - topicName - Name of the namespace topic. -// - eventSubscriptionName - Name of the event subscription to be created. Event subscription names must be between 3 and 100 -// characters in length and use alphanumeric letters only. -// - eventSubscriptionInfo - Event subscription properties containing the delivery mode, filter information, and others. -// - options - NamespaceTopicEventSubscriptionsClientBeginCreateOrUpdateOptions contains the optional parameters for the NamespaceTopicEventSubscriptionsClient.BeginCreateOrUpdate -// method. -func (client *NamespaceTopicEventSubscriptionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, eventSubscriptionName string, eventSubscriptionInfo Subscription, options *NamespaceTopicEventSubscriptionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[NamespaceTopicEventSubscriptionsClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, namespaceName, topicName, eventSubscriptionName, eventSubscriptionInfo, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespaceTopicEventSubscriptionsClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[NamespaceTopicEventSubscriptionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// CreateOrUpdate - Asynchronously creates or updates an event subscription of a namespace topic with the specified parameters. -// Existing event subscriptions will be updated with this API. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *NamespaceTopicEventSubscriptionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, eventSubscriptionName string, eventSubscriptionInfo Subscription, options *NamespaceTopicEventSubscriptionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, namespaceName, topicName, eventSubscriptionName, eventSubscriptionInfo, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *NamespaceTopicEventSubscriptionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, eventSubscriptionName string, eventSubscriptionInfo Subscription, options *NamespaceTopicEventSubscriptionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if topicName == "" { - return nil, errors.New("parameter topicName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{topicName}", url.PathEscape(topicName)) - if eventSubscriptionName == "" { - return nil, errors.New("parameter eventSubscriptionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{eventSubscriptionName}", url.PathEscape(eventSubscriptionName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, eventSubscriptionInfo) -} - -// BeginDelete - Delete an existing event subscription of a namespace topic. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - topicName - Name of the namespace topic. -// - eventSubscriptionName - Name of the event subscription to be created. Event subscription names must be between 3 and 100 -// characters in length and use alphanumeric letters only. -// - options - NamespaceTopicEventSubscriptionsClientBeginDeleteOptions contains the optional parameters for the NamespaceTopicEventSubscriptionsClient.BeginDelete -// method. -func (client *NamespaceTopicEventSubscriptionsClient) BeginDelete(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, eventSubscriptionName string, options *NamespaceTopicEventSubscriptionsClientBeginDeleteOptions) (*runtime.Poller[NamespaceTopicEventSubscriptionsClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, namespaceName, topicName, eventSubscriptionName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespaceTopicEventSubscriptionsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[NamespaceTopicEventSubscriptionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Delete - Delete an existing event subscription of a namespace topic. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *NamespaceTopicEventSubscriptionsClient) deleteOperation(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, eventSubscriptionName string, options *NamespaceTopicEventSubscriptionsClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, namespaceName, topicName, eventSubscriptionName, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *NamespaceTopicEventSubscriptionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, eventSubscriptionName string, options *NamespaceTopicEventSubscriptionsClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if topicName == "" { - return nil, errors.New("parameter topicName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{topicName}", url.PathEscape(topicName)) - if eventSubscriptionName == "" { - return nil, errors.New("parameter eventSubscriptionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{eventSubscriptionName}", url.PathEscape(eventSubscriptionName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get properties of an event subscription of a namespace topic. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - topicName - Name of the namespace topic. -// - eventSubscriptionName - Name of the event subscription to be created. Event subscription names must be between 3 and 100 -// characters in length and use alphanumeric letters only. -// - options - NamespaceTopicEventSubscriptionsClientGetOptions contains the optional parameters for the NamespaceTopicEventSubscriptionsClient.Get -// method. -func (client *NamespaceTopicEventSubscriptionsClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, eventSubscriptionName string, options *NamespaceTopicEventSubscriptionsClientGetOptions) (NamespaceTopicEventSubscriptionsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, namespaceName, topicName, eventSubscriptionName, options) - if err != nil { - return NamespaceTopicEventSubscriptionsClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return NamespaceTopicEventSubscriptionsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return NamespaceTopicEventSubscriptionsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *NamespaceTopicEventSubscriptionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, eventSubscriptionName string, options *NamespaceTopicEventSubscriptionsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if topicName == "" { - return nil, errors.New("parameter topicName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{topicName}", url.PathEscape(topicName)) - if eventSubscriptionName == "" { - return nil, errors.New("parameter eventSubscriptionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{eventSubscriptionName}", url.PathEscape(eventSubscriptionName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *NamespaceTopicEventSubscriptionsClient) getHandleResponse(resp *http.Response) (NamespaceTopicEventSubscriptionsClientGetResponse, error) { - result := NamespaceTopicEventSubscriptionsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Subscription); err != nil { - return NamespaceTopicEventSubscriptionsClientGetResponse{}, err - } - return result, nil -} - -// NewListByNamespaceTopicPager - List event subscriptions that belong to a specific namespace topic. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - topicName - Name of the namespace topic. -// - options - NamespaceTopicEventSubscriptionsClientListByNamespaceTopicOptions contains the optional parameters for the NamespaceTopicEventSubscriptionsClient.NewListByNamespaceTopicPager -// method. -func (client *NamespaceTopicEventSubscriptionsClient) NewListByNamespaceTopicPager(resourceGroupName string, namespaceName string, topicName string, options *NamespaceTopicEventSubscriptionsClientListByNamespaceTopicOptions) *runtime.Pager[NamespaceTopicEventSubscriptionsClientListByNamespaceTopicResponse] { - return runtime.NewPager(runtime.PagingHandler[NamespaceTopicEventSubscriptionsClientListByNamespaceTopicResponse]{ - More: func(page NamespaceTopicEventSubscriptionsClientListByNamespaceTopicResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *NamespaceTopicEventSubscriptionsClientListByNamespaceTopicResponse) (NamespaceTopicEventSubscriptionsClientListByNamespaceTopicResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByNamespaceTopicCreateRequest(ctx, resourceGroupName, namespaceName, topicName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return NamespaceTopicEventSubscriptionsClientListByNamespaceTopicResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return NamespaceTopicEventSubscriptionsClientListByNamespaceTopicResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return NamespaceTopicEventSubscriptionsClientListByNamespaceTopicResponse{}, runtime.NewResponseError(resp) - } - return client.listByNamespaceTopicHandleResponse(resp) - }, - }) -} - -// listByNamespaceTopicCreateRequest creates the ListByNamespaceTopic request. -func (client *NamespaceTopicEventSubscriptionsClient) listByNamespaceTopicCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, options *NamespaceTopicEventSubscriptionsClientListByNamespaceTopicOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if topicName == "" { - return nil, errors.New("parameter topicName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{topicName}", url.PathEscape(topicName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByNamespaceTopicHandleResponse handles the ListByNamespaceTopic response. -func (client *NamespaceTopicEventSubscriptionsClient) listByNamespaceTopicHandleResponse(resp *http.Response) (NamespaceTopicEventSubscriptionsClientListByNamespaceTopicResponse, error) { - result := NamespaceTopicEventSubscriptionsClientListByNamespaceTopicResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionsListResult); err != nil { - return NamespaceTopicEventSubscriptionsClientListByNamespaceTopicResponse{}, err - } - return result, nil -} - -// BeginUpdate - Update an existing event subscription of a namespace topic. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - topicName - Name of the namespace topic. -// - eventSubscriptionName - Name of the event subscription to be created. Event subscription names must be between 3 and 100 -// characters in length and use alphanumeric letters only. -// - eventSubscriptionUpdateParameters - Updated event subscription information. -// - options - NamespaceTopicEventSubscriptionsClientBeginUpdateOptions contains the optional parameters for the NamespaceTopicEventSubscriptionsClient.BeginUpdate -// method. -func (client *NamespaceTopicEventSubscriptionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters SubscriptionUpdateParameters, options *NamespaceTopicEventSubscriptionsClientBeginUpdateOptions) (*runtime.Poller[NamespaceTopicEventSubscriptionsClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, namespaceName, topicName, eventSubscriptionName, eventSubscriptionUpdateParameters, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespaceTopicEventSubscriptionsClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[NamespaceTopicEventSubscriptionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Update - Update an existing event subscription of a namespace topic. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *NamespaceTopicEventSubscriptionsClient) update(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters SubscriptionUpdateParameters, options *NamespaceTopicEventSubscriptionsClientBeginUpdateOptions) (*http.Response, error) { - req, err := client.updateCreateRequest(ctx, resourceGroupName, namespaceName, topicName, eventSubscriptionName, eventSubscriptionUpdateParameters, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// updateCreateRequest creates the Update request. -func (client *NamespaceTopicEventSubscriptionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters SubscriptionUpdateParameters, options *NamespaceTopicEventSubscriptionsClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if topicName == "" { - return nil, errors.New("parameter topicName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{topicName}", url.PathEscape(topicName)) - if eventSubscriptionName == "" { - return nil, errors.New("parameter eventSubscriptionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{eventSubscriptionName}", url.PathEscape(eventSubscriptionName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, eventSubscriptionUpdateParameters) -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/namespacetopiceventsubscriptions_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/namespacetopiceventsubscriptions_client_example_test.go deleted file mode 100644 index 2186c6e752c7..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/namespacetopiceventsubscriptions_client_example_test.go +++ /dev/null @@ -1,247 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armeventgrid_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/NamespaceTopicEventSubscriptions_Get.json -func ExampleNamespaceTopicEventSubscriptionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNamespaceTopicEventSubscriptionsClient().Get(ctx, "examplerg", "examplenamespace2", "examplenamespacetopic2", "examplenamespacetopicEventSub1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Subscription = armeventgrid.Subscription{ - // Name: to.Ptr("examplenamespacetopicEventSub2"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces/topics/eventsubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/examplenamespace2/topics/examplenamespacetopic2/eventSubscriptions/examplenamespacetopicEventSub2"), - // Properties: &armeventgrid.SubscriptionProperties{ - // DeliveryConfiguration: &armeventgrid.DeliveryConfiguration{ - // DeliveryMode: to.Ptr(armeventgrid.DeliveryModeQueue), - // Queue: &armeventgrid.QueueInfo{ - // EventTimeToLive: to.Ptr("P1D"), - // MaxDeliveryCount: to.Ptr[int32](4), - // ReceiveLockDurationInSeconds: to.Ptr[int32](60), - // }, - // }, - // EventDeliverySchema: to.Ptr(armeventgrid.DeliverySchemaCloudEventSchemaV10), - // ProvisioningState: to.Ptr(armeventgrid.SubscriptionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/NamespaceTopicEventSubscriptions_CreateOrUpdate.json -func ExampleNamespaceTopicEventSubscriptionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNamespaceTopicEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "examplerg", "examplenamespace2", "examplenamespacetopic2", "examplenamespacetopicEventSub2", armeventgrid.Subscription{ - Properties: &armeventgrid.SubscriptionProperties{ - DeliveryConfiguration: &armeventgrid.DeliveryConfiguration{ - DeliveryMode: to.Ptr(armeventgrid.DeliveryModeQueue), - Queue: &armeventgrid.QueueInfo{ - EventTimeToLive: to.Ptr("P1D"), - MaxDeliveryCount: to.Ptr[int32](4), - ReceiveLockDurationInSeconds: to.Ptr[int32](60), - }, - }, - EventDeliverySchema: to.Ptr(armeventgrid.DeliverySchemaCloudEventSchemaV10), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Subscription = armeventgrid.Subscription{ - // Name: to.Ptr("examplenamespacetopicEventSub2"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces/topics/eventsubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/examplenamespace2/topics/examplenamespacetopic2/eventSubscriptions/examplenamespacetopicEventSub2"), - // Properties: &armeventgrid.SubscriptionProperties{ - // DeliveryConfiguration: &armeventgrid.DeliveryConfiguration{ - // DeliveryMode: to.Ptr(armeventgrid.DeliveryModeQueue), - // Queue: &armeventgrid.QueueInfo{ - // EventTimeToLive: to.Ptr("P1D"), - // MaxDeliveryCount: to.Ptr[int32](4), - // ReceiveLockDurationInSeconds: to.Ptr[int32](60), - // }, - // }, - // EventDeliverySchema: to.Ptr(armeventgrid.DeliverySchemaCloudEventSchemaV10), - // ProvisioningState: to.Ptr(armeventgrid.SubscriptionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/NamespaceTopicEventSubscriptions_Delete.json -func ExampleNamespaceTopicEventSubscriptionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNamespaceTopicEventSubscriptionsClient().BeginDelete(ctx, "examplerg", "examplenamespace2", "examplenamespacetopic2", "examplenamespacetopicEventSub2", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/NamespaceTopicEventSubscriptions_Update.json -func ExampleNamespaceTopicEventSubscriptionsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNamespaceTopicEventSubscriptionsClient().BeginUpdate(ctx, "examplerg", "exampleNamespaceName1", "exampleNamespaceTopicName1", "exampleNamespaceTopicEventSubscriptionName1", armeventgrid.SubscriptionUpdateParameters{ - Properties: &armeventgrid.SubscriptionUpdateParametersProperties{ - DeliveryConfiguration: &armeventgrid.DeliveryConfiguration{ - DeliveryMode: to.Ptr(armeventgrid.DeliveryModeQueue), - Queue: &armeventgrid.QueueInfo{ - EventTimeToLive: to.Ptr("P1D"), - MaxDeliveryCount: to.Ptr[int32](3), - ReceiveLockDurationInSeconds: to.Ptr[int32](60), - }, - }, - EventDeliverySchema: to.Ptr(armeventgrid.DeliverySchemaCloudEventSchemaV10), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Subscription = armeventgrid.Subscription{ - // Name: to.Ptr("exampleNamespaceTopicEventSubscriptionName1"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces/topics/eventsubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/examplenamespace2/topics/exampleNamespaceTopicName1/eventSubscriptions/exampleNamespaceTopicEventSubscriptionName1"), - // Properties: &armeventgrid.SubscriptionProperties{ - // DeliveryConfiguration: &armeventgrid.DeliveryConfiguration{ - // DeliveryMode: to.Ptr(armeventgrid.DeliveryModeQueue), - // Queue: &armeventgrid.QueueInfo{ - // EventTimeToLive: to.Ptr("P1D"), - // MaxDeliveryCount: to.Ptr[int32](3), - // ReceiveLockDurationInSeconds: to.Ptr[int32](60), - // }, - // }, - // EventDeliverySchema: to.Ptr(armeventgrid.DeliverySchemaCloudEventSchemaV10), - // ProvisioningState: to.Ptr(armeventgrid.SubscriptionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/NamespaceTopicEventSubscriptions_ListByNamespaceTopic.json -func ExampleNamespaceTopicEventSubscriptionsClient_NewListByNamespaceTopicPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewNamespaceTopicEventSubscriptionsClient().NewListByNamespaceTopicPager("examplerg", "examplenamespace2", "examplenamespacetopic2", &armeventgrid.NamespaceTopicEventSubscriptionsClientListByNamespaceTopicOptions{Filter: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SubscriptionsListResult = armeventgrid.SubscriptionsListResult{ - // Value: []*armeventgrid.Subscription{ - // { - // Name: to.Ptr("examplenamespacetopicEventSub1"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces/topics/eventsubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/examplenamespace2/topics/examplenamespacetopic2/eventSubscriptions/examplenamespacetopicEventSub1"), - // Properties: &armeventgrid.SubscriptionProperties{ - // DeliveryConfiguration: &armeventgrid.DeliveryConfiguration{ - // DeliveryMode: to.Ptr(armeventgrid.DeliveryModeQueue), - // Queue: &armeventgrid.QueueInfo{ - // EventTimeToLive: to.Ptr("P1D"), - // MaxDeliveryCount: to.Ptr[int32](5), - // ReceiveLockDurationInSeconds: to.Ptr[int32](50), - // }, - // }, - // EventDeliverySchema: to.Ptr(armeventgrid.DeliverySchemaCloudEventSchemaV10), - // ProvisioningState: to.Ptr(armeventgrid.SubscriptionProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("examplenamespacetopicEventSub2"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces/topics/eventsubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/examplenamespace2/topics/examplenamespacetopic2/eventSubscriptions/examplenamespacetopicEventSub2"), - // Properties: &armeventgrid.SubscriptionProperties{ - // DeliveryConfiguration: &armeventgrid.DeliveryConfiguration{ - // DeliveryMode: to.Ptr(armeventgrid.DeliveryModeQueue), - // Queue: &armeventgrid.QueueInfo{ - // EventTimeToLive: to.Ptr("P1D"), - // MaxDeliveryCount: to.Ptr[int32](4), - // ReceiveLockDurationInSeconds: to.Ptr[int32](60), - // }, - // }, - // EventDeliverySchema: to.Ptr(armeventgrid.DeliverySchemaCloudEventSchemaV10), - // ProvisioningState: to.Ptr(armeventgrid.SubscriptionProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/namespacetopics_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/namespacetopics_client.go deleted file mode 100644 index 8c974ea819f7..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/namespacetopics_client.go +++ /dev/null @@ -1,539 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armeventgrid - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strconv" - "strings" -) - -// NamespaceTopicsClient contains the methods for the NamespaceTopics group. -// Don't use this type directly, use NewNamespaceTopicsClient() instead. -type NamespaceTopicsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewNamespaceTopicsClient creates a new instance of NamespaceTopicsClient with the specified values. -// - subscriptionID - Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewNamespaceTopicsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*NamespaceTopicsClient, error) { - cl, err := arm.NewClient(moduleName+".NamespaceTopicsClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &NamespaceTopicsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreateOrUpdate - Asynchronously creates a new namespace topic with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - topicName - Name of the namespace topic. -// - namespaceTopicInfo - Namespace topic information. -// - options - NamespaceTopicsClientBeginCreateOrUpdateOptions contains the optional parameters for the NamespaceTopicsClient.BeginCreateOrUpdate -// method. -func (client *NamespaceTopicsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, namespaceTopicInfo NamespaceTopic, options *NamespaceTopicsClientBeginCreateOrUpdateOptions) (*runtime.Poller[NamespaceTopicsClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, namespaceName, topicName, namespaceTopicInfo, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespaceTopicsClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[NamespaceTopicsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// CreateOrUpdate - Asynchronously creates a new namespace topic with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *NamespaceTopicsClient) createOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, namespaceTopicInfo NamespaceTopic, options *NamespaceTopicsClientBeginCreateOrUpdateOptions) (*http.Response, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, namespaceName, topicName, namespaceTopicInfo, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *NamespaceTopicsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, namespaceTopicInfo NamespaceTopic, options *NamespaceTopicsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if topicName == "" { - return nil, errors.New("parameter topicName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{topicName}", url.PathEscape(topicName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, namespaceTopicInfo) -} - -// BeginDelete - Delete existing namespace topic. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - topicName - Name of the topic. -// - options - NamespaceTopicsClientBeginDeleteOptions contains the optional parameters for the NamespaceTopicsClient.BeginDelete -// method. -func (client *NamespaceTopicsClient) BeginDelete(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, options *NamespaceTopicsClientBeginDeleteOptions) (*runtime.Poller[NamespaceTopicsClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, namespaceName, topicName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespaceTopicsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[NamespaceTopicsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Delete - Delete existing namespace topic. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *NamespaceTopicsClient) deleteOperation(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, options *NamespaceTopicsClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, namespaceName, topicName, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *NamespaceTopicsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, options *NamespaceTopicsClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if topicName == "" { - return nil, errors.New("parameter topicName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{topicName}", url.PathEscape(topicName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get properties of a namespace topic. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - topicName - Name of the namespace topic. -// - options - NamespaceTopicsClientGetOptions contains the optional parameters for the NamespaceTopicsClient.Get method. -func (client *NamespaceTopicsClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, options *NamespaceTopicsClientGetOptions) (NamespaceTopicsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, namespaceName, topicName, options) - if err != nil { - return NamespaceTopicsClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return NamespaceTopicsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return NamespaceTopicsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *NamespaceTopicsClient) getCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, options *NamespaceTopicsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if topicName == "" { - return nil, errors.New("parameter topicName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{topicName}", url.PathEscape(topicName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *NamespaceTopicsClient) getHandleResponse(resp *http.Response) (NamespaceTopicsClientGetResponse, error) { - result := NamespaceTopicsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.NamespaceTopic); err != nil { - return NamespaceTopicsClientGetResponse{}, err - } - return result, nil -} - -// NewListByNamespacePager - List all the namespace topics under a namespace. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - options - NamespaceTopicsClientListByNamespaceOptions contains the optional parameters for the NamespaceTopicsClient.NewListByNamespacePager -// method. -func (client *NamespaceTopicsClient) NewListByNamespacePager(resourceGroupName string, namespaceName string, options *NamespaceTopicsClientListByNamespaceOptions) *runtime.Pager[NamespaceTopicsClientListByNamespaceResponse] { - return runtime.NewPager(runtime.PagingHandler[NamespaceTopicsClientListByNamespaceResponse]{ - More: func(page NamespaceTopicsClientListByNamespaceResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *NamespaceTopicsClientListByNamespaceResponse) (NamespaceTopicsClientListByNamespaceResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByNamespaceCreateRequest(ctx, resourceGroupName, namespaceName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return NamespaceTopicsClientListByNamespaceResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return NamespaceTopicsClientListByNamespaceResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return NamespaceTopicsClientListByNamespaceResponse{}, runtime.NewResponseError(resp) - } - return client.listByNamespaceHandleResponse(resp) - }, - }) -} - -// listByNamespaceCreateRequest creates the ListByNamespace request. -func (client *NamespaceTopicsClient) listByNamespaceCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, options *NamespaceTopicsClientListByNamespaceOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByNamespaceHandleResponse handles the ListByNamespace response. -func (client *NamespaceTopicsClient) listByNamespaceHandleResponse(resp *http.Response) (NamespaceTopicsClientListByNamespaceResponse, error) { - result := NamespaceTopicsClientListByNamespaceResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.NamespaceTopicsListResult); err != nil { - return NamespaceTopicsClientListByNamespaceResponse{}, err - } - return result, nil -} - -// ListSharedAccessKeys - List the two keys used to publish to a namespace topic. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - topicName - Name of the topic. -// - options - NamespaceTopicsClientListSharedAccessKeysOptions contains the optional parameters for the NamespaceTopicsClient.ListSharedAccessKeys -// method. -func (client *NamespaceTopicsClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, options *NamespaceTopicsClientListSharedAccessKeysOptions) (NamespaceTopicsClientListSharedAccessKeysResponse, error) { - req, err := client.listSharedAccessKeysCreateRequest(ctx, resourceGroupName, namespaceName, topicName, options) - if err != nil { - return NamespaceTopicsClientListSharedAccessKeysResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return NamespaceTopicsClientListSharedAccessKeysResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return NamespaceTopicsClientListSharedAccessKeysResponse{}, runtime.NewResponseError(resp) - } - return client.listSharedAccessKeysHandleResponse(resp) -} - -// listSharedAccessKeysCreateRequest creates the ListSharedAccessKeys request. -func (client *NamespaceTopicsClient) listSharedAccessKeysCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, options *NamespaceTopicsClientListSharedAccessKeysOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/listKeys" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if topicName == "" { - return nil, errors.New("parameter topicName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{topicName}", url.PathEscape(topicName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listSharedAccessKeysHandleResponse handles the ListSharedAccessKeys response. -func (client *NamespaceTopicsClient) listSharedAccessKeysHandleResponse(resp *http.Response) (NamespaceTopicsClientListSharedAccessKeysResponse, error) { - result := NamespaceTopicsClientListSharedAccessKeysResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.TopicSharedAccessKeys); err != nil { - return NamespaceTopicsClientListSharedAccessKeysResponse{}, err - } - return result, nil -} - -// BeginRegenerateKey - Regenerate a shared access key for a namespace topic. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - topicName - Name of the topic. -// - regenerateKeyRequest - Request body to regenerate key. -// - options - NamespaceTopicsClientBeginRegenerateKeyOptions contains the optional parameters for the NamespaceTopicsClient.BeginRegenerateKey -// method. -func (client *NamespaceTopicsClient) BeginRegenerateKey(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest, options *NamespaceTopicsClientBeginRegenerateKeyOptions) (*runtime.Poller[NamespaceTopicsClientRegenerateKeyResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.regenerateKey(ctx, resourceGroupName, namespaceName, topicName, regenerateKeyRequest, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespaceTopicsClientRegenerateKeyResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[NamespaceTopicsClientRegenerateKeyResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// RegenerateKey - Regenerate a shared access key for a namespace topic. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *NamespaceTopicsClient) regenerateKey(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest, options *NamespaceTopicsClientBeginRegenerateKeyOptions) (*http.Response, error) { - req, err := client.regenerateKeyCreateRequest(ctx, resourceGroupName, namespaceName, topicName, regenerateKeyRequest, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// regenerateKeyCreateRequest creates the RegenerateKey request. -func (client *NamespaceTopicsClient) regenerateKeyCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest, options *NamespaceTopicsClientBeginRegenerateKeyOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/regenerateKey" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if topicName == "" { - return nil, errors.New("parameter topicName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{topicName}", url.PathEscape(topicName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, regenerateKeyRequest) -} - -// BeginUpdate - Asynchronously updates a namespace topic with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - topicName - Name of the namespace topic. -// - namespaceTopicUpdateParameters - Namespace topic update information. -// - options - NamespaceTopicsClientBeginUpdateOptions contains the optional parameters for the NamespaceTopicsClient.BeginUpdate -// method. -func (client *NamespaceTopicsClient) BeginUpdate(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, namespaceTopicUpdateParameters NamespaceTopicUpdateParameters, options *NamespaceTopicsClientBeginUpdateOptions) (*runtime.Poller[NamespaceTopicsClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, namespaceName, topicName, namespaceTopicUpdateParameters, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespaceTopicsClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[NamespaceTopicsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Update - Asynchronously updates a namespace topic with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *NamespaceTopicsClient) update(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, namespaceTopicUpdateParameters NamespaceTopicUpdateParameters, options *NamespaceTopicsClientBeginUpdateOptions) (*http.Response, error) { - req, err := client.updateCreateRequest(ctx, resourceGroupName, namespaceName, topicName, namespaceTopicUpdateParameters, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// updateCreateRequest creates the Update request. -func (client *NamespaceTopicsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, namespaceTopicUpdateParameters NamespaceTopicUpdateParameters, options *NamespaceTopicsClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if topicName == "" { - return nil, errors.New("parameter topicName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{topicName}", url.PathEscape(topicName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, namespaceTopicUpdateParameters) -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/namespacetopics_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/namespacetopics_client_example_test.go deleted file mode 100644 index 67748063f438..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/namespacetopics_client_example_test.go +++ /dev/null @@ -1,257 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armeventgrid_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/NamespaceTopics_Get.json -func ExampleNamespaceTopicsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNamespaceTopicsClient().Get(ctx, "examplerg", "examplenamespace2", "examplenamespacetopic2", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NamespaceTopic = armeventgrid.NamespaceTopic{ - // Name: to.Ptr("examplenamespacetopic2"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces/topics"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e41/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/examplenamespace2/topics/examplenamespacetopic2"), - // Properties: &armeventgrid.NamespaceTopicProperties{ - // EventRetentionInDays: to.Ptr[int32](1), - // InputSchema: to.Ptr(armeventgrid.EventInputSchemaCloudEventSchemaV10), - // ProvisioningState: to.Ptr(armeventgrid.NamespaceTopicProvisioningStateSucceeded), - // PublisherType: to.Ptr(armeventgrid.PublisherTypeCustom), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/NamespaceTopics_CreateOrUpdate.json -func ExampleNamespaceTopicsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNamespaceTopicsClient().BeginCreateOrUpdate(ctx, "examplerg", "examplenamespace2", "examplenamespacetopic2", armeventgrid.NamespaceTopic{ - Properties: &armeventgrid.NamespaceTopicProperties{ - EventRetentionInDays: to.Ptr[int32](1), - InputSchema: to.Ptr(armeventgrid.EventInputSchemaCloudEventSchemaV10), - PublisherType: to.Ptr(armeventgrid.PublisherTypeCustom), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NamespaceTopic = armeventgrid.NamespaceTopic{ - // Name: to.Ptr("examplenamespacetopic2"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces/topics"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/examplenamespace2/topics/examplenamespacetopic2"), - // Properties: &armeventgrid.NamespaceTopicProperties{ - // EventRetentionInDays: to.Ptr[int32](1), - // InputSchema: to.Ptr(armeventgrid.EventInputSchemaCloudEventSchemaV10), - // ProvisioningState: to.Ptr(armeventgrid.NamespaceTopicProvisioningStateSucceeded), - // PublisherType: to.Ptr(armeventgrid.PublisherTypeCustom), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/NamespaceTopics_Delete.json -func ExampleNamespaceTopicsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNamespaceTopicsClient().BeginDelete(ctx, "examplerg", "examplenamespace2", "examplenamespacetopic2", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/NamespaceTopics_Update.json -func ExampleNamespaceTopicsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNamespaceTopicsClient().BeginUpdate(ctx, "examplerg", "exampleNamespaceName1", "exampleNamespaceTopicName1", armeventgrid.NamespaceTopicUpdateParameters{ - Properties: &armeventgrid.NamespaceTopicUpdateParameterProperties{ - EventRetentionInDays: to.Ptr[int32](1), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NamespaceTopic = armeventgrid.NamespaceTopic{ - // Name: to.Ptr("examplenamespacetopic2"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces/topics"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/exampleNamespaceName1/topics/exampleNamespaceTopicName1"), - // Properties: &armeventgrid.NamespaceTopicProperties{ - // EventRetentionInDays: to.Ptr[int32](1), - // InputSchema: to.Ptr(armeventgrid.EventInputSchemaCloudEventSchemaV10), - // ProvisioningState: to.Ptr(armeventgrid.NamespaceTopicProvisioningStateSucceeded), - // PublisherType: to.Ptr(armeventgrid.PublisherTypeCustom), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/NamespaceTopics_ListByNamespace.json -func ExampleNamespaceTopicsClient_NewListByNamespacePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewNamespaceTopicsClient().NewListByNamespacePager("examplerg", "examplenamespace2", &armeventgrid.NamespaceTopicsClientListByNamespaceOptions{Filter: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.NamespaceTopicsListResult = armeventgrid.NamespaceTopicsListResult{ - // Value: []*armeventgrid.NamespaceTopic{ - // { - // Name: to.Ptr("examplenamespacetopic2"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces/topics"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/examplenamespace2/topics/examplenamespacetopic2"), - // Properties: &armeventgrid.NamespaceTopicProperties{ - // EventRetentionInDays: to.Ptr[int32](1), - // InputSchema: to.Ptr(armeventgrid.EventInputSchemaCloudEventSchemaV10), - // ProvisioningState: to.Ptr(armeventgrid.NamespaceTopicProvisioningStateSucceeded), - // PublisherType: to.Ptr(armeventgrid.PublisherTypeCustom), - // }, - // }, - // { - // Name: to.Ptr("examplenamespacetopic4"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces/topics"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/examplenamespace2/topics/examplenamespacetopic4"), - // Properties: &armeventgrid.NamespaceTopicProperties{ - // EventRetentionInDays: to.Ptr[int32](1), - // InputSchema: to.Ptr(armeventgrid.EventInputSchemaCloudEventSchemaV10), - // ProvisioningState: to.Ptr(armeventgrid.NamespaceTopicProvisioningStateSucceeded), - // PublisherType: to.Ptr(armeventgrid.PublisherTypeCustom), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/NamespaceTopics_ListSharedAccessKeys.json -func ExampleNamespaceTopicsClient_ListSharedAccessKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNamespaceTopicsClient().ListSharedAccessKeys(ctx, "examplerg", "examplenamespace2", "examplenamespacetopic2", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TopicSharedAccessKeys = armeventgrid.TopicSharedAccessKeys{ - // Key1: to.Ptr("testKey1Value"), - // Key2: to.Ptr("testKey2Value"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/NamespaceTopics_RegenerateKey.json -func ExampleNamespaceTopicsClient_BeginRegenerateKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNamespaceTopicsClient().BeginRegenerateKey(ctx, "examplerg", "examplenamespace2", "examplenamespacetopic2", armeventgrid.TopicRegenerateKeyRequest{ - KeyName: to.Ptr("key1"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TopicSharedAccessKeys = armeventgrid.TopicSharedAccessKeys{ - // Key1: to.Ptr("testKey1Value"), - // Key2: to.Ptr("testKey2Value"), - // } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/operations_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/operations_client.go index 6fa8f0b4b3d3..c20b1cee18f4 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/operations_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/operations_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid @@ -28,7 +27,7 @@ type OperationsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { - cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -40,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - List the available operations supported by the Microsoft.EventGrid resource provider. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -48,6 +47,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption return false }, Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") req, err := client.listCreateRequest(ctx, options) if err != nil { return OperationsClientListResponse{}, err @@ -61,6 +61,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption } return client.listHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -72,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/operations_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/operations_client_example_test.go index de6f55d8f0b3..0eadeca9ba7e 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/operations_client_example_test.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/operations_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Operations_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Operations_List.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/options.go b/sdk/resourcemanager/eventgrid/armeventgrid/options.go new file mode 100644 index 000000000000..0206b0538fd1 --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/options.go @@ -0,0 +1,1102 @@ +//go:build go1.18 +// +build go1.18 + +// 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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armeventgrid + +// ChannelsClientBeginDeleteOptions contains the optional parameters for the ChannelsClient.BeginDelete method. +type ChannelsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ChannelsClientCreateOrUpdateOptions contains the optional parameters for the ChannelsClient.CreateOrUpdate method. +type ChannelsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ChannelsClientGetFullURLOptions contains the optional parameters for the ChannelsClient.GetFullURL method. +type ChannelsClientGetFullURLOptions struct { + // placeholder for future optional parameters +} + +// ChannelsClientGetOptions contains the optional parameters for the ChannelsClient.Get method. +type ChannelsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ChannelsClientListByPartnerNamespaceOptions contains the optional parameters for the ChannelsClient.NewListByPartnerNamespacePager +// method. +type ChannelsClientListByPartnerNamespaceOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// ChannelsClientUpdateOptions contains the optional parameters for the ChannelsClient.Update method. +type ChannelsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// DomainEventSubscriptionsClientBeginCreateOrUpdateOptions contains the optional parameters for the DomainEventSubscriptionsClient.BeginCreateOrUpdate +// method. +type DomainEventSubscriptionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DomainEventSubscriptionsClientBeginDeleteOptions contains the optional parameters for the DomainEventSubscriptionsClient.BeginDelete +// method. +type DomainEventSubscriptionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DomainEventSubscriptionsClientBeginUpdateOptions contains the optional parameters for the DomainEventSubscriptionsClient.BeginUpdate +// method. +type DomainEventSubscriptionsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DomainEventSubscriptionsClientGetDeliveryAttributesOptions contains the optional parameters for the DomainEventSubscriptionsClient.GetDeliveryAttributes +// method. +type DomainEventSubscriptionsClientGetDeliveryAttributesOptions struct { + // placeholder for future optional parameters +} + +// DomainEventSubscriptionsClientGetFullURLOptions contains the optional parameters for the DomainEventSubscriptionsClient.GetFullURL +// method. +type DomainEventSubscriptionsClientGetFullURLOptions struct { + // placeholder for future optional parameters +} + +// DomainEventSubscriptionsClientGetOptions contains the optional parameters for the DomainEventSubscriptionsClient.Get method. +type DomainEventSubscriptionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DomainEventSubscriptionsClientListOptions contains the optional parameters for the DomainEventSubscriptionsClient.NewListPager +// method. +type DomainEventSubscriptionsClientListOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// DomainTopicEventSubscriptionsClientBeginCreateOrUpdateOptions contains the optional parameters for the DomainTopicEventSubscriptionsClient.BeginCreateOrUpdate +// method. +type DomainTopicEventSubscriptionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DomainTopicEventSubscriptionsClientBeginDeleteOptions contains the optional parameters for the DomainTopicEventSubscriptionsClient.BeginDelete +// method. +type DomainTopicEventSubscriptionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DomainTopicEventSubscriptionsClientBeginUpdateOptions contains the optional parameters for the DomainTopicEventSubscriptionsClient.BeginUpdate +// method. +type DomainTopicEventSubscriptionsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DomainTopicEventSubscriptionsClientGetDeliveryAttributesOptions contains the optional parameters for the DomainTopicEventSubscriptionsClient.GetDeliveryAttributes +// method. +type DomainTopicEventSubscriptionsClientGetDeliveryAttributesOptions struct { + // placeholder for future optional parameters +} + +// DomainTopicEventSubscriptionsClientGetFullURLOptions contains the optional parameters for the DomainTopicEventSubscriptionsClient.GetFullURL +// method. +type DomainTopicEventSubscriptionsClientGetFullURLOptions struct { + // placeholder for future optional parameters +} + +// DomainTopicEventSubscriptionsClientGetOptions contains the optional parameters for the DomainTopicEventSubscriptionsClient.Get +// method. +type DomainTopicEventSubscriptionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DomainTopicEventSubscriptionsClientListOptions contains the optional parameters for the DomainTopicEventSubscriptionsClient.NewListPager +// method. +type DomainTopicEventSubscriptionsClientListOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// DomainTopicsClientBeginCreateOrUpdateOptions contains the optional parameters for the DomainTopicsClient.BeginCreateOrUpdate +// method. +type DomainTopicsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DomainTopicsClientBeginDeleteOptions contains the optional parameters for the DomainTopicsClient.BeginDelete method. +type DomainTopicsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DomainTopicsClientGetOptions contains the optional parameters for the DomainTopicsClient.Get method. +type DomainTopicsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DomainTopicsClientListByDomainOptions contains the optional parameters for the DomainTopicsClient.NewListByDomainPager +// method. +type DomainTopicsClientListByDomainOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// DomainsClientBeginCreateOrUpdateOptions contains the optional parameters for the DomainsClient.BeginCreateOrUpdate method. +type DomainsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DomainsClientBeginDeleteOptions contains the optional parameters for the DomainsClient.BeginDelete method. +type DomainsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DomainsClientBeginUpdateOptions contains the optional parameters for the DomainsClient.BeginUpdate method. +type DomainsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DomainsClientGetOptions contains the optional parameters for the DomainsClient.Get method. +type DomainsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DomainsClientListByResourceGroupOptions contains the optional parameters for the DomainsClient.NewListByResourceGroupPager +// method. +type DomainsClientListByResourceGroupOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// DomainsClientListBySubscriptionOptions contains the optional parameters for the DomainsClient.NewListBySubscriptionPager +// method. +type DomainsClientListBySubscriptionOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// DomainsClientListSharedAccessKeysOptions contains the optional parameters for the DomainsClient.ListSharedAccessKeys method. +type DomainsClientListSharedAccessKeysOptions struct { + // placeholder for future optional parameters +} + +// DomainsClientRegenerateKeyOptions contains the optional parameters for the DomainsClient.RegenerateKey method. +type DomainsClientRegenerateKeyOptions struct { + // placeholder for future optional parameters +} + +// EventSubscriptionsClientBeginCreateOrUpdateOptions contains the optional parameters for the EventSubscriptionsClient.BeginCreateOrUpdate +// method. +type EventSubscriptionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// EventSubscriptionsClientBeginDeleteOptions contains the optional parameters for the EventSubscriptionsClient.BeginDelete +// method. +type EventSubscriptionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// EventSubscriptionsClientBeginUpdateOptions contains the optional parameters for the EventSubscriptionsClient.BeginUpdate +// method. +type EventSubscriptionsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// EventSubscriptionsClientGetDeliveryAttributesOptions contains the optional parameters for the EventSubscriptionsClient.GetDeliveryAttributes +// method. +type EventSubscriptionsClientGetDeliveryAttributesOptions struct { + // placeholder for future optional parameters +} + +// EventSubscriptionsClientGetFullURLOptions contains the optional parameters for the EventSubscriptionsClient.GetFullURL +// method. +type EventSubscriptionsClientGetFullURLOptions struct { + // placeholder for future optional parameters +} + +// EventSubscriptionsClientGetOptions contains the optional parameters for the EventSubscriptionsClient.Get method. +type EventSubscriptionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// EventSubscriptionsClientListByDomainTopicOptions contains the optional parameters for the EventSubscriptionsClient.NewListByDomainTopicPager +// method. +type EventSubscriptionsClientListByDomainTopicOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// EventSubscriptionsClientListByResourceOptions contains the optional parameters for the EventSubscriptionsClient.NewListByResourcePager +// method. +type EventSubscriptionsClientListByResourceOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// EventSubscriptionsClientListGlobalByResourceGroupForTopicTypeOptions contains the optional parameters for the EventSubscriptionsClient.NewListGlobalByResourceGroupForTopicTypePager +// method. +type EventSubscriptionsClientListGlobalByResourceGroupForTopicTypeOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// EventSubscriptionsClientListGlobalByResourceGroupOptions contains the optional parameters for the EventSubscriptionsClient.NewListGlobalByResourceGroupPager +// method. +type EventSubscriptionsClientListGlobalByResourceGroupOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// EventSubscriptionsClientListGlobalBySubscriptionForTopicTypeOptions contains the optional parameters for the EventSubscriptionsClient.NewListGlobalBySubscriptionForTopicTypePager +// method. +type EventSubscriptionsClientListGlobalBySubscriptionForTopicTypeOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// EventSubscriptionsClientListGlobalBySubscriptionOptions contains the optional parameters for the EventSubscriptionsClient.NewListGlobalBySubscriptionPager +// method. +type EventSubscriptionsClientListGlobalBySubscriptionOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// EventSubscriptionsClientListRegionalByResourceGroupForTopicTypeOptions contains the optional parameters for the EventSubscriptionsClient.NewListRegionalByResourceGroupForTopicTypePager +// method. +type EventSubscriptionsClientListRegionalByResourceGroupForTopicTypeOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// EventSubscriptionsClientListRegionalByResourceGroupOptions contains the optional parameters for the EventSubscriptionsClient.NewListRegionalByResourceGroupPager +// method. +type EventSubscriptionsClientListRegionalByResourceGroupOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// EventSubscriptionsClientListRegionalBySubscriptionForTopicTypeOptions contains the optional parameters for the EventSubscriptionsClient.NewListRegionalBySubscriptionForTopicTypePager +// method. +type EventSubscriptionsClientListRegionalBySubscriptionForTopicTypeOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// EventSubscriptionsClientListRegionalBySubscriptionOptions contains the optional parameters for the EventSubscriptionsClient.NewListRegionalBySubscriptionPager +// method. +type EventSubscriptionsClientListRegionalBySubscriptionOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// ExtensionTopicsClientGetOptions contains the optional parameters for the ExtensionTopicsClient.Get method. +type ExtensionTopicsClientGetOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PartnerConfigurationsClientAuthorizePartnerOptions contains the optional parameters for the PartnerConfigurationsClient.AuthorizePartner +// method. +type PartnerConfigurationsClientAuthorizePartnerOptions struct { + // placeholder for future optional parameters +} + +// PartnerConfigurationsClientBeginCreateOrUpdateOptions contains the optional parameters for the PartnerConfigurationsClient.BeginCreateOrUpdate +// method. +type PartnerConfigurationsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PartnerConfigurationsClientBeginDeleteOptions contains the optional parameters for the PartnerConfigurationsClient.BeginDelete +// method. +type PartnerConfigurationsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PartnerConfigurationsClientBeginUpdateOptions contains the optional parameters for the PartnerConfigurationsClient.BeginUpdate +// method. +type PartnerConfigurationsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PartnerConfigurationsClientGetOptions contains the optional parameters for the PartnerConfigurationsClient.Get method. +type PartnerConfigurationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PartnerConfigurationsClientListByResourceGroupOptions contains the optional parameters for the PartnerConfigurationsClient.NewListByResourceGroupPager +// method. +type PartnerConfigurationsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// PartnerConfigurationsClientListBySubscriptionOptions contains the optional parameters for the PartnerConfigurationsClient.NewListBySubscriptionPager +// method. +type PartnerConfigurationsClientListBySubscriptionOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// PartnerConfigurationsClientUnauthorizePartnerOptions contains the optional parameters for the PartnerConfigurationsClient.UnauthorizePartner +// method. +type PartnerConfigurationsClientUnauthorizePartnerOptions struct { + // placeholder for future optional parameters +} + +// PartnerNamespacesClientBeginCreateOrUpdateOptions contains the optional parameters for the PartnerNamespacesClient.BeginCreateOrUpdate +// method. +type PartnerNamespacesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PartnerNamespacesClientBeginDeleteOptions contains the optional parameters for the PartnerNamespacesClient.BeginDelete +// method. +type PartnerNamespacesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PartnerNamespacesClientBeginUpdateOptions contains the optional parameters for the PartnerNamespacesClient.BeginUpdate +// method. +type PartnerNamespacesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PartnerNamespacesClientGetOptions contains the optional parameters for the PartnerNamespacesClient.Get method. +type PartnerNamespacesClientGetOptions struct { + // placeholder for future optional parameters +} + +// PartnerNamespacesClientListByResourceGroupOptions contains the optional parameters for the PartnerNamespacesClient.NewListByResourceGroupPager +// method. +type PartnerNamespacesClientListByResourceGroupOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// PartnerNamespacesClientListBySubscriptionOptions contains the optional parameters for the PartnerNamespacesClient.NewListBySubscriptionPager +// method. +type PartnerNamespacesClientListBySubscriptionOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// PartnerNamespacesClientListSharedAccessKeysOptions contains the optional parameters for the PartnerNamespacesClient.ListSharedAccessKeys +// method. +type PartnerNamespacesClientListSharedAccessKeysOptions struct { + // placeholder for future optional parameters +} + +// PartnerNamespacesClientRegenerateKeyOptions contains the optional parameters for the PartnerNamespacesClient.RegenerateKey +// method. +type PartnerNamespacesClientRegenerateKeyOptions struct { + // placeholder for future optional parameters +} + +// PartnerRegistrationsClientBeginCreateOrUpdateOptions contains the optional parameters for the PartnerRegistrationsClient.BeginCreateOrUpdate +// method. +type PartnerRegistrationsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PartnerRegistrationsClientBeginDeleteOptions contains the optional parameters for the PartnerRegistrationsClient.BeginDelete +// method. +type PartnerRegistrationsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PartnerRegistrationsClientBeginUpdateOptions contains the optional parameters for the PartnerRegistrationsClient.BeginUpdate +// method. +type PartnerRegistrationsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PartnerRegistrationsClientGetOptions contains the optional parameters for the PartnerRegistrationsClient.Get method. +type PartnerRegistrationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PartnerRegistrationsClientListByResourceGroupOptions contains the optional parameters for the PartnerRegistrationsClient.NewListByResourceGroupPager +// method. +type PartnerRegistrationsClientListByResourceGroupOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// PartnerRegistrationsClientListBySubscriptionOptions contains the optional parameters for the PartnerRegistrationsClient.NewListBySubscriptionPager +// method. +type PartnerRegistrationsClientListBySubscriptionOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// PartnerTopicEventSubscriptionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PartnerTopicEventSubscriptionsClient.BeginCreateOrUpdate +// method. +type PartnerTopicEventSubscriptionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PartnerTopicEventSubscriptionsClientBeginDeleteOptions contains the optional parameters for the PartnerTopicEventSubscriptionsClient.BeginDelete +// method. +type PartnerTopicEventSubscriptionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PartnerTopicEventSubscriptionsClientBeginUpdateOptions contains the optional parameters for the PartnerTopicEventSubscriptionsClient.BeginUpdate +// method. +type PartnerTopicEventSubscriptionsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PartnerTopicEventSubscriptionsClientGetDeliveryAttributesOptions contains the optional parameters for the PartnerTopicEventSubscriptionsClient.GetDeliveryAttributes +// method. +type PartnerTopicEventSubscriptionsClientGetDeliveryAttributesOptions struct { + // placeholder for future optional parameters +} + +// PartnerTopicEventSubscriptionsClientGetFullURLOptions contains the optional parameters for the PartnerTopicEventSubscriptionsClient.GetFullURL +// method. +type PartnerTopicEventSubscriptionsClientGetFullURLOptions struct { + // placeholder for future optional parameters +} + +// PartnerTopicEventSubscriptionsClientGetOptions contains the optional parameters for the PartnerTopicEventSubscriptionsClient.Get +// method. +type PartnerTopicEventSubscriptionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PartnerTopicEventSubscriptionsClientListByPartnerTopicOptions contains the optional parameters for the PartnerTopicEventSubscriptionsClient.NewListByPartnerTopicPager +// method. +type PartnerTopicEventSubscriptionsClientListByPartnerTopicOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// PartnerTopicsClientActivateOptions contains the optional parameters for the PartnerTopicsClient.Activate method. +type PartnerTopicsClientActivateOptions struct { + // placeholder for future optional parameters +} + +// PartnerTopicsClientBeginDeleteOptions contains the optional parameters for the PartnerTopicsClient.BeginDelete method. +type PartnerTopicsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PartnerTopicsClientCreateOrUpdateOptions contains the optional parameters for the PartnerTopicsClient.CreateOrUpdate method. +type PartnerTopicsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// PartnerTopicsClientDeactivateOptions contains the optional parameters for the PartnerTopicsClient.Deactivate method. +type PartnerTopicsClientDeactivateOptions struct { + // placeholder for future optional parameters +} + +// PartnerTopicsClientGetOptions contains the optional parameters for the PartnerTopicsClient.Get method. +type PartnerTopicsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PartnerTopicsClientListByResourceGroupOptions contains the optional parameters for the PartnerTopicsClient.NewListByResourceGroupPager +// method. +type PartnerTopicsClientListByResourceGroupOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// PartnerTopicsClientListBySubscriptionOptions contains the optional parameters for the PartnerTopicsClient.NewListBySubscriptionPager +// method. +type PartnerTopicsClientListBySubscriptionOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// PartnerTopicsClientUpdateOptions contains the optional parameters for the PartnerTopicsClient.Update method. +type PartnerTopicsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +type PrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientBeginUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginUpdate +// method. +type PrivateEndpointConnectionsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +type PrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByResourcePager +// method. +type PrivateEndpointConnectionsClientListByResourceOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get method. +type PrivateLinkResourcesClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientListByResourceOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByResourcePager +// method. +type PrivateLinkResourcesClientListByResourceOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// SystemTopicEventSubscriptionsClientBeginCreateOrUpdateOptions contains the optional parameters for the SystemTopicEventSubscriptionsClient.BeginCreateOrUpdate +// method. +type SystemTopicEventSubscriptionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SystemTopicEventSubscriptionsClientBeginDeleteOptions contains the optional parameters for the SystemTopicEventSubscriptionsClient.BeginDelete +// method. +type SystemTopicEventSubscriptionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SystemTopicEventSubscriptionsClientBeginUpdateOptions contains the optional parameters for the SystemTopicEventSubscriptionsClient.BeginUpdate +// method. +type SystemTopicEventSubscriptionsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SystemTopicEventSubscriptionsClientGetDeliveryAttributesOptions contains the optional parameters for the SystemTopicEventSubscriptionsClient.GetDeliveryAttributes +// method. +type SystemTopicEventSubscriptionsClientGetDeliveryAttributesOptions struct { + // placeholder for future optional parameters +} + +// SystemTopicEventSubscriptionsClientGetFullURLOptions contains the optional parameters for the SystemTopicEventSubscriptionsClient.GetFullURL +// method. +type SystemTopicEventSubscriptionsClientGetFullURLOptions struct { + // placeholder for future optional parameters +} + +// SystemTopicEventSubscriptionsClientGetOptions contains the optional parameters for the SystemTopicEventSubscriptionsClient.Get +// method. +type SystemTopicEventSubscriptionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// SystemTopicEventSubscriptionsClientListBySystemTopicOptions contains the optional parameters for the SystemTopicEventSubscriptionsClient.NewListBySystemTopicPager +// method. +type SystemTopicEventSubscriptionsClientListBySystemTopicOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// SystemTopicsClientBeginCreateOrUpdateOptions contains the optional parameters for the SystemTopicsClient.BeginCreateOrUpdate +// method. +type SystemTopicsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SystemTopicsClientBeginDeleteOptions contains the optional parameters for the SystemTopicsClient.BeginDelete method. +type SystemTopicsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SystemTopicsClientBeginUpdateOptions contains the optional parameters for the SystemTopicsClient.BeginUpdate method. +type SystemTopicsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SystemTopicsClientGetOptions contains the optional parameters for the SystemTopicsClient.Get method. +type SystemTopicsClientGetOptions struct { + // placeholder for future optional parameters +} + +// SystemTopicsClientListByResourceGroupOptions contains the optional parameters for the SystemTopicsClient.NewListByResourceGroupPager +// method. +type SystemTopicsClientListByResourceGroupOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// SystemTopicsClientListBySubscriptionOptions contains the optional parameters for the SystemTopicsClient.NewListBySubscriptionPager +// method. +type SystemTopicsClientListBySubscriptionOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// TopicEventSubscriptionsClientBeginCreateOrUpdateOptions contains the optional parameters for the TopicEventSubscriptionsClient.BeginCreateOrUpdate +// method. +type TopicEventSubscriptionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TopicEventSubscriptionsClientBeginDeleteOptions contains the optional parameters for the TopicEventSubscriptionsClient.BeginDelete +// method. +type TopicEventSubscriptionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TopicEventSubscriptionsClientBeginUpdateOptions contains the optional parameters for the TopicEventSubscriptionsClient.BeginUpdate +// method. +type TopicEventSubscriptionsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TopicEventSubscriptionsClientGetDeliveryAttributesOptions contains the optional parameters for the TopicEventSubscriptionsClient.GetDeliveryAttributes +// method. +type TopicEventSubscriptionsClientGetDeliveryAttributesOptions struct { + // placeholder for future optional parameters +} + +// TopicEventSubscriptionsClientGetFullURLOptions contains the optional parameters for the TopicEventSubscriptionsClient.GetFullURL +// method. +type TopicEventSubscriptionsClientGetFullURLOptions struct { + // placeholder for future optional parameters +} + +// TopicEventSubscriptionsClientGetOptions contains the optional parameters for the TopicEventSubscriptionsClient.Get method. +type TopicEventSubscriptionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// TopicEventSubscriptionsClientListOptions contains the optional parameters for the TopicEventSubscriptionsClient.NewListPager +// method. +type TopicEventSubscriptionsClientListOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// TopicTypesClientGetOptions contains the optional parameters for the TopicTypesClient.Get method. +type TopicTypesClientGetOptions struct { + // placeholder for future optional parameters +} + +// TopicTypesClientListEventTypesOptions contains the optional parameters for the TopicTypesClient.NewListEventTypesPager +// method. +type TopicTypesClientListEventTypesOptions struct { + // placeholder for future optional parameters +} + +// TopicTypesClientListOptions contains the optional parameters for the TopicTypesClient.NewListPager method. +type TopicTypesClientListOptions struct { + // placeholder for future optional parameters +} + +// TopicsClientBeginCreateOrUpdateOptions contains the optional parameters for the TopicsClient.BeginCreateOrUpdate method. +type TopicsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TopicsClientBeginDeleteOptions contains the optional parameters for the TopicsClient.BeginDelete method. +type TopicsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TopicsClientBeginRegenerateKeyOptions contains the optional parameters for the TopicsClient.BeginRegenerateKey method. +type TopicsClientBeginRegenerateKeyOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TopicsClientBeginUpdateOptions contains the optional parameters for the TopicsClient.BeginUpdate method. +type TopicsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TopicsClientGetOptions contains the optional parameters for the TopicsClient.Get method. +type TopicsClientGetOptions struct { + // placeholder for future optional parameters +} + +// TopicsClientListByResourceGroupOptions contains the optional parameters for the TopicsClient.NewListByResourceGroupPager +// method. +type TopicsClientListByResourceGroupOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// TopicsClientListBySubscriptionOptions contains the optional parameters for the TopicsClient.NewListBySubscriptionPager +// method. +type TopicsClientListBySubscriptionOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} + +// TopicsClientListEventTypesOptions contains the optional parameters for the TopicsClient.NewListEventTypesPager method. +type TopicsClientListEventTypesOptions struct { + // placeholder for future optional parameters +} + +// TopicsClientListSharedAccessKeysOptions contains the optional parameters for the TopicsClient.ListSharedAccessKeys method. +type TopicsClientListSharedAccessKeysOptions struct { + // placeholder for future optional parameters +} + +// VerifiedPartnersClientGetOptions contains the optional parameters for the VerifiedPartnersClient.Get method. +type VerifiedPartnersClientGetOptions struct { + // placeholder for future optional parameters +} + +// VerifiedPartnersClientListOptions contains the optional parameters for the VerifiedPartnersClient.NewListPager method. +type VerifiedPartnersClientListOptions struct { + // 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'. + Filter *string + + // 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. + Top *int32 +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/partnerconfigurations_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/partnerconfigurations_client.go index fdb3161874db..3226902ddccc 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/partnerconfigurations_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/partnerconfigurations_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid @@ -35,7 +34,7 @@ type PartnerConfigurationsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPartnerConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PartnerConfigurationsClient, error) { - cl, err := arm.NewClient(moduleName+".PartnerConfigurationsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -49,24 +48,31 @@ func NewPartnerConfigurationsClient(subscriptionID string, credential azcore.Tok // AuthorizePartner - Authorize a single partner either by partner registration immutable Id or by partner name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerInfo - The information of the partner to be authorized. // - options - PartnerConfigurationsClientAuthorizePartnerOptions contains the optional parameters for the PartnerConfigurationsClient.AuthorizePartner // method. func (client *PartnerConfigurationsClient) AuthorizePartner(ctx context.Context, resourceGroupName string, partnerInfo Partner, options *PartnerConfigurationsClientAuthorizePartnerOptions) (PartnerConfigurationsClientAuthorizePartnerResponse, error) { + var err error + const operationName = "PartnerConfigurationsClient.AuthorizePartner" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.authorizePartnerCreateRequest(ctx, resourceGroupName, partnerInfo, options) if err != nil { return PartnerConfigurationsClientAuthorizePartnerResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PartnerConfigurationsClientAuthorizePartnerResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerConfigurationsClientAuthorizePartnerResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PartnerConfigurationsClientAuthorizePartnerResponse{}, err } - return client.authorizePartnerHandleResponse(resp) + resp, err := client.authorizePartnerHandleResponse(httpResp) + return resp, err } // authorizePartnerCreateRequest creates the AuthorizePartner request. @@ -85,10 +91,13 @@ func (client *PartnerConfigurationsClient) authorizePartnerCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, partnerInfo) + if err := runtime.MarshalAsJSON(req, partnerInfo); err != nil { + return nil, err + } + return req, nil } // authorizePartnerHandleResponse handles the AuthorizePartner response. @@ -103,7 +112,7 @@ func (client *PartnerConfigurationsClient) authorizePartnerHandleResponse(resp * // BeginCreateOrUpdate - Synchronously creates or updates a partner configuration with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerConfigurationInfo - Partner configuration information. // - options - PartnerConfigurationsClientBeginCreateOrUpdateOptions contains the optional parameters for the PartnerConfigurationsClient.BeginCreateOrUpdate @@ -114,29 +123,40 @@ func (client *PartnerConfigurationsClient) BeginCreateOrUpdate(ctx context.Conte if err != nil { return nil, err } - return runtime.NewPoller[PartnerConfigurationsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PartnerConfigurationsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[PartnerConfigurationsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PartnerConfigurationsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // CreateOrUpdate - Synchronously creates or updates a partner configuration with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *PartnerConfigurationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, partnerConfigurationInfo PartnerConfiguration, options *PartnerConfigurationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "PartnerConfigurationsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, partnerConfigurationInfo, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -155,16 +175,19 @@ func (client *PartnerConfigurationsClient) createOrUpdateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, partnerConfigurationInfo) + if err := runtime.MarshalAsJSON(req, partnerConfigurationInfo); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete existing partner configuration. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - options - PartnerConfigurationsClientBeginDeleteOptions contains the optional parameters for the PartnerConfigurationsClient.BeginDelete // method. @@ -174,29 +197,40 @@ func (client *PartnerConfigurationsClient) BeginDelete(ctx context.Context, reso if err != nil { return nil, err } - return runtime.NewPoller[PartnerConfigurationsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PartnerConfigurationsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[PartnerConfigurationsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PartnerConfigurationsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Delete - Delete existing partner configuration. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *PartnerConfigurationsClient) deleteOperation(ctx context.Context, resourceGroupName string, options *PartnerConfigurationsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "PartnerConfigurationsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -215,7 +249,7 @@ func (client *PartnerConfigurationsClient) deleteCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -223,23 +257,30 @@ func (client *PartnerConfigurationsClient) deleteCreateRequest(ctx context.Conte // Get - Get properties of a partner configuration. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - options - PartnerConfigurationsClientGetOptions contains the optional parameters for the PartnerConfigurationsClient.Get // method. func (client *PartnerConfigurationsClient) Get(ctx context.Context, resourceGroupName string, options *PartnerConfigurationsClientGetOptions) (PartnerConfigurationsClientGetResponse, error) { + var err error + const operationName = "PartnerConfigurationsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, options) if err != nil { return PartnerConfigurationsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PartnerConfigurationsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerConfigurationsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PartnerConfigurationsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -258,7 +299,7 @@ func (client *PartnerConfigurationsClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -275,7 +316,7 @@ func (client *PartnerConfigurationsClient) getHandleResponse(resp *http.Response // NewListByResourceGroupPager - List all the partner configurations under a resource group. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - options - PartnerConfigurationsClientListByResourceGroupOptions contains the optional parameters for the PartnerConfigurationsClient.NewListByResourceGroupPager // method. @@ -285,6 +326,7 @@ func (client *PartnerConfigurationsClient) NewListByResourceGroupPager(resourceG return false }, Fetcher: func(ctx context.Context, page *PartnerConfigurationsClientListByResourceGroupResponse) (PartnerConfigurationsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PartnerConfigurationsClient.NewListByResourceGroupPager") req, err := client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) if err != nil { return PartnerConfigurationsClientListByResourceGroupResponse{}, err @@ -298,6 +340,7 @@ func (client *PartnerConfigurationsClient) NewListByResourceGroupPager(resourceG } return client.listByResourceGroupHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -317,7 +360,7 @@ func (client *PartnerConfigurationsClient) listByResourceGroupCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -334,7 +377,7 @@ func (client *PartnerConfigurationsClient) listByResourceGroupHandleResponse(res // NewListBySubscriptionPager - List all the partner configurations under an Azure subscription. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - options - PartnerConfigurationsClientListBySubscriptionOptions contains the optional parameters for the PartnerConfigurationsClient.NewListBySubscriptionPager // method. func (client *PartnerConfigurationsClient) NewListBySubscriptionPager(options *PartnerConfigurationsClientListBySubscriptionOptions) *runtime.Pager[PartnerConfigurationsClientListBySubscriptionResponse] { @@ -343,25 +386,20 @@ func (client *PartnerConfigurationsClient) NewListBySubscriptionPager(options *P return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *PartnerConfigurationsClientListBySubscriptionResponse) (PartnerConfigurationsClientListBySubscriptionResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listBySubscriptionCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return PartnerConfigurationsClientListBySubscriptionResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PartnerConfigurationsClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) if err != nil { return PartnerConfigurationsClientListBySubscriptionResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerConfigurationsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) - } return client.listBySubscriptionHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -377,7 +415,7 @@ func (client *PartnerConfigurationsClient) listBySubscriptionCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -401,24 +439,31 @@ func (client *PartnerConfigurationsClient) listBySubscriptionHandleResponse(resp // UnauthorizePartner - Unauthorize a single partner either by partner registration immutable Id or by partner name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerInfo - The information of the partner to be unauthorized. // - options - PartnerConfigurationsClientUnauthorizePartnerOptions contains the optional parameters for the PartnerConfigurationsClient.UnauthorizePartner // method. func (client *PartnerConfigurationsClient) UnauthorizePartner(ctx context.Context, resourceGroupName string, partnerInfo Partner, options *PartnerConfigurationsClientUnauthorizePartnerOptions) (PartnerConfigurationsClientUnauthorizePartnerResponse, error) { + var err error + const operationName = "PartnerConfigurationsClient.UnauthorizePartner" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.unauthorizePartnerCreateRequest(ctx, resourceGroupName, partnerInfo, options) if err != nil { return PartnerConfigurationsClientUnauthorizePartnerResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PartnerConfigurationsClientUnauthorizePartnerResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerConfigurationsClientUnauthorizePartnerResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PartnerConfigurationsClientUnauthorizePartnerResponse{}, err } - return client.unauthorizePartnerHandleResponse(resp) + resp, err := client.unauthorizePartnerHandleResponse(httpResp) + return resp, err } // unauthorizePartnerCreateRequest creates the UnauthorizePartner request. @@ -437,10 +482,13 @@ func (client *PartnerConfigurationsClient) unauthorizePartnerCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, partnerInfo) + if err := runtime.MarshalAsJSON(req, partnerInfo); err != nil { + return nil, err + } + return req, nil } // unauthorizePartnerHandleResponse handles the UnauthorizePartner response. @@ -455,7 +503,7 @@ func (client *PartnerConfigurationsClient) unauthorizePartnerHandleResponse(resp // BeginUpdate - Synchronously updates a partner configuration with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerConfigurationUpdateParameters - Partner configuration update information. // - options - PartnerConfigurationsClientBeginUpdateOptions contains the optional parameters for the PartnerConfigurationsClient.BeginUpdate @@ -466,29 +514,40 @@ func (client *PartnerConfigurationsClient) BeginUpdate(ctx context.Context, reso if err != nil { return nil, err } - return runtime.NewPoller[PartnerConfigurationsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PartnerConfigurationsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[PartnerConfigurationsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PartnerConfigurationsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Update - Synchronously updates a partner configuration with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *PartnerConfigurationsClient) update(ctx context.Context, resourceGroupName string, partnerConfigurationUpdateParameters PartnerConfigurationUpdateParameters, options *PartnerConfigurationsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "PartnerConfigurationsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, partnerConfigurationUpdateParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -507,8 +566,11 @@ func (client *PartnerConfigurationsClient) updateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, partnerConfigurationUpdateParameters) + if err := runtime.MarshalAsJSON(req, partnerConfigurationUpdateParameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/partnerconfigurations_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/partnerconfigurations_client_example_test.go index b28a023a14c3..60d8dd83272d 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/partnerconfigurations_client_example_test.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/partnerconfigurations_client_example_test.go @@ -20,7 +20,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerConfigurations_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerConfigurations_Get.json func ExamplePartnerConfigurationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -41,7 +41,7 @@ func ExamplePartnerConfigurationsClient_Get() { // res.PartnerConfiguration = armeventgrid.PartnerConfiguration{ // Name: to.Ptr("default"), // Type: to.Ptr("Microsoft.EventGrid/partnerConfigurations"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerConfigurations/default"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerConfigurations/default"), // Location: to.Ptr("global"), // Properties: &armeventgrid.PartnerConfigurationProperties{ // PartnerAuthorization: &armeventgrid.PartnerAuthorization{ @@ -66,7 +66,7 @@ func ExamplePartnerConfigurationsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerConfigurations_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerConfigurations_CreateOrUpdate.json func ExamplePartnerConfigurationsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -108,7 +108,7 @@ func ExamplePartnerConfigurationsClient_BeginCreateOrUpdate() { // res.PartnerConfiguration = armeventgrid.PartnerConfiguration{ // Name: to.Ptr("default"), // Type: to.Ptr("Microsoft.EventGrid/partnerConfigurations"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerConfigurations/default"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerConfigurations/default"), // Location: to.Ptr("global"), // Properties: &armeventgrid.PartnerConfigurationProperties{ // PartnerAuthorization: &armeventgrid.PartnerAuthorization{ @@ -133,7 +133,7 @@ func ExamplePartnerConfigurationsClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerConfigurations_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerConfigurations_Delete.json func ExamplePartnerConfigurationsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -154,7 +154,7 @@ func ExamplePartnerConfigurationsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerConfigurations_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerConfigurations_Update.json func ExamplePartnerConfigurationsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -187,7 +187,7 @@ func ExamplePartnerConfigurationsClient_BeginUpdate() { // res.PartnerConfiguration = armeventgrid.PartnerConfiguration{ // Name: to.Ptr("default"), // Type: to.Ptr("Microsoft.EventGrid/partnerConfigurations"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerConfigurations/default"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerConfigurations/default"), // Location: to.Ptr("global"), // Properties: &armeventgrid.PartnerConfigurationProperties{ // PartnerAuthorization: &armeventgrid.PartnerAuthorization{ @@ -212,7 +212,7 @@ func ExamplePartnerConfigurationsClient_BeginUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerConfigurations_ListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerConfigurations_ListByResourceGroup.json func ExamplePartnerConfigurationsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -239,7 +239,7 @@ func ExamplePartnerConfigurationsClient_NewListByResourceGroupPager() { // { // Name: to.Ptr("default"), // Type: to.Ptr("Microsoft.EventGrid/partnerConfigurations"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerConfigurations/default"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerConfigurations/default"), // Location: to.Ptr("global"), // Properties: &armeventgrid.PartnerConfigurationProperties{ // PartnerAuthorization: &armeventgrid.PartnerAuthorization{ @@ -266,7 +266,7 @@ func ExamplePartnerConfigurationsClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerConfigurations_ListBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerConfigurations_ListBySubscription.json func ExamplePartnerConfigurationsClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -295,7 +295,7 @@ func ExamplePartnerConfigurationsClient_NewListBySubscriptionPager() { // { // Name: to.Ptr("default"), // Type: to.Ptr("Microsoft.EventGrid/partnerConfigurations"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerConfigurations/default"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerConfigurations/default"), // Location: to.Ptr("global"), // Properties: &armeventgrid.PartnerConfigurationProperties{ // PartnerAuthorization: &armeventgrid.PartnerAuthorization{ @@ -322,7 +322,7 @@ func ExamplePartnerConfigurationsClient_NewListBySubscriptionPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerConfigurations_AuthorizePartner.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerConfigurations_AuthorizePartner.json func ExamplePartnerConfigurationsClient_AuthorizePartner() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -347,7 +347,7 @@ func ExamplePartnerConfigurationsClient_AuthorizePartner() { // res.PartnerConfiguration = armeventgrid.PartnerConfiguration{ // Name: to.Ptr("default"), // Type: to.Ptr("Microsoft.EventGrid/partnerConfigurations"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerConfigurations/default"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerConfigurations/default"), // Location: to.Ptr("global"), // Properties: &armeventgrid.PartnerConfigurationProperties{ // PartnerAuthorization: &armeventgrid.PartnerAuthorization{ @@ -372,7 +372,7 @@ func ExamplePartnerConfigurationsClient_AuthorizePartner() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerConfigurations_UnauthorizePartner.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerConfigurations_UnauthorizePartner.json func ExamplePartnerConfigurationsClient_UnauthorizePartner() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -397,7 +397,7 @@ func ExamplePartnerConfigurationsClient_UnauthorizePartner() { // res.PartnerConfiguration = armeventgrid.PartnerConfiguration{ // Name: to.Ptr("default"), // Type: to.Ptr("Microsoft.EventGrid/partnerConfigurations"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerConfigurations/default"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerConfigurations/default"), // Location: to.Ptr("global"), // Properties: &armeventgrid.PartnerConfigurationProperties{ // PartnerAuthorization: &armeventgrid.PartnerAuthorization{ diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/partnerdestinations_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/partnerdestinations_client.go deleted file mode 100644 index f008d8f37c82..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/partnerdestinations_client.go +++ /dev/null @@ -1,502 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armeventgrid - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strconv" - "strings" -) - -// PartnerDestinationsClient contains the methods for the PartnerDestinations group. -// Don't use this type directly, use NewPartnerDestinationsClient() instead. -type PartnerDestinationsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewPartnerDestinationsClient creates a new instance of PartnerDestinationsClient with the specified values. -// - subscriptionID - Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewPartnerDestinationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PartnerDestinationsClient, error) { - cl, err := arm.NewClient(moduleName+".PartnerDestinationsClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PartnerDestinationsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Activate - Activate a newly created partner destination. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - partnerDestinationName - Name of the partner destination. -// - options - PartnerDestinationsClientActivateOptions contains the optional parameters for the PartnerDestinationsClient.Activate -// method. -func (client *PartnerDestinationsClient) Activate(ctx context.Context, resourceGroupName string, partnerDestinationName string, options *PartnerDestinationsClientActivateOptions) (PartnerDestinationsClientActivateResponse, error) { - req, err := client.activateCreateRequest(ctx, resourceGroupName, partnerDestinationName, options) - if err != nil { - return PartnerDestinationsClientActivateResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PartnerDestinationsClientActivateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerDestinationsClientActivateResponse{}, runtime.NewResponseError(resp) - } - return client.activateHandleResponse(resp) -} - -// activateCreateRequest creates the Activate request. -func (client *PartnerDestinationsClient) activateCreateRequest(ctx context.Context, resourceGroupName string, partnerDestinationName string, options *PartnerDestinationsClientActivateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}/activate" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerDestinationName == "" { - return nil, errors.New("parameter partnerDestinationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerDestinationName}", url.PathEscape(partnerDestinationName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// activateHandleResponse handles the Activate response. -func (client *PartnerDestinationsClient) activateHandleResponse(resp *http.Response) (PartnerDestinationsClientActivateResponse, error) { - result := PartnerDestinationsClientActivateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PartnerDestination); err != nil { - return PartnerDestinationsClientActivateResponse{}, err - } - return result, nil -} - -// BeginCreateOrUpdate - Asynchronously creates a new partner destination with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - partnerDestinationName - Name of the partner destination. -// - partnerDestination - Partner destination create information. -// - options - PartnerDestinationsClientBeginCreateOrUpdateOptions contains the optional parameters for the PartnerDestinationsClient.BeginCreateOrUpdate -// method. -func (client *PartnerDestinationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, partnerDestinationName string, partnerDestination PartnerDestination, options *PartnerDestinationsClientBeginCreateOrUpdateOptions) (*runtime.Poller[PartnerDestinationsClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, partnerDestinationName, partnerDestination, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PartnerDestinationsClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[PartnerDestinationsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// CreateOrUpdate - Asynchronously creates a new partner destination with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *PartnerDestinationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, partnerDestinationName string, partnerDestination PartnerDestination, options *PartnerDestinationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, partnerDestinationName, partnerDestination, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *PartnerDestinationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, partnerDestinationName string, partnerDestination PartnerDestination, options *PartnerDestinationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerDestinationName == "" { - return nil, errors.New("parameter partnerDestinationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerDestinationName}", url.PathEscape(partnerDestinationName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, partnerDestination) -} - -// BeginDelete - Delete existing partner destination. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - partnerDestinationName - Name of the partner destination. -// - options - PartnerDestinationsClientBeginDeleteOptions contains the optional parameters for the PartnerDestinationsClient.BeginDelete -// method. -func (client *PartnerDestinationsClient) BeginDelete(ctx context.Context, resourceGroupName string, partnerDestinationName string, options *PartnerDestinationsClientBeginDeleteOptions) (*runtime.Poller[PartnerDestinationsClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, partnerDestinationName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PartnerDestinationsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[PartnerDestinationsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Delete - Delete existing partner destination. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *PartnerDestinationsClient) deleteOperation(ctx context.Context, resourceGroupName string, partnerDestinationName string, options *PartnerDestinationsClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, partnerDestinationName, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *PartnerDestinationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, partnerDestinationName string, options *PartnerDestinationsClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerDestinationName == "" { - return nil, errors.New("parameter partnerDestinationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerDestinationName}", url.PathEscape(partnerDestinationName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get properties of a partner destination. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - partnerDestinationName - Name of the partner destination. -// - options - PartnerDestinationsClientGetOptions contains the optional parameters for the PartnerDestinationsClient.Get method. -func (client *PartnerDestinationsClient) Get(ctx context.Context, resourceGroupName string, partnerDestinationName string, options *PartnerDestinationsClientGetOptions) (PartnerDestinationsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, partnerDestinationName, options) - if err != nil { - return PartnerDestinationsClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PartnerDestinationsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerDestinationsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *PartnerDestinationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, partnerDestinationName string, options *PartnerDestinationsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerDestinationName == "" { - return nil, errors.New("parameter partnerDestinationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerDestinationName}", url.PathEscape(partnerDestinationName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PartnerDestinationsClient) getHandleResponse(resp *http.Response) (PartnerDestinationsClientGetResponse, error) { - result := PartnerDestinationsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PartnerDestination); err != nil { - return PartnerDestinationsClientGetResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - List all the partner destinations under a resource group. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - options - PartnerDestinationsClientListByResourceGroupOptions contains the optional parameters for the PartnerDestinationsClient.NewListByResourceGroupPager -// method. -func (client *PartnerDestinationsClient) NewListByResourceGroupPager(resourceGroupName string, options *PartnerDestinationsClientListByResourceGroupOptions) *runtime.Pager[PartnerDestinationsClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[PartnerDestinationsClientListByResourceGroupResponse]{ - More: func(page PartnerDestinationsClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *PartnerDestinationsClientListByResourceGroupResponse) (PartnerDestinationsClientListByResourceGroupResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return PartnerDestinationsClientListByResourceGroupResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PartnerDestinationsClientListByResourceGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerDestinationsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } - return client.listByResourceGroupHandleResponse(resp) - }, - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *PartnerDestinationsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PartnerDestinationsClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *PartnerDestinationsClient) listByResourceGroupHandleResponse(resp *http.Response) (PartnerDestinationsClientListByResourceGroupResponse, error) { - result := PartnerDestinationsClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PartnerDestinationsListResult); err != nil { - return PartnerDestinationsClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - List all the partner destinations under an Azure subscription. -// -// Generated from API version 2023-06-01-preview -// - options - PartnerDestinationsClientListBySubscriptionOptions contains the optional parameters for the PartnerDestinationsClient.NewListBySubscriptionPager -// method. -func (client *PartnerDestinationsClient) NewListBySubscriptionPager(options *PartnerDestinationsClientListBySubscriptionOptions) *runtime.Pager[PartnerDestinationsClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[PartnerDestinationsClientListBySubscriptionResponse]{ - More: func(page PartnerDestinationsClientListBySubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *PartnerDestinationsClientListBySubscriptionResponse) (PartnerDestinationsClientListBySubscriptionResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listBySubscriptionCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return PartnerDestinationsClientListBySubscriptionResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PartnerDestinationsClientListBySubscriptionResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerDestinationsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) - } - return client.listBySubscriptionHandleResponse(resp) - }, - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *PartnerDestinationsClient) listBySubscriptionCreateRequest(ctx context.Context, options *PartnerDestinationsClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerDestinations" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *PartnerDestinationsClient) listBySubscriptionHandleResponse(resp *http.Response) (PartnerDestinationsClientListBySubscriptionResponse, error) { - result := PartnerDestinationsClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PartnerDestinationsListResult); err != nil { - return PartnerDestinationsClientListBySubscriptionResponse{}, err - } - return result, nil -} - -// BeginUpdate - Asynchronously updates a partner destination with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - partnerDestinationName - Name of the partner destination. -// - partnerDestinationUpdateParameters - Partner destination update information. -// - options - PartnerDestinationsClientBeginUpdateOptions contains the optional parameters for the PartnerDestinationsClient.BeginUpdate -// method. -func (client *PartnerDestinationsClient) BeginUpdate(ctx context.Context, resourceGroupName string, partnerDestinationName string, partnerDestinationUpdateParameters PartnerDestinationUpdateParameters, options *PartnerDestinationsClientBeginUpdateOptions) (*runtime.Poller[PartnerDestinationsClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, partnerDestinationName, partnerDestinationUpdateParameters, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PartnerDestinationsClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[PartnerDestinationsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Update - Asynchronously updates a partner destination with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *PartnerDestinationsClient) update(ctx context.Context, resourceGroupName string, partnerDestinationName string, partnerDestinationUpdateParameters PartnerDestinationUpdateParameters, options *PartnerDestinationsClientBeginUpdateOptions) (*http.Response, error) { - req, err := client.updateCreateRequest(ctx, resourceGroupName, partnerDestinationName, partnerDestinationUpdateParameters, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// updateCreateRequest creates the Update request. -func (client *PartnerDestinationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, partnerDestinationName string, partnerDestinationUpdateParameters PartnerDestinationUpdateParameters, options *PartnerDestinationsClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerDestinationName == "" { - return nil, errors.New("parameter partnerDestinationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerDestinationName}", url.PathEscape(partnerDestinationName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, partnerDestinationUpdateParameters) -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/partnerdestinations_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/partnerdestinations_client_example_test.go deleted file mode 100644 index bcb18890fdb3..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/partnerdestinations_client_example_test.go +++ /dev/null @@ -1,296 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armeventgrid_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerDestinations_Get.json -func ExamplePartnerDestinationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPartnerDestinationsClient().Get(ctx, "examplerg", "examplePartnerDestinationName1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PartnerDestination = armeventgrid.PartnerDestination{ - // Name: to.Ptr("examplePartnerDestinationName1"), - // Type: to.Ptr("Microsoft.EventGrid/partnerDestinations"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerDestinations/examplePartnerDestinationName1"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armeventgrid.PartnerDestinationProperties{ - // ActivationState: to.Ptr(armeventgrid.PartnerDestinationActivationStateNeverActivated), - // EndpointBaseURL: to.Ptr("https://somepartnerhostname"), - // EndpointServiceContext: to.Ptr("ContosoCorp.Accounts.User1"), - // ExpirationTimeIfNotActivatedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-21T22:50:25.410433Z"); return t}()), - // MessageForActivation: to.Ptr("Some message to the approver"), - // ProvisioningState: to.Ptr(armeventgrid.PartnerDestinationProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerDestinations_CreateOrUpdate.json -func ExamplePartnerDestinationsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPartnerDestinationsClient().BeginCreateOrUpdate(ctx, "examplerg", "examplePartnerDestinationName1", armeventgrid.PartnerDestination{ - Location: to.Ptr("westus2"), - Properties: &armeventgrid.PartnerDestinationProperties{ - EndpointBaseURL: to.Ptr("https://www.example/endpoint"), - EndpointServiceContext: to.Ptr("This is an example"), - ExpirationTimeIfNotActivatedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-14T19:33:43.430Z"); return t }()), - MessageForActivation: to.Ptr("Sample Activation message"), - PartnerRegistrationImmutableID: to.Ptr("0bd70ee2-7d95-447e-ab1f-c4f320019404"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PartnerDestination = armeventgrid.PartnerDestination{ - // Name: to.Ptr("examplePartnerDestinationName1"), - // Type: to.Ptr("Microsoft.EventGrid/partnerDestinations"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerDestinations/examplePartnerDestinationName1"), - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armeventgrid.PartnerDestinationProperties{ - // ActivationState: to.Ptr(armeventgrid.PartnerDestinationActivationStateNeverActivated), - // EndpointBaseURL: to.Ptr("https://www.example/endpoint"), - // EndpointServiceContext: to.Ptr("string"), - // ExpirationTimeIfNotActivatedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-14T19:33:43.430Z"); return t}()), - // MessageForActivation: to.Ptr("Sample Activation message"), - // PartnerRegistrationImmutableID: to.Ptr("0bd70ee2-7d95-447e-ab1f-c4f320019404"), - // ProvisioningState: to.Ptr(armeventgrid.PartnerDestinationProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerDestinations_Delete.json -func ExamplePartnerDestinationsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPartnerDestinationsClient().BeginDelete(ctx, "examplerg", "examplePartnerDestinationName1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerDestinations_Update.json -func ExamplePartnerDestinationsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPartnerDestinationsClient().BeginUpdate(ctx, "examplerg", "examplePartnerDestinationName1", armeventgrid.PartnerDestinationUpdateParameters{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PartnerDestination = armeventgrid.PartnerDestination{ - // Name: to.Ptr("examplePartnerDestinationName1"), - // Type: to.Ptr("Microsoft.EventGrid/partnerDestinations"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerDestinations/examplePartnerDestinationName1"), - // Location: to.Ptr("centraluseuap"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armeventgrid.PartnerDestinationProperties{ - // ActivationState: to.Ptr(armeventgrid.PartnerDestinationActivationStateNeverActivated), - // EndpointBaseURL: to.Ptr("https://somepartnerhostname"), - // EndpointServiceContext: to.Ptr("ContosoCorp.Accounts.User1"), - // ExpirationTimeIfNotActivatedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-21T22:50:25.410433Z"); return t}()), - // MessageForActivation: to.Ptr("Some message to the approver"), - // ProvisioningState: to.Ptr(armeventgrid.PartnerDestinationProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerDestinations_ListBySubscription.json -func ExamplePartnerDestinationsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPartnerDestinationsClient().NewListBySubscriptionPager(&armeventgrid.PartnerDestinationsClientListBySubscriptionOptions{Filter: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PartnerDestinationsListResult = armeventgrid.PartnerDestinationsListResult{ - // Value: []*armeventgrid.PartnerDestination{ - // { - // Name: to.Ptr("examplePartnerDestinationName1"), - // Type: to.Ptr("Microsoft.EventGrid/partnerDestinations"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerDestinations/examplePartnerDestinationName1"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armeventgrid.PartnerDestinationProperties{ - // ActivationState: to.Ptr(armeventgrid.PartnerDestinationActivationStateNeverActivated), - // EndpointBaseURL: to.Ptr("https://somepartnerhostname"), - // EndpointServiceContext: to.Ptr("ContosoCorp.Accounts.User1"), - // ExpirationTimeIfNotActivatedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-21T22:50:25.410433Z"); return t}()), - // MessageForActivation: to.Ptr("Some message to the approver"), - // ProvisioningState: to.Ptr(armeventgrid.PartnerDestinationProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerDestinations_ListByResourceGroup.json -func ExamplePartnerDestinationsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPartnerDestinationsClient().NewListByResourceGroupPager("examplerg", &armeventgrid.PartnerDestinationsClientListByResourceGroupOptions{Filter: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PartnerDestinationsListResult = armeventgrid.PartnerDestinationsListResult{ - // Value: []*armeventgrid.PartnerDestination{ - // { - // Name: to.Ptr("examplePartnerDestinationName1"), - // Type: to.Ptr("Microsoft.EventGrid/partnerDestinations"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerDestinations/examplePartnerDestinationName1"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armeventgrid.PartnerDestinationProperties{ - // ActivationState: to.Ptr(armeventgrid.PartnerDestinationActivationStateNeverActivated), - // EndpointBaseURL: to.Ptr("https://somepartnerhostname"), - // EndpointServiceContext: to.Ptr("ContosoCorp.Accounts.User1"), - // ExpirationTimeIfNotActivatedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-21T22:50:25.410433Z"); return t}()), - // MessageForActivation: to.Ptr("Some message to the approver"), - // ProvisioningState: to.Ptr(armeventgrid.PartnerDestinationProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerDestinations_Activate.json -func ExamplePartnerDestinationsClient_Activate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPartnerDestinationsClient().Activate(ctx, "examplerg", "examplePartnerDestination1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PartnerDestination = armeventgrid.PartnerDestination{ - // Name: to.Ptr("examplePartnerDestinationName1"), - // Type: to.Ptr("Microsoft.EventGrid/partnerDestinations"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerDestinations/examplePartnerDestinationName1"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armeventgrid.PartnerDestinationProperties{ - // ActivationState: to.Ptr(armeventgrid.PartnerDestinationActivationStateActivated), - // EndpointBaseURL: to.Ptr("https://somepartnerhostname"), - // EndpointServiceContext: to.Ptr("ContosoCorp.Accounts.User1"), - // MessageForActivation: to.Ptr("Some message to the approver"), - // ProvisioningState: to.Ptr(armeventgrid.PartnerDestinationProvisioningStateSucceeded), - // }, - // } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/partnernamespaces_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/partnernamespaces_client.go index 25de7cac473a..44a4fa031da9 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/partnernamespaces_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/partnernamespaces_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid @@ -35,7 +34,7 @@ type PartnerNamespacesClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPartnerNamespacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PartnerNamespacesClient, error) { - cl, err := arm.NewClient(moduleName+".PartnerNamespacesClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -49,7 +48,7 @@ func NewPartnerNamespacesClient(subscriptionID string, credential azcore.TokenCr // BeginCreateOrUpdate - Asynchronously creates a new partner namespace with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerNamespaceName - Name of the partner namespace. // - partnerNamespaceInfo - PartnerNamespace information. @@ -61,29 +60,40 @@ func (client *PartnerNamespacesClient) BeginCreateOrUpdate(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[PartnerNamespacesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PartnerNamespacesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[PartnerNamespacesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PartnerNamespacesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // CreateOrUpdate - Asynchronously creates a new partner namespace with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *PartnerNamespacesClient) createOrUpdate(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceInfo PartnerNamespace, options *PartnerNamespacesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "PartnerNamespacesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, partnerNamespaceName, partnerNamespaceInfo, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -106,16 +116,19 @@ func (client *PartnerNamespacesClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, partnerNamespaceInfo) + if err := runtime.MarshalAsJSON(req, partnerNamespaceInfo); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete existing partner namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerNamespaceName - Name of the partner namespace. // - options - PartnerNamespacesClientBeginDeleteOptions contains the optional parameters for the PartnerNamespacesClient.BeginDelete @@ -126,29 +139,40 @@ func (client *PartnerNamespacesClient) BeginDelete(ctx context.Context, resource if err != nil { return nil, err } - return runtime.NewPoller[PartnerNamespacesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PartnerNamespacesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[PartnerNamespacesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PartnerNamespacesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Delete - Delete existing partner namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *PartnerNamespacesClient) deleteOperation(ctx context.Context, resourceGroupName string, partnerNamespaceName string, options *PartnerNamespacesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "PartnerNamespacesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, partnerNamespaceName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -171,7 +195,7 @@ func (client *PartnerNamespacesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -179,23 +203,30 @@ func (client *PartnerNamespacesClient) deleteCreateRequest(ctx context.Context, // Get - Get properties of a partner namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerNamespaceName - Name of the partner namespace. // - options - PartnerNamespacesClientGetOptions contains the optional parameters for the PartnerNamespacesClient.Get method. func (client *PartnerNamespacesClient) Get(ctx context.Context, resourceGroupName string, partnerNamespaceName string, options *PartnerNamespacesClientGetOptions) (PartnerNamespacesClientGetResponse, error) { + var err error + const operationName = "PartnerNamespacesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, partnerNamespaceName, options) if err != nil { return PartnerNamespacesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PartnerNamespacesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerNamespacesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PartnerNamespacesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -218,7 +249,7 @@ func (client *PartnerNamespacesClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -235,7 +266,7 @@ func (client *PartnerNamespacesClient) getHandleResponse(resp *http.Response) (P // NewListByResourceGroupPager - List all the partner namespaces under a resource group. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - options - PartnerNamespacesClientListByResourceGroupOptions contains the optional parameters for the PartnerNamespacesClient.NewListByResourceGroupPager // method. @@ -245,25 +276,20 @@ func (client *PartnerNamespacesClient) NewListByResourceGroupPager(resourceGroup return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *PartnerNamespacesClientListByResourceGroupResponse) (PartnerNamespacesClientListByResourceGroupResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PartnerNamespacesClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) if err != nil { return PartnerNamespacesClientListByResourceGroupResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PartnerNamespacesClientListByResourceGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerNamespacesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } return client.listByResourceGroupHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -283,7 +309,7 @@ func (client *PartnerNamespacesClient) listByResourceGroupCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -306,7 +332,7 @@ func (client *PartnerNamespacesClient) listByResourceGroupHandleResponse(resp *h // NewListBySubscriptionPager - List all the partner namespaces under an Azure subscription. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - options - PartnerNamespacesClientListBySubscriptionOptions contains the optional parameters for the PartnerNamespacesClient.NewListBySubscriptionPager // method. func (client *PartnerNamespacesClient) NewListBySubscriptionPager(options *PartnerNamespacesClientListBySubscriptionOptions) *runtime.Pager[PartnerNamespacesClientListBySubscriptionResponse] { @@ -315,25 +341,20 @@ func (client *PartnerNamespacesClient) NewListBySubscriptionPager(options *Partn return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *PartnerNamespacesClientListBySubscriptionResponse) (PartnerNamespacesClientListBySubscriptionResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listBySubscriptionCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PartnerNamespacesClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) if err != nil { return PartnerNamespacesClientListBySubscriptionResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PartnerNamespacesClientListBySubscriptionResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerNamespacesClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) - } return client.listBySubscriptionHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -349,7 +370,7 @@ func (client *PartnerNamespacesClient) listBySubscriptionCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -373,24 +394,31 @@ func (client *PartnerNamespacesClient) listBySubscriptionHandleResponse(resp *ht // ListSharedAccessKeys - List the two keys used to publish to a partner namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerNamespaceName - Name of the partner namespace. // - options - PartnerNamespacesClientListSharedAccessKeysOptions contains the optional parameters for the PartnerNamespacesClient.ListSharedAccessKeys // method. func (client *PartnerNamespacesClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, partnerNamespaceName string, options *PartnerNamespacesClientListSharedAccessKeysOptions) (PartnerNamespacesClientListSharedAccessKeysResponse, error) { + var err error + const operationName = "PartnerNamespacesClient.ListSharedAccessKeys" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.listSharedAccessKeysCreateRequest(ctx, resourceGroupName, partnerNamespaceName, options) if err != nil { return PartnerNamespacesClientListSharedAccessKeysResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PartnerNamespacesClientListSharedAccessKeysResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerNamespacesClientListSharedAccessKeysResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PartnerNamespacesClientListSharedAccessKeysResponse{}, err } - return client.listSharedAccessKeysHandleResponse(resp) + resp, err := client.listSharedAccessKeysHandleResponse(httpResp) + return resp, err } // listSharedAccessKeysCreateRequest creates the ListSharedAccessKeys request. @@ -413,7 +441,7 @@ func (client *PartnerNamespacesClient) listSharedAccessKeysCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -431,25 +459,32 @@ func (client *PartnerNamespacesClient) listSharedAccessKeysHandleResponse(resp * // RegenerateKey - Regenerate a shared access key for a partner namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerNamespaceName - Name of the partner namespace. // - regenerateKeyRequest - Request body to regenerate key. // - options - PartnerNamespacesClientRegenerateKeyOptions contains the optional parameters for the PartnerNamespacesClient.RegenerateKey // method. func (client *PartnerNamespacesClient) RegenerateKey(ctx context.Context, resourceGroupName string, partnerNamespaceName string, regenerateKeyRequest PartnerNamespaceRegenerateKeyRequest, options *PartnerNamespacesClientRegenerateKeyOptions) (PartnerNamespacesClientRegenerateKeyResponse, error) { + var err error + const operationName = "PartnerNamespacesClient.RegenerateKey" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.regenerateKeyCreateRequest(ctx, resourceGroupName, partnerNamespaceName, regenerateKeyRequest, options) if err != nil { return PartnerNamespacesClientRegenerateKeyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PartnerNamespacesClientRegenerateKeyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerNamespacesClientRegenerateKeyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PartnerNamespacesClientRegenerateKeyResponse{}, err } - return client.regenerateKeyHandleResponse(resp) + resp, err := client.regenerateKeyHandleResponse(httpResp) + return resp, err } // regenerateKeyCreateRequest creates the RegenerateKey request. @@ -472,10 +507,13 @@ func (client *PartnerNamespacesClient) regenerateKeyCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, regenerateKeyRequest) + if err := runtime.MarshalAsJSON(req, regenerateKeyRequest); err != nil { + return nil, err + } + return req, nil } // regenerateKeyHandleResponse handles the RegenerateKey response. @@ -490,7 +528,7 @@ func (client *PartnerNamespacesClient) regenerateKeyHandleResponse(resp *http.Re // BeginUpdate - Asynchronously updates a partner namespace with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerNamespaceName - Name of the partner namespace. // - partnerNamespaceUpdateParameters - Partner namespace update information. @@ -502,29 +540,40 @@ func (client *PartnerNamespacesClient) BeginUpdate(ctx context.Context, resource if err != nil { return nil, err } - return runtime.NewPoller[PartnerNamespacesClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PartnerNamespacesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[PartnerNamespacesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PartnerNamespacesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Update - Asynchronously updates a partner namespace with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *PartnerNamespacesClient) update(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceUpdateParameters PartnerNamespaceUpdateParameters, options *PartnerNamespacesClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "PartnerNamespacesClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, partnerNamespaceName, partnerNamespaceUpdateParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -547,8 +596,11 @@ func (client *PartnerNamespacesClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, partnerNamespaceUpdateParameters) + if err := runtime.MarshalAsJSON(req, partnerNamespaceUpdateParameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/partnernamespaces_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/partnernamespaces_client_example_test.go index f0fa1d68b601..e1f674183c88 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/partnernamespaces_client_example_test.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/partnernamespaces_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerNamespaces_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerNamespaces_Get.json func ExamplePartnerNamespacesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -39,7 +39,7 @@ func ExamplePartnerNamespacesClient_Get() { // res.PartnerNamespace = armeventgrid.PartnerNamespace{ // Name: to.Ptr("examplePartnerNamespaceName1"), // Type: to.Ptr("Microsoft.EventGrid/partnerNamespaces"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerNamespaces/examplePartnerNamespaceName1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerNamespaces/examplePartnerNamespaceName1"), // Location: to.Ptr("Central US EUAP"), // Tags: map[string]*string{ // "key1": to.Ptr("value1"), @@ -48,13 +48,13 @@ func ExamplePartnerNamespacesClient_Get() { // }, // Properties: &armeventgrid.PartnerNamespaceProperties{ // Endpoint: to.Ptr("https://examplePartnerNamespaceName1.centraluseuap-1.eventgrid.azure.net/api/events"), - // PartnerRegistrationFullyQualifiedID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerRegistrations/ContosoCorpAccount1"), + // PartnerRegistrationFullyQualifiedID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerRegistrations/ContosoCorpAccount1"), // ProvisioningState: to.Ptr(armeventgrid.PartnerNamespaceProvisioningStateSucceeded), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerNamespaces_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerNamespaces_CreateOrUpdate.json func ExamplePartnerNamespacesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -72,7 +72,7 @@ func ExamplePartnerNamespacesClient_BeginCreateOrUpdate() { "tag2": to.Ptr("value2"), }, Properties: &armeventgrid.PartnerNamespaceProperties{ - PartnerRegistrationFullyQualifiedID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerRegistrations/ContosoCorpAccount1"), + PartnerRegistrationFullyQualifiedID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerRegistrations/ContosoCorpAccount1"), }, }, nil) if err != nil { @@ -84,7 +84,7 @@ func ExamplePartnerNamespacesClient_BeginCreateOrUpdate() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerNamespaces_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerNamespaces_Delete.json func ExamplePartnerNamespacesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -105,7 +105,7 @@ func ExamplePartnerNamespacesClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerNamespaces_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerNamespaces_Update.json func ExamplePartnerNamespacesClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -130,7 +130,7 @@ func ExamplePartnerNamespacesClient_BeginUpdate() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerNamespaces_ListBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerNamespaces_ListBySubscription.json func ExamplePartnerNamespacesClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -159,7 +159,7 @@ func ExamplePartnerNamespacesClient_NewListBySubscriptionPager() { // { // Name: to.Ptr("partnerNamespace123"), // Type: to.Ptr("Microsoft.EventGrid/partnerNamespaces"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/amh/providers/Microsoft.EventGrid/partnerNamespaces/partnerNamespace123"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/amh/providers/Microsoft.EventGrid/partnerNamespaces/partnerNamespace123"), // Location: to.Ptr("Central US EUAP"), // Tags: map[string]*string{ // "key1": to.Ptr("value1"), @@ -168,7 +168,7 @@ func ExamplePartnerNamespacesClient_NewListBySubscriptionPager() { // }, // Properties: &armeventgrid.PartnerNamespaceProperties{ // Endpoint: to.Ptr("https://partnernamespace123.centraluseuap-1.eventgrid.azure.net/api/events"), - // PartnerRegistrationFullyQualifiedID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/amh/providers/Microsoft.EventGrid/partnerRegistrations/ContosoCorpAccount1"), + // PartnerRegistrationFullyQualifiedID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/amh/providers/Microsoft.EventGrid/partnerRegistrations/ContosoCorpAccount1"), // ProvisioningState: to.Ptr(armeventgrid.PartnerNamespaceProvisioningStateSucceeded), // }, // }}, @@ -176,7 +176,7 @@ func ExamplePartnerNamespacesClient_NewListBySubscriptionPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerNamespaces_ListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerNamespaces_ListByResourceGroup.json func ExamplePartnerNamespacesClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -205,7 +205,7 @@ func ExamplePartnerNamespacesClient_NewListByResourceGroupPager() { // { // Name: to.Ptr("partnerNamespace123"), // Type: to.Ptr("Microsoft.EventGrid/partnerNamespaces"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerNamespaces/partnerNamespace123"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerNamespaces/partnerNamespace123"), // Location: to.Ptr("Central US EUAP"), // Tags: map[string]*string{ // "key1": to.Ptr("value1"), @@ -214,7 +214,7 @@ func ExamplePartnerNamespacesClient_NewListByResourceGroupPager() { // }, // Properties: &armeventgrid.PartnerNamespaceProperties{ // Endpoint: to.Ptr("https://partnernamespace123.centraluseuap-1.eventgrid.azure.net/api/events"), - // PartnerRegistrationFullyQualifiedID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerRegistrations/ContosoCorpAccount1"), + // PartnerRegistrationFullyQualifiedID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerRegistrations/ContosoCorpAccount1"), // ProvisioningState: to.Ptr(armeventgrid.PartnerNamespaceProvisioningStateSucceeded), // }, // }}, @@ -222,7 +222,7 @@ func ExamplePartnerNamespacesClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerNamespaces_ListSharedAccessKeys.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerNamespaces_ListSharedAccessKeys.json func ExamplePartnerNamespacesClient_ListSharedAccessKeys() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -246,7 +246,7 @@ func ExamplePartnerNamespacesClient_ListSharedAccessKeys() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerNamespaces_RegenerateKey.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerNamespaces_RegenerateKey.json func ExamplePartnerNamespacesClient_RegenerateKey() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/partnerregistrations_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/partnerregistrations_client.go index 5377204b0598..cd49dd6e3b57 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/partnerregistrations_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/partnerregistrations_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid @@ -35,7 +34,7 @@ type PartnerRegistrationsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPartnerRegistrationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PartnerRegistrationsClient, error) { - cl, err := arm.NewClient(moduleName+".PartnerRegistrationsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -49,7 +48,7 @@ func NewPartnerRegistrationsClient(subscriptionID string, credential azcore.Toke // BeginCreateOrUpdate - Creates a new partner registration with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerRegistrationName - Name of the partner registration. // - partnerRegistrationInfo - PartnerRegistration information. @@ -61,29 +60,40 @@ func (client *PartnerRegistrationsClient) BeginCreateOrUpdate(ctx context.Contex if err != nil { return nil, err } - return runtime.NewPoller[PartnerRegistrationsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PartnerRegistrationsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[PartnerRegistrationsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PartnerRegistrationsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // CreateOrUpdate - Creates a new partner registration with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *PartnerRegistrationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationInfo PartnerRegistration, options *PartnerRegistrationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "PartnerRegistrationsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, partnerRegistrationName, partnerRegistrationInfo, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -106,16 +116,19 @@ func (client *PartnerRegistrationsClient) createOrUpdateCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, partnerRegistrationInfo) + if err := runtime.MarshalAsJSON(req, partnerRegistrationInfo); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a partner registration with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerRegistrationName - Name of the partner registration. // - options - PartnerRegistrationsClientBeginDeleteOptions contains the optional parameters for the PartnerRegistrationsClient.BeginDelete @@ -126,29 +139,40 @@ func (client *PartnerRegistrationsClient) BeginDelete(ctx context.Context, resou if err != nil { return nil, err } - return runtime.NewPoller[PartnerRegistrationsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PartnerRegistrationsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[PartnerRegistrationsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PartnerRegistrationsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Delete - Deletes a partner registration with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *PartnerRegistrationsClient) deleteOperation(ctx context.Context, resourceGroupName string, partnerRegistrationName string, options *PartnerRegistrationsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "PartnerRegistrationsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, partnerRegistrationName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -171,7 +195,7 @@ func (client *PartnerRegistrationsClient) deleteCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -179,24 +203,31 @@ func (client *PartnerRegistrationsClient) deleteCreateRequest(ctx context.Contex // Get - Gets a partner registration with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerRegistrationName - Name of the partner registration. // - options - PartnerRegistrationsClientGetOptions contains the optional parameters for the PartnerRegistrationsClient.Get // method. func (client *PartnerRegistrationsClient) Get(ctx context.Context, resourceGroupName string, partnerRegistrationName string, options *PartnerRegistrationsClientGetOptions) (PartnerRegistrationsClientGetResponse, error) { + var err error + const operationName = "PartnerRegistrationsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, partnerRegistrationName, options) if err != nil { return PartnerRegistrationsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PartnerRegistrationsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerRegistrationsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PartnerRegistrationsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -219,7 +250,7 @@ func (client *PartnerRegistrationsClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -236,7 +267,7 @@ func (client *PartnerRegistrationsClient) getHandleResponse(resp *http.Response) // NewListByResourceGroupPager - List all the partner registrations under a resource group. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - options - PartnerRegistrationsClientListByResourceGroupOptions contains the optional parameters for the PartnerRegistrationsClient.NewListByResourceGroupPager // method. @@ -246,25 +277,20 @@ func (client *PartnerRegistrationsClient) NewListByResourceGroupPager(resourceGr return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *PartnerRegistrationsClientListByResourceGroupResponse) (PartnerRegistrationsClientListByResourceGroupResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return PartnerRegistrationsClientListByResourceGroupResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PartnerRegistrationsClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) if err != nil { return PartnerRegistrationsClientListByResourceGroupResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerRegistrationsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } return client.listByResourceGroupHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -284,7 +310,7 @@ func (client *PartnerRegistrationsClient) listByResourceGroupCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -307,7 +333,7 @@ func (client *PartnerRegistrationsClient) listByResourceGroupHandleResponse(resp // NewListBySubscriptionPager - List all the partner registrations under an Azure subscription. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - options - PartnerRegistrationsClientListBySubscriptionOptions contains the optional parameters for the PartnerRegistrationsClient.NewListBySubscriptionPager // method. func (client *PartnerRegistrationsClient) NewListBySubscriptionPager(options *PartnerRegistrationsClientListBySubscriptionOptions) *runtime.Pager[PartnerRegistrationsClientListBySubscriptionResponse] { @@ -316,25 +342,20 @@ func (client *PartnerRegistrationsClient) NewListBySubscriptionPager(options *Pa return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *PartnerRegistrationsClientListBySubscriptionResponse) (PartnerRegistrationsClientListBySubscriptionResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listBySubscriptionCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PartnerRegistrationsClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) if err != nil { return PartnerRegistrationsClientListBySubscriptionResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PartnerRegistrationsClientListBySubscriptionResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerRegistrationsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) - } return client.listBySubscriptionHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -350,7 +371,7 @@ func (client *PartnerRegistrationsClient) listBySubscriptionCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -374,7 +395,7 @@ func (client *PartnerRegistrationsClient) listBySubscriptionHandleResponse(resp // BeginUpdate - Updates a partner registration with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerRegistrationName - Name of the partner registration. // - partnerRegistrationUpdateParameters - Partner registration update information. @@ -386,29 +407,40 @@ func (client *PartnerRegistrationsClient) BeginUpdate(ctx context.Context, resou if err != nil { return nil, err } - return runtime.NewPoller[PartnerRegistrationsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PartnerRegistrationsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[PartnerRegistrationsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PartnerRegistrationsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Update - Updates a partner registration with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *PartnerRegistrationsClient) update(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationUpdateParameters PartnerRegistrationUpdateParameters, options *PartnerRegistrationsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "PartnerRegistrationsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, partnerRegistrationName, partnerRegistrationUpdateParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -431,8 +463,11 @@ func (client *PartnerRegistrationsClient) updateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, partnerRegistrationUpdateParameters) + if err := runtime.MarshalAsJSON(req, partnerRegistrationUpdateParameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/partnerregistrations_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/partnerregistrations_client_example_test.go index 9e1f91b7b98e..24f2b303c01e 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/partnerregistrations_client_example_test.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/partnerregistrations_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerRegistrations_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerRegistrations_Get.json func ExamplePartnerRegistrationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -39,7 +39,7 @@ func ExamplePartnerRegistrationsClient_Get() { // res.PartnerRegistration = armeventgrid.PartnerRegistration{ // Name: to.Ptr("examplePartnerRegistrationName1"), // Type: to.Ptr("Microsoft.EventGrid/partnerRegistrations"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerRegistrations/examplePartnerRegistrationName1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerRegistrations/examplePartnerRegistrationName1"), // Location: to.Ptr("global"), // Tags: map[string]*string{ // "key1": to.Ptr("value1"), @@ -47,13 +47,13 @@ func ExamplePartnerRegistrationsClient_Get() { // "key3": to.Ptr("Value3"), // }, // Properties: &armeventgrid.PartnerRegistrationProperties{ - // PartnerRegistrationImmutableID: to.Ptr("cda82399-79fe-4d5a-bc6d-b05a437204d9"), + // PartnerRegistrationImmutableID: to.Ptr("6a1e637f-1495-4938-bf46-ff468b9a75d2"), // ProvisioningState: to.Ptr(armeventgrid.PartnerRegistrationProvisioningStateSucceeded), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerRegistrations_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerRegistrations_CreateOrUpdate.json func ExamplePartnerRegistrationsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -85,7 +85,7 @@ func ExamplePartnerRegistrationsClient_BeginCreateOrUpdate() { // res.PartnerRegistration = armeventgrid.PartnerRegistration{ // Name: to.Ptr("examplePartnerRegistrationName1"), // Type: to.Ptr("Microsoft.EventGrid/partnerRegistrations"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerRegistrations/examplePartnerRegistrationName1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerRegistrations/examplePartnerRegistrationName1"), // Location: to.Ptr("global"), // Tags: map[string]*string{ // "key1": to.Ptr("value1"), @@ -93,13 +93,13 @@ func ExamplePartnerRegistrationsClient_BeginCreateOrUpdate() { // "key3": to.Ptr("Value3"), // }, // Properties: &armeventgrid.PartnerRegistrationProperties{ - // PartnerRegistrationImmutableID: to.Ptr("cda82399-79fe-4d5a-bc6d-b05a437204d9"), + // PartnerRegistrationImmutableID: to.Ptr("6a1e637f-1495-4938-bf46-ff468b9a75d2"), // ProvisioningState: to.Ptr(armeventgrid.PartnerRegistrationProvisioningStateSucceeded), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerRegistrations_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerRegistrations_Delete.json func ExamplePartnerRegistrationsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -120,7 +120,7 @@ func ExamplePartnerRegistrationsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerRegistrations_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerRegistrations_Update.json func ExamplePartnerRegistrationsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -133,7 +133,8 @@ func ExamplePartnerRegistrationsClient_BeginUpdate() { } poller, err := clientFactory.NewPartnerRegistrationsClient().BeginUpdate(ctx, "examplerg", "examplePartnerRegistrationName1", armeventgrid.PartnerRegistrationUpdateParameters{ Tags: map[string]*string{ - "NewKey": to.Ptr("NewValue"), + "tag1": to.Ptr("value1"), + "tag2": to.Ptr("value2"), }, }, nil) if err != nil { @@ -145,7 +146,7 @@ func ExamplePartnerRegistrationsClient_BeginUpdate() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerRegistrations_ListBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerRegistrations_ListBySubscription.json func ExamplePartnerRegistrationsClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -174,7 +175,7 @@ func ExamplePartnerRegistrationsClient_NewListBySubscriptionPager() { // { // Name: to.Ptr("ContosoCorpAccount1"), // Type: to.Ptr("Microsoft.EventGrid/partnerRegistrations"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/amh/providers/Microsoft.EventGrid/partnerRegistrations/ContosoCorpAccount1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/amh/providers/Microsoft.EventGrid/partnerRegistrations/ContosoCorpAccount1"), // Location: to.Ptr("global"), // Tags: map[string]*string{ // "key1": to.Ptr("value1"), @@ -182,7 +183,7 @@ func ExamplePartnerRegistrationsClient_NewListBySubscriptionPager() { // "key3": to.Ptr("Value3"), // }, // Properties: &armeventgrid.PartnerRegistrationProperties{ - // PartnerRegistrationImmutableID: to.Ptr("cda82399-79fe-4d5a-bc6d-b05a437204d9"), + // PartnerRegistrationImmutableID: to.Ptr("6a1e637f-1495-4938-bf46-ff468b9a75d2"), // ProvisioningState: to.Ptr(armeventgrid.PartnerRegistrationProvisioningStateSucceeded), // }, // }}, @@ -190,7 +191,7 @@ func ExamplePartnerRegistrationsClient_NewListBySubscriptionPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerRegistrations_ListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerRegistrations_ListByResourceGroup.json func ExamplePartnerRegistrationsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -219,7 +220,7 @@ func ExamplePartnerRegistrationsClient_NewListByResourceGroupPager() { // { // Name: to.Ptr("ContosoCorpAccount1"), // Type: to.Ptr("Microsoft.EventGrid/partnerRegistrations"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/amh/providers/Microsoft.EventGrid/partnerRegistrations/ContosoCorpAccount1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/amh/providers/Microsoft.EventGrid/partnerRegistrations/ContosoCorpAccount1"), // Location: to.Ptr("global"), // Tags: map[string]*string{ // "key1": to.Ptr("value1"), @@ -227,7 +228,7 @@ func ExamplePartnerRegistrationsClient_NewListByResourceGroupPager() { // "key3": to.Ptr("Value3"), // }, // Properties: &armeventgrid.PartnerRegistrationProperties{ - // PartnerRegistrationImmutableID: to.Ptr("cda82399-79fe-4d5a-bc6d-b05a437204d9"), + // PartnerRegistrationImmutableID: to.Ptr("6a1e637f-1495-4938-bf46-ff468b9a75d2"), // ProvisioningState: to.Ptr(armeventgrid.PartnerRegistrationProvisioningStateSucceeded), // }, // }}, diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/partnertopiceventsubscriptions_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/partnertopiceventsubscriptions_client.go index 802072affd35..8b78f0f24f30 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/partnertopiceventsubscriptions_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/partnertopiceventsubscriptions_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid @@ -35,7 +34,7 @@ type PartnerTopicEventSubscriptionsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPartnerTopicEventSubscriptionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PartnerTopicEventSubscriptionsClient, error) { - cl, err := arm.NewClient(moduleName+".PartnerTopicEventSubscriptionsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -50,7 +49,7 @@ func NewPartnerTopicEventSubscriptionsClient(subscriptionID string, credential a // Existing event subscriptions will be updated with this API. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerTopicName - Name of the partner topic. // - eventSubscriptionName - Name of the event subscription to be created. Event subscription names must be between 3 and 100 @@ -64,9 +63,14 @@ func (client *PartnerTopicEventSubscriptionsClient) BeginCreateOrUpdate(ctx cont if err != nil { return nil, err } - return runtime.NewPoller[PartnerTopicEventSubscriptionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PartnerTopicEventSubscriptionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[PartnerTopicEventSubscriptionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PartnerTopicEventSubscriptionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -74,20 +78,26 @@ func (client *PartnerTopicEventSubscriptionsClient) BeginCreateOrUpdate(ctx cont // Existing event subscriptions will be updated with this API. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *PartnerTopicEventSubscriptionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription, options *PartnerTopicEventSubscriptionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "PartnerTopicEventSubscriptionsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName, eventSubscriptionInfo, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -114,16 +124,19 @@ func (client *PartnerTopicEventSubscriptionsClient) createOrUpdateCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, eventSubscriptionInfo) + if err := runtime.MarshalAsJSON(req, eventSubscriptionInfo); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete an existing event subscription of a partner topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerTopicName - Name of the partner topic. // - eventSubscriptionName - Name of the event subscription to be created. Event subscription names must be between 3 and 100 @@ -136,29 +149,40 @@ func (client *PartnerTopicEventSubscriptionsClient) BeginDelete(ctx context.Cont if err != nil { return nil, err } - return runtime.NewPoller[PartnerTopicEventSubscriptionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PartnerTopicEventSubscriptionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[PartnerTopicEventSubscriptionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PartnerTopicEventSubscriptionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Delete - Delete an existing event subscription of a partner topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *PartnerTopicEventSubscriptionsClient) deleteOperation(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, options *PartnerTopicEventSubscriptionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "PartnerTopicEventSubscriptionsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -185,7 +209,7 @@ func (client *PartnerTopicEventSubscriptionsClient) deleteCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -193,7 +217,7 @@ func (client *PartnerTopicEventSubscriptionsClient) deleteCreateRequest(ctx cont // Get - Get properties of an event subscription of a partner topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerTopicName - Name of the partner topic. // - eventSubscriptionName - Name of the event subscription to be found. Event subscription names must be between 3 and 100 @@ -201,18 +225,25 @@ func (client *PartnerTopicEventSubscriptionsClient) deleteCreateRequest(ctx cont // - options - PartnerTopicEventSubscriptionsClientGetOptions contains the optional parameters for the PartnerTopicEventSubscriptionsClient.Get // method. func (client *PartnerTopicEventSubscriptionsClient) Get(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, options *PartnerTopicEventSubscriptionsClientGetOptions) (PartnerTopicEventSubscriptionsClientGetResponse, error) { + var err error + const operationName = "PartnerTopicEventSubscriptionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName, options) if err != nil { return PartnerTopicEventSubscriptionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PartnerTopicEventSubscriptionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerTopicEventSubscriptionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PartnerTopicEventSubscriptionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -239,7 +270,7 @@ func (client *PartnerTopicEventSubscriptionsClient) getCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -257,7 +288,7 @@ func (client *PartnerTopicEventSubscriptionsClient) getHandleResponse(resp *http // GetDeliveryAttributes - Get all delivery attributes for an event subscription of a partner topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerTopicName - Name of the partner topic. // - eventSubscriptionName - Name of the event subscription to be created. Event subscription names must be between 3 and 100 @@ -265,18 +296,25 @@ func (client *PartnerTopicEventSubscriptionsClient) getHandleResponse(resp *http // - options - PartnerTopicEventSubscriptionsClientGetDeliveryAttributesOptions contains the optional parameters for the PartnerTopicEventSubscriptionsClient.GetDeliveryAttributes // method. func (client *PartnerTopicEventSubscriptionsClient) GetDeliveryAttributes(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, options *PartnerTopicEventSubscriptionsClientGetDeliveryAttributesOptions) (PartnerTopicEventSubscriptionsClientGetDeliveryAttributesResponse, error) { + var err error + const operationName = "PartnerTopicEventSubscriptionsClient.GetDeliveryAttributes" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getDeliveryAttributesCreateRequest(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName, options) if err != nil { return PartnerTopicEventSubscriptionsClientGetDeliveryAttributesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PartnerTopicEventSubscriptionsClientGetDeliveryAttributesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerTopicEventSubscriptionsClientGetDeliveryAttributesResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PartnerTopicEventSubscriptionsClientGetDeliveryAttributesResponse{}, err } - return client.getDeliveryAttributesHandleResponse(resp) + resp, err := client.getDeliveryAttributesHandleResponse(httpResp) + return resp, err } // getDeliveryAttributesCreateRequest creates the GetDeliveryAttributes request. @@ -303,7 +341,7 @@ func (client *PartnerTopicEventSubscriptionsClient) getDeliveryAttributesCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -321,7 +359,7 @@ func (client *PartnerTopicEventSubscriptionsClient) getDeliveryAttributesHandleR // GetFullURL - Get the full endpoint URL for an event subscription of a partner topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerTopicName - Name of the partner topic. // - eventSubscriptionName - Name of the event subscription to be created. Event subscription names must be between 3 and 100 @@ -329,18 +367,25 @@ func (client *PartnerTopicEventSubscriptionsClient) getDeliveryAttributesHandleR // - options - PartnerTopicEventSubscriptionsClientGetFullURLOptions contains the optional parameters for the PartnerTopicEventSubscriptionsClient.GetFullURL // method. func (client *PartnerTopicEventSubscriptionsClient) GetFullURL(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, options *PartnerTopicEventSubscriptionsClientGetFullURLOptions) (PartnerTopicEventSubscriptionsClientGetFullURLResponse, error) { + var err error + const operationName = "PartnerTopicEventSubscriptionsClient.GetFullURL" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getFullURLCreateRequest(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName, options) if err != nil { return PartnerTopicEventSubscriptionsClientGetFullURLResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PartnerTopicEventSubscriptionsClientGetFullURLResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerTopicEventSubscriptionsClientGetFullURLResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PartnerTopicEventSubscriptionsClientGetFullURLResponse{}, err } - return client.getFullURLHandleResponse(resp) + resp, err := client.getFullURLHandleResponse(httpResp) + return resp, err } // getFullURLCreateRequest creates the GetFullURL request. @@ -367,7 +412,7 @@ func (client *PartnerTopicEventSubscriptionsClient) getFullURLCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -384,7 +429,7 @@ func (client *PartnerTopicEventSubscriptionsClient) getFullURLHandleResponse(res // NewListByPartnerTopicPager - List event subscriptions that belong to a specific partner topic. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerTopicName - Name of the partner topic. // - options - PartnerTopicEventSubscriptionsClientListByPartnerTopicOptions contains the optional parameters for the PartnerTopicEventSubscriptionsClient.NewListByPartnerTopicPager @@ -395,25 +440,20 @@ func (client *PartnerTopicEventSubscriptionsClient) NewListByPartnerTopicPager(r return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *PartnerTopicEventSubscriptionsClientListByPartnerTopicResponse) (PartnerTopicEventSubscriptionsClientListByPartnerTopicResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByPartnerTopicCreateRequest(ctx, resourceGroupName, partnerTopicName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PartnerTopicEventSubscriptionsClient.NewListByPartnerTopicPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByPartnerTopicCreateRequest(ctx, resourceGroupName, partnerTopicName, options) + }, nil) if err != nil { return PartnerTopicEventSubscriptionsClientListByPartnerTopicResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PartnerTopicEventSubscriptionsClientListByPartnerTopicResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerTopicEventSubscriptionsClientListByPartnerTopicResponse{}, runtime.NewResponseError(resp) - } return client.listByPartnerTopicHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -437,7 +477,7 @@ func (client *PartnerTopicEventSubscriptionsClient) listByPartnerTopicCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -461,7 +501,7 @@ func (client *PartnerTopicEventSubscriptionsClient) listByPartnerTopicHandleResp // BeginUpdate - Update an existing event subscription of a partner topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerTopicName - Name of the partner topic. // - eventSubscriptionName - Name of the event subscription to be created. Event subscription names must be between 3 and 100 @@ -475,29 +515,40 @@ func (client *PartnerTopicEventSubscriptionsClient) BeginUpdate(ctx context.Cont if err != nil { return nil, err } - return runtime.NewPoller[PartnerTopicEventSubscriptionsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PartnerTopicEventSubscriptionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[PartnerTopicEventSubscriptionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PartnerTopicEventSubscriptionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Update - Update an existing event subscription of a partner topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *PartnerTopicEventSubscriptionsClient) update(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters, options *PartnerTopicEventSubscriptionsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "PartnerTopicEventSubscriptionsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName, eventSubscriptionUpdateParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -524,8 +575,11 @@ func (client *PartnerTopicEventSubscriptionsClient) updateCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, eventSubscriptionUpdateParameters) + if err := runtime.MarshalAsJSON(req, eventSubscriptionUpdateParameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/partnertopiceventsubscriptions_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/partnertopiceventsubscriptions_client_example_test.go index febc1b1aa5ca..2723e1c249b9 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/partnertopiceventsubscriptions_client_example_test.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/partnertopiceventsubscriptions_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerTopicEventSubscriptions_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerTopicEventSubscriptions_Get.json func ExamplePartnerTopicEventSubscriptionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -39,13 +39,13 @@ func ExamplePartnerTopicEventSubscriptionsClient_Get() { // res.EventSubscription = armeventgrid.EventSubscription{ // Name: to.Ptr("examplesubscription1"), // Type: to.Ptr("Microsoft.EventGrid/partnerTopics/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopic1/eventSubscriptions/examplesubscription1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopic1/eventSubscriptions/examplesubscription1"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.StorageQueueEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeStorageQueue), // Properties: &armeventgrid.StorageQueueEventSubscriptionDestinationProperties{ // QueueName: to.Ptr("que"), - // ResourceID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.Storage/storageAccounts/testtrackedsource"), + // ResourceID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.Storage/storageAccounts/testtrackedsource"), // }, // }, // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), @@ -65,12 +65,12 @@ func ExamplePartnerTopicEventSubscriptionsClient_Get() { // EventTimeToLiveInMinutes: to.Ptr[int32](1440), // MaxDeliveryAttempts: to.Ptr[int32](30), // }, - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopic1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopic1"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerTopicEventSubscriptions_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerTopicEventSubscriptions_CreateOrUpdate.json func ExamplePartnerTopicEventSubscriptionsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -109,7 +109,7 @@ func ExamplePartnerTopicEventSubscriptionsClient_BeginCreateOrUpdate() { // res.EventSubscription = armeventgrid.EventSubscription{ // Name: to.Ptr("exampleEventSubscriptionName1"), // Type: to.Ptr("Microsoft.EventGrid/partnerTopics/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopic1/eventSubscriptions/exampleEventSubscriptionName1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopic1/eventSubscriptions/exampleEventSubscriptionName1"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -128,12 +128,12 @@ func ExamplePartnerTopicEventSubscriptionsClient_BeginCreateOrUpdate() { // EventTimeToLiveInMinutes: to.Ptr[int32](1440), // MaxDeliveryAttempts: to.Ptr[int32](30), // }, - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopic1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopic1"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerTopicEventSubscriptions_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerTopicEventSubscriptions_Delete.json func ExamplePartnerTopicEventSubscriptionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -154,7 +154,7 @@ func ExamplePartnerTopicEventSubscriptionsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerTopicEventSubscriptions_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerTopicEventSubscriptions_Update.json func ExamplePartnerTopicEventSubscriptionsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -190,7 +190,7 @@ func ExamplePartnerTopicEventSubscriptionsClient_BeginUpdate() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerTopicEventSubscriptions_GetFullUrl.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerTopicEventSubscriptions_GetFullUrl.json func ExamplePartnerTopicEventSubscriptionsClient_GetFullURL() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -213,7 +213,7 @@ func ExamplePartnerTopicEventSubscriptionsClient_GetFullURL() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerTopicEventSubscriptions_ListByPartnerTopic.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerTopicEventSubscriptions_ListByPartnerTopic.json func ExamplePartnerTopicEventSubscriptionsClient_NewListByPartnerTopicPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -242,13 +242,13 @@ func ExamplePartnerTopicEventSubscriptionsClient_NewListByPartnerTopicPager() { // { // Name: to.Ptr("examplesubscription1"), // Type: to.Ptr("Microsoft.EventGrid/partnerTopics/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopic1/eventSubscriptions/examplesubscription1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopic1/eventSubscriptions/examplesubscription1"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.StorageQueueEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeStorageQueue), // Properties: &armeventgrid.StorageQueueEventSubscriptionDestinationProperties{ // QueueName: to.Ptr("que"), - // ResourceID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.Storage/storageAccounts/testtrackedsource"), + // ResourceID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.Storage/storageAccounts/testtrackedsource"), // }, // }, // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), @@ -263,19 +263,19 @@ func ExamplePartnerTopicEventSubscriptionsClient_NewListByPartnerTopicPager() { // EventTimeToLiveInMinutes: to.Ptr[int32](1440), // MaxDeliveryAttempts: to.Ptr[int32](10), // }, - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopic1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopic1"), // }, // }, // { // Name: to.Ptr("examplesubscription2"), // Type: to.Ptr("Microsoft.EventGrid/partnerTopics/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopic1/eventSubscriptions/examplesubscription2"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopic1/eventSubscriptions/examplesubscription2"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.StorageQueueEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeStorageQueue), // Properties: &armeventgrid.StorageQueueEventSubscriptionDestinationProperties{ // QueueName: to.Ptr("que"), - // ResourceID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.Storage/storageAccounts/testtrackedsource"), + // ResourceID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.Storage/storageAccounts/testtrackedsource"), // }, // }, // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), @@ -295,14 +295,14 @@ func ExamplePartnerTopicEventSubscriptionsClient_NewListByPartnerTopicPager() { // EventTimeToLiveInMinutes: to.Ptr[int32](1440), // MaxDeliveryAttempts: to.Ptr[int32](30), // }, - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopic1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopic1"), // }, // }}, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerTopicEventSubscriptions_GetDeliveryAttributes.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerTopicEventSubscriptions_GetDeliveryAttributes.json func ExamplePartnerTopicEventSubscriptionsClient_GetDeliveryAttributes() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/partnertopics_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/partnertopics_client.go index a3b9502ee296..d32ca57aa9ba 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/partnertopics_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/partnertopics_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid @@ -35,7 +34,7 @@ type PartnerTopicsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPartnerTopicsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PartnerTopicsClient, error) { - cl, err := arm.NewClient(moduleName+".PartnerTopicsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -49,23 +48,30 @@ func NewPartnerTopicsClient(subscriptionID string, credential azcore.TokenCreden // Activate - Activate a newly created partner topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerTopicName - Name of the partner topic. // - options - PartnerTopicsClientActivateOptions contains the optional parameters for the PartnerTopicsClient.Activate method. func (client *PartnerTopicsClient) Activate(ctx context.Context, resourceGroupName string, partnerTopicName string, options *PartnerTopicsClientActivateOptions) (PartnerTopicsClientActivateResponse, error) { + var err error + const operationName = "PartnerTopicsClient.Activate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.activateCreateRequest(ctx, resourceGroupName, partnerTopicName, options) if err != nil { return PartnerTopicsClientActivateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PartnerTopicsClientActivateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerTopicsClientActivateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PartnerTopicsClientActivateResponse{}, err } - return client.activateHandleResponse(resp) + resp, err := client.activateHandleResponse(httpResp) + return resp, err } // activateCreateRequest creates the Activate request. @@ -88,7 +94,7 @@ func (client *PartnerTopicsClient) activateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -106,25 +112,32 @@ func (client *PartnerTopicsClient) activateHandleResponse(resp *http.Response) ( // CreateOrUpdate - Asynchronously creates a new partner topic with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerTopicName - Name of the partner topic. // - partnerTopicInfo - Partner Topic information. // - options - PartnerTopicsClientCreateOrUpdateOptions contains the optional parameters for the PartnerTopicsClient.CreateOrUpdate // method. func (client *PartnerTopicsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerTopicName string, partnerTopicInfo PartnerTopic, options *PartnerTopicsClientCreateOrUpdateOptions) (PartnerTopicsClientCreateOrUpdateResponse, error) { + var err error + const operationName = "PartnerTopicsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, partnerTopicName, partnerTopicInfo, options) if err != nil { return PartnerTopicsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PartnerTopicsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return PartnerTopicsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return PartnerTopicsClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -147,10 +160,13 @@ func (client *PartnerTopicsClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, partnerTopicInfo) + if err := runtime.MarshalAsJSON(req, partnerTopicInfo); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -165,24 +181,31 @@ func (client *PartnerTopicsClient) createOrUpdateHandleResponse(resp *http.Respo // Deactivate - Deactivate specific partner topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerTopicName - Name of the partner topic. // - options - PartnerTopicsClientDeactivateOptions contains the optional parameters for the PartnerTopicsClient.Deactivate // method. func (client *PartnerTopicsClient) Deactivate(ctx context.Context, resourceGroupName string, partnerTopicName string, options *PartnerTopicsClientDeactivateOptions) (PartnerTopicsClientDeactivateResponse, error) { + var err error + const operationName = "PartnerTopicsClient.Deactivate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deactivateCreateRequest(ctx, resourceGroupName, partnerTopicName, options) if err != nil { return PartnerTopicsClientDeactivateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PartnerTopicsClientDeactivateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerTopicsClientDeactivateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PartnerTopicsClientDeactivateResponse{}, err } - return client.deactivateHandleResponse(resp) + resp, err := client.deactivateHandleResponse(httpResp) + return resp, err } // deactivateCreateRequest creates the Deactivate request. @@ -205,7 +228,7 @@ func (client *PartnerTopicsClient) deactivateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -223,7 +246,7 @@ func (client *PartnerTopicsClient) deactivateHandleResponse(resp *http.Response) // BeginDelete - Delete existing partner topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerTopicName - Name of the partner topic. // - options - PartnerTopicsClientBeginDeleteOptions contains the optional parameters for the PartnerTopicsClient.BeginDelete @@ -234,29 +257,40 @@ func (client *PartnerTopicsClient) BeginDelete(ctx context.Context, resourceGrou if err != nil { return nil, err } - return runtime.NewPoller[PartnerTopicsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PartnerTopicsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[PartnerTopicsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PartnerTopicsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Delete - Delete existing partner topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *PartnerTopicsClient) deleteOperation(ctx context.Context, resourceGroupName string, partnerTopicName string, options *PartnerTopicsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "PartnerTopicsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, partnerTopicName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -279,7 +313,7 @@ func (client *PartnerTopicsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -287,23 +321,30 @@ func (client *PartnerTopicsClient) deleteCreateRequest(ctx context.Context, reso // Get - Get properties of a partner topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerTopicName - Name of the partner topic. // - options - PartnerTopicsClientGetOptions contains the optional parameters for the PartnerTopicsClient.Get method. func (client *PartnerTopicsClient) Get(ctx context.Context, resourceGroupName string, partnerTopicName string, options *PartnerTopicsClientGetOptions) (PartnerTopicsClientGetResponse, error) { + var err error + const operationName = "PartnerTopicsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, partnerTopicName, options) if err != nil { return PartnerTopicsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PartnerTopicsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerTopicsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PartnerTopicsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -326,7 +367,7 @@ func (client *PartnerTopicsClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -343,7 +384,7 @@ func (client *PartnerTopicsClient) getHandleResponse(resp *http.Response) (Partn // NewListByResourceGroupPager - List all the partner topics under a resource group. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - options - PartnerTopicsClientListByResourceGroupOptions contains the optional parameters for the PartnerTopicsClient.NewListByResourceGroupPager // method. @@ -353,25 +394,20 @@ func (client *PartnerTopicsClient) NewListByResourceGroupPager(resourceGroupName return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *PartnerTopicsClientListByResourceGroupResponse) (PartnerTopicsClientListByResourceGroupResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return PartnerTopicsClientListByResourceGroupResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PartnerTopicsClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) if err != nil { return PartnerTopicsClientListByResourceGroupResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerTopicsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } return client.listByResourceGroupHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -391,7 +427,7 @@ func (client *PartnerTopicsClient) listByResourceGroupCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -414,7 +450,7 @@ func (client *PartnerTopicsClient) listByResourceGroupHandleResponse(resp *http. // NewListBySubscriptionPager - List all the partner topics under an Azure subscription. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - options - PartnerTopicsClientListBySubscriptionOptions contains the optional parameters for the PartnerTopicsClient.NewListBySubscriptionPager // method. func (client *PartnerTopicsClient) NewListBySubscriptionPager(options *PartnerTopicsClientListBySubscriptionOptions) *runtime.Pager[PartnerTopicsClientListBySubscriptionResponse] { @@ -423,25 +459,20 @@ func (client *PartnerTopicsClient) NewListBySubscriptionPager(options *PartnerTo return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *PartnerTopicsClientListBySubscriptionResponse) (PartnerTopicsClientListBySubscriptionResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listBySubscriptionCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return PartnerTopicsClientListBySubscriptionResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PartnerTopicsClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) if err != nil { return PartnerTopicsClientListBySubscriptionResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerTopicsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) - } return client.listBySubscriptionHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -457,7 +488,7 @@ func (client *PartnerTopicsClient) listBySubscriptionCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -481,24 +512,31 @@ func (client *PartnerTopicsClient) listBySubscriptionHandleResponse(resp *http.R // Update - Asynchronously updates a partner topic with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerTopicName - Name of the partner topic. // - partnerTopicUpdateParameters - PartnerTopic update information. // - options - PartnerTopicsClientUpdateOptions contains the optional parameters for the PartnerTopicsClient.Update method. func (client *PartnerTopicsClient) Update(ctx context.Context, resourceGroupName string, partnerTopicName string, partnerTopicUpdateParameters PartnerTopicUpdateParameters, options *PartnerTopicsClientUpdateOptions) (PartnerTopicsClientUpdateResponse, error) { + var err error + const operationName = "PartnerTopicsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, partnerTopicName, partnerTopicUpdateParameters, options) if err != nil { return PartnerTopicsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PartnerTopicsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return PartnerTopicsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return PartnerTopicsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -521,10 +559,13 @@ func (client *PartnerTopicsClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, partnerTopicUpdateParameters) + if err := runtime.MarshalAsJSON(req, partnerTopicUpdateParameters); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/partnertopics_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/partnertopics_client_example_test.go index 9cd7e203ab7a..1dfa46214b39 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/partnertopics_client_example_test.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/partnertopics_client_example_test.go @@ -20,7 +20,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerTopics_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerTopics_Get.json func ExamplePartnerTopicsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -41,7 +41,7 @@ func ExamplePartnerTopicsClient_Get() { // res.PartnerTopic = armeventgrid.PartnerTopic{ // Name: to.Ptr("examplePartnerTopicName1"), // Type: to.Ptr("Microsoft.EventGrid/partnerTopics"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopicName1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopicName1"), // Location: to.Ptr("centraluseuap"), // Properties: &armeventgrid.PartnerTopicProperties{ // ActivationState: to.Ptr(armeventgrid.PartnerTopicActivationStateNeverActivated), @@ -51,7 +51,7 @@ func ExamplePartnerTopicsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerTopics_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerTopics_CreateOrUpdate.json func ExamplePartnerTopicsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -81,7 +81,7 @@ func ExamplePartnerTopicsClient_CreateOrUpdate() { // res.PartnerTopic = armeventgrid.PartnerTopic{ // Name: to.Ptr("examplePartnerTopicName1"), // Type: to.Ptr("Microsoft.EventGrid/partnerTopics"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopicName1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopicName1"), // Location: to.Ptr("centraluseuap"), // Tags: map[string]*string{ // "tag1": to.Ptr("value1"), @@ -99,7 +99,7 @@ func ExamplePartnerTopicsClient_CreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerTopics_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerTopics_Delete.json func ExamplePartnerTopicsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -120,7 +120,7 @@ func ExamplePartnerTopicsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerTopics_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerTopics_Update.json func ExamplePartnerTopicsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -142,7 +142,7 @@ func ExamplePartnerTopicsClient_Update() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerTopics_ListBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerTopics_ListBySubscription.json func ExamplePartnerTopicsClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -171,7 +171,7 @@ func ExamplePartnerTopicsClient_NewListBySubscriptionPager() { // { // Name: to.Ptr("examplePartnerTopic1"), // Type: to.Ptr("Microsoft.EventGrid/partnerTopics"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/amh/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopic1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/amh/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopic1"), // Location: to.Ptr("centraluseuap"), // Properties: &armeventgrid.PartnerTopicProperties{ // ActivationState: to.Ptr(armeventgrid.PartnerTopicActivationStateNeverActivated), @@ -183,7 +183,7 @@ func ExamplePartnerTopicsClient_NewListBySubscriptionPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerTopics_ListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerTopics_ListByResourceGroup.json func ExamplePartnerTopicsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -212,7 +212,7 @@ func ExamplePartnerTopicsClient_NewListByResourceGroupPager() { // { // Name: to.Ptr("examplePartnerTopic1"), // Type: to.Ptr("Microsoft.EventGrid/partnerTopics"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/amh/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopic1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/amh/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopic1"), // Location: to.Ptr("centraluseuap"), // Properties: &armeventgrid.PartnerTopicProperties{ // ActivationState: to.Ptr(armeventgrid.PartnerTopicActivationStateNeverActivated), @@ -224,7 +224,7 @@ func ExamplePartnerTopicsClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerTopics_Activate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerTopics_Activate.json func ExamplePartnerTopicsClient_Activate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -245,7 +245,7 @@ func ExamplePartnerTopicsClient_Activate() { // res.PartnerTopic = armeventgrid.PartnerTopic{ // Name: to.Ptr("examplePartnerTopic1"), // Type: to.Ptr("Microsoft.EventGrid/partnerTopics"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopic1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopic1"), // Location: to.Ptr("centraluseuap"), // Properties: &armeventgrid.PartnerTopicProperties{ // ActivationState: to.Ptr(armeventgrid.PartnerTopicActivationStateActivated), @@ -255,7 +255,7 @@ func ExamplePartnerTopicsClient_Activate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PartnerTopics_Deactivate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PartnerTopics_Deactivate.json func ExamplePartnerTopicsClient_Deactivate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -276,7 +276,7 @@ func ExamplePartnerTopicsClient_Deactivate() { // res.PartnerTopic = armeventgrid.PartnerTopic{ // Name: to.Ptr("examplePartnerTopic1"), // Type: to.Ptr("Microsoft.EventGrid/partnerTopics"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopic1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerTopics/examplePartnerTopic1"), // Location: to.Ptr("centraluseuap"), // Properties: &armeventgrid.PartnerTopicProperties{ // ActivationState: to.Ptr(armeventgrid.PartnerTopicActivationStateDeactivated), diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/permissionbindings_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/permissionbindings_client.go deleted file mode 100644 index 2bb17aa1d5af..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/permissionbindings_client.go +++ /dev/null @@ -1,330 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armeventgrid - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strconv" - "strings" -) - -// PermissionBindingsClient contains the methods for the PermissionBindings group. -// Don't use this type directly, use NewPermissionBindingsClient() instead. -type PermissionBindingsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewPermissionBindingsClient creates a new instance of PermissionBindingsClient with the specified values. -// - subscriptionID - Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewPermissionBindingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PermissionBindingsClient, error) { - cl, err := arm.NewClient(moduleName+".PermissionBindingsClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PermissionBindingsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreateOrUpdate - Create or update a permission binding with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - permissionBindingName - The permission binding name. -// - permissionBindingInfo - Permission binding information. -// - options - PermissionBindingsClientBeginCreateOrUpdateOptions contains the optional parameters for the PermissionBindingsClient.BeginCreateOrUpdate -// method. -func (client *PermissionBindingsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, permissionBindingName string, permissionBindingInfo PermissionBinding, options *PermissionBindingsClientBeginCreateOrUpdateOptions) (*runtime.Poller[PermissionBindingsClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, namespaceName, permissionBindingName, permissionBindingInfo, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PermissionBindingsClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[PermissionBindingsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// CreateOrUpdate - Create or update a permission binding with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *PermissionBindingsClient) createOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, permissionBindingName string, permissionBindingInfo PermissionBinding, options *PermissionBindingsClientBeginCreateOrUpdateOptions) (*http.Response, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, namespaceName, permissionBindingName, permissionBindingInfo, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *PermissionBindingsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, permissionBindingName string, permissionBindingInfo PermissionBinding, options *PermissionBindingsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/permissionBindings/{permissionBindingName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if permissionBindingName == "" { - return nil, errors.New("parameter permissionBindingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{permissionBindingName}", url.PathEscape(permissionBindingName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, permissionBindingInfo) -} - -// BeginDelete - Delete an existing permission binding. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - permissionBindingName - Name of the permission binding. -// - options - PermissionBindingsClientBeginDeleteOptions contains the optional parameters for the PermissionBindingsClient.BeginDelete -// method. -func (client *PermissionBindingsClient) BeginDelete(ctx context.Context, resourceGroupName string, namespaceName string, permissionBindingName string, options *PermissionBindingsClientBeginDeleteOptions) (*runtime.Poller[PermissionBindingsClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, namespaceName, permissionBindingName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PermissionBindingsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[PermissionBindingsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Delete - Delete an existing permission binding. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *PermissionBindingsClient) deleteOperation(ctx context.Context, resourceGroupName string, namespaceName string, permissionBindingName string, options *PermissionBindingsClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, namespaceName, permissionBindingName, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *PermissionBindingsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, permissionBindingName string, options *PermissionBindingsClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/permissionBindings/{permissionBindingName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if permissionBindingName == "" { - return nil, errors.New("parameter permissionBindingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{permissionBindingName}", url.PathEscape(permissionBindingName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get properties of a permission binding. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - permissionBindingName - Name of the permission binding. -// - options - PermissionBindingsClientGetOptions contains the optional parameters for the PermissionBindingsClient.Get method. -func (client *PermissionBindingsClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, permissionBindingName string, options *PermissionBindingsClientGetOptions) (PermissionBindingsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, namespaceName, permissionBindingName, options) - if err != nil { - return PermissionBindingsClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PermissionBindingsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PermissionBindingsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *PermissionBindingsClient) getCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, permissionBindingName string, options *PermissionBindingsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/permissionBindings/{permissionBindingName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if permissionBindingName == "" { - return nil, errors.New("parameter permissionBindingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{permissionBindingName}", url.PathEscape(permissionBindingName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PermissionBindingsClient) getHandleResponse(resp *http.Response) (PermissionBindingsClientGetResponse, error) { - result := PermissionBindingsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PermissionBinding); err != nil { - return PermissionBindingsClientGetResponse{}, err - } - return result, nil -} - -// NewListByNamespacePager - Get all the permission bindings under a namespace. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - options - PermissionBindingsClientListByNamespaceOptions contains the optional parameters for the PermissionBindingsClient.NewListByNamespacePager -// method. -func (client *PermissionBindingsClient) NewListByNamespacePager(resourceGroupName string, namespaceName string, options *PermissionBindingsClientListByNamespaceOptions) *runtime.Pager[PermissionBindingsClientListByNamespaceResponse] { - return runtime.NewPager(runtime.PagingHandler[PermissionBindingsClientListByNamespaceResponse]{ - More: func(page PermissionBindingsClientListByNamespaceResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *PermissionBindingsClientListByNamespaceResponse) (PermissionBindingsClientListByNamespaceResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByNamespaceCreateRequest(ctx, resourceGroupName, namespaceName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return PermissionBindingsClientListByNamespaceResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PermissionBindingsClientListByNamespaceResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PermissionBindingsClientListByNamespaceResponse{}, runtime.NewResponseError(resp) - } - return client.listByNamespaceHandleResponse(resp) - }, - }) -} - -// listByNamespaceCreateRequest creates the ListByNamespace request. -func (client *PermissionBindingsClient) listByNamespaceCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, options *PermissionBindingsClientListByNamespaceOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/permissionBindings" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByNamespaceHandleResponse handles the ListByNamespace response. -func (client *PermissionBindingsClient) listByNamespaceHandleResponse(resp *http.Response) (PermissionBindingsClientListByNamespaceResponse, error) { - result := PermissionBindingsClientListByNamespaceResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PermissionBindingsListResult); err != nil { - return PermissionBindingsClientListByNamespaceResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/permissionbindings_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/permissionbindings_client_example_test.go deleted file mode 100644 index 0c08c9571cc4..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/permissionbindings_client_example_test.go +++ /dev/null @@ -1,153 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armeventgrid_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PermissionBindings_Get.json -func ExamplePermissionBindingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPermissionBindingsClient().Get(ctx, "examplerg", "exampleNamespaceName1", "examplePermissionBindingName1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PermissionBinding = armeventgrid.PermissionBinding{ - // Name: to.Ptr("examplePermissionBindingName1"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces/permissionBindings"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/exampleNamespaceName1/permissionBindings/examplePermissionBindingName1"), - // Properties: &armeventgrid.PermissionBindingProperties{ - // ClientGroupName: to.Ptr("exampleClientGroupName1"), - // Permission: to.Ptr(armeventgrid.PermissionTypePublisher), - // ProvisioningState: to.Ptr(armeventgrid.PermissionBindingProvisioningStateSucceeded), - // TopicSpaceName: to.Ptr("exampleTopicSpaceName1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PermissionBindings_CreateOrUpdate.json -func ExamplePermissionBindingsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPermissionBindingsClient().BeginCreateOrUpdate(ctx, "examplerg", "exampleNamespaceName1", "examplePermissionBindingName1", armeventgrid.PermissionBinding{ - Properties: &armeventgrid.PermissionBindingProperties{ - ClientGroupName: to.Ptr("exampleClientGroupName1"), - Permission: to.Ptr(armeventgrid.PermissionTypePublisher), - TopicSpaceName: to.Ptr("exampleTopicSpaceName1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PermissionBinding = armeventgrid.PermissionBinding{ - // Name: to.Ptr("examplePermissionBindingName1"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces/permissionBindings"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/exampleNamespaceName1/permissionBindings/examplePermissionBindingName1"), - // Properties: &armeventgrid.PermissionBindingProperties{ - // ClientGroupName: to.Ptr("exampleClientGroupName1"), - // Permission: to.Ptr(armeventgrid.PermissionTypePublisher), - // ProvisioningState: to.Ptr(armeventgrid.PermissionBindingProvisioningStateSucceeded), - // TopicSpaceName: to.Ptr("exampleTopicSpaceName1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PermissionBindings_Delete.json -func ExamplePermissionBindingsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPermissionBindingsClient().BeginDelete(ctx, "examplerg", "exampleNamespaceName1", "examplePermissionBindingName1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PermissionBindings_ListByNamespace.json -func ExamplePermissionBindingsClient_NewListByNamespacePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPermissionBindingsClient().NewListByNamespacePager("examplerg", "namespace123", &armeventgrid.PermissionBindingsClientListByNamespaceOptions{Filter: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PermissionBindingsListResult = armeventgrid.PermissionBindingsListResult{ - // Value: []*armeventgrid.PermissionBinding{ - // { - // Name: to.Ptr("examplePermissionBindingName1"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces/permissionBindings"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/exampleNamespaceName1/permissionBindings/examplePermissionBindingName1"), - // Properties: &armeventgrid.PermissionBindingProperties{ - // ClientGroupName: to.Ptr("exampleClientGroupName1"), - // Permission: to.Ptr(armeventgrid.PermissionTypePublisher), - // ProvisioningState: to.Ptr(armeventgrid.PermissionBindingProvisioningStateSucceeded), - // TopicSpaceName: to.Ptr("exampleTopicSpaceName1"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/polymorphic_helpers.go b/sdk/resourcemanager/eventgrid/armeventgrid/polymorphic_helpers.go index 7e5a9c17f4e9..c3bb1ac258c7 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/polymorphic_helpers.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/polymorphic_helpers.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid @@ -62,7 +61,10 @@ func unmarshalAdvancedFilterClassification(rawMsg json.RawMessage) (AdvancedFilt default: b = &AdvancedFilter{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalAdvancedFilterClassificationArray(rawMsg json.RawMessage) ([]AdvancedFilterClassification, error) { @@ -99,7 +101,10 @@ func unmarshalDeadLetterDestinationClassification(rawMsg json.RawMessage) (DeadL default: b = &DeadLetterDestination{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalDeliveryAttributeMappingClassification(rawMsg json.RawMessage) (DeliveryAttributeMappingClassification, error) { @@ -119,7 +124,10 @@ func unmarshalDeliveryAttributeMappingClassification(rawMsg json.RawMessage) (De default: b = &DeliveryAttributeMapping{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalDeliveryAttributeMappingClassificationArray(rawMsg json.RawMessage) ([]DeliveryAttributeMappingClassification, error) { @@ -157,8 +165,6 @@ func unmarshalEventSubscriptionDestinationClassification(rawMsg json.RawMessage) b = &EventHubEventSubscriptionDestination{} case string(EndpointTypeHybridConnection): b = &HybridConnectionEventSubscriptionDestination{} - case string(EndpointTypePartnerDestination): - b = &PartnerEventSubscriptionDestination{} case string(EndpointTypeServiceBusQueue): b = &ServiceBusQueueEventSubscriptionDestination{} case string(EndpointTypeServiceBusTopic): @@ -170,80 +176,10 @@ func unmarshalEventSubscriptionDestinationClassification(rawMsg json.RawMessage) default: b = &EventSubscriptionDestination{} } - return b, json.Unmarshal(rawMsg, b) -} - -func unmarshalFilterClassification(rawMsg json.RawMessage) (FilterClassification, error) { - if rawMsg == nil { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { + if err := json.Unmarshal(rawMsg, b); err != nil { return nil, err } - var b FilterClassification - switch m["operatorType"] { - case string(FilterOperatorTypeBoolEquals): - b = &BoolEqualsFilter{} - case string(FilterOperatorTypeIsNotNull): - b = &IsNotNullFilter{} - case string(FilterOperatorTypeIsNullOrUndefined): - b = &IsNullOrUndefinedFilter{} - case string(FilterOperatorTypeNumberGreaterThan): - b = &NumberGreaterThanFilter{} - case string(FilterOperatorTypeNumberGreaterThanOrEquals): - b = &NumberGreaterThanOrEqualsFilter{} - case string(FilterOperatorTypeNumberIn): - b = &NumberInFilter{} - case string(FilterOperatorTypeNumberInRange): - b = &NumberInRangeFilter{} - case string(FilterOperatorTypeNumberLessThan): - b = &NumberLessThanFilter{} - case string(FilterOperatorTypeNumberLessThanOrEquals): - b = &NumberLessThanOrEqualsFilter{} - case string(FilterOperatorTypeNumberNotIn): - b = &NumberNotInFilter{} - case string(FilterOperatorTypeNumberNotInRange): - b = &NumberNotInRangeFilter{} - case string(FilterOperatorTypeStringBeginsWith): - b = &StringBeginsWithFilter{} - case string(FilterOperatorTypeStringContains): - b = &StringContainsFilter{} - case string(FilterOperatorTypeStringEndsWith): - b = &StringEndsWithFilter{} - case string(FilterOperatorTypeStringIn): - b = &StringInFilter{} - case string(FilterOperatorTypeStringNotBeginsWith): - b = &StringNotBeginsWithFilter{} - case string(FilterOperatorTypeStringNotContains): - b = &StringNotContainsFilter{} - case string(FilterOperatorTypeStringNotEndsWith): - b = &StringNotEndsWithFilter{} - case string(FilterOperatorTypeStringNotIn): - b = &StringNotInFilter{} - default: - b = &Filter{} - } - return b, json.Unmarshal(rawMsg, b) -} - -func unmarshalFilterClassificationArray(rawMsg json.RawMessage) ([]FilterClassification, error) { - if rawMsg == nil { - return nil, nil - } - var rawMessages []json.RawMessage - if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { - return nil, err - } - fArray := make([]FilterClassification, len(rawMessages)) - for index, rawMessage := range rawMessages { - f, err := unmarshalFilterClassification(rawMessage) - if err != nil { - return nil, err - } - fArray[index] = f - } - return fArray, nil + return b, nil } func unmarshalInputSchemaMappingClassification(rawMsg json.RawMessage) (InputSchemaMappingClassification, error) { @@ -261,59 +197,8 @@ func unmarshalInputSchemaMappingClassification(rawMsg json.RawMessage) (InputSch default: b = &InputSchemaMapping{} } - return b, json.Unmarshal(rawMsg, b) -} - -func unmarshalPartnerClientAuthenticationClassification(rawMsg json.RawMessage) (PartnerClientAuthenticationClassification, error) { - if rawMsg == nil { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b PartnerClientAuthenticationClassification - switch m["clientAuthenticationType"] { - case string(PartnerClientAuthenticationTypeAzureAD): - b = &AzureADPartnerClientAuthentication{} - default: - b = &PartnerClientAuthentication{} - } - return b, json.Unmarshal(rawMsg, b) -} - -func unmarshalPartnerDestinationInfoClassification(rawMsg json.RawMessage) (PartnerDestinationInfoClassification, error) { - if rawMsg == nil { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b PartnerDestinationInfoClassification - switch m["endpointType"] { - case string(PartnerEndpointTypeWebHook): - b = &WebhookPartnerDestinationInfo{} - default: - b = &PartnerDestinationInfo{} - } - return b, json.Unmarshal(rawMsg, b) -} - -func unmarshalPartnerUpdateDestinationInfoClassification(rawMsg json.RawMessage) (PartnerUpdateDestinationInfoClassification, error) { - if rawMsg == nil { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { + if err := json.Unmarshal(rawMsg, b); err != nil { return nil, err } - var b PartnerUpdateDestinationInfoClassification - switch m["endpointType"] { - case string(PartnerEndpointTypeWebHook): - b = &WebhookUpdatePartnerDestinationInfo{} - default: - b = &PartnerUpdateDestinationInfo{} - } - return b, json.Unmarshal(rawMsg, b) + return b, nil } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/privateendpointconnections_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/privateendpointconnections_client.go index bb5870097b9c..e2a79a7a665d 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/privateendpointconnections_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/privateendpointconnections_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid @@ -35,7 +34,7 @@ type PrivateEndpointConnectionsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { - cl, err := arm.NewClient(moduleName+".PrivateEndpointConnectionsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -46,14 +45,13 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor return client, nil } -// BeginDelete - Delete a specific private endpoint connection under a topic, domain, or partner namespace or namespace. +// BeginDelete - Delete a specific private endpoint connection under a topic, domain, or partner namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. -// - parentType - The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\' or \'namespaces\'. -// - parentName - The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or -// namespace name). +// - parentType - The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\'. +// - parentName - The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name). // - privateEndpointConnectionName - The name of the private endpoint connection connection. // - options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete // method. @@ -63,29 +61,40 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[PrivateEndpointConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateEndpointConnectionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } -// Delete - Delete a specific private endpoint connection under a topic, domain, or partner namespace or namespace. +// Delete - Delete a specific private endpoint connection under a topic, domain, or partner namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, parentType PrivateEndpointConnectionsParentType, parentName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, parentType, parentName, privateEndpointConnectionName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -116,35 +125,41 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } -// Get - Get a specific private endpoint connection under a topic, domain, or partner namespace or namespace. +// Get - Get a specific private endpoint connection under a topic, domain, or partner namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. -// - parentType - The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\' or \'namespaces\'. -// - parentName - The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or -// namespace name). +// - parentType - The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\'. +// - parentName - The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name). // - privateEndpointConnectionName - The name of the private endpoint connection connection. // - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get // method. func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, parentType PrivateEndpointConnectionsParentType, parentName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, parentType, parentName, privateEndpointConnectionName, options) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -175,7 +190,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -190,13 +205,12 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res return result, nil } -// NewListByResourcePager - Get all private endpoint connections under a topic, domain, or partner namespace or namespace. +// NewListByResourcePager - Get all private endpoint connections under a topic, domain, or partner namespace. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. -// - parentType - The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\' or \'namespaces\'. -// - parentName - The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or -// namespace name). +// - parentType - The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\'. +// - parentName - The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name). // - options - PrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByResourcePager // method. func (client *PrivateEndpointConnectionsClient) NewListByResourcePager(resourceGroupName string, parentType PrivateEndpointConnectionsParentType, parentName string, options *PrivateEndpointConnectionsClientListByResourceOptions) *runtime.Pager[PrivateEndpointConnectionsClientListByResourceResponse] { @@ -205,25 +219,20 @@ func (client *PrivateEndpointConnectionsClient) NewListByResourcePager(resourceG return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsClientListByResourceResponse) (PrivateEndpointConnectionsClientListByResourceResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByResourceCreateRequest(ctx, resourceGroupName, parentType, parentName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return PrivateEndpointConnectionsClientListByResourceResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateEndpointConnectionsClient.NewListByResourcePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceCreateRequest(ctx, resourceGroupName, parentType, parentName, options) + }, nil) if err != nil { return PrivateEndpointConnectionsClientListByResourceResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionsClientListByResourceResponse{}, runtime.NewResponseError(resp) - } return client.listByResourceHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -251,7 +260,7 @@ func (client *PrivateEndpointConnectionsClient) listByResourceCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -275,11 +284,10 @@ func (client *PrivateEndpointConnectionsClient) listByResourceHandleResponse(res // BeginUpdate - Update a specific private endpoint connection under a topic, domain or partner namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. -// - parentType - The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\' or \'namespaces\'. -// - parentName - The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or -// namespace name). +// - parentType - The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\'. +// - parentName - The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name). // - privateEndpointConnectionName - The name of the private endpoint connection connection. // - privateEndpointConnection - The private endpoint connection object to update. // - options - PrivateEndpointConnectionsClientBeginUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginUpdate @@ -290,29 +298,40 @@ func (client *PrivateEndpointConnectionsClient) BeginUpdate(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[PrivateEndpointConnectionsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateEndpointConnectionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Update - Update a specific private endpoint connection under a topic, domain or partner namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *PrivateEndpointConnectionsClient) update(ctx context.Context, resourceGroupName string, parentType PrivateEndpointConnectionsParentType, parentName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, parentType, parentName, privateEndpointConnectionName, privateEndpointConnection, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -343,8 +362,11 @@ func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, privateEndpointConnection) + if err := runtime.MarshalAsJSON(req, privateEndpointConnection); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/privateendpointconnections_client_example_test.go index 56ef21f753f2..972dd1f8225c 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/privateendpointconnections_client_example_test.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/privateendpointconnections_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PrivateEndpointConnections_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PrivateEndpointConnections_Get.json func ExamplePrivateEndpointConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -39,12 +39,12 @@ func ExamplePrivateEndpointConnectionsClient_Get() { // res.PrivateEndpointConnection = armeventgrid.PrivateEndpointConnection{ // Name: to.Ptr("BMTPE5.8A30D251-4C61-489D-A1AA-B37C4A329B8B"), // Type: to.Ptr("Microsoft.EventGrid/topics/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1/privateEndpointConnections/BMTPE5.8A30D251-4C61-489D-A1AA-B37C4A329B8B"), + // ID: to.Ptr("/subscriptions/5B4B650E-28B9-4790-B3AB-DDBD88D727C4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1/privateEndpointConnections/BMTPE5.8A30D251-4C61-489D-A1AA-B37C4A329B8B"), // Properties: &armeventgrid.PrivateEndpointConnectionProperties{ // GroupIDs: []*string{ // to.Ptr("topic")}, // PrivateEndpoint: &armeventgrid.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.Network/privateEndpoints/bmtpe5"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.Network/privateEndpoints/bmtpe5"), // }, // PrivateLinkServiceConnectionState: &armeventgrid.ConnectionState{ // Description: to.Ptr("Test"), @@ -56,7 +56,7 @@ func ExamplePrivateEndpointConnectionsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PrivateEndpointConnections_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PrivateEndpointConnections_Update.json func ExamplePrivateEndpointConnectionsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -89,12 +89,12 @@ func ExamplePrivateEndpointConnectionsClient_BeginUpdate() { // res.PrivateEndpointConnection = armeventgrid.PrivateEndpointConnection{ // Name: to.Ptr("BMTPE5.8A30D251-4C61-489D-A1AA-B37C4A329B8B"), // Type: to.Ptr("Microsoft.EventGrid/topics/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1/privateEndpointConnections/BMTPE5.8A30D251-4C61-489D-A1AA-B37C4A329B8B"), + // ID: to.Ptr("/subscriptions/5B4B650E-28B9-4790-B3AB-DDBD88D727C4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1/privateEndpointConnections/BMTPE5.8A30D251-4C61-489D-A1AA-B37C4A329B8B"), // Properties: &armeventgrid.PrivateEndpointConnectionProperties{ // GroupIDs: []*string{ // to.Ptr("topic")}, // PrivateEndpoint: &armeventgrid.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.Network/privateEndpoints/bmtpe5"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.Network/privateEndpoints/bmtpe5"), // }, // PrivateLinkServiceConnectionState: &armeventgrid.ConnectionState{ // Description: to.Ptr("approving connection"), @@ -106,7 +106,7 @@ func ExamplePrivateEndpointConnectionsClient_BeginUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PrivateEndpointConnections_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PrivateEndpointConnections_Delete.json func ExamplePrivateEndpointConnectionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -127,7 +127,7 @@ func ExamplePrivateEndpointConnectionsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PrivateEndpointConnections_ListByResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PrivateEndpointConnections_ListByResource.json func ExamplePrivateEndpointConnectionsClient_NewListByResourcePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -156,12 +156,12 @@ func ExamplePrivateEndpointConnectionsClient_NewListByResourcePager() { // { // Name: to.Ptr("BMTPE5.8A30D251-4C61-489D-A1AA-B37C4A329B8B"), // Type: to.Ptr("Microsoft.EventGrid/topics/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1/privateEndpointConnections/BMTPE5.8A30D251-4C61-489D-A1AA-B37C4A329B8B"), + // ID: to.Ptr("/subscriptions/5B4B650E-28B9-4790-B3AB-DDBD88D727C4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1/privateEndpointConnections/BMTPE5.8A30D251-4C61-489D-A1AA-B37C4A329B8B"), // Properties: &armeventgrid.PrivateEndpointConnectionProperties{ // GroupIDs: []*string{ // to.Ptr("topic")}, // PrivateEndpoint: &armeventgrid.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.Network/privateEndpoints/bmtpe5"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.Network/privateEndpoints/bmtpe5"), // }, // PrivateLinkServiceConnectionState: &armeventgrid.ConnectionState{ // Description: to.Ptr("Test"), diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/privatelinkresources_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/privatelinkresources_client.go index 5eb83cc33f63..a1f64a79e1d7 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/privatelinkresources_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/privatelinkresources_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid @@ -35,7 +34,7 @@ type PrivateLinkResourcesClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { - cl, err := arm.NewClient(moduleName+".PrivateLinkResourcesClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -49,27 +48,33 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // Get - Get properties of a private link resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. -// - parentType - The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\' or \'namespaces\'. -// - parentName - The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name or -// namespace name). -// - privateLinkResourceName - The name of private link resource will be either topic, domain, partnerNamespace or namespace. +// - parentType - The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\'. +// - parentName - The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name). +// - privateLinkResourceName - The name of private link resource. // - options - PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get // method. func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateLinkResourceName string, options *PrivateLinkResourcesClientGetOptions) (PrivateLinkResourcesClientGetResponse, error) { + var err error + const operationName = "PrivateLinkResourcesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, parentType, parentName, privateLinkResourceName, options) if err != nil { return PrivateLinkResourcesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkResourcesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateLinkResourcesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkResourcesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -100,7 +105,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -115,13 +120,12 @@ func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) return result, nil } -// NewListByResourcePager - List all the private link resources under a topic, domain, or partner namespace or namespace. +// NewListByResourcePager - List all the private link resources under a topic, domain, or partner namespace. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. -// - parentType - The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\' or \'namespaces\'. -// - parentName - The name of the parent resource (namely, either, the topic name, domain name, or partner namespace or namespace -// name). +// - parentType - The type of the parent resource. This can be either \'topics\', \'domains\', or \'partnerNamespaces\'. +// - parentName - The name of the parent resource (namely, either, the topic name, domain name, or partner namespace name). // - options - PrivateLinkResourcesClientListByResourceOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByResourcePager // method. func (client *PrivateLinkResourcesClient) NewListByResourcePager(resourceGroupName string, parentType string, parentName string, options *PrivateLinkResourcesClientListByResourceOptions) *runtime.Pager[PrivateLinkResourcesClientListByResourceResponse] { @@ -130,25 +134,20 @@ func (client *PrivateLinkResourcesClient) NewListByResourcePager(resourceGroupNa return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *PrivateLinkResourcesClientListByResourceResponse) (PrivateLinkResourcesClientListByResourceResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByResourceCreateRequest(ctx, resourceGroupName, parentType, parentName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateLinkResourcesClient.NewListByResourcePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceCreateRequest(ctx, resourceGroupName, parentType, parentName, options) + }, nil) if err != nil { return PrivateLinkResourcesClientListByResourceResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateLinkResourcesClientListByResourceResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateLinkResourcesClientListByResourceResponse{}, runtime.NewResponseError(resp) - } return client.listByResourceHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -176,7 +175,7 @@ func (client *PrivateLinkResourcesClient) listByResourceCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/privatelinkresources_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/privatelinkresources_client_example_test.go index dc47547ea069..fbb52424b132 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/privatelinkresources_client_example_test.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/privatelinkresources_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PrivateLinkResources_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PrivateLinkResources_Get.json func ExamplePrivateLinkResourcesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -38,7 +38,7 @@ func ExamplePrivateLinkResourcesClient_Get() { // res.PrivateLinkResource = armeventgrid.PrivateLinkResource{ // Name: to.Ptr("topic"), // Type: to.Ptr("Microsoft.EventGrid/topics/privateLinkResources"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/amh/providers/Microsoft.EventGrid/topics/exampletopic1/privateLinkResources/topic"), + // ID: to.Ptr("/subscriptions/5B4B650E-28B9-4790-B3AB-DDBD88D727C4/resourceGroups/amh/providers/Microsoft.EventGrid/topics/exampletopic1/privateLinkResources/topic"), // Properties: &armeventgrid.PrivateLinkResourceProperties{ // DisplayName: to.Ptr("Event Grid topic"), // GroupID: to.Ptr("topic"), @@ -50,7 +50,7 @@ func ExamplePrivateLinkResourcesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/PrivateLinkResources_ListByResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/PrivateLinkResources_ListByResource.json func ExamplePrivateLinkResourcesClient_NewListByResourcePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -79,7 +79,7 @@ func ExamplePrivateLinkResourcesClient_NewListByResourcePager() { // { // Name: to.Ptr("topic"), // Type: to.Ptr("Microsoft.EventGrid/topics/privateLinkResources"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/amh/providers/Microsoft.EventGrid/topics/exampletopic1/privateLinkResources/topic"), + // ID: to.Ptr("/subscriptions/5B4B650E-28B9-4790-B3AB-DDBD88D727C4/resourceGroups/amh/providers/Microsoft.EventGrid/topics/exampletopic1/privateLinkResources/topic"), // Properties: &armeventgrid.PrivateLinkResourceProperties{ // DisplayName: to.Ptr("Event Grid topic"), // GroupID: to.Ptr("topic"), diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/response_types.go b/sdk/resourcemanager/eventgrid/armeventgrid/response_types.go index 59d8330ca688..4f7a2bf05a1d 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/response_types.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/response_types.go @@ -3,34 +3,14 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid -// CaCertificatesClientCreateOrUpdateResponse contains the response from method CaCertificatesClient.BeginCreateOrUpdate. -type CaCertificatesClientCreateOrUpdateResponse struct { - CaCertificate -} - -// CaCertificatesClientDeleteResponse contains the response from method CaCertificatesClient.BeginDelete. -type CaCertificatesClientDeleteResponse struct { - // placeholder for future response values -} - -// CaCertificatesClientGetResponse contains the response from method CaCertificatesClient.Get. -type CaCertificatesClientGetResponse struct { - CaCertificate -} - -// CaCertificatesClientListByNamespaceResponse contains the response from method CaCertificatesClient.NewListByNamespacePager. -type CaCertificatesClientListByNamespaceResponse struct { - CaCertificatesListResult -} - // ChannelsClientCreateOrUpdateResponse contains the response from method ChannelsClient.CreateOrUpdate. type ChannelsClientCreateOrUpdateResponse struct { + // Channel info. Channel } @@ -41,16 +21,19 @@ type ChannelsClientDeleteResponse struct { // ChannelsClientGetFullURLResponse contains the response from method ChannelsClient.GetFullURL. type ChannelsClientGetFullURLResponse struct { + // Full endpoint url of an event subscription EventSubscriptionFullURL } // ChannelsClientGetResponse contains the response from method ChannelsClient.Get. type ChannelsClientGetResponse struct { + // Channel info. Channel } // ChannelsClientListByPartnerNamespaceResponse contains the response from method ChannelsClient.NewListByPartnerNamespacePager. type ChannelsClientListByPartnerNamespaceResponse struct { + // Result of the List Channels operation ChannelsListResult } @@ -59,48 +42,9 @@ type ChannelsClientUpdateResponse struct { // placeholder for future response values } -// ClientGroupsClientCreateOrUpdateResponse contains the response from method ClientGroupsClient.BeginCreateOrUpdate. -type ClientGroupsClientCreateOrUpdateResponse struct { - ClientGroup -} - -// ClientGroupsClientDeleteResponse contains the response from method ClientGroupsClient.BeginDelete. -type ClientGroupsClientDeleteResponse struct { - // placeholder for future response values -} - -// ClientGroupsClientGetResponse contains the response from method ClientGroupsClient.Get. -type ClientGroupsClientGetResponse struct { - ClientGroup -} - -// ClientGroupsClientListByNamespaceResponse contains the response from method ClientGroupsClient.NewListByNamespacePager. -type ClientGroupsClientListByNamespaceResponse struct { - ClientGroupsListResult -} - -// ClientsClientCreateOrUpdateResponse contains the response from method ClientsClient.BeginCreateOrUpdate. -type ClientsClientCreateOrUpdateResponse struct { - Client -} - -// ClientsClientDeleteResponse contains the response from method ClientsClient.BeginDelete. -type ClientsClientDeleteResponse struct { - // placeholder for future response values -} - -// ClientsClientGetResponse contains the response from method ClientsClient.Get. -type ClientsClientGetResponse struct { - Client -} - -// ClientsClientListByNamespaceResponse contains the response from method ClientsClient.NewListByNamespacePager. -type ClientsClientListByNamespaceResponse struct { - ClientsListResult -} - // DomainEventSubscriptionsClientCreateOrUpdateResponse contains the response from method DomainEventSubscriptionsClient.BeginCreateOrUpdate. type DomainEventSubscriptionsClientCreateOrUpdateResponse struct { + // Event Subscription EventSubscription } @@ -111,31 +55,37 @@ type DomainEventSubscriptionsClientDeleteResponse struct { // DomainEventSubscriptionsClientGetDeliveryAttributesResponse contains the response from method DomainEventSubscriptionsClient.GetDeliveryAttributes. type DomainEventSubscriptionsClientGetDeliveryAttributesResponse struct { + // Result of the Get delivery attributes operation. DeliveryAttributeListResult } // DomainEventSubscriptionsClientGetFullURLResponse contains the response from method DomainEventSubscriptionsClient.GetFullURL. type DomainEventSubscriptionsClientGetFullURLResponse struct { + // Full endpoint url of an event subscription EventSubscriptionFullURL } // DomainEventSubscriptionsClientGetResponse contains the response from method DomainEventSubscriptionsClient.Get. type DomainEventSubscriptionsClientGetResponse struct { + // Event Subscription EventSubscription } // DomainEventSubscriptionsClientListResponse contains the response from method DomainEventSubscriptionsClient.NewListPager. type DomainEventSubscriptionsClientListResponse struct { + // Result of the List EventSubscriptions operation EventSubscriptionsListResult } // DomainEventSubscriptionsClientUpdateResponse contains the response from method DomainEventSubscriptionsClient.BeginUpdate. type DomainEventSubscriptionsClientUpdateResponse struct { + // Event Subscription EventSubscription } // DomainTopicEventSubscriptionsClientCreateOrUpdateResponse contains the response from method DomainTopicEventSubscriptionsClient.BeginCreateOrUpdate. type DomainTopicEventSubscriptionsClientCreateOrUpdateResponse struct { + // Event Subscription EventSubscription } @@ -146,31 +96,37 @@ type DomainTopicEventSubscriptionsClientDeleteResponse struct { // DomainTopicEventSubscriptionsClientGetDeliveryAttributesResponse contains the response from method DomainTopicEventSubscriptionsClient.GetDeliveryAttributes. type DomainTopicEventSubscriptionsClientGetDeliveryAttributesResponse struct { + // Result of the Get delivery attributes operation. DeliveryAttributeListResult } // DomainTopicEventSubscriptionsClientGetFullURLResponse contains the response from method DomainTopicEventSubscriptionsClient.GetFullURL. type DomainTopicEventSubscriptionsClientGetFullURLResponse struct { + // Full endpoint url of an event subscription EventSubscriptionFullURL } // DomainTopicEventSubscriptionsClientGetResponse contains the response from method DomainTopicEventSubscriptionsClient.Get. type DomainTopicEventSubscriptionsClientGetResponse struct { + // Event Subscription EventSubscription } // DomainTopicEventSubscriptionsClientListResponse contains the response from method DomainTopicEventSubscriptionsClient.NewListPager. type DomainTopicEventSubscriptionsClientListResponse struct { + // Result of the List EventSubscriptions operation EventSubscriptionsListResult } // DomainTopicEventSubscriptionsClientUpdateResponse contains the response from method DomainTopicEventSubscriptionsClient.BeginUpdate. type DomainTopicEventSubscriptionsClientUpdateResponse struct { + // Event Subscription EventSubscription } // DomainTopicsClientCreateOrUpdateResponse contains the response from method DomainTopicsClient.BeginCreateOrUpdate. type DomainTopicsClientCreateOrUpdateResponse struct { + // Domain Topic. DomainTopic } @@ -181,16 +137,19 @@ type DomainTopicsClientDeleteResponse struct { // DomainTopicsClientGetResponse contains the response from method DomainTopicsClient.Get. type DomainTopicsClientGetResponse struct { + // Domain Topic. DomainTopic } // DomainTopicsClientListByDomainResponse contains the response from method DomainTopicsClient.NewListByDomainPager. type DomainTopicsClientListByDomainResponse struct { + // Result of the List Domain Topics operation. DomainTopicsListResult } // DomainsClientCreateOrUpdateResponse contains the response from method DomainsClient.BeginCreateOrUpdate. type DomainsClientCreateOrUpdateResponse struct { + // EventGrid Domain. Domain } @@ -201,36 +160,43 @@ type DomainsClientDeleteResponse struct { // DomainsClientGetResponse contains the response from method DomainsClient.Get. type DomainsClientGetResponse struct { + // EventGrid Domain. Domain } // DomainsClientListByResourceGroupResponse contains the response from method DomainsClient.NewListByResourceGroupPager. type DomainsClientListByResourceGroupResponse struct { + // Result of the List Domains operation. DomainsListResult } // DomainsClientListBySubscriptionResponse contains the response from method DomainsClient.NewListBySubscriptionPager. type DomainsClientListBySubscriptionResponse struct { + // Result of the List Domains operation. DomainsListResult } // DomainsClientListSharedAccessKeysResponse contains the response from method DomainsClient.ListSharedAccessKeys. type DomainsClientListSharedAccessKeysResponse struct { + // Shared access keys of the Domain. DomainSharedAccessKeys } // DomainsClientRegenerateKeyResponse contains the response from method DomainsClient.RegenerateKey. type DomainsClientRegenerateKeyResponse struct { + // Shared access keys of the Domain. DomainSharedAccessKeys } // DomainsClientUpdateResponse contains the response from method DomainsClient.BeginUpdate. type DomainsClientUpdateResponse struct { + // EventGrid Domain. Domain } // EventSubscriptionsClientCreateOrUpdateResponse contains the response from method EventSubscriptionsClient.BeginCreateOrUpdate. type EventSubscriptionsClientCreateOrUpdateResponse struct { + // Event Subscription EventSubscription } @@ -241,191 +207,109 @@ type EventSubscriptionsClientDeleteResponse struct { // EventSubscriptionsClientGetDeliveryAttributesResponse contains the response from method EventSubscriptionsClient.GetDeliveryAttributes. type EventSubscriptionsClientGetDeliveryAttributesResponse struct { + // Result of the Get delivery attributes operation. DeliveryAttributeListResult } // EventSubscriptionsClientGetFullURLResponse contains the response from method EventSubscriptionsClient.GetFullURL. type EventSubscriptionsClientGetFullURLResponse struct { + // Full endpoint url of an event subscription EventSubscriptionFullURL } // EventSubscriptionsClientGetResponse contains the response from method EventSubscriptionsClient.Get. type EventSubscriptionsClientGetResponse struct { + // Event Subscription EventSubscription } // EventSubscriptionsClientListByDomainTopicResponse contains the response from method EventSubscriptionsClient.NewListByDomainTopicPager. type EventSubscriptionsClientListByDomainTopicResponse struct { + // Result of the List EventSubscriptions operation EventSubscriptionsListResult } // EventSubscriptionsClientListByResourceResponse contains the response from method EventSubscriptionsClient.NewListByResourcePager. type EventSubscriptionsClientListByResourceResponse struct { + // Result of the List EventSubscriptions operation EventSubscriptionsListResult } // EventSubscriptionsClientListGlobalByResourceGroupForTopicTypeResponse contains the response from method EventSubscriptionsClient.NewListGlobalByResourceGroupForTopicTypePager. type EventSubscriptionsClientListGlobalByResourceGroupForTopicTypeResponse struct { + // Result of the List EventSubscriptions operation EventSubscriptionsListResult } // EventSubscriptionsClientListGlobalByResourceGroupResponse contains the response from method EventSubscriptionsClient.NewListGlobalByResourceGroupPager. type EventSubscriptionsClientListGlobalByResourceGroupResponse struct { + // Result of the List EventSubscriptions operation EventSubscriptionsListResult } // EventSubscriptionsClientListGlobalBySubscriptionForTopicTypeResponse contains the response from method EventSubscriptionsClient.NewListGlobalBySubscriptionForTopicTypePager. type EventSubscriptionsClientListGlobalBySubscriptionForTopicTypeResponse struct { + // Result of the List EventSubscriptions operation EventSubscriptionsListResult } // EventSubscriptionsClientListGlobalBySubscriptionResponse contains the response from method EventSubscriptionsClient.NewListGlobalBySubscriptionPager. type EventSubscriptionsClientListGlobalBySubscriptionResponse struct { + // Result of the List EventSubscriptions operation EventSubscriptionsListResult } // EventSubscriptionsClientListRegionalByResourceGroupForTopicTypeResponse contains the response from method EventSubscriptionsClient.NewListRegionalByResourceGroupForTopicTypePager. type EventSubscriptionsClientListRegionalByResourceGroupForTopicTypeResponse struct { + // Result of the List EventSubscriptions operation EventSubscriptionsListResult } // EventSubscriptionsClientListRegionalByResourceGroupResponse contains the response from method EventSubscriptionsClient.NewListRegionalByResourceGroupPager. type EventSubscriptionsClientListRegionalByResourceGroupResponse struct { + // Result of the List EventSubscriptions operation EventSubscriptionsListResult } // EventSubscriptionsClientListRegionalBySubscriptionForTopicTypeResponse contains the response from method EventSubscriptionsClient.NewListRegionalBySubscriptionForTopicTypePager. type EventSubscriptionsClientListRegionalBySubscriptionForTopicTypeResponse struct { + // Result of the List EventSubscriptions operation EventSubscriptionsListResult } // EventSubscriptionsClientListRegionalBySubscriptionResponse contains the response from method EventSubscriptionsClient.NewListRegionalBySubscriptionPager. type EventSubscriptionsClientListRegionalBySubscriptionResponse struct { + // Result of the List EventSubscriptions operation EventSubscriptionsListResult } // EventSubscriptionsClientUpdateResponse contains the response from method EventSubscriptionsClient.BeginUpdate. type EventSubscriptionsClientUpdateResponse struct { + // Event Subscription EventSubscription } // ExtensionTopicsClientGetResponse contains the response from method ExtensionTopicsClient.Get. type ExtensionTopicsClientGetResponse struct { + // Event grid Extension Topic. This is used for getting Event Grid related metrics for Azure resources. ExtensionTopic } -// NamespaceTopicEventSubscriptionsClientCreateOrUpdateResponse contains the response from method NamespaceTopicEventSubscriptionsClient.BeginCreateOrUpdate. -type NamespaceTopicEventSubscriptionsClientCreateOrUpdateResponse struct { - Subscription -} - -// NamespaceTopicEventSubscriptionsClientDeleteResponse contains the response from method NamespaceTopicEventSubscriptionsClient.BeginDelete. -type NamespaceTopicEventSubscriptionsClientDeleteResponse struct { - // placeholder for future response values -} - -// NamespaceTopicEventSubscriptionsClientGetResponse contains the response from method NamespaceTopicEventSubscriptionsClient.Get. -type NamespaceTopicEventSubscriptionsClientGetResponse struct { - Subscription -} - -// NamespaceTopicEventSubscriptionsClientListByNamespaceTopicResponse contains the response from method NamespaceTopicEventSubscriptionsClient.NewListByNamespaceTopicPager. -type NamespaceTopicEventSubscriptionsClientListByNamespaceTopicResponse struct { - SubscriptionsListResult -} - -// NamespaceTopicEventSubscriptionsClientUpdateResponse contains the response from method NamespaceTopicEventSubscriptionsClient.BeginUpdate. -type NamespaceTopicEventSubscriptionsClientUpdateResponse struct { - Subscription -} - -// NamespaceTopicsClientCreateOrUpdateResponse contains the response from method NamespaceTopicsClient.BeginCreateOrUpdate. -type NamespaceTopicsClientCreateOrUpdateResponse struct { - NamespaceTopic -} - -// NamespaceTopicsClientDeleteResponse contains the response from method NamespaceTopicsClient.BeginDelete. -type NamespaceTopicsClientDeleteResponse struct { - // placeholder for future response values -} - -// NamespaceTopicsClientGetResponse contains the response from method NamespaceTopicsClient.Get. -type NamespaceTopicsClientGetResponse struct { - NamespaceTopic -} - -// NamespaceTopicsClientListByNamespaceResponse contains the response from method NamespaceTopicsClient.NewListByNamespacePager. -type NamespaceTopicsClientListByNamespaceResponse struct { - NamespaceTopicsListResult -} - -// NamespaceTopicsClientListSharedAccessKeysResponse contains the response from method NamespaceTopicsClient.ListSharedAccessKeys. -type NamespaceTopicsClientListSharedAccessKeysResponse struct { - TopicSharedAccessKeys -} - -// NamespaceTopicsClientRegenerateKeyResponse contains the response from method NamespaceTopicsClient.BeginRegenerateKey. -type NamespaceTopicsClientRegenerateKeyResponse struct { - TopicSharedAccessKeys -} - -// NamespaceTopicsClientUpdateResponse contains the response from method NamespaceTopicsClient.BeginUpdate. -type NamespaceTopicsClientUpdateResponse struct { - NamespaceTopic -} - -// NamespacesClientCreateOrUpdateResponse contains the response from method NamespacesClient.BeginCreateOrUpdate. -type NamespacesClientCreateOrUpdateResponse struct { - Namespace -} - -// NamespacesClientDeleteResponse contains the response from method NamespacesClient.BeginDelete. -type NamespacesClientDeleteResponse struct { - // placeholder for future response values -} - -// NamespacesClientGetResponse contains the response from method NamespacesClient.Get. -type NamespacesClientGetResponse struct { - Namespace -} - -// NamespacesClientListByResourceGroupResponse contains the response from method NamespacesClient.NewListByResourceGroupPager. -type NamespacesClientListByResourceGroupResponse struct { - NamespacesListResult -} - -// NamespacesClientListBySubscriptionResponse contains the response from method NamespacesClient.NewListBySubscriptionPager. -type NamespacesClientListBySubscriptionResponse struct { - NamespacesListResult -} - -// NamespacesClientListSharedAccessKeysResponse contains the response from method NamespacesClient.ListSharedAccessKeys. -type NamespacesClientListSharedAccessKeysResponse struct { - NamespaceSharedAccessKeys -} - -// NamespacesClientRegenerateKeyResponse contains the response from method NamespacesClient.BeginRegenerateKey. -type NamespacesClientRegenerateKeyResponse struct { - NamespaceSharedAccessKeys -} - -// NamespacesClientUpdateResponse contains the response from method NamespacesClient.BeginUpdate. -type NamespacesClientUpdateResponse struct { - Namespace -} - // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // Result of the List Operations operation OperationsListResult } // PartnerConfigurationsClientAuthorizePartnerResponse contains the response from method PartnerConfigurationsClient.AuthorizePartner. type PartnerConfigurationsClientAuthorizePartnerResponse struct { + // Partner configuration information PartnerConfiguration } // PartnerConfigurationsClientCreateOrUpdateResponse contains the response from method PartnerConfigurationsClient.BeginCreateOrUpdate. type PartnerConfigurationsClientCreateOrUpdateResponse struct { + // Partner configuration information PartnerConfiguration } @@ -436,66 +320,37 @@ type PartnerConfigurationsClientDeleteResponse struct { // PartnerConfigurationsClientGetResponse contains the response from method PartnerConfigurationsClient.Get. type PartnerConfigurationsClientGetResponse struct { + // Partner configuration information PartnerConfiguration } // PartnerConfigurationsClientListByResourceGroupResponse contains the response from method PartnerConfigurationsClient.NewListByResourceGroupPager. type PartnerConfigurationsClientListByResourceGroupResponse struct { + // Result of the List partner configurations operation PartnerConfigurationsListResult } // PartnerConfigurationsClientListBySubscriptionResponse contains the response from method PartnerConfigurationsClient.NewListBySubscriptionPager. type PartnerConfigurationsClientListBySubscriptionResponse struct { + // Result of the List partner configurations operation PartnerConfigurationsListResult } // PartnerConfigurationsClientUnauthorizePartnerResponse contains the response from method PartnerConfigurationsClient.UnauthorizePartner. type PartnerConfigurationsClientUnauthorizePartnerResponse struct { + // Partner configuration information PartnerConfiguration } // PartnerConfigurationsClientUpdateResponse contains the response from method PartnerConfigurationsClient.BeginUpdate. type PartnerConfigurationsClientUpdateResponse struct { + // Partner configuration information PartnerConfiguration } -// PartnerDestinationsClientActivateResponse contains the response from method PartnerDestinationsClient.Activate. -type PartnerDestinationsClientActivateResponse struct { - PartnerDestination -} - -// PartnerDestinationsClientCreateOrUpdateResponse contains the response from method PartnerDestinationsClient.BeginCreateOrUpdate. -type PartnerDestinationsClientCreateOrUpdateResponse struct { - PartnerDestination -} - -// PartnerDestinationsClientDeleteResponse contains the response from method PartnerDestinationsClient.BeginDelete. -type PartnerDestinationsClientDeleteResponse struct { - // placeholder for future response values -} - -// PartnerDestinationsClientGetResponse contains the response from method PartnerDestinationsClient.Get. -type PartnerDestinationsClientGetResponse struct { - PartnerDestination -} - -// PartnerDestinationsClientListByResourceGroupResponse contains the response from method PartnerDestinationsClient.NewListByResourceGroupPager. -type PartnerDestinationsClientListByResourceGroupResponse struct { - PartnerDestinationsListResult -} - -// PartnerDestinationsClientListBySubscriptionResponse contains the response from method PartnerDestinationsClient.NewListBySubscriptionPager. -type PartnerDestinationsClientListBySubscriptionResponse struct { - PartnerDestinationsListResult -} - -// PartnerDestinationsClientUpdateResponse contains the response from method PartnerDestinationsClient.BeginUpdate. -type PartnerDestinationsClientUpdateResponse struct { - PartnerDestination -} - // PartnerNamespacesClientCreateOrUpdateResponse contains the response from method PartnerNamespacesClient.BeginCreateOrUpdate. type PartnerNamespacesClientCreateOrUpdateResponse struct { + // EventGrid Partner Namespace. PartnerNamespace } @@ -506,36 +361,43 @@ type PartnerNamespacesClientDeleteResponse struct { // PartnerNamespacesClientGetResponse contains the response from method PartnerNamespacesClient.Get. type PartnerNamespacesClientGetResponse struct { + // EventGrid Partner Namespace. PartnerNamespace } // PartnerNamespacesClientListByResourceGroupResponse contains the response from method PartnerNamespacesClient.NewListByResourceGroupPager. type PartnerNamespacesClientListByResourceGroupResponse struct { + // Result of the List Partner Namespaces operation PartnerNamespacesListResult } // PartnerNamespacesClientListBySubscriptionResponse contains the response from method PartnerNamespacesClient.NewListBySubscriptionPager. type PartnerNamespacesClientListBySubscriptionResponse struct { + // Result of the List Partner Namespaces operation PartnerNamespacesListResult } // PartnerNamespacesClientListSharedAccessKeysResponse contains the response from method PartnerNamespacesClient.ListSharedAccessKeys. type PartnerNamespacesClientListSharedAccessKeysResponse struct { + // Shared access keys of the partner namespace. PartnerNamespaceSharedAccessKeys } // PartnerNamespacesClientRegenerateKeyResponse contains the response from method PartnerNamespacesClient.RegenerateKey. type PartnerNamespacesClientRegenerateKeyResponse struct { + // Shared access keys of the partner namespace. PartnerNamespaceSharedAccessKeys } // PartnerNamespacesClientUpdateResponse contains the response from method PartnerNamespacesClient.BeginUpdate. type PartnerNamespacesClientUpdateResponse struct { + // EventGrid Partner Namespace. PartnerNamespace } // PartnerRegistrationsClientCreateOrUpdateResponse contains the response from method PartnerRegistrationsClient.BeginCreateOrUpdate. type PartnerRegistrationsClientCreateOrUpdateResponse struct { + // Information about a partner registration. PartnerRegistration } @@ -546,26 +408,31 @@ type PartnerRegistrationsClientDeleteResponse struct { // PartnerRegistrationsClientGetResponse contains the response from method PartnerRegistrationsClient.Get. type PartnerRegistrationsClientGetResponse struct { + // Information about a partner registration. PartnerRegistration } // PartnerRegistrationsClientListByResourceGroupResponse contains the response from method PartnerRegistrationsClient.NewListByResourceGroupPager. type PartnerRegistrationsClientListByResourceGroupResponse struct { + // Result of the List Partner Registrations operation. PartnerRegistrationsListResult } // PartnerRegistrationsClientListBySubscriptionResponse contains the response from method PartnerRegistrationsClient.NewListBySubscriptionPager. type PartnerRegistrationsClientListBySubscriptionResponse struct { + // Result of the List Partner Registrations operation. PartnerRegistrationsListResult } // PartnerRegistrationsClientUpdateResponse contains the response from method PartnerRegistrationsClient.BeginUpdate. type PartnerRegistrationsClientUpdateResponse struct { + // Information about a partner registration. PartnerRegistration } // PartnerTopicEventSubscriptionsClientCreateOrUpdateResponse contains the response from method PartnerTopicEventSubscriptionsClient.BeginCreateOrUpdate. type PartnerTopicEventSubscriptionsClientCreateOrUpdateResponse struct { + // Event Subscription EventSubscription } @@ -576,41 +443,49 @@ type PartnerTopicEventSubscriptionsClientDeleteResponse struct { // PartnerTopicEventSubscriptionsClientGetDeliveryAttributesResponse contains the response from method PartnerTopicEventSubscriptionsClient.GetDeliveryAttributes. type PartnerTopicEventSubscriptionsClientGetDeliveryAttributesResponse struct { + // Result of the Get delivery attributes operation. DeliveryAttributeListResult } // PartnerTopicEventSubscriptionsClientGetFullURLResponse contains the response from method PartnerTopicEventSubscriptionsClient.GetFullURL. type PartnerTopicEventSubscriptionsClientGetFullURLResponse struct { + // Full endpoint url of an event subscription EventSubscriptionFullURL } // PartnerTopicEventSubscriptionsClientGetResponse contains the response from method PartnerTopicEventSubscriptionsClient.Get. type PartnerTopicEventSubscriptionsClientGetResponse struct { + // Event Subscription EventSubscription } // PartnerTopicEventSubscriptionsClientListByPartnerTopicResponse contains the response from method PartnerTopicEventSubscriptionsClient.NewListByPartnerTopicPager. type PartnerTopicEventSubscriptionsClientListByPartnerTopicResponse struct { + // Result of the List EventSubscriptions operation EventSubscriptionsListResult } // PartnerTopicEventSubscriptionsClientUpdateResponse contains the response from method PartnerTopicEventSubscriptionsClient.BeginUpdate. type PartnerTopicEventSubscriptionsClientUpdateResponse struct { + // Event Subscription EventSubscription } // PartnerTopicsClientActivateResponse contains the response from method PartnerTopicsClient.Activate. type PartnerTopicsClientActivateResponse struct { + // Event Grid Partner Topic. PartnerTopic } // PartnerTopicsClientCreateOrUpdateResponse contains the response from method PartnerTopicsClient.CreateOrUpdate. type PartnerTopicsClientCreateOrUpdateResponse struct { + // Event Grid Partner Topic. PartnerTopic } // PartnerTopicsClientDeactivateResponse contains the response from method PartnerTopicsClient.Deactivate. type PartnerTopicsClientDeactivateResponse struct { + // Event Grid Partner Topic. PartnerTopic } @@ -621,44 +496,28 @@ type PartnerTopicsClientDeleteResponse struct { // PartnerTopicsClientGetResponse contains the response from method PartnerTopicsClient.Get. type PartnerTopicsClientGetResponse struct { + // Event Grid Partner Topic. PartnerTopic } // PartnerTopicsClientListByResourceGroupResponse contains the response from method PartnerTopicsClient.NewListByResourceGroupPager. type PartnerTopicsClientListByResourceGroupResponse struct { + // Result of the List Partner Topics operation. PartnerTopicsListResult } // PartnerTopicsClientListBySubscriptionResponse contains the response from method PartnerTopicsClient.NewListBySubscriptionPager. type PartnerTopicsClientListBySubscriptionResponse struct { + // Result of the List Partner Topics operation. PartnerTopicsListResult } // PartnerTopicsClientUpdateResponse contains the response from method PartnerTopicsClient.Update. type PartnerTopicsClientUpdateResponse struct { + // Event Grid Partner Topic. PartnerTopic } -// PermissionBindingsClientCreateOrUpdateResponse contains the response from method PermissionBindingsClient.BeginCreateOrUpdate. -type PermissionBindingsClientCreateOrUpdateResponse struct { - PermissionBinding -} - -// PermissionBindingsClientDeleteResponse contains the response from method PermissionBindingsClient.BeginDelete. -type PermissionBindingsClientDeleteResponse struct { - // placeholder for future response values -} - -// PermissionBindingsClientGetResponse contains the response from method PermissionBindingsClient.Get. -type PermissionBindingsClientGetResponse struct { - PermissionBinding -} - -// PermissionBindingsClientListByNamespaceResponse contains the response from method PermissionBindingsClient.NewListByNamespacePager. -type PermissionBindingsClientListByNamespaceResponse struct { - PermissionBindingsListResult -} - // PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.BeginDelete. type PrivateEndpointConnectionsClientDeleteResponse struct { // placeholder for future response values @@ -671,6 +530,7 @@ type PrivateEndpointConnectionsClientGetResponse struct { // PrivateEndpointConnectionsClientListByResourceResponse contains the response from method PrivateEndpointConnectionsClient.NewListByResourcePager. type PrivateEndpointConnectionsClientListByResourceResponse struct { + // Result of the list of all private endpoint connections operation. PrivateEndpointConnectionListResult } @@ -681,16 +541,19 @@ type PrivateEndpointConnectionsClientUpdateResponse struct { // PrivateLinkResourcesClientGetResponse contains the response from method PrivateLinkResourcesClient.Get. type PrivateLinkResourcesClientGetResponse struct { + // Information of the private link resource. PrivateLinkResource } // PrivateLinkResourcesClientListByResourceResponse contains the response from method PrivateLinkResourcesClient.NewListByResourcePager. type PrivateLinkResourcesClientListByResourceResponse struct { + // Result of the List private link resources operation. PrivateLinkResourcesListResult } // SystemTopicEventSubscriptionsClientCreateOrUpdateResponse contains the response from method SystemTopicEventSubscriptionsClient.BeginCreateOrUpdate. type SystemTopicEventSubscriptionsClientCreateOrUpdateResponse struct { + // Event Subscription EventSubscription } @@ -701,31 +564,37 @@ type SystemTopicEventSubscriptionsClientDeleteResponse struct { // SystemTopicEventSubscriptionsClientGetDeliveryAttributesResponse contains the response from method SystemTopicEventSubscriptionsClient.GetDeliveryAttributes. type SystemTopicEventSubscriptionsClientGetDeliveryAttributesResponse struct { + // Result of the Get delivery attributes operation. DeliveryAttributeListResult } // SystemTopicEventSubscriptionsClientGetFullURLResponse contains the response from method SystemTopicEventSubscriptionsClient.GetFullURL. type SystemTopicEventSubscriptionsClientGetFullURLResponse struct { + // Full endpoint url of an event subscription EventSubscriptionFullURL } // SystemTopicEventSubscriptionsClientGetResponse contains the response from method SystemTopicEventSubscriptionsClient.Get. type SystemTopicEventSubscriptionsClientGetResponse struct { + // Event Subscription EventSubscription } // SystemTopicEventSubscriptionsClientListBySystemTopicResponse contains the response from method SystemTopicEventSubscriptionsClient.NewListBySystemTopicPager. type SystemTopicEventSubscriptionsClientListBySystemTopicResponse struct { + // Result of the List EventSubscriptions operation EventSubscriptionsListResult } // SystemTopicEventSubscriptionsClientUpdateResponse contains the response from method SystemTopicEventSubscriptionsClient.BeginUpdate. type SystemTopicEventSubscriptionsClientUpdateResponse struct { + // Event Subscription EventSubscription } // SystemTopicsClientCreateOrUpdateResponse contains the response from method SystemTopicsClient.BeginCreateOrUpdate. type SystemTopicsClientCreateOrUpdateResponse struct { + // EventGrid System Topic. SystemTopic } @@ -736,26 +605,31 @@ type SystemTopicsClientDeleteResponse struct { // SystemTopicsClientGetResponse contains the response from method SystemTopicsClient.Get. type SystemTopicsClientGetResponse struct { + // EventGrid System Topic. SystemTopic } // SystemTopicsClientListByResourceGroupResponse contains the response from method SystemTopicsClient.NewListByResourceGroupPager. type SystemTopicsClientListByResourceGroupResponse struct { + // Result of the List System topics operation. SystemTopicsListResult } // SystemTopicsClientListBySubscriptionResponse contains the response from method SystemTopicsClient.NewListBySubscriptionPager. type SystemTopicsClientListBySubscriptionResponse struct { + // Result of the List System topics operation. SystemTopicsListResult } // SystemTopicsClientUpdateResponse contains the response from method SystemTopicsClient.BeginUpdate. type SystemTopicsClientUpdateResponse struct { + // EventGrid System Topic. SystemTopic } // TopicEventSubscriptionsClientCreateOrUpdateResponse contains the response from method TopicEventSubscriptionsClient.BeginCreateOrUpdate. type TopicEventSubscriptionsClientCreateOrUpdateResponse struct { + // Event Subscription EventSubscription } @@ -766,66 +640,55 @@ type TopicEventSubscriptionsClientDeleteResponse struct { // TopicEventSubscriptionsClientGetDeliveryAttributesResponse contains the response from method TopicEventSubscriptionsClient.GetDeliveryAttributes. type TopicEventSubscriptionsClientGetDeliveryAttributesResponse struct { + // Result of the Get delivery attributes operation. DeliveryAttributeListResult } // TopicEventSubscriptionsClientGetFullURLResponse contains the response from method TopicEventSubscriptionsClient.GetFullURL. type TopicEventSubscriptionsClientGetFullURLResponse struct { + // Full endpoint url of an event subscription EventSubscriptionFullURL } // TopicEventSubscriptionsClientGetResponse contains the response from method TopicEventSubscriptionsClient.Get. type TopicEventSubscriptionsClientGetResponse struct { + // Event Subscription EventSubscription } // TopicEventSubscriptionsClientListResponse contains the response from method TopicEventSubscriptionsClient.NewListPager. type TopicEventSubscriptionsClientListResponse struct { + // Result of the List EventSubscriptions operation EventSubscriptionsListResult } // TopicEventSubscriptionsClientUpdateResponse contains the response from method TopicEventSubscriptionsClient.BeginUpdate. type TopicEventSubscriptionsClientUpdateResponse struct { + // Event Subscription EventSubscription } -// TopicSpacesClientCreateOrUpdateResponse contains the response from method TopicSpacesClient.BeginCreateOrUpdate. -type TopicSpacesClientCreateOrUpdateResponse struct { - TopicSpace -} - -// TopicSpacesClientDeleteResponse contains the response from method TopicSpacesClient.BeginDelete. -type TopicSpacesClientDeleteResponse struct { - // placeholder for future response values -} - -// TopicSpacesClientGetResponse contains the response from method TopicSpacesClient.Get. -type TopicSpacesClientGetResponse struct { - TopicSpace -} - -// TopicSpacesClientListByNamespaceResponse contains the response from method TopicSpacesClient.NewListByNamespacePager. -type TopicSpacesClientListByNamespaceResponse struct { - TopicSpacesListResult -} - // TopicTypesClientGetResponse contains the response from method TopicTypesClient.Get. type TopicTypesClientGetResponse struct { + // Properties of a topic type info. TopicTypeInfo } // TopicTypesClientListEventTypesResponse contains the response from method TopicTypesClient.NewListEventTypesPager. type TopicTypesClientListEventTypesResponse struct { + // Result of the List Event Types operation EventTypesListResult } // TopicTypesClientListResponse contains the response from method TopicTypesClient.NewListPager. type TopicTypesClientListResponse struct { + // Result of the List Topic Types operation TopicTypesListResult } // TopicsClientCreateOrUpdateResponse contains the response from method TopicsClient.BeginCreateOrUpdate. type TopicsClientCreateOrUpdateResponse struct { + // EventGrid Topic Topic } @@ -836,45 +699,54 @@ type TopicsClientDeleteResponse struct { // TopicsClientGetResponse contains the response from method TopicsClient.Get. type TopicsClientGetResponse struct { + // EventGrid Topic Topic } // TopicsClientListByResourceGroupResponse contains the response from method TopicsClient.NewListByResourceGroupPager. type TopicsClientListByResourceGroupResponse struct { + // Result of the List Topics operation TopicsListResult } // TopicsClientListBySubscriptionResponse contains the response from method TopicsClient.NewListBySubscriptionPager. type TopicsClientListBySubscriptionResponse struct { + // Result of the List Topics operation TopicsListResult } // TopicsClientListEventTypesResponse contains the response from method TopicsClient.NewListEventTypesPager. type TopicsClientListEventTypesResponse struct { + // Result of the List Event Types operation EventTypesListResult } // TopicsClientListSharedAccessKeysResponse contains the response from method TopicsClient.ListSharedAccessKeys. type TopicsClientListSharedAccessKeysResponse struct { + // Shared access keys of the Topic TopicSharedAccessKeys } // TopicsClientRegenerateKeyResponse contains the response from method TopicsClient.BeginRegenerateKey. type TopicsClientRegenerateKeyResponse struct { + // Shared access keys of the Topic TopicSharedAccessKeys } // TopicsClientUpdateResponse contains the response from method TopicsClient.BeginUpdate. type TopicsClientUpdateResponse struct { + // EventGrid Topic Topic } // VerifiedPartnersClientGetResponse contains the response from method VerifiedPartnersClient.Get. type VerifiedPartnersClientGetResponse struct { + // Verified partner information VerifiedPartner } // VerifiedPartnersClientListResponse contains the response from method VerifiedPartnersClient.NewListPager. type VerifiedPartnersClientListResponse struct { + // Result of the List verified partners operation VerifiedPartnersListResult } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/systemtopiceventsubscriptions_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/systemtopiceventsubscriptions_client.go index 13ed65053d68..92b7275d4f9a 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/systemtopiceventsubscriptions_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/systemtopiceventsubscriptions_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid @@ -35,7 +34,7 @@ type SystemTopicEventSubscriptionsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewSystemTopicEventSubscriptionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SystemTopicEventSubscriptionsClient, error) { - cl, err := arm.NewClient(moduleName+".SystemTopicEventSubscriptionsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -50,7 +49,7 @@ func NewSystemTopicEventSubscriptionsClient(subscriptionID string, credential az // subscriptions will be updated with this API. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - systemTopicName - Name of the system topic. // - eventSubscriptionName - Name of the event subscription to be created. Event subscription names must be between 3 and 100 @@ -64,9 +63,14 @@ func (client *SystemTopicEventSubscriptionsClient) BeginCreateOrUpdate(ctx conte if err != nil { return nil, err } - return runtime.NewPoller[SystemTopicEventSubscriptionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SystemTopicEventSubscriptionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[SystemTopicEventSubscriptionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SystemTopicEventSubscriptionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -74,20 +78,26 @@ func (client *SystemTopicEventSubscriptionsClient) BeginCreateOrUpdate(ctx conte // subscriptions will be updated with this API. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *SystemTopicEventSubscriptionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription, options *SystemTopicEventSubscriptionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "SystemTopicEventSubscriptionsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, systemTopicName, eventSubscriptionName, eventSubscriptionInfo, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -114,16 +124,19 @@ func (client *SystemTopicEventSubscriptionsClient) createOrUpdateCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, eventSubscriptionInfo) + if err := runtime.MarshalAsJSON(req, eventSubscriptionInfo); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete an existing event subscription of a system topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - systemTopicName - Name of the system topic. // - eventSubscriptionName - Name of the event subscription to be created. Event subscription names must be between 3 and 100 @@ -136,29 +149,40 @@ func (client *SystemTopicEventSubscriptionsClient) BeginDelete(ctx context.Conte if err != nil { return nil, err } - return runtime.NewPoller[SystemTopicEventSubscriptionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SystemTopicEventSubscriptionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[SystemTopicEventSubscriptionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SystemTopicEventSubscriptionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Delete - Delete an existing event subscription of a system topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *SystemTopicEventSubscriptionsClient) deleteOperation(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, options *SystemTopicEventSubscriptionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "SystemTopicEventSubscriptionsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, systemTopicName, eventSubscriptionName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -185,7 +209,7 @@ func (client *SystemTopicEventSubscriptionsClient) deleteCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -193,7 +217,7 @@ func (client *SystemTopicEventSubscriptionsClient) deleteCreateRequest(ctx conte // Get - Get an event subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - systemTopicName - Name of the system topic. // - eventSubscriptionName - Name of the event subscription to be created. Event subscription names must be between 3 and 100 @@ -201,18 +225,25 @@ func (client *SystemTopicEventSubscriptionsClient) deleteCreateRequest(ctx conte // - options - SystemTopicEventSubscriptionsClientGetOptions contains the optional parameters for the SystemTopicEventSubscriptionsClient.Get // method. func (client *SystemTopicEventSubscriptionsClient) Get(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, options *SystemTopicEventSubscriptionsClientGetOptions) (SystemTopicEventSubscriptionsClientGetResponse, error) { + var err error + const operationName = "SystemTopicEventSubscriptionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, systemTopicName, eventSubscriptionName, options) if err != nil { return SystemTopicEventSubscriptionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SystemTopicEventSubscriptionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SystemTopicEventSubscriptionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SystemTopicEventSubscriptionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -239,7 +270,7 @@ func (client *SystemTopicEventSubscriptionsClient) getCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -257,7 +288,7 @@ func (client *SystemTopicEventSubscriptionsClient) getHandleResponse(resp *http. // GetDeliveryAttributes - Get all delivery attributes for an event subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - systemTopicName - Name of the system topic. // - eventSubscriptionName - Name of the event subscription to be created. Event subscription names must be between 3 and 100 @@ -265,18 +296,25 @@ func (client *SystemTopicEventSubscriptionsClient) getHandleResponse(resp *http. // - options - SystemTopicEventSubscriptionsClientGetDeliveryAttributesOptions contains the optional parameters for the SystemTopicEventSubscriptionsClient.GetDeliveryAttributes // method. func (client *SystemTopicEventSubscriptionsClient) GetDeliveryAttributes(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, options *SystemTopicEventSubscriptionsClientGetDeliveryAttributesOptions) (SystemTopicEventSubscriptionsClientGetDeliveryAttributesResponse, error) { + var err error + const operationName = "SystemTopicEventSubscriptionsClient.GetDeliveryAttributes" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getDeliveryAttributesCreateRequest(ctx, resourceGroupName, systemTopicName, eventSubscriptionName, options) if err != nil { return SystemTopicEventSubscriptionsClientGetDeliveryAttributesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SystemTopicEventSubscriptionsClientGetDeliveryAttributesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SystemTopicEventSubscriptionsClientGetDeliveryAttributesResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SystemTopicEventSubscriptionsClientGetDeliveryAttributesResponse{}, err } - return client.getDeliveryAttributesHandleResponse(resp) + resp, err := client.getDeliveryAttributesHandleResponse(httpResp) + return resp, err } // getDeliveryAttributesCreateRequest creates the GetDeliveryAttributes request. @@ -303,7 +341,7 @@ func (client *SystemTopicEventSubscriptionsClient) getDeliveryAttributesCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -321,7 +359,7 @@ func (client *SystemTopicEventSubscriptionsClient) getDeliveryAttributesHandleRe // GetFullURL - Get the full endpoint URL for an event subscription of a system topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - systemTopicName - Name of the system topic. // - eventSubscriptionName - Name of the event subscription to be created. Event subscription names must be between 3 and 100 @@ -329,18 +367,25 @@ func (client *SystemTopicEventSubscriptionsClient) getDeliveryAttributesHandleRe // - options - SystemTopicEventSubscriptionsClientGetFullURLOptions contains the optional parameters for the SystemTopicEventSubscriptionsClient.GetFullURL // method. func (client *SystemTopicEventSubscriptionsClient) GetFullURL(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, options *SystemTopicEventSubscriptionsClientGetFullURLOptions) (SystemTopicEventSubscriptionsClientGetFullURLResponse, error) { + var err error + const operationName = "SystemTopicEventSubscriptionsClient.GetFullURL" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getFullURLCreateRequest(ctx, resourceGroupName, systemTopicName, eventSubscriptionName, options) if err != nil { return SystemTopicEventSubscriptionsClientGetFullURLResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SystemTopicEventSubscriptionsClientGetFullURLResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SystemTopicEventSubscriptionsClientGetFullURLResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SystemTopicEventSubscriptionsClientGetFullURLResponse{}, err } - return client.getFullURLHandleResponse(resp) + resp, err := client.getFullURLHandleResponse(httpResp) + return resp, err } // getFullURLCreateRequest creates the GetFullURL request. @@ -367,7 +412,7 @@ func (client *SystemTopicEventSubscriptionsClient) getFullURLCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -384,7 +429,7 @@ func (client *SystemTopicEventSubscriptionsClient) getFullURLHandleResponse(resp // NewListBySystemTopicPager - List event subscriptions that belong to a specific system topic. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - systemTopicName - Name of the system topic. // - options - SystemTopicEventSubscriptionsClientListBySystemTopicOptions contains the optional parameters for the SystemTopicEventSubscriptionsClient.NewListBySystemTopicPager @@ -395,25 +440,20 @@ func (client *SystemTopicEventSubscriptionsClient) NewListBySystemTopicPager(res return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *SystemTopicEventSubscriptionsClientListBySystemTopicResponse) (SystemTopicEventSubscriptionsClientListBySystemTopicResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listBySystemTopicCreateRequest(ctx, resourceGroupName, systemTopicName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SystemTopicEventSubscriptionsClient.NewListBySystemTopicPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySystemTopicCreateRequest(ctx, resourceGroupName, systemTopicName, options) + }, nil) if err != nil { return SystemTopicEventSubscriptionsClientListBySystemTopicResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return SystemTopicEventSubscriptionsClientListBySystemTopicResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SystemTopicEventSubscriptionsClientListBySystemTopicResponse{}, runtime.NewResponseError(resp) - } return client.listBySystemTopicHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -437,7 +477,7 @@ func (client *SystemTopicEventSubscriptionsClient) listBySystemTopicCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -461,7 +501,7 @@ func (client *SystemTopicEventSubscriptionsClient) listBySystemTopicHandleRespon // BeginUpdate - Update an existing event subscription of a system topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - systemTopicName - Name of the system topic. // - eventSubscriptionName - Name of the event subscription to be created. Event subscription names must be between 3 and 100 @@ -475,29 +515,40 @@ func (client *SystemTopicEventSubscriptionsClient) BeginUpdate(ctx context.Conte if err != nil { return nil, err } - return runtime.NewPoller[SystemTopicEventSubscriptionsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SystemTopicEventSubscriptionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[SystemTopicEventSubscriptionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SystemTopicEventSubscriptionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Update - Update an existing event subscription of a system topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *SystemTopicEventSubscriptionsClient) update(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters, options *SystemTopicEventSubscriptionsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "SystemTopicEventSubscriptionsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, systemTopicName, eventSubscriptionName, eventSubscriptionUpdateParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -524,8 +575,11 @@ func (client *SystemTopicEventSubscriptionsClient) updateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, eventSubscriptionUpdateParameters) + if err := runtime.MarshalAsJSON(req, eventSubscriptionUpdateParameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/systemtopiceventsubscriptions_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/systemtopiceventsubscriptions_client_example_test.go index 5029df24dfa5..b5392925af70 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/systemtopiceventsubscriptions_client_example_test.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/systemtopiceventsubscriptions_client_example_test.go @@ -18,53 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/SystemTopicEventSubscriptions_GetDeliveryAttributes.json -func ExampleSystemTopicEventSubscriptionsClient_GetDeliveryAttributes() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSystemTopicEventSubscriptionsClient().GetDeliveryAttributes(ctx, "examplerg", "exampleSystemTopic1", "examplesubscription1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DeliveryAttributeListResult = armeventgrid.DeliveryAttributeListResult{ - // Value: []armeventgrid.DeliveryAttributeMappingClassification{ - // &armeventgrid.StaticDeliveryAttributeMapping{ - // Name: to.Ptr("header1"), - // Type: to.Ptr(armeventgrid.DeliveryAttributeMappingTypeStatic), - // Properties: &armeventgrid.StaticDeliveryAttributeMappingProperties{ - // IsSecret: to.Ptr(false), - // Value: to.Ptr("NormalValue"), - // }, - // }, - // &armeventgrid.DynamicDeliveryAttributeMapping{ - // Name: to.Ptr("header2"), - // Type: to.Ptr(armeventgrid.DeliveryAttributeMappingTypeDynamic), - // Properties: &armeventgrid.DynamicDeliveryAttributeMappingProperties{ - // SourceField: to.Ptr("data.foo"), - // }, - // }, - // &armeventgrid.StaticDeliveryAttributeMapping{ - // Name: to.Ptr("header3"), - // Type: to.Ptr(armeventgrid.DeliveryAttributeMappingTypeStatic), - // Properties: &armeventgrid.StaticDeliveryAttributeMappingProperties{ - // IsSecret: to.Ptr(true), - // Value: to.Ptr("mySecretValue"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/SystemTopicEventSubscriptions_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/SystemTopicEventSubscriptions_Get.json func ExampleSystemTopicEventSubscriptionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -85,13 +39,13 @@ func ExampleSystemTopicEventSubscriptionsClient_Get() { // res.EventSubscription = armeventgrid.EventSubscription{ // Name: to.Ptr("examplesubscription1"), // Type: to.Ptr("Microsoft.EventGrid/systemTopics/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/systemTopics/exampleSystemTopic1/eventSubscriptions/examplesubscription1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/systemTopics/exampleSystemTopic1/eventSubscriptions/examplesubscription1"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.StorageQueueEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeStorageQueue), // Properties: &armeventgrid.StorageQueueEventSubscriptionDestinationProperties{ // QueueName: to.Ptr("que"), - // ResourceID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.Storage/storageAccounts/testtrackedsource"), + // ResourceID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.Storage/storageAccounts/testtrackedsource"), // }, // }, // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), @@ -111,12 +65,12 @@ func ExampleSystemTopicEventSubscriptionsClient_Get() { // EventTimeToLiveInMinutes: to.Ptr[int32](1440), // MaxDeliveryAttempts: to.Ptr[int32](30), // }, - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/systemTopics/exampleSystemTopic1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/systemTopics/exampleSystemTopic1"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/SystemTopicEventSubscriptions_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/SystemTopicEventSubscriptions_CreateOrUpdate.json func ExampleSystemTopicEventSubscriptionsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -151,7 +105,7 @@ func ExampleSystemTopicEventSubscriptionsClient_BeginCreateOrUpdate() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/SystemTopicEventSubscriptions_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/SystemTopicEventSubscriptions_Delete.json func ExampleSystemTopicEventSubscriptionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -172,7 +126,7 @@ func ExampleSystemTopicEventSubscriptionsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/SystemTopicEventSubscriptions_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/SystemTopicEventSubscriptions_Update.json func ExampleSystemTopicEventSubscriptionsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -208,7 +162,7 @@ func ExampleSystemTopicEventSubscriptionsClient_BeginUpdate() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/SystemTopicEventSubscriptions_GetFullUrl.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/SystemTopicEventSubscriptions_GetFullUrl.json func ExampleSystemTopicEventSubscriptionsClient_GetFullURL() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -231,7 +185,7 @@ func ExampleSystemTopicEventSubscriptionsClient_GetFullURL() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/SystemTopicEventSubscriptions_ListBySystemTopic.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/SystemTopicEventSubscriptions_ListBySystemTopic.json func ExampleSystemTopicEventSubscriptionsClient_NewListBySystemTopicPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -260,13 +214,13 @@ func ExampleSystemTopicEventSubscriptionsClient_NewListBySystemTopicPager() { // { // Name: to.Ptr("examplesubscription1"), // Type: to.Ptr("Microsoft.EventGrid/systemTopics/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/systemTopics/exampleSystemTopic1/eventSubscriptions/examplesubscription1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/systemTopics/exampleSystemTopic1/eventSubscriptions/examplesubscription1"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.StorageQueueEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeStorageQueue), // Properties: &armeventgrid.StorageQueueEventSubscriptionDestinationProperties{ // QueueName: to.Ptr("que"), - // ResourceID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.Storage/storageAccounts/testtrackedsource"), + // ResourceID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.Storage/storageAccounts/testtrackedsource"), // }, // }, // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), @@ -281,19 +235,19 @@ func ExampleSystemTopicEventSubscriptionsClient_NewListBySystemTopicPager() { // EventTimeToLiveInMinutes: to.Ptr[int32](1440), // MaxDeliveryAttempts: to.Ptr[int32](10), // }, - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/systemTopics/exampleSystemTopic1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/systemTopics/exampleSystemTopic1"), // }, // }, // { // Name: to.Ptr("examplesubscription2"), // Type: to.Ptr("Microsoft.EventGrid/systemTopics/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/systemTopics/exampleSystemTopic1/eventSubscriptions/examplesubscription2"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/systemTopics/exampleSystemTopic1/eventSubscriptions/examplesubscription2"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.StorageQueueEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeStorageQueue), // Properties: &armeventgrid.StorageQueueEventSubscriptionDestinationProperties{ // QueueName: to.Ptr("que"), - // ResourceID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.Storage/storageAccounts/testtrackedsource"), + // ResourceID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.Storage/storageAccounts/testtrackedsource"), // }, // }, // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), @@ -313,9 +267,55 @@ func ExampleSystemTopicEventSubscriptionsClient_NewListBySystemTopicPager() { // EventTimeToLiveInMinutes: to.Ptr[int32](1440), // MaxDeliveryAttempts: to.Ptr[int32](30), // }, - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/systemTopics/exampleSystemTopic1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/systemTopics/exampleSystemTopic1"), // }, // }}, // } } } + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/SystemTopicEventSubscriptions_GetDeliveryAttributes.json +func ExampleSystemTopicEventSubscriptionsClient_GetDeliveryAttributes() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSystemTopicEventSubscriptionsClient().GetDeliveryAttributes(ctx, "examplerg", "exampleSystemTopic1", "examplesubscription1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.DeliveryAttributeListResult = armeventgrid.DeliveryAttributeListResult{ + // Value: []armeventgrid.DeliveryAttributeMappingClassification{ + // &armeventgrid.StaticDeliveryAttributeMapping{ + // Name: to.Ptr("header1"), + // Type: to.Ptr(armeventgrid.DeliveryAttributeMappingTypeStatic), + // Properties: &armeventgrid.StaticDeliveryAttributeMappingProperties{ + // IsSecret: to.Ptr(false), + // Value: to.Ptr("NormalValue"), + // }, + // }, + // &armeventgrid.DynamicDeliveryAttributeMapping{ + // Name: to.Ptr("header2"), + // Type: to.Ptr(armeventgrid.DeliveryAttributeMappingTypeDynamic), + // Properties: &armeventgrid.DynamicDeliveryAttributeMappingProperties{ + // SourceField: to.Ptr("data.foo"), + // }, + // }, + // &armeventgrid.StaticDeliveryAttributeMapping{ + // Name: to.Ptr("header3"), + // Type: to.Ptr(armeventgrid.DeliveryAttributeMappingTypeStatic), + // Properties: &armeventgrid.StaticDeliveryAttributeMappingProperties{ + // IsSecret: to.Ptr(true), + // Value: to.Ptr("mySecretValue"), + // }, + // }}, + // } +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/systemtopics_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/systemtopics_client.go index fcf92cb06b89..58c194ab727e 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/systemtopics_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/systemtopics_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid @@ -35,7 +34,7 @@ type SystemTopicsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewSystemTopicsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SystemTopicsClient, error) { - cl, err := arm.NewClient(moduleName+".SystemTopicsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -49,7 +48,7 @@ func NewSystemTopicsClient(subscriptionID string, credential azcore.TokenCredent // BeginCreateOrUpdate - Asynchronously creates a new system topic with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - systemTopicName - Name of the system topic. // - systemTopicInfo - System Topic information. @@ -61,29 +60,40 @@ func (client *SystemTopicsClient) BeginCreateOrUpdate(ctx context.Context, resou if err != nil { return nil, err } - return runtime.NewPoller[SystemTopicsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SystemTopicsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[SystemTopicsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SystemTopicsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // CreateOrUpdate - Asynchronously creates a new system topic with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *SystemTopicsClient) createOrUpdate(ctx context.Context, resourceGroupName string, systemTopicName string, systemTopicInfo SystemTopic, options *SystemTopicsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "SystemTopicsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, systemTopicName, systemTopicInfo, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -106,16 +116,19 @@ func (client *SystemTopicsClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, systemTopicInfo) + if err := runtime.MarshalAsJSON(req, systemTopicInfo); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete existing system topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - systemTopicName - Name of the system topic. // - options - SystemTopicsClientBeginDeleteOptions contains the optional parameters for the SystemTopicsClient.BeginDelete @@ -126,29 +139,40 @@ func (client *SystemTopicsClient) BeginDelete(ctx context.Context, resourceGroup if err != nil { return nil, err } - return runtime.NewPoller[SystemTopicsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SystemTopicsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[SystemTopicsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SystemTopicsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Delete - Delete existing system topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *SystemTopicsClient) deleteOperation(ctx context.Context, resourceGroupName string, systemTopicName string, options *SystemTopicsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "SystemTopicsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, systemTopicName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -171,7 +195,7 @@ func (client *SystemTopicsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -179,23 +203,30 @@ func (client *SystemTopicsClient) deleteCreateRequest(ctx context.Context, resou // Get - Get properties of a system topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - systemTopicName - Name of the system topic. // - options - SystemTopicsClientGetOptions contains the optional parameters for the SystemTopicsClient.Get method. func (client *SystemTopicsClient) Get(ctx context.Context, resourceGroupName string, systemTopicName string, options *SystemTopicsClientGetOptions) (SystemTopicsClientGetResponse, error) { + var err error + const operationName = "SystemTopicsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, systemTopicName, options) if err != nil { return SystemTopicsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SystemTopicsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SystemTopicsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SystemTopicsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -218,7 +249,7 @@ func (client *SystemTopicsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -235,7 +266,7 @@ func (client *SystemTopicsClient) getHandleResponse(resp *http.Response) (System // NewListByResourceGroupPager - List all the system topics under a resource group. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - options - SystemTopicsClientListByResourceGroupOptions contains the optional parameters for the SystemTopicsClient.NewListByResourceGroupPager // method. @@ -245,25 +276,20 @@ func (client *SystemTopicsClient) NewListByResourceGroupPager(resourceGroupName return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *SystemTopicsClientListByResourceGroupResponse) (SystemTopicsClientListByResourceGroupResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return SystemTopicsClientListByResourceGroupResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SystemTopicsClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) if err != nil { return SystemTopicsClientListByResourceGroupResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SystemTopicsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } return client.listByResourceGroupHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -283,7 +309,7 @@ func (client *SystemTopicsClient) listByResourceGroupCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -306,7 +332,7 @@ func (client *SystemTopicsClient) listByResourceGroupHandleResponse(resp *http.R // NewListBySubscriptionPager - List all the system topics under an Azure subscription. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - options - SystemTopicsClientListBySubscriptionOptions contains the optional parameters for the SystemTopicsClient.NewListBySubscriptionPager // method. func (client *SystemTopicsClient) NewListBySubscriptionPager(options *SystemTopicsClientListBySubscriptionOptions) *runtime.Pager[SystemTopicsClientListBySubscriptionResponse] { @@ -315,25 +341,20 @@ func (client *SystemTopicsClient) NewListBySubscriptionPager(options *SystemTopi return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *SystemTopicsClientListBySubscriptionResponse) (SystemTopicsClientListBySubscriptionResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listBySubscriptionCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SystemTopicsClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) if err != nil { return SystemTopicsClientListBySubscriptionResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return SystemTopicsClientListBySubscriptionResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SystemTopicsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) - } return client.listBySubscriptionHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -349,7 +370,7 @@ func (client *SystemTopicsClient) listBySubscriptionCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -373,7 +394,7 @@ func (client *SystemTopicsClient) listBySubscriptionHandleResponse(resp *http.Re // BeginUpdate - Asynchronously updates a system topic with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - systemTopicName - Name of the system topic. // - systemTopicUpdateParameters - SystemTopic update information. @@ -385,29 +406,40 @@ func (client *SystemTopicsClient) BeginUpdate(ctx context.Context, resourceGroup if err != nil { return nil, err } - return runtime.NewPoller[SystemTopicsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SystemTopicsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[SystemTopicsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SystemTopicsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Update - Asynchronously updates a system topic with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *SystemTopicsClient) update(ctx context.Context, resourceGroupName string, systemTopicName string, systemTopicUpdateParameters SystemTopicUpdateParameters, options *SystemTopicsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "SystemTopicsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, systemTopicName, systemTopicUpdateParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -430,8 +462,11 @@ func (client *SystemTopicsClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, systemTopicUpdateParameters) + if err := runtime.MarshalAsJSON(req, systemTopicUpdateParameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/systemtopics_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/systemtopics_client_example_test.go index 703e5527b2dc..52ad6ee52239 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/systemtopics_client_example_test.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/systemtopics_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/SystemTopics_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/SystemTopics_Get.json func ExampleSystemTopicsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -39,18 +39,18 @@ func ExampleSystemTopicsClient_Get() { // res.SystemTopic = armeventgrid.SystemTopic{ // Name: to.Ptr("exampleSystemTopic2"), // Type: to.Ptr("Microsoft.EventGrid/systemTopics"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/systemTopics/exampleSystemTopic2"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/systemTopics/exampleSystemTopic2"), // Location: to.Ptr("centraluseuap"), // Properties: &armeventgrid.SystemTopicProperties{ // MetricResourceID: to.Ptr("183c0fb1-17ff-47b6-ac77-5a47420ab01e"), // ProvisioningState: to.Ptr(armeventgrid.ResourceProvisioningStateSucceeded), - // Source: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/azureeventgridrunnerrgcentraluseuap/providers/microsoft.storage/storageaccounts/pubstgrunnerb71cd29e"), + // Source: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/azureeventgridrunnerrgcentraluseuap/providers/microsoft.storage/storageaccounts/pubstgrunnerb71cd29e"), // TopicType: to.Ptr("microsoft.storage.storageaccounts"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/SystemTopics_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/SystemTopics_CreateOrUpdate.json func ExampleSystemTopicsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -68,7 +68,7 @@ func ExampleSystemTopicsClient_BeginCreateOrUpdate() { "tag2": to.Ptr("value2"), }, Properties: &armeventgrid.SystemTopicProperties{ - Source: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/azureeventgridrunnerrgcentraluseuap/providers/microsoft.storage/storageaccounts/pubstgrunnerb71cd29e"), + Source: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/azureeventgridrunnerrgcentraluseuap/providers/microsoft.storage/storageaccounts/pubstgrunnerb71cd29e"), TopicType: to.Ptr("microsoft.storage.storageaccounts"), }, }, nil) @@ -85,18 +85,18 @@ func ExampleSystemTopicsClient_BeginCreateOrUpdate() { // res.SystemTopic = armeventgrid.SystemTopic{ // Name: to.Ptr("exampleSystemTopic2"), // Type: to.Ptr("Microsoft.EventGrid/systemTopics"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/systemTopics/exampleSystemTopic2"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/systemTopics/exampleSystemTopic2"), // Location: to.Ptr("centraluseuap"), // Properties: &armeventgrid.SystemTopicProperties{ // MetricResourceID: to.Ptr("183c0fb1-17ff-47b6-ac77-5a47420ab01e"), // ProvisioningState: to.Ptr(armeventgrid.ResourceProvisioningStateSucceeded), - // Source: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/azureeventgridrunnerrgcentraluseuap/providers/microsoft.storage/storageaccounts/pubstgrunnerb71cd29e"), + // Source: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/azureeventgridrunnerrgcentraluseuap/providers/microsoft.storage/storageaccounts/pubstgrunnerb71cd29e"), // TopicType: to.Ptr("microsoft.storage.storageaccounts"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/SystemTopics_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/SystemTopics_Delete.json func ExampleSystemTopicsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -117,7 +117,7 @@ func ExampleSystemTopicsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/SystemTopics_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/SystemTopics_Update.json func ExampleSystemTopicsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -147,18 +147,18 @@ func ExampleSystemTopicsClient_BeginUpdate() { // res.SystemTopic = armeventgrid.SystemTopic{ // Name: to.Ptr("exampleSystemTopic2"), // Type: to.Ptr("Microsoft.EventGrid/systemTopics"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/systemTopics/exampleSystemTopic2"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/systemTopics/exampleSystemTopic2"), // Location: to.Ptr("centraluseuap"), // Properties: &armeventgrid.SystemTopicProperties{ // MetricResourceID: to.Ptr("183c0fb1-17ff-47b6-ac77-5a47420ab01e"), // ProvisioningState: to.Ptr(armeventgrid.ResourceProvisioningStateSucceeded), - // Source: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/azureeventgridrunnerrgcentraluseuap/providers/microsoft.storage/storageaccounts/pubstgrunnerb71cd29e"), + // Source: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/azureeventgridrunnerrgcentraluseuap/providers/microsoft.storage/storageaccounts/pubstgrunnerb71cd29e"), // TopicType: to.Ptr("microsoft.storage.storageaccounts"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/SystemTopics_ListBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/SystemTopics_ListBySubscription.json func ExampleSystemTopicsClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -187,12 +187,12 @@ func ExampleSystemTopicsClient_NewListBySubscriptionPager() { // { // Name: to.Ptr("exampleSystemTopic2"), // Type: to.Ptr("Microsoft.EventGrid/systemTopics"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/systemTopics/exampleSystemTopic2"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/systemTopics/exampleSystemTopic2"), // Location: to.Ptr("centraluseuap"), // Properties: &armeventgrid.SystemTopicProperties{ // MetricResourceID: to.Ptr("183c0fb1-17ff-47b6-ac77-5a47420ab01e"), // ProvisioningState: to.Ptr(armeventgrid.ResourceProvisioningStateSucceeded), - // Source: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/azureeventgridrunnerrgcentraluseuap/providers/microsoft.storage/storageaccounts/pubstgrunnerb71cd29e"), + // Source: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/azureeventgridrunnerrgcentraluseuap/providers/microsoft.storage/storageaccounts/pubstgrunnerb71cd29e"), // TopicType: to.Ptr("microsoft.storage.storageaccounts"), // }, // }}, @@ -200,7 +200,7 @@ func ExampleSystemTopicsClient_NewListBySubscriptionPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/SystemTopics_ListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/SystemTopics_ListByResourceGroup.json func ExampleSystemTopicsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -229,12 +229,12 @@ func ExampleSystemTopicsClient_NewListByResourceGroupPager() { // { // Name: to.Ptr("pubstgrunnerb71cd29e-86fad330-7bac-4238-8cab-9e46b75165aa"), // Type: to.Ptr("Microsoft.EventGrid/systemTopics"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/systemTopics/pubstgrunnerb71cd29e-86fad330-7bac-4238-8cab-9e46b75165aa"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/systemTopics/pubstgrunnerb71cd29e-86fad330-7bac-4238-8cab-9e46b75165aa"), // Location: to.Ptr("centraluseuap"), // Properties: &armeventgrid.SystemTopicProperties{ // MetricResourceID: to.Ptr("183c0fb1-17ff-47b6-ac77-5a47420ab01e"), // ProvisioningState: to.Ptr(armeventgrid.ResourceProvisioningStateSucceeded), - // Source: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/azureeventgridrunnerrgcentraluseuap/providers/microsoft.storage/storageaccounts/pubstgrunnerb71cd29e"), + // Source: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/azureeventgridrunnerrgcentraluseuap/providers/microsoft.storage/storageaccounts/pubstgrunnerb71cd29e"), // TopicType: to.Ptr("microsoft.storage.storageaccounts"), // }, // }}, diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/time_rfc3339.go b/sdk/resourcemanager/eventgrid/armeventgrid/time_rfc3339.go index 79468be56040..6a078860d343 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/time_rfc3339.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/time_rfc3339.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid @@ -19,50 +18,50 @@ import ( "time" ) -const ( - utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` - utcLayout = "2006-01-02T15:04:05.999999999" - rfc3339JSON = `"` + time.RFC3339Nano + `"` -) - // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) -type timeRFC3339 time.Time +const ( + utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` + utcDateTime = "2006-01-02T15:04:05.999999999" + dateTimeJSON = `"` + time.RFC3339Nano + `"` +) + +type dateTimeRFC3339 time.Time -func (t timeRFC3339) MarshalJSON() (json []byte, err error) { +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { tt := time.Time(t) return tt.MarshalJSON() } -func (t timeRFC3339) MarshalText() (text []byte, err error) { +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { tt := time.Time(t) return tt.MarshalText() } -func (t *timeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcLayoutJSON +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcDateTimeJSON if tzOffsetRegex.Match(data) { - layout = rfc3339JSON + layout = dateTimeJSON } return t.Parse(layout, string(data)) } -func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { - layout := utcLayout +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + layout := utcDateTime if tzOffsetRegex.Match(data) { layout = time.RFC3339Nano } return t.Parse(layout, string(data)) } -func (t *timeRFC3339) Parse(layout, value string) error { +func (t *dateTimeRFC3339) Parse(layout, value string) error { p, err := time.Parse(layout, strings.ToUpper(value)) - *t = timeRFC3339(p) + *t = dateTimeRFC3339(p) return err } -func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { @@ -71,14 +70,14 @@ func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { } else if reflect.ValueOf(t).IsNil() { return } - m[k] = (*timeRFC3339)(t) + m[k] = (*dateTimeRFC3339)(t) } -func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { if data == nil || strings.EqualFold(string(data), "null") { return nil } - var aux timeRFC3339 + var aux dateTimeRFC3339 if err := json.Unmarshal(data, &aux); err != nil { return fmt.Errorf("struct field %s: %v", fn, err) } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/topiceventsubscriptions_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/topiceventsubscriptions_client.go index 1bca4257af6d..ac41f2dcd3d7 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/topiceventsubscriptions_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/topiceventsubscriptions_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid @@ -35,7 +34,7 @@ type TopicEventSubscriptionsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewTopicEventSubscriptionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TopicEventSubscriptionsClient, error) { - cl, err := arm.NewClient(moduleName+".TopicEventSubscriptionsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -49,7 +48,7 @@ func NewTopicEventSubscriptionsClient(subscriptionID string, credential azcore.T // BeginCreateOrUpdate - Asynchronously creates a new event subscription or updates an existing event subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - topicName - Name of the domain topic. // - eventSubscriptionName - Name of the event subscription to be created. Event subscription names must be between 3 and 100 @@ -63,29 +62,40 @@ func (client *TopicEventSubscriptionsClient) BeginCreateOrUpdate(ctx context.Con if err != nil { return nil, err } - return runtime.NewPoller[TopicEventSubscriptionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TopicEventSubscriptionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[TopicEventSubscriptionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[TopicEventSubscriptionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // CreateOrUpdate - Asynchronously creates a new event subscription or updates an existing event subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *TopicEventSubscriptionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, topicName string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription, options *TopicEventSubscriptionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "TopicEventSubscriptionsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, topicName, eventSubscriptionName, eventSubscriptionInfo, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -112,16 +122,19 @@ func (client *TopicEventSubscriptionsClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, eventSubscriptionInfo) + if err := runtime.MarshalAsJSON(req, eventSubscriptionInfo); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete an existing event subscription for a topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - topicName - Name of the topic. // - eventSubscriptionName - Name of the event subscription to be deleted. Event subscription names must be between 3 and 100 @@ -134,29 +147,40 @@ func (client *TopicEventSubscriptionsClient) BeginDelete(ctx context.Context, re if err != nil { return nil, err } - return runtime.NewPoller[TopicEventSubscriptionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TopicEventSubscriptionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[TopicEventSubscriptionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[TopicEventSubscriptionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Delete - Delete an existing event subscription for a topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *TopicEventSubscriptionsClient) deleteOperation(ctx context.Context, resourceGroupName string, topicName string, eventSubscriptionName string, options *TopicEventSubscriptionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "TopicEventSubscriptionsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, topicName, eventSubscriptionName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -183,7 +207,7 @@ func (client *TopicEventSubscriptionsClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -191,26 +215,33 @@ func (client *TopicEventSubscriptionsClient) deleteCreateRequest(ctx context.Con // Get - Get properties of an event subscription of a topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. -// - topicName - Name of the topic. +// - topicName - Name of the partner topic. // - eventSubscriptionName - Name of the event subscription to be found. Event subscription names must be between 3 and 100 // characters in length and use alphanumeric letters only. // - options - TopicEventSubscriptionsClientGetOptions contains the optional parameters for the TopicEventSubscriptionsClient.Get // method. func (client *TopicEventSubscriptionsClient) Get(ctx context.Context, resourceGroupName string, topicName string, eventSubscriptionName string, options *TopicEventSubscriptionsClientGetOptions) (TopicEventSubscriptionsClientGetResponse, error) { + var err error + const operationName = "TopicEventSubscriptionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, topicName, eventSubscriptionName, options) if err != nil { return TopicEventSubscriptionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TopicEventSubscriptionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TopicEventSubscriptionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TopicEventSubscriptionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -237,7 +268,7 @@ func (client *TopicEventSubscriptionsClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -255,25 +286,32 @@ func (client *TopicEventSubscriptionsClient) getHandleResponse(resp *http.Respon // GetDeliveryAttributes - Get all delivery attributes for an event subscription for topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. -// - topicName - Name of the topic. +// - topicName - Name of the domain topic. // - eventSubscriptionName - Name of the event subscription. // - options - TopicEventSubscriptionsClientGetDeliveryAttributesOptions contains the optional parameters for the TopicEventSubscriptionsClient.GetDeliveryAttributes // method. func (client *TopicEventSubscriptionsClient) GetDeliveryAttributes(ctx context.Context, resourceGroupName string, topicName string, eventSubscriptionName string, options *TopicEventSubscriptionsClientGetDeliveryAttributesOptions) (TopicEventSubscriptionsClientGetDeliveryAttributesResponse, error) { + var err error + const operationName = "TopicEventSubscriptionsClient.GetDeliveryAttributes" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getDeliveryAttributesCreateRequest(ctx, resourceGroupName, topicName, eventSubscriptionName, options) if err != nil { return TopicEventSubscriptionsClientGetDeliveryAttributesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TopicEventSubscriptionsClientGetDeliveryAttributesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TopicEventSubscriptionsClientGetDeliveryAttributesResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TopicEventSubscriptionsClientGetDeliveryAttributesResponse{}, err } - return client.getDeliveryAttributesHandleResponse(resp) + resp, err := client.getDeliveryAttributesHandleResponse(httpResp) + return resp, err } // getDeliveryAttributesCreateRequest creates the GetDeliveryAttributes request. @@ -300,7 +338,7 @@ func (client *TopicEventSubscriptionsClient) getDeliveryAttributesCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -318,25 +356,32 @@ func (client *TopicEventSubscriptionsClient) getDeliveryAttributesHandleResponse // GetFullURL - Get the full endpoint URL for an event subscription for topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - topicName - Name of the domain topic. // - eventSubscriptionName - Name of the event subscription. // - options - TopicEventSubscriptionsClientGetFullURLOptions contains the optional parameters for the TopicEventSubscriptionsClient.GetFullURL // method. func (client *TopicEventSubscriptionsClient) GetFullURL(ctx context.Context, resourceGroupName string, topicName string, eventSubscriptionName string, options *TopicEventSubscriptionsClientGetFullURLOptions) (TopicEventSubscriptionsClientGetFullURLResponse, error) { + var err error + const operationName = "TopicEventSubscriptionsClient.GetFullURL" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getFullURLCreateRequest(ctx, resourceGroupName, topicName, eventSubscriptionName, options) if err != nil { return TopicEventSubscriptionsClientGetFullURLResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TopicEventSubscriptionsClientGetFullURLResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TopicEventSubscriptionsClientGetFullURLResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TopicEventSubscriptionsClientGetFullURLResponse{}, err } - return client.getFullURLHandleResponse(resp) + resp, err := client.getFullURLHandleResponse(httpResp) + return resp, err } // getFullURLCreateRequest creates the GetFullURL request. @@ -363,7 +408,7 @@ func (client *TopicEventSubscriptionsClient) getFullURLCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -380,7 +425,7 @@ func (client *TopicEventSubscriptionsClient) getFullURLHandleResponse(resp *http // NewListPager - List all event subscriptions that have been created for a specific topic. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - topicName - Name of the topic. // - options - TopicEventSubscriptionsClientListOptions contains the optional parameters for the TopicEventSubscriptionsClient.NewListPager @@ -391,25 +436,20 @@ func (client *TopicEventSubscriptionsClient) NewListPager(resourceGroupName stri return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *TopicEventSubscriptionsClientListResponse) (TopicEventSubscriptionsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, resourceGroupName, topicName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TopicEventSubscriptionsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, topicName, options) + }, nil) if err != nil { return TopicEventSubscriptionsClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TopicEventSubscriptionsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TopicEventSubscriptionsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -433,7 +473,7 @@ func (client *TopicEventSubscriptionsClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -457,7 +497,7 @@ func (client *TopicEventSubscriptionsClient) listHandleResponse(resp *http.Respo // BeginUpdate - Update an existing event subscription for a topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - topicName - Name of the domain. // - eventSubscriptionName - Name of the event subscription to be updated. @@ -470,29 +510,40 @@ func (client *TopicEventSubscriptionsClient) BeginUpdate(ctx context.Context, re if err != nil { return nil, err } - return runtime.NewPoller[TopicEventSubscriptionsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TopicEventSubscriptionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[TopicEventSubscriptionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[TopicEventSubscriptionsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Update - Update an existing event subscription for a topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *TopicEventSubscriptionsClient) update(ctx context.Context, resourceGroupName string, topicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters, options *TopicEventSubscriptionsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "TopicEventSubscriptionsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, topicName, eventSubscriptionName, eventSubscriptionUpdateParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -519,8 +570,11 @@ func (client *TopicEventSubscriptionsClient) updateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, eventSubscriptionUpdateParameters) + if err := runtime.MarshalAsJSON(req, eventSubscriptionUpdateParameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/topiceventsubscriptions_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/topiceventsubscriptions_client_example_test.go index 9ebba17a6c42..2d03ef89f935 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/topiceventsubscriptions_client_example_test.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/topiceventsubscriptions_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/TopicEventSubscriptions_GetDeliveryAttributes.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/TopicEventSubscriptions_GetDeliveryAttributes.json func ExampleTopicEventSubscriptionsClient_GetDeliveryAttributes() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -64,7 +64,7 @@ func ExampleTopicEventSubscriptionsClient_GetDeliveryAttributes() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/TopicEventSubscriptions_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/TopicEventSubscriptions_Get.json func ExampleTopicEventSubscriptionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -85,13 +85,13 @@ func ExampleTopicEventSubscriptionsClient_Get() { // res.EventSubscription = armeventgrid.EventSubscription{ // Name: to.Ptr("examplesubscription1"), // Type: to.Ptr("Microsoft.EventGrid/topics/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampleTopic1/eventSubscriptions/examplesubscription1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampleTopic1/eventSubscriptions/examplesubscription1"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.StorageQueueEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeStorageQueue), // Properties: &armeventgrid.StorageQueueEventSubscriptionDestinationProperties{ // QueueName: to.Ptr("que"), - // ResourceID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.Storage/storageAccounts/testtrackedsource"), + // ResourceID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.Storage/storageAccounts/testtrackedsource"), // }, // }, // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), @@ -111,12 +111,12 @@ func ExampleTopicEventSubscriptionsClient_Get() { // EventTimeToLiveInMinutes: to.Ptr[int32](1440), // MaxDeliveryAttempts: to.Ptr[int32](30), // }, - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampleTopic1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampleTopic1"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/TopicEventSubscriptions_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/TopicEventSubscriptions_CreateOrUpdate.json func ExampleTopicEventSubscriptionsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -155,7 +155,7 @@ func ExampleTopicEventSubscriptionsClient_BeginCreateOrUpdate() { // res.EventSubscription = armeventgrid.EventSubscription{ // Name: to.Ptr("exampleEventSubscriptionName1"), // Type: to.Ptr("Microsoft.EventGrid/topics/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampleTopic1/eventSubscriptions/exampleEventSubscriptionName1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampleTopic1/eventSubscriptions/exampleEventSubscriptionName1"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), @@ -174,12 +174,12 @@ func ExampleTopicEventSubscriptionsClient_BeginCreateOrUpdate() { // EventTimeToLiveInMinutes: to.Ptr[int32](1440), // MaxDeliveryAttempts: to.Ptr[int32](30), // }, - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampleTopic1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampleTopic1"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/TopicEventSubscriptions_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/TopicEventSubscriptions_Delete.json func ExampleTopicEventSubscriptionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -200,7 +200,7 @@ func ExampleTopicEventSubscriptionsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/TopicEventSubscriptions_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/TopicEventSubscriptions_Update.json func ExampleTopicEventSubscriptionsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -236,7 +236,7 @@ func ExampleTopicEventSubscriptionsClient_BeginUpdate() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/TopicEventSubscriptions_GetFullUrl.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/TopicEventSubscriptions_GetFullUrl.json func ExampleTopicEventSubscriptionsClient_GetFullURL() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -259,7 +259,7 @@ func ExampleTopicEventSubscriptionsClient_GetFullURL() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/TopicEventSubscriptions_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/TopicEventSubscriptions_List.json func ExampleTopicEventSubscriptionsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -288,13 +288,13 @@ func ExampleTopicEventSubscriptionsClient_NewListPager() { // { // Name: to.Ptr("examplesubscription1"), // Type: to.Ptr("Microsoft.EventGrid/topics/eventSubscriptions"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampleTopic1/eventSubscriptions/examplesubscription1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampleTopic1/eventSubscriptions/examplesubscription1"), // Properties: &armeventgrid.EventSubscriptionProperties{ // Destination: &armeventgrid.StorageQueueEventSubscriptionDestination{ // EndpointType: to.Ptr(armeventgrid.EndpointTypeStorageQueue), // Properties: &armeventgrid.StorageQueueEventSubscriptionDestinationProperties{ // QueueName: to.Ptr("que"), - // ResourceID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.Storage/storageAccounts/testtrackedsource"), + // ResourceID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.Storage/storageAccounts/testtrackedsource"), // }, // }, // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), @@ -314,7 +314,7 @@ func ExampleTopicEventSubscriptionsClient_NewListPager() { // EventTimeToLiveInMinutes: to.Ptr[int32](1440), // MaxDeliveryAttempts: to.Ptr[int32](30), // }, - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampleTopic1"), + // Topic: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampleTopic1"), // }, // }}, // } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/topics_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/topics_client.go index bde420a07cb9..f416ee9440a9 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/topics_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/topics_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid @@ -35,7 +34,7 @@ type TopicsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewTopicsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TopicsClient, error) { - cl, err := arm.NewClient(moduleName+".TopicsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -49,7 +48,7 @@ func NewTopicsClient(subscriptionID string, credential azcore.TokenCredential, o // BeginCreateOrUpdate - Asynchronously creates a new topic with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - topicName - Name of the topic. // - topicInfo - Topic information. @@ -61,29 +60,40 @@ func (client *TopicsClient) BeginCreateOrUpdate(ctx context.Context, resourceGro if err != nil { return nil, err } - return runtime.NewPoller[TopicsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TopicsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[TopicsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[TopicsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // CreateOrUpdate - Asynchronously creates a new topic with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *TopicsClient) createOrUpdate(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic, options *TopicsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "TopicsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, topicName, topicInfo, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -106,16 +116,19 @@ func (client *TopicsClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, topicInfo) + if err := runtime.MarshalAsJSON(req, topicInfo); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete existing topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - topicName - Name of the topic. // - options - TopicsClientBeginDeleteOptions contains the optional parameters for the TopicsClient.BeginDelete method. @@ -125,29 +138,40 @@ func (client *TopicsClient) BeginDelete(ctx context.Context, resourceGroupName s if err != nil { return nil, err } - return runtime.NewPoller[TopicsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TopicsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[TopicsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[TopicsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Delete - Delete existing topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *TopicsClient) deleteOperation(ctx context.Context, resourceGroupName string, topicName string, options *TopicsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "TopicsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, topicName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -170,7 +194,7 @@ func (client *TopicsClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -178,23 +202,30 @@ func (client *TopicsClient) deleteCreateRequest(ctx context.Context, resourceGro // Get - Get properties of a topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - topicName - Name of the topic. // - options - TopicsClientGetOptions contains the optional parameters for the TopicsClient.Get method. func (client *TopicsClient) Get(ctx context.Context, resourceGroupName string, topicName string, options *TopicsClientGetOptions) (TopicsClientGetResponse, error) { + var err error + const operationName = "TopicsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, topicName, options) if err != nil { return TopicsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TopicsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TopicsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TopicsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -217,7 +248,7 @@ func (client *TopicsClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -234,7 +265,7 @@ func (client *TopicsClient) getHandleResponse(resp *http.Response) (TopicsClient // NewListByResourceGroupPager - List all the topics under a resource group. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - options - TopicsClientListByResourceGroupOptions contains the optional parameters for the TopicsClient.NewListByResourceGroupPager // method. @@ -244,25 +275,20 @@ func (client *TopicsClient) NewListByResourceGroupPager(resourceGroupName string return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *TopicsClientListByResourceGroupResponse) (TopicsClientListByResourceGroupResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return TopicsClientListByResourceGroupResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TopicsClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) if err != nil { return TopicsClientListByResourceGroupResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TopicsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } return client.listByResourceGroupHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -282,7 +308,7 @@ func (client *TopicsClient) listByResourceGroupCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -305,7 +331,7 @@ func (client *TopicsClient) listByResourceGroupHandleResponse(resp *http.Respons // NewListBySubscriptionPager - List all the topics under an Azure subscription. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - options - TopicsClientListBySubscriptionOptions contains the optional parameters for the TopicsClient.NewListBySubscriptionPager // method. func (client *TopicsClient) NewListBySubscriptionPager(options *TopicsClientListBySubscriptionOptions) *runtime.Pager[TopicsClientListBySubscriptionResponse] { @@ -314,25 +340,20 @@ func (client *TopicsClient) NewListBySubscriptionPager(options *TopicsClientList return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *TopicsClientListBySubscriptionResponse) (TopicsClientListBySubscriptionResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listBySubscriptionCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TopicsClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) if err != nil { return TopicsClientListBySubscriptionResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TopicsClientListBySubscriptionResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TopicsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) - } return client.listBySubscriptionHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -348,7 +369,7 @@ func (client *TopicsClient) listBySubscriptionCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -371,7 +392,7 @@ func (client *TopicsClient) listBySubscriptionHandleResponse(resp *http.Response // NewListEventTypesPager - List event types for a topic. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - providerNamespace - Namespace of the provider of the topic. // - resourceTypeName - Name of the topic type. @@ -384,6 +405,7 @@ func (client *TopicsClient) NewListEventTypesPager(resourceGroupName string, pro return false }, Fetcher: func(ctx context.Context, page *TopicsClientListEventTypesResponse) (TopicsClientListEventTypesResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TopicsClient.NewListEventTypesPager") req, err := client.listEventTypesCreateRequest(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName, options) if err != nil { return TopicsClientListEventTypesResponse{}, err @@ -397,6 +419,7 @@ func (client *TopicsClient) NewListEventTypesPager(resourceGroupName string, pro } return client.listEventTypesHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -428,7 +451,7 @@ func (client *TopicsClient) listEventTypesCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -446,24 +469,31 @@ func (client *TopicsClient) listEventTypesHandleResponse(resp *http.Response) (T // ListSharedAccessKeys - List the two keys used to publish to a topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - topicName - Name of the topic. // - options - TopicsClientListSharedAccessKeysOptions contains the optional parameters for the TopicsClient.ListSharedAccessKeys // method. func (client *TopicsClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, topicName string, options *TopicsClientListSharedAccessKeysOptions) (TopicsClientListSharedAccessKeysResponse, error) { + var err error + const operationName = "TopicsClient.ListSharedAccessKeys" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.listSharedAccessKeysCreateRequest(ctx, resourceGroupName, topicName, options) if err != nil { return TopicsClientListSharedAccessKeysResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TopicsClientListSharedAccessKeysResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TopicsClientListSharedAccessKeysResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TopicsClientListSharedAccessKeysResponse{}, err } - return client.listSharedAccessKeysHandleResponse(resp) + resp, err := client.listSharedAccessKeysHandleResponse(httpResp) + return resp, err } // listSharedAccessKeysCreateRequest creates the ListSharedAccessKeys request. @@ -486,7 +516,7 @@ func (client *TopicsClient) listSharedAccessKeysCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -504,7 +534,7 @@ func (client *TopicsClient) listSharedAccessKeysHandleResponse(resp *http.Respon // BeginRegenerateKey - Regenerate a shared access key for a topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - topicName - Name of the topic. // - regenerateKeyRequest - Request body to regenerate key. @@ -516,29 +546,40 @@ func (client *TopicsClient) BeginRegenerateKey(ctx context.Context, resourceGrou if err != nil { return nil, err } - return runtime.NewPoller[TopicsClientRegenerateKeyResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TopicsClientRegenerateKeyResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[TopicsClientRegenerateKeyResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[TopicsClientRegenerateKeyResponse]{ + Tracer: client.internal.Tracer(), + }) } } // RegenerateKey - Regenerate a shared access key for a topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *TopicsClient) regenerateKey(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest, options *TopicsClientBeginRegenerateKeyOptions) (*http.Response, error) { + var err error + const operationName = "TopicsClient.BeginRegenerateKey" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.regenerateKeyCreateRequest(ctx, resourceGroupName, topicName, regenerateKeyRequest, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // regenerateKeyCreateRequest creates the RegenerateKey request. @@ -561,16 +602,19 @@ func (client *TopicsClient) regenerateKeyCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, regenerateKeyRequest) + if err := runtime.MarshalAsJSON(req, regenerateKeyRequest); err != nil { + return nil, err + } + return req, nil } // BeginUpdate - Asynchronously updates a topic with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - resourceGroupName - The name of the resource group within the user's subscription. // - topicName - Name of the topic. // - topicUpdateParameters - Topic update information. @@ -581,29 +625,40 @@ func (client *TopicsClient) BeginUpdate(ctx context.Context, resourceGroupName s if err != nil { return nil, err } - return runtime.NewPoller[TopicsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TopicsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err } else { - return runtime.NewPollerFromResumeToken[TopicsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[TopicsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } // Update - Asynchronously updates a topic with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 func (client *TopicsClient) update(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters TopicUpdateParameters, options *TopicsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "TopicsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, topicName, topicUpdateParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -626,8 +681,11 @@ func (client *TopicsClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, topicUpdateParameters) + if err := runtime.MarshalAsJSON(req, topicUpdateParameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/topics_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/topics_client_example_test.go index 60ab52999bdc..d43ae8d11ad1 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/topics_client_example_test.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/topics_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Topics_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Topics_Get.json func ExampleTopicsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -39,7 +39,7 @@ func ExampleTopicsClient_Get() { // res.Topic = armeventgrid.Topic{ // Name: to.Ptr("exampletopic2"), // Type: to.Ptr("Microsoft.EventGrid/topics"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2"), // Location: to.Ptr("westcentralus"), // Tags: map[string]*string{ // "tag1": to.Ptr("value1"), @@ -52,8 +52,8 @@ func ExampleTopicsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Topics_CreateOrUpdate.json -func ExampleTopicsClient_BeginCreateOrUpdate_topicsCreateOrUpdate() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Topics_CreateOrUpdate.json +func ExampleTopicsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -91,42 +91,7 @@ func ExampleTopicsClient_BeginCreateOrUpdate_topicsCreateOrUpdate() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Topics_CreateOrUpdateForAzureArc.json -func ExampleTopicsClient_BeginCreateOrUpdate_topicsCreateOrUpdateForAzureArc() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewTopicsClient().BeginCreateOrUpdate(ctx, "examplerg", "exampletopic1", armeventgrid.Topic{ - Location: to.Ptr("westus2"), - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - ExtendedLocation: &armeventgrid.ExtendedLocation{ - Name: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourcegroups/examplerg/providers/Microsoft.ExtendedLocation/CustomLocations/exampleCustomLocation"), - Type: to.Ptr("CustomLocation"), - }, - Kind: to.Ptr(armeventgrid.ResourceKindAzureArc), - Properties: &armeventgrid.TopicProperties{ - InputSchema: to.Ptr(armeventgrid.InputSchemaCloudEventSchemaV10), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Topics_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Topics_Delete.json func ExampleTopicsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -137,7 +102,7 @@ func ExampleTopicsClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewTopicsClient().BeginDelete(ctx, "examplerg1", "exampletopic1", nil) + poller, err := clientFactory.NewTopicsClient().BeginDelete(ctx, "examplerg", "exampletopic1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -147,7 +112,7 @@ func ExampleTopicsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Topics_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Topics_Update.json func ExampleTopicsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -185,7 +150,7 @@ func ExampleTopicsClient_BeginUpdate() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Topics_ListBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Topics_ListBySubscription.json func ExampleTopicsClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -214,7 +179,7 @@ func ExampleTopicsClient_NewListBySubscriptionPager() { // { // Name: to.Ptr("exampletopic1"), // Type: to.Ptr("Microsoft.EventGrid/topics"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1"), // Location: to.Ptr("westus2"), // Tags: map[string]*string{ // "tag1": to.Ptr("value1"), @@ -228,7 +193,7 @@ func ExampleTopicsClient_NewListBySubscriptionPager() { // { // Name: to.Ptr("exampletopic2"), // Type: to.Ptr("Microsoft.EventGrid/topics"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2"), // Location: to.Ptr("westcentralus"), // Tags: map[string]*string{ // "tag1": to.Ptr("value1"), @@ -243,7 +208,7 @@ func ExampleTopicsClient_NewListBySubscriptionPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Topics_ListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Topics_ListByResourceGroup.json func ExampleTopicsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -272,7 +237,7 @@ func ExampleTopicsClient_NewListByResourceGroupPager() { // { // Name: to.Ptr("exampletopic1"), // Type: to.Ptr("Microsoft.EventGrid/topics"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1"), // Location: to.Ptr("westus2"), // Tags: map[string]*string{ // "tag1": to.Ptr("value1"), @@ -286,7 +251,7 @@ func ExampleTopicsClient_NewListByResourceGroupPager() { // { // Name: to.Ptr("exampletopic2"), // Type: to.Ptr("Microsoft.EventGrid/topics"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2"), + // ID: to.Ptr("/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2"), // Location: to.Ptr("westcentralus"), // Tags: map[string]*string{ // "tag1": to.Ptr("value1"), @@ -301,7 +266,7 @@ func ExampleTopicsClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Topics_ListSharedAccessKeys.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Topics_ListSharedAccessKeys.json func ExampleTopicsClient_ListSharedAccessKeys() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -320,12 +285,12 @@ func ExampleTopicsClient_ListSharedAccessKeys() { _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. // res.TopicSharedAccessKeys = armeventgrid.TopicSharedAccessKeys{ - // Key1: to.Ptr("testKey1Value"), - // Key2: to.Ptr("testKey2Value"), + // Key1: to.Ptr(""), + // Key2: to.Ptr(""), // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Topics_RegenerateKey.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Topics_RegenerateKey.json func ExampleTopicsClient_BeginRegenerateKey() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -350,12 +315,12 @@ func ExampleTopicsClient_BeginRegenerateKey() { _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. // res.TopicSharedAccessKeys = armeventgrid.TopicSharedAccessKeys{ - // Key1: to.Ptr("testKey1Value"), - // Key2: to.Ptr("testKey2Value"), + // Key1: to.Ptr(""), + // Key2: to.Ptr(""), // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/Topics_ListEventTypes.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/Topics_ListEventTypes.json func ExampleTopicsClient_NewListEventTypesPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/topicspaces_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/topicspaces_client.go deleted file mode 100644 index 9d2ce58dfc85..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/topicspaces_client.go +++ /dev/null @@ -1,329 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armeventgrid - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strconv" - "strings" -) - -// TopicSpacesClient contains the methods for the TopicSpaces group. -// Don't use this type directly, use NewTopicSpacesClient() instead. -type TopicSpacesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewTopicSpacesClient creates a new instance of TopicSpacesClient with the specified values. -// - subscriptionID - Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewTopicSpacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TopicSpacesClient, error) { - cl, err := arm.NewClient(moduleName+".TopicSpacesClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &TopicSpacesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreateOrUpdate - Create or update a topic space with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - topicSpaceName - The topic space name. -// - topicSpaceInfo - Topic space information. -// - options - TopicSpacesClientBeginCreateOrUpdateOptions contains the optional parameters for the TopicSpacesClient.BeginCreateOrUpdate -// method. -func (client *TopicSpacesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, topicSpaceName string, topicSpaceInfo TopicSpace, options *TopicSpacesClientBeginCreateOrUpdateOptions) (*runtime.Poller[TopicSpacesClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, namespaceName, topicSpaceName, topicSpaceInfo, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TopicSpacesClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - } else { - return runtime.NewPollerFromResumeToken[TopicSpacesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// CreateOrUpdate - Create or update a topic space with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *TopicSpacesClient) createOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, topicSpaceName string, topicSpaceInfo TopicSpace, options *TopicSpacesClientBeginCreateOrUpdateOptions) (*http.Response, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, namespaceName, topicSpaceName, topicSpaceInfo, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *TopicSpacesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, topicSpaceName string, topicSpaceInfo TopicSpace, options *TopicSpacesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topicSpaces/{topicSpaceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if topicSpaceName == "" { - return nil, errors.New("parameter topicSpaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{topicSpaceName}", url.PathEscape(topicSpaceName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, topicSpaceInfo) -} - -// BeginDelete - Delete an existing topic space. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - topicSpaceName - Name of the Topic space. -// - options - TopicSpacesClientBeginDeleteOptions contains the optional parameters for the TopicSpacesClient.BeginDelete method. -func (client *TopicSpacesClient) BeginDelete(ctx context.Context, resourceGroupName string, namespaceName string, topicSpaceName string, options *TopicSpacesClientBeginDeleteOptions) (*runtime.Poller[TopicSpacesClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, namespaceName, topicSpaceName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TopicSpacesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[TopicSpacesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Delete - Delete an existing topic space. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -func (client *TopicSpacesClient) deleteOperation(ctx context.Context, resourceGroupName string, namespaceName string, topicSpaceName string, options *TopicSpacesClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, namespaceName, topicSpaceName, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *TopicSpacesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, topicSpaceName string, options *TopicSpacesClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topicSpaces/{topicSpaceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if topicSpaceName == "" { - return nil, errors.New("parameter topicSpaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{topicSpaceName}", url.PathEscape(topicSpaceName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get properties of a topic space. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - topicSpaceName - Name of the Topic space. -// - options - TopicSpacesClientGetOptions contains the optional parameters for the TopicSpacesClient.Get method. -func (client *TopicSpacesClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, topicSpaceName string, options *TopicSpacesClientGetOptions) (TopicSpacesClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, namespaceName, topicSpaceName, options) - if err != nil { - return TopicSpacesClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TopicSpacesClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TopicSpacesClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *TopicSpacesClient) getCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, topicSpaceName string, options *TopicSpacesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topicSpaces/{topicSpaceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - if topicSpaceName == "" { - return nil, errors.New("parameter topicSpaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{topicSpaceName}", url.PathEscape(topicSpaceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *TopicSpacesClient) getHandleResponse(resp *http.Response) (TopicSpacesClientGetResponse, error) { - result := TopicSpacesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.TopicSpace); err != nil { - return TopicSpacesClientGetResponse{}, err - } - return result, nil -} - -// NewListByNamespacePager - Get all the topic spaces under a namespace. -// -// Generated from API version 2023-06-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. -// - namespaceName - Name of the namespace. -// - options - TopicSpacesClientListByNamespaceOptions contains the optional parameters for the TopicSpacesClient.NewListByNamespacePager -// method. -func (client *TopicSpacesClient) NewListByNamespacePager(resourceGroupName string, namespaceName string, options *TopicSpacesClientListByNamespaceOptions) *runtime.Pager[TopicSpacesClientListByNamespaceResponse] { - return runtime.NewPager(runtime.PagingHandler[TopicSpacesClientListByNamespaceResponse]{ - More: func(page TopicSpacesClientListByNamespaceResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *TopicSpacesClientListByNamespaceResponse) (TopicSpacesClientListByNamespaceResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByNamespaceCreateRequest(ctx, resourceGroupName, namespaceName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return TopicSpacesClientListByNamespaceResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TopicSpacesClientListByNamespaceResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TopicSpacesClientListByNamespaceResponse{}, runtime.NewResponseError(resp) - } - return client.listByNamespaceHandleResponse(resp) - }, - }) -} - -// listByNamespaceCreateRequest creates the ListByNamespace request. -func (client *TopicSpacesClient) listByNamespaceCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, options *TopicSpacesClientListByNamespaceOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topicSpaces" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if namespaceName == "" { - return nil, errors.New("parameter namespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByNamespaceHandleResponse handles the ListByNamespace response. -func (client *TopicSpacesClient) listByNamespaceHandleResponse(resp *http.Response) (TopicSpacesClientListByNamespaceResponse, error) { - result := TopicSpacesClientListByNamespaceResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.TopicSpacesListResult); err != nil { - return TopicSpacesClientListByNamespaceResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/topicspaces_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/topicspaces_client_example_test.go deleted file mode 100644 index e0bab42c6de8..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/topicspaces_client_example_test.go +++ /dev/null @@ -1,153 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armeventgrid_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/TopicSpaces_Get.json -func ExampleTopicSpacesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTopicSpacesClient().Get(ctx, "examplerg", "exampleNamespaceName1", "exampleTopicSpaceName1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TopicSpace = armeventgrid.TopicSpace{ - // Name: to.Ptr("exampleTopicSpaceName1"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces/topicSpaces"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/exampleNamespaceName1/topicSpaces/exampleTopicSpaceName1"), - // Properties: &armeventgrid.TopicSpaceProperties{ - // ProvisioningState: to.Ptr(armeventgrid.TopicSpaceProvisioningStateSucceeded), - // TopicTemplates: []*string{ - // to.Ptr("filter1"), - // to.Ptr("filter2")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/TopicSpaces_CreateOrUpdate.json -func ExampleTopicSpacesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewTopicSpacesClient().BeginCreateOrUpdate(ctx, "examplerg", "exampleNamespaceName1", "exampleTopicSpaceName1", armeventgrid.TopicSpace{ - Properties: &armeventgrid.TopicSpaceProperties{ - TopicTemplates: []*string{ - to.Ptr("filter1"), - to.Ptr("filter2")}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TopicSpace = armeventgrid.TopicSpace{ - // Name: to.Ptr("exampleTopicSpaceName1"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces/topicSpaces"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/exampleNamespaceName1/topicSpaces/exampleTopicSpaceName1"), - // Properties: &armeventgrid.TopicSpaceProperties{ - // ProvisioningState: to.Ptr(armeventgrid.TopicSpaceProvisioningStateSucceeded), - // TopicTemplates: []*string{ - // to.Ptr("filter1"), - // to.Ptr("filter2")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/TopicSpaces_Delete.json -func ExampleTopicSpacesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewTopicSpacesClient().BeginDelete(ctx, "examplerg", "exampleNamespaceName1", "exampleTopicSpaceName1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/TopicSpaces_ListByNamespace.json -func ExampleTopicSpacesClient_NewListByNamespacePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventgrid.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTopicSpacesClient().NewListByNamespacePager("examplerg", "namespace123", &armeventgrid.TopicSpacesClientListByNamespaceOptions{Filter: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.TopicSpacesListResult = armeventgrid.TopicSpacesListResult{ - // Value: []*armeventgrid.TopicSpace{ - // { - // Name: to.Ptr("exampleTopicSpaceName1"), - // Type: to.Ptr("Microsoft.EventGrid/namespaces/topicSpaces"), - // ID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/namespaces/exampleNamespaceName1/topicSpaces/exampleTopicSpaceName1"), - // Properties: &armeventgrid.TopicSpaceProperties{ - // ProvisioningState: to.Ptr(armeventgrid.TopicSpaceProvisioningStateSucceeded), - // TopicTemplates: []*string{ - // to.Ptr("filter1"), - // to.Ptr("filter2")}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/topictypes_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/topictypes_client.go index 63c48deed4e0..6f9a45c6eb00 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/topictypes_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/topictypes_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid @@ -31,7 +30,7 @@ type TopicTypesClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewTopicTypesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*TopicTypesClient, error) { - cl, err := arm.NewClient(moduleName+".TopicTypesClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -44,22 +43,29 @@ func NewTopicTypesClient(credential azcore.TokenCredential, options *arm.ClientO // Get - Get information about a topic type. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - topicTypeName - Name of the topic type. // - options - TopicTypesClientGetOptions contains the optional parameters for the TopicTypesClient.Get method. func (client *TopicTypesClient) Get(ctx context.Context, topicTypeName string, options *TopicTypesClientGetOptions) (TopicTypesClientGetResponse, error) { + var err error + const operationName = "TopicTypesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, topicTypeName, options) if err != nil { return TopicTypesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TopicTypesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TopicTypesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TopicTypesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -74,7 +80,7 @@ func (client *TopicTypesClient) getCreateRequest(ctx context.Context, topicTypeN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -91,7 +97,7 @@ func (client *TopicTypesClient) getHandleResponse(resp *http.Response) (TopicTyp // NewListPager - List all registered topic types. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - options - TopicTypesClientListOptions contains the optional parameters for the TopicTypesClient.NewListPager method. func (client *TopicTypesClient) NewListPager(options *TopicTypesClientListOptions) *runtime.Pager[TopicTypesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[TopicTypesClientListResponse]{ @@ -99,6 +105,7 @@ func (client *TopicTypesClient) NewListPager(options *TopicTypesClientListOption return false }, Fetcher: func(ctx context.Context, page *TopicTypesClientListResponse) (TopicTypesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TopicTypesClient.NewListPager") req, err := client.listCreateRequest(ctx, options) if err != nil { return TopicTypesClientListResponse{}, err @@ -112,6 +119,7 @@ func (client *TopicTypesClient) NewListPager(options *TopicTypesClientListOption } return client.listHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -123,7 +131,7 @@ func (client *TopicTypesClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -140,7 +148,7 @@ func (client *TopicTypesClient) listHandleResponse(resp *http.Response) (TopicTy // NewListEventTypesPager - List event types for a topic type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - topicTypeName - Name of the topic type. // - options - TopicTypesClientListEventTypesOptions contains the optional parameters for the TopicTypesClient.NewListEventTypesPager // method. @@ -150,6 +158,7 @@ func (client *TopicTypesClient) NewListEventTypesPager(topicTypeName string, opt return false }, Fetcher: func(ctx context.Context, page *TopicTypesClientListEventTypesResponse) (TopicTypesClientListEventTypesResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TopicTypesClient.NewListEventTypesPager") req, err := client.listEventTypesCreateRequest(ctx, topicTypeName, options) if err != nil { return TopicTypesClientListEventTypesResponse{}, err @@ -163,6 +172,7 @@ func (client *TopicTypesClient) NewListEventTypesPager(topicTypeName string, opt } return client.listEventTypesHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -178,7 +188,7 @@ func (client *TopicTypesClient) listEventTypesCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/topictypes_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/topictypes_client_example_test.go index a6063c860021..65bbf379811c 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/topictypes_client_example_test.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/topictypes_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/TopicTypes_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/TopicTypes_List.json func ExampleTopicTypesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -69,7 +69,7 @@ func ExampleTopicTypesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/TopicTypes_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/TopicTypes_Get.json func ExampleTopicTypesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -101,7 +101,7 @@ func ExampleTopicTypesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/TopicTypes_ListEventTypes.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/TopicTypes_ListEventTypes.json func ExampleTopicTypesClient_NewListEventTypesPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/verifiedpartners_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/verifiedpartners_client.go index efbadc205c6a..730b163967a4 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/verifiedpartners_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/verifiedpartners_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armeventgrid @@ -32,7 +31,7 @@ type VerifiedPartnersClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewVerifiedPartnersClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*VerifiedPartnersClient, error) { - cl, err := arm.NewClient(moduleName+".VerifiedPartnersClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -45,22 +44,29 @@ func NewVerifiedPartnersClient(credential azcore.TokenCredential, options *arm.C // Get - Get properties of a verified partner. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - verifiedPartnerName - Name of the verified partner. // - options - VerifiedPartnersClientGetOptions contains the optional parameters for the VerifiedPartnersClient.Get method. func (client *VerifiedPartnersClient) Get(ctx context.Context, verifiedPartnerName string, options *VerifiedPartnersClientGetOptions) (VerifiedPartnersClientGetResponse, error) { + var err error + const operationName = "VerifiedPartnersClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, verifiedPartnerName, options) if err != nil { return VerifiedPartnersClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VerifiedPartnersClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VerifiedPartnersClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VerifiedPartnersClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -75,7 +81,7 @@ func (client *VerifiedPartnersClient) getCreateRequest(ctx context.Context, veri return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -92,7 +98,7 @@ func (client *VerifiedPartnersClient) getHandleResponse(resp *http.Response) (Ve // NewListPager - Get a list of all verified partners. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2022-06-15 // - options - VerifiedPartnersClientListOptions contains the optional parameters for the VerifiedPartnersClient.NewListPager // method. func (client *VerifiedPartnersClient) NewListPager(options *VerifiedPartnersClientListOptions) *runtime.Pager[VerifiedPartnersClientListResponse] { @@ -101,25 +107,20 @@ func (client *VerifiedPartnersClient) NewListPager(options *VerifiedPartnersClie return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *VerifiedPartnersClientListResponse) (VerifiedPartnersClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VerifiedPartnersClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) if err != nil { return VerifiedPartnersClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return VerifiedPartnersClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VerifiedPartnersClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } @@ -131,7 +132,7 @@ func (client *VerifiedPartnersClient) listCreateRequest(ctx context.Context, opt return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2022-06-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/verifiedpartners_client_example_test.go b/sdk/resourcemanager/eventgrid/armeventgrid/verifiedpartners_client_example_test.go index 0ee6ec4ddbb8..5dabe18dcf27 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/verifiedpartners_client_example_test.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/verifiedpartners_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/VerifiedPartners_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/VerifiedPartners_Get.json func ExampleVerifiedPartnersClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -41,11 +41,6 @@ func ExampleVerifiedPartnersClient_Get() { // ID: to.Ptr("/providers/Microsoft.EventGrid/verifiedPartners/Contoso.Finance"), // Properties: &armeventgrid.VerifiedPartnerProperties{ // OrganizationName: to.Ptr("Contoso"), - // PartnerDestinationDetails: &armeventgrid.PartnerDetails{ - // Description: to.Ptr("This is custom description"), - // LongDescription: to.Ptr("This is long custom description"), - // SetupURI: to.Ptr("https://www.example.com/"), - // }, // PartnerDisplayName: to.Ptr("Contoso - Finance Department"), // PartnerRegistrationImmutableID: to.Ptr("941892bc-f5d0-4d1c-8fb5-477570fc2b71"), // PartnerTopicDetails: &armeventgrid.PartnerDetails{ @@ -57,7 +52,7 @@ func ExampleVerifiedPartnersClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/173bb3b6fd5b1809fdbf347f67fccfa0440ac126/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/examples/VerifiedPartners_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f88928d723133dc392e3297e6d61b7f6d10501fd/specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2022-06-15/examples/VerifiedPartners_List.json func ExampleVerifiedPartnersClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -89,11 +84,6 @@ func ExampleVerifiedPartnersClient_NewListPager() { // ID: to.Ptr("/providers/Microsoft.EventGrid/verifiedPartners/Contoso.Finance"), // Properties: &armeventgrid.VerifiedPartnerProperties{ // OrganizationName: to.Ptr("Contoso"), - // PartnerDestinationDetails: &armeventgrid.PartnerDetails{ - // Description: to.Ptr("This is custom description"), - // LongDescription: to.Ptr("This is long custom description"), - // SetupURI: to.Ptr("https://www.example.com/"), - // }, // PartnerDisplayName: to.Ptr("Contoso - Finance Department"), // PartnerRegistrationImmutableID: to.Ptr("941892bc-f5d0-4d1c-8fb5-477570fc2b71"), // PartnerTopicDetails: &armeventgrid.PartnerDetails{