diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/CHANGELOG.md b/sdk/resourcemanager/eventgrid/armeventgrid/CHANGELOG.md index 0498497d8e5f..246e2a0a9b3b 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/CHANGELOG.md +++ b/sdk/resourcemanager/eventgrid/armeventgrid/CHANGELOG.md @@ -1,5 +1,53 @@ # Release History +## 2.2.0-beta.2 (2023-10-27) +### Breaking Changes + +- Struct `ClientAuthentication` has been removed +- Struct `ClientCertificateSubjectDistinguishedName` has been removed +- Struct `ClientCertificateThumbprint` has been removed +- Field `Authentication` of struct `ClientProperties` has been removed + +### Features Added + +- New value `DeliveryModePush` added to enum type `DeliveryMode` +- New value `EndpointTypeMonitorAlert`, `EndpointTypeNamespaceTopic` added to enum type `EndpointType` +- New value `PublicNetworkAccessSecuredByPerimeter` added to enum type `PublicNetworkAccess` +- New enum type `MonitorAlertSeverity` with values `MonitorAlertSeveritySev0`, `MonitorAlertSeveritySev1`, `MonitorAlertSeveritySev2`, `MonitorAlertSeveritySev3`, `MonitorAlertSeveritySev4` +- New enum type `NetworkSecurityPerimeterAssociationAccessMode` with values `NetworkSecurityPerimeterAssociationAccessModeAudit`, `NetworkSecurityPerimeterAssociationAccessModeEnforced`, `NetworkSecurityPerimeterAssociationAccessModeLearning` +- New enum type `NetworkSecurityPerimeterConfigProvisioningState` with values `NetworkSecurityPerimeterConfigProvisioningStateAccepted`, `NetworkSecurityPerimeterConfigProvisioningStateCanceled`, `NetworkSecurityPerimeterConfigProvisioningStateCreating`, `NetworkSecurityPerimeterConfigProvisioningStateDeleted`, `NetworkSecurityPerimeterConfigProvisioningStateDeleting`, `NetworkSecurityPerimeterConfigProvisioningStateFailed`, `NetworkSecurityPerimeterConfigProvisioningStateSucceeded`, `NetworkSecurityPerimeterConfigProvisioningStateUpdating` +- New enum type `NetworkSecurityPerimeterConfigurationIssueSeverity` with values `NetworkSecurityPerimeterConfigurationIssueSeverityError`, `NetworkSecurityPerimeterConfigurationIssueSeverityWarning` +- New enum type `NetworkSecurityPerimeterConfigurationIssueType` with values `NetworkSecurityPerimeterConfigurationIssueTypeConfigurationPropagationFailure`, `NetworkSecurityPerimeterConfigurationIssueTypeMissingIdentityConfiguration`, `NetworkSecurityPerimeterConfigurationIssueTypeMissingPerimeterConfiguration`, `NetworkSecurityPerimeterConfigurationIssueTypeOther` +- New enum type `NetworkSecurityPerimeterProfileAccessRuleDirection` with values `NetworkSecurityPerimeterProfileAccessRuleDirectionInbound`, `NetworkSecurityPerimeterProfileAccessRuleDirectionOutbound` +- New enum type `NetworkSecurityPerimeterResourceType` with values `NetworkSecurityPerimeterResourceTypeDomains`, `NetworkSecurityPerimeterResourceTypeTopics` +- New function `*ClientFactory.NewNetworkSecurityPerimeterConfigurationsClient() *NetworkSecurityPerimeterConfigurationsClient` +- New function `*MonitorAlertEventSubscriptionDestination.GetEventSubscriptionDestination() *EventSubscriptionDestination` +- New function `*NamespaceTopicEventSubscriptionDestination.GetEventSubscriptionDestination() *EventSubscriptionDestination` +- New function `*NamespaceTopicEventSubscriptionsClient.GetDeliveryAttributes(context.Context, string, string, string, string, *NamespaceTopicEventSubscriptionsClientGetDeliveryAttributesOptions) (NamespaceTopicEventSubscriptionsClientGetDeliveryAttributesResponse, error)` +- New function `NewNetworkSecurityPerimeterConfigurationsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*NetworkSecurityPerimeterConfigurationsClient, error)` +- New function `*NetworkSecurityPerimeterConfigurationsClient.Get(context.Context, string, NetworkSecurityPerimeterResourceType, string, string, string, *NetworkSecurityPerimeterConfigurationsClientGetOptions) (NetworkSecurityPerimeterConfigurationsClientGetResponse, error)` +- New function `*NetworkSecurityPerimeterConfigurationsClient.NewListPager(string, NetworkSecurityPerimeterResourceType, string, *NetworkSecurityPerimeterConfigurationsClientListOptions) *runtime.Pager[NetworkSecurityPerimeterConfigurationsClientListResponse]` +- New function `*NetworkSecurityPerimeterConfigurationsClient.BeginReconcile(context.Context, string, NetworkSecurityPerimeterResourceType, string, string, string, *NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions) (*runtime.Poller[NetworkSecurityPerimeterConfigurationsClientReconcileResponse], error)` +- New struct `MonitorAlertEventSubscriptionDestination` +- New struct `MonitorAlertEventSubscriptionDestinationProperties` +- New struct `NamespaceTopicEventSubscriptionDestination` +- New struct `NamespaceTopicEventSubscriptionDestinationProperties` +- New struct `NetworkSecurityPerimeterConfiguration` +- New struct `NetworkSecurityPerimeterConfigurationIssues` +- New struct `NetworkSecurityPerimeterConfigurationIssuesProperties` +- New struct `NetworkSecurityPerimeterConfigurationList` +- New struct `NetworkSecurityPerimeterConfigurationProfile` +- New struct `NetworkSecurityPerimeterConfigurationProperties` +- New struct `NetworkSecurityPerimeterInfo` +- New struct `NetworkSecurityPerimeterProfileAccessRule` +- New struct `NetworkSecurityPerimeterProfileAccessRuleProperties` +- New struct `PushInfo` +- New struct `ResourceAssociation` +- New struct `TopicTypeAdditionalEnforcedPermission` +- New field `Push` in struct `DeliveryConfiguration` +- New field `AdditionalEnforcedPermissions` in struct `TopicTypeProperties` + + ## 2.2.0-beta.1 (2023-05-26) ### Features Added diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/autorest.md b/sdk/resourcemanager/eventgrid/armeventgrid/autorest.md index adec3a1e14a6..7cac79004c5a 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/autorest.md +++ b/sdk/resourcemanager/eventgrid/armeventgrid/autorest.md @@ -5,9 +5,8 @@ ``` 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 +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/eventgrid/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/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-beta.2 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/cacertificates_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/cacertificates_client.go index 308b9fe2f0de..0f11cbd7ed78 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/cacertificates_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/cacertificates_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 @@ -49,7 +48,7 @@ func NewCaCertificatesClient(subscriptionID string, credential azcore.TokenCrede // 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 +// Generated from API version 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - namespaceName - Name of the namespace. // - caCertificateName - The CA certificate name. @@ -62,9 +61,10 @@ func (client *CaCertificatesClient) BeginCreateOrUpdate(ctx context.Context, res if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CaCertificatesClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CaCertificatesClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[CaCertificatesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -73,20 +73,22 @@ func (client *CaCertificatesClient) BeginCreateOrUpdate(ctx context.Context, res // 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 +// Generated from API version 2023-12-15-preview func (client *CaCertificatesClient) createOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, caCertificateName string, caCertificateInfo CaCertificate, options *CaCertificatesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, namespaceName, caCertificateName, caCertificateInfo, 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. @@ -113,16 +115,19 @@ func (client *CaCertificatesClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, caCertificateInfo) + if err := runtime.MarshalAsJSON(req, caCertificateInfo); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete an existing CA certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - namespaceName - Name of the namespace. // - caCertificateName - Name of the CA certificate. @@ -134,9 +139,10 @@ func (client *CaCertificatesClient) BeginDelete(ctx context.Context, resourceGro if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CaCertificatesClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CaCertificatesClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[CaCertificatesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -145,20 +151,22 @@ func (client *CaCertificatesClient) BeginDelete(ctx context.Context, resourceGro // Delete - Delete an existing CA certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-preview func (client *CaCertificatesClient) deleteOperation(ctx context.Context, resourceGroupName string, namespaceName string, caCertificateName string, options *CaCertificatesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, namespaceName, caCertificateName, 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 +193,7 @@ func (client *CaCertificatesClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -194,24 +202,27 @@ func (client *CaCertificatesClient) deleteCreateRequest(ctx context.Context, res // 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 +// Generated from API version 2023-12-15-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) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, namespaceName, caCertificateName, options) if err != nil { return CaCertificatesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CaCertificatesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CaCertificatesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CaCertificatesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -238,7 +249,7 @@ func (client *CaCertificatesClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -255,7 +266,7 @@ func (client *CaCertificatesClient) getHandleResponse(resp *http.Response) (CaCe // NewListByNamespacePager - Get all the CA certificates under a namespace. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-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 @@ -308,7 +319,7 @@ func (client *CaCertificatesClient) listByNamespaceCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } 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..da133b4af21d 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 @@ -49,25 +48,28 @@ 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 2023-12-15-preview // - 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 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 +96,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", "2023-12-15-preview") 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 +117,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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the partners subscription. // - partnerNamespaceName - Name of the partner namespace. // - channelName - Name of the channel. @@ -123,7 +128,8 @@ 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[ChannelsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ChannelsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -132,20 +138,22 @@ func (client *ChannelsClient) BeginDelete(ctx context.Context, resourceGroupName // 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 2023-12-15-preview func (client *ChannelsClient) deleteOperation(ctx context.Context, resourceGroupName string, partnerNamespaceName string, channelName string, options *ChannelsClientBeginDeleteOptions) (*http.Response, error) { + var err error 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 +180,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -180,24 +188,27 @@ 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 2023-12-15-preview // - 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 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 +235,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -242,24 +253,27 @@ 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 2023-12-15-preview // - 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 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 +300,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -303,7 +317,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 2023-12-15-preview // - 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 @@ -356,7 +370,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -380,23 +394,25 @@ 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 2023-12-15-preview // - 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 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 +441,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", "2023-12-15-preview") 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 deleted file mode 100644 index ce70039795a9..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/channels_client_example_test.go +++ /dev/null @@ -1,220 +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/Channels_Get.json -func ExampleChannelsClient_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.NewChannelsClient().Get(ctx, "examplerg", "examplePartnerNamespaceName1", "exampleChannelName1", 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.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"), - // 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}()), - // MessageForActivation: to.Ptr("Example message to approver"), - // PartnerTopicInfo: &armeventgrid.PartnerTopicInfo{ - // Name: to.Ptr("examplePartnerTopic1"), - // AzureSubscriptionID: to.Ptr("8f6b6269-84f2-4d09-9e31-1127efcd1e40"), - // ResourceGroupName: to.Ptr("examplerg2"), - // Source: to.Ptr("ContosoCorp.Accounts.User1"), - // }, - // ProvisioningState: to.Ptr(armeventgrid.ChannelProvisioningStateSucceeded), - // ReadinessState: to.Ptr(armeventgrid.ReadinessStateNeverActivated), - // }, - // } -} - -// 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 -func ExampleChannelsClient_CreateOrUpdate() { - 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.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 }()), - MessageForActivation: to.Ptr("Example message to approver"), - PartnerTopicInfo: &armeventgrid.PartnerTopicInfo{ - Name: to.Ptr("examplePartnerTopic1"), - AzureSubscriptionID: to.Ptr("8f6b6269-84f2-4d09-9e31-1127efcd1e40"), - ResourceGroupName: to.Ptr("examplerg2"), - Source: to.Ptr("ContosoCorp.Accounts.User1"), - }, - }, - }, 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.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"), - // 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}()), - // MessageForActivation: to.Ptr("Example message to approver"), - // PartnerTopicInfo: &armeventgrid.PartnerTopicInfo{ - // Name: to.Ptr("examplePartnerTopic1"), - // AzureSubscriptionID: to.Ptr("8f6b6269-84f2-4d09-9e31-1127efcd1e40"), - // ResourceGroupName: to.Ptr("examplerg2"), - // Source: to.Ptr("ContosoCorp.Accounts.User1"), - // }, - // }, - // } -} - -// 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 -func ExampleChannelsClient_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.NewChannelsClient().BeginDelete(ctx, "examplerg", "examplePartnerNamespaceName1", "exampleEventChannelName1", 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/Channels_Update.json -func ExampleChannelsClient_Update() { - 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) - } - _, err = clientFactory.NewChannelsClient().Update(ctx, "examplerg", "examplePartnerNamespaceName1", "exampleChannelName1", armeventgrid.ChannelUpdateParameters{ - Properties: &armeventgrid.ChannelUpdateParametersProperties{ - ExpirationTimeIfNotActivatedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T23:06:11.785Z"); return t }()), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %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/Channels_ListByPartnerNamespace.json -func ExampleChannelsClient_NewListByPartnerNamespacePager() { - 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.NewChannelsClient().NewListByPartnerNamespacePager("examplerg", "examplePartnerNamespaceName1", &armeventgrid.ChannelsClientListByPartnerNamespaceOptions{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.ChannelsListResult = armeventgrid.ChannelsListResult{ - // Value: []*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"), - // 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}()), - // MessageForActivation: to.Ptr("Example message to approver"), - // PartnerTopicInfo: &armeventgrid.PartnerTopicInfo{ - // Name: to.Ptr("examplePartnerTopic1"), - // AzureSubscriptionID: to.Ptr("8f6b6269-84f2-4d09-9e31-1127efcd1e40"), - // ResourceGroupName: to.Ptr("examplerg2"), - // Source: to.Ptr("ContosoCorp.Accounts.User1"), - // }, - // ProvisioningState: to.Ptr(armeventgrid.ChannelProvisioningStateSucceeded), - // ReadinessState: to.Ptr(armeventgrid.ReadinessStateNeverActivated), - // }, - // }}, - // } - } -} - -// 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 -func ExampleChannelsClient_GetFullURL() { - 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.NewChannelsClient().GetFullURL(ctx, "examplerg", "examplenamespace", "examplechannel", 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.EventSubscriptionFullURL = armeventgrid.EventSubscriptionFullURL{ - // EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - // } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/client_factory.go b/sdk/resourcemanager/eventgrid/armeventgrid/client_factory.go index 17ee72896c8e..fa222c96f3eb 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 @@ -59,13 +58,8 @@ func (c *ClientFactory) NewClientsClient() *ClientsClient { 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) +func (c *ClientFactory) NewDomainEventSubscriptionsClient() *DomainEventSubscriptionsClient { + subClient, _ := NewDomainEventSubscriptionsClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -74,13 +68,13 @@ func (c *ClientFactory) NewDomainTopicEventSubscriptionsClient() *DomainTopicEve return subClient } -func (c *ClientFactory) NewTopicEventSubscriptionsClient() *TopicEventSubscriptionsClient { - subClient, _ := NewTopicEventSubscriptionsClient(c.subscriptionID, c.credential, c.options) +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) +func (c *ClientFactory) NewDomainsClient() *DomainsClient { + subClient, _ := NewDomainsClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -89,8 +83,8 @@ func (c *ClientFactory) NewEventSubscriptionsClient() *EventSubscriptionsClient return subClient } -func (c *ClientFactory) NewSystemTopicEventSubscriptionsClient() *SystemTopicEventSubscriptionsClient { - subClient, _ := NewSystemTopicEventSubscriptionsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewExtensionTopicsClient() *ExtensionTopicsClient { + subClient, _ := NewExtensionTopicsClient(c.credential, c.options) return subClient } @@ -99,8 +93,8 @@ func (c *ClientFactory) NewNamespaceTopicEventSubscriptionsClient() *NamespaceTo return subClient } -func (c *ClientFactory) NewPartnerTopicEventSubscriptionsClient() *PartnerTopicEventSubscriptionsClient { - subClient, _ := NewPartnerTopicEventSubscriptionsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewNamespaceTopicsClient() *NamespaceTopicsClient { + subClient, _ := NewNamespaceTopicsClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -109,8 +103,8 @@ func (c *ClientFactory) NewNamespacesClient() *NamespacesClient { return subClient } -func (c *ClientFactory) NewNamespaceTopicsClient() *NamespaceTopicsClient { - subClient, _ := NewNamespaceTopicsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewNetworkSecurityPerimeterConfigurationsClient() *NetworkSecurityPerimeterConfigurationsClient { + subClient, _ := NewNetworkSecurityPerimeterConfigurationsClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -139,6 +133,11 @@ func (c *ClientFactory) NewPartnerRegistrationsClient() *PartnerRegistrationsCli return subClient } +func (c *ClientFactory) NewPartnerTopicEventSubscriptionsClient() *PartnerTopicEventSubscriptionsClient { + subClient, _ := NewPartnerTopicEventSubscriptionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewPartnerTopicsClient() *PartnerTopicsClient { subClient, _ := NewPartnerTopicsClient(c.subscriptionID, c.credential, c.options) return subClient @@ -159,18 +158,18 @@ func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesCli return subClient } -func (c *ClientFactory) NewSystemTopicsClient() *SystemTopicsClient { - subClient, _ := NewSystemTopicsClient(c.subscriptionID, c.credential, c.options) +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) +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) +func (c *ClientFactory) NewTopicEventSubscriptionsClient() *TopicEventSubscriptionsClient { + subClient, _ := NewTopicEventSubscriptionsClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -184,6 +183,11 @@ func (c *ClientFactory) NewTopicTypesClient() *TopicTypesClient { return subClient } +func (c *ClientFactory) NewTopicsClient() *TopicsClient { + subClient, _ := NewTopicsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + 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 index 011a9829a191..3f2e37f67e86 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/clientgroups_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/clientgroups_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 @@ -49,7 +48,7 @@ func NewClientGroupsClient(subscriptionID string, credential azcore.TokenCredent // 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 +// Generated from API version 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - namespaceName - Name of the namespace. // - clientGroupName - The client group name. @@ -62,9 +61,10 @@ func (client *ClientGroupsClient) BeginCreateOrUpdate(ctx context.Context, resou if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientGroupsClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientGroupsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClientGroupsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -73,20 +73,22 @@ func (client *ClientGroupsClient) BeginCreateOrUpdate(ctx context.Context, resou // 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 +// Generated from API version 2023-12-15-preview func (client *ClientGroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, clientGroupName string, clientGroupInfo ClientGroup, options *ClientGroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, namespaceName, clientGroupName, clientGroupInfo, 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. @@ -113,16 +115,19 @@ func (client *ClientGroupsClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, clientGroupInfo) + if err := runtime.MarshalAsJSON(req, clientGroupInfo); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete an existing client group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - namespaceName - Name of the namespace. // - clientGroupName - Name of the client group. @@ -134,9 +139,10 @@ func (client *ClientGroupsClient) BeginDelete(ctx context.Context, resourceGroup if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientGroupsClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientGroupsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClientGroupsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -145,20 +151,22 @@ func (client *ClientGroupsClient) BeginDelete(ctx context.Context, resourceGroup // Delete - Delete an existing client group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-preview func (client *ClientGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, namespaceName string, clientGroupName string, options *ClientGroupsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, namespaceName, clientGroupName, 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 +193,7 @@ func (client *ClientGroupsClient) 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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -194,24 +202,27 @@ func (client *ClientGroupsClient) deleteCreateRequest(ctx context.Context, resou // 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 +// Generated from API version 2023-12-15-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) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, namespaceName, clientGroupName, options) if err != nil { return ClientGroupsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClientGroupsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientGroupsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientGroupsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -238,7 +249,7 @@ func (client *ClientGroupsClient) 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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -255,7 +266,7 @@ func (client *ClientGroupsClient) getHandleResponse(resp *http.Response) (Client // NewListByNamespacePager - Get all the client groups under a namespace. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-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 @@ -308,7 +319,7 @@ func (client *ClientGroupsClient) listByNamespaceCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } 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 index e34024e38aca..f9282d297dfa 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/clients_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/clients_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 @@ -49,7 +48,7 @@ func NewClientsClient(subscriptionID string, credential azcore.TokenCredential, // 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 +// Generated from API version 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - namespaceName - Name of the namespace. // - clientName - The client name. @@ -62,9 +61,10 @@ func (client *ClientsClient) BeginCreateOrUpdate(ctx context.Context, resourceGr if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientsClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClientsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -73,20 +73,22 @@ func (client *ClientsClient) BeginCreateOrUpdate(ctx context.Context, resourceGr // 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 +// Generated from API version 2023-12-15-preview func (client *ClientsClient) createOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, clientName string, clientInfo Client, options *ClientsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, namespaceName, clientName, clientInfo, 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. @@ -113,16 +115,19 @@ func (client *ClientsClient) 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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, clientInfo) + if err := runtime.MarshalAsJSON(req, clientInfo); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete an existing client. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - namespaceName - Name of the namespace. // - clientName - Name of the client. @@ -133,9 +138,10 @@ func (client *ClientsClient) BeginDelete(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientsClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClientsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -144,20 +150,22 @@ func (client *ClientsClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Delete an existing client. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-preview func (client *ClientsClient) deleteOperation(ctx context.Context, resourceGroupName string, namespaceName string, clientName string, options *ClientsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, namespaceName, clientName, 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. @@ -184,7 +192,7 @@ func (client *ClientsClient) 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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -193,24 +201,27 @@ func (client *ClientsClient) deleteCreateRequest(ctx context.Context, resourceGr // Get - Get properties of a client. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-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) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, namespaceName, clientName, options) if err != nil { return ClientsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClientsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -237,7 +248,7 @@ func (client *ClientsClient) 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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -254,7 +265,7 @@ func (client *ClientsClient) getHandleResponse(resp *http.Response) (ClientsClie // NewListByNamespacePager - Get all the permission bindings under a namespace. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-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 @@ -307,7 +318,7 @@ func (client *ClientsClient) listByNamespaceCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } 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..6feb6b314bd8 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" + moduleVersion = "v2.2.0-beta.2" ) // AdvancedFilterOperatorType - The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. @@ -317,12 +316,14 @@ func PossibleDeliveryAttributeMappingTypeValues() []DeliveryAttributeMappingType type DeliveryMode string const ( + DeliveryModePush DeliveryMode = "Push" DeliveryModeQueue DeliveryMode = "Queue" ) // PossibleDeliveryModeValues returns the possible values for the DeliveryMode const type. func PossibleDeliveryModeValues() []DeliveryMode { return []DeliveryMode{ + DeliveryModePush, DeliveryModeQueue, } } @@ -396,6 +397,8 @@ const ( EndpointTypeAzureFunction EndpointType = "AzureFunction" EndpointTypeEventHub EndpointType = "EventHub" EndpointTypeHybridConnection EndpointType = "HybridConnection" + EndpointTypeMonitorAlert EndpointType = "MonitorAlert" + EndpointTypeNamespaceTopic EndpointType = "NamespaceTopic" EndpointTypePartnerDestination EndpointType = "PartnerDestination" EndpointTypeServiceBusQueue EndpointType = "ServiceBusQueue" EndpointTypeServiceBusTopic EndpointType = "ServiceBusTopic" @@ -409,6 +412,8 @@ func PossibleEndpointTypeValues() []EndpointType { EndpointTypeAzureFunction, EndpointTypeEventHub, EndpointTypeHybridConnection, + EndpointTypeMonitorAlert, + EndpointTypeNamespaceTopic, EndpointTypePartnerDestination, EndpointTypeServiceBusQueue, EndpointTypeServiceBusTopic, @@ -624,6 +629,29 @@ func PossibleInputSchemaMappingTypeValues() []InputSchemaMappingType { } } +// MonitorAlertSeverity - The severity that will be attached to every Alert fired through this event subscription. This field +// must be provided. +type MonitorAlertSeverity string + +const ( + MonitorAlertSeveritySev0 MonitorAlertSeverity = "Sev0" + MonitorAlertSeveritySev1 MonitorAlertSeverity = "Sev1" + MonitorAlertSeveritySev2 MonitorAlertSeverity = "Sev2" + MonitorAlertSeveritySev3 MonitorAlertSeverity = "Sev3" + MonitorAlertSeveritySev4 MonitorAlertSeverity = "Sev4" +) + +// PossibleMonitorAlertSeverityValues returns the possible values for the MonitorAlertSeverity const type. +func PossibleMonitorAlertSeverityValues() []MonitorAlertSeverity { + return []MonitorAlertSeverity{ + MonitorAlertSeveritySev0, + MonitorAlertSeveritySev1, + MonitorAlertSeveritySev2, + MonitorAlertSeveritySev3, + MonitorAlertSeveritySev4, + } +} + // NamespaceProvisioningState - Provisioning state of the namespace resource. type NamespaceProvisioningState string @@ -688,6 +716,120 @@ func PossibleNamespaceTopicProvisioningStateValues() []NamespaceTopicProvisionin } } +// NetworkSecurityPerimeterAssociationAccessMode - Network security perimeter access mode. +type NetworkSecurityPerimeterAssociationAccessMode string + +const ( + NetworkSecurityPerimeterAssociationAccessModeAudit NetworkSecurityPerimeterAssociationAccessMode = "Audit" + NetworkSecurityPerimeterAssociationAccessModeEnforced NetworkSecurityPerimeterAssociationAccessMode = "Enforced" + NetworkSecurityPerimeterAssociationAccessModeLearning NetworkSecurityPerimeterAssociationAccessMode = "Learning" +) + +// PossibleNetworkSecurityPerimeterAssociationAccessModeValues returns the possible values for the NetworkSecurityPerimeterAssociationAccessMode const type. +func PossibleNetworkSecurityPerimeterAssociationAccessModeValues() []NetworkSecurityPerimeterAssociationAccessMode { + return []NetworkSecurityPerimeterAssociationAccessMode{ + NetworkSecurityPerimeterAssociationAccessModeAudit, + NetworkSecurityPerimeterAssociationAccessModeEnforced, + NetworkSecurityPerimeterAssociationAccessModeLearning, + } +} + +// NetworkSecurityPerimeterConfigProvisioningState - Provisioning state to reflect configuration state and indicate status +// of nsp profile configuration retrieval. +type NetworkSecurityPerimeterConfigProvisioningState string + +const ( + NetworkSecurityPerimeterConfigProvisioningStateAccepted NetworkSecurityPerimeterConfigProvisioningState = "Accepted" + NetworkSecurityPerimeterConfigProvisioningStateCanceled NetworkSecurityPerimeterConfigProvisioningState = "Canceled" + NetworkSecurityPerimeterConfigProvisioningStateCreating NetworkSecurityPerimeterConfigProvisioningState = "Creating" + NetworkSecurityPerimeterConfigProvisioningStateDeleted NetworkSecurityPerimeterConfigProvisioningState = "Deleted" + NetworkSecurityPerimeterConfigProvisioningStateDeleting NetworkSecurityPerimeterConfigProvisioningState = "Deleting" + NetworkSecurityPerimeterConfigProvisioningStateFailed NetworkSecurityPerimeterConfigProvisioningState = "Failed" + NetworkSecurityPerimeterConfigProvisioningStateSucceeded NetworkSecurityPerimeterConfigProvisioningState = "Succeeded" + NetworkSecurityPerimeterConfigProvisioningStateUpdating NetworkSecurityPerimeterConfigProvisioningState = "Updating" +) + +// PossibleNetworkSecurityPerimeterConfigProvisioningStateValues returns the possible values for the NetworkSecurityPerimeterConfigProvisioningState const type. +func PossibleNetworkSecurityPerimeterConfigProvisioningStateValues() []NetworkSecurityPerimeterConfigProvisioningState { + return []NetworkSecurityPerimeterConfigProvisioningState{ + NetworkSecurityPerimeterConfigProvisioningStateAccepted, + NetworkSecurityPerimeterConfigProvisioningStateCanceled, + NetworkSecurityPerimeterConfigProvisioningStateCreating, + NetworkSecurityPerimeterConfigProvisioningStateDeleted, + NetworkSecurityPerimeterConfigProvisioningStateDeleting, + NetworkSecurityPerimeterConfigProvisioningStateFailed, + NetworkSecurityPerimeterConfigProvisioningStateSucceeded, + NetworkSecurityPerimeterConfigProvisioningStateUpdating, + } +} + +// NetworkSecurityPerimeterConfigurationIssueSeverity - Provisioning issue severity. +type NetworkSecurityPerimeterConfigurationIssueSeverity string + +const ( + NetworkSecurityPerimeterConfigurationIssueSeverityError NetworkSecurityPerimeterConfigurationIssueSeverity = "Error" + NetworkSecurityPerimeterConfigurationIssueSeverityWarning NetworkSecurityPerimeterConfigurationIssueSeverity = "Warning" +) + +// PossibleNetworkSecurityPerimeterConfigurationIssueSeverityValues returns the possible values for the NetworkSecurityPerimeterConfigurationIssueSeverity const type. +func PossibleNetworkSecurityPerimeterConfigurationIssueSeverityValues() []NetworkSecurityPerimeterConfigurationIssueSeverity { + return []NetworkSecurityPerimeterConfigurationIssueSeverity{ + NetworkSecurityPerimeterConfigurationIssueSeverityError, + NetworkSecurityPerimeterConfigurationIssueSeverityWarning, + } +} + +// NetworkSecurityPerimeterConfigurationIssueType - Provisioning issue type. +type NetworkSecurityPerimeterConfigurationIssueType string + +const ( + NetworkSecurityPerimeterConfigurationIssueTypeConfigurationPropagationFailure NetworkSecurityPerimeterConfigurationIssueType = "ConfigurationPropagationFailure" + NetworkSecurityPerimeterConfigurationIssueTypeMissingIdentityConfiguration NetworkSecurityPerimeterConfigurationIssueType = "MissingIdentityConfiguration" + NetworkSecurityPerimeterConfigurationIssueTypeMissingPerimeterConfiguration NetworkSecurityPerimeterConfigurationIssueType = "MissingPerimeterConfiguration" + NetworkSecurityPerimeterConfigurationIssueTypeOther NetworkSecurityPerimeterConfigurationIssueType = "Other" +) + +// PossibleNetworkSecurityPerimeterConfigurationIssueTypeValues returns the possible values for the NetworkSecurityPerimeterConfigurationIssueType const type. +func PossibleNetworkSecurityPerimeterConfigurationIssueTypeValues() []NetworkSecurityPerimeterConfigurationIssueType { + return []NetworkSecurityPerimeterConfigurationIssueType{ + NetworkSecurityPerimeterConfigurationIssueTypeConfigurationPropagationFailure, + NetworkSecurityPerimeterConfigurationIssueTypeMissingIdentityConfiguration, + NetworkSecurityPerimeterConfigurationIssueTypeMissingPerimeterConfiguration, + NetworkSecurityPerimeterConfigurationIssueTypeOther, + } +} + +// NetworkSecurityPerimeterProfileAccessRuleDirection - NSP access rule direction. +type NetworkSecurityPerimeterProfileAccessRuleDirection string + +const ( + NetworkSecurityPerimeterProfileAccessRuleDirectionInbound NetworkSecurityPerimeterProfileAccessRuleDirection = "Inbound" + NetworkSecurityPerimeterProfileAccessRuleDirectionOutbound NetworkSecurityPerimeterProfileAccessRuleDirection = "Outbound" +) + +// PossibleNetworkSecurityPerimeterProfileAccessRuleDirectionValues returns the possible values for the NetworkSecurityPerimeterProfileAccessRuleDirection const type. +func PossibleNetworkSecurityPerimeterProfileAccessRuleDirectionValues() []NetworkSecurityPerimeterProfileAccessRuleDirection { + return []NetworkSecurityPerimeterProfileAccessRuleDirection{ + NetworkSecurityPerimeterProfileAccessRuleDirectionInbound, + NetworkSecurityPerimeterProfileAccessRuleDirectionOutbound, + } +} + +type NetworkSecurityPerimeterResourceType string + +const ( + NetworkSecurityPerimeterResourceTypeDomains NetworkSecurityPerimeterResourceType = "domains" + NetworkSecurityPerimeterResourceTypeTopics NetworkSecurityPerimeterResourceType = "topics" +) + +// PossibleNetworkSecurityPerimeterResourceTypeValues returns the possible values for the NetworkSecurityPerimeterResourceType const type. +func PossibleNetworkSecurityPerimeterResourceTypeValues() []NetworkSecurityPerimeterResourceType { + return []NetworkSecurityPerimeterResourceType{ + NetworkSecurityPerimeterResourceTypeDomains, + NetworkSecurityPerimeterResourceTypeTopics, + } +} + // PartnerClientAuthenticationType - Type of client authentication type PartnerClientAuthenticationType string @@ -978,8 +1120,9 @@ func PossiblePrivateEndpointConnectionsParentTypeValues() []PrivateEndpointConne type PublicNetworkAccess string const ( - PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" + PublicNetworkAccessSecuredByPerimeter PublicNetworkAccess = "SecuredByPerimeter" ) // PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type. @@ -987,6 +1130,7 @@ func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { return []PublicNetworkAccess{ PublicNetworkAccessDisabled, PublicNetworkAccessEnabled, + PublicNetworkAccessSecuredByPerimeter, } } @@ -1255,7 +1399,7 @@ func PossibleTopicSpacesConfigurationStateValues() []TopicSpacesConfigurationSta } } -// TopicTypeProvisioningState - Provisioning state of the topic type +// TopicTypeProvisioningState - Provisioning state of the topic type. type TopicTypeProvisioningState string const ( diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/domaineventsubscriptions_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/domaineventsubscriptions_client.go index 0fff01260e9f..089ab3a1d4dc 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 @@ -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 2023-12-15-preview // - 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,7 +62,8 @@ 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[DomainEventSubscriptionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DomainEventSubscriptionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -72,20 +72,22 @@ func (client *DomainEventSubscriptionsClient) BeginCreateOrUpdate(ctx context.Co // 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 2023-12-15-preview func (client *DomainEventSubscriptionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, domainName string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription, options *DomainEventSubscriptionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error 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 +114,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", "2023-12-15-preview") 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 2023-12-15-preview // - 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,7 +139,8 @@ 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[DomainEventSubscriptionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DomainEventSubscriptionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -143,20 +149,22 @@ func (client *DomainEventSubscriptionsClient) BeginDelete(ctx context.Context, r // 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 2023-12-15-preview func (client *DomainEventSubscriptionsClient) deleteOperation(ctx context.Context, resourceGroupName string, domainName string, eventSubscriptionName string, options *DomainEventSubscriptionsClientBeginDeleteOptions) (*http.Response, error) { + var err error 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 +191,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -191,7 +199,7 @@ 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 2023-12-15-preview // - 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 found. Event subscription names must be between 3 and 100 @@ -199,18 +207,21 @@ func (client *DomainEventSubscriptionsClient) deleteCreateRequest(ctx context.Co // - 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 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 +248,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -255,25 +266,28 @@ 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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the domain. // - 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 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 +314,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -318,25 +332,28 @@ 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 2023-12-15-preview // - 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 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 +380,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -380,7 +397,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 2023-12-15-preview // - 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 @@ -433,7 +450,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -457,7 +474,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 2023-12-15-preview // - 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,7 +487,8 @@ 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[DomainEventSubscriptionsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DomainEventSubscriptionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -479,20 +497,22 @@ func (client *DomainEventSubscriptionsClient) BeginUpdate(ctx context.Context, r // 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 2023-12-15-preview func (client *DomainEventSubscriptionsClient) update(ctx context.Context, resourceGroupName string, domainName string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters, options *DomainEventSubscriptionsClientBeginUpdateOptions) (*http.Response, error) { + var err error 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 +539,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", "2023-12-15-preview") 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 deleted file mode 100644 index cf8477acf9bf..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/domaineventsubscriptions_client_example_test.go +++ /dev/null @@ -1,322 +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/DomainEventSubscriptions_GetDeliveryAttributes.json -func ExampleDomainEventSubscriptionsClient_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.NewDomainEventSubscriptionsClient().GetDeliveryAttributes(ctx, "examplerg", "exampleDomain1", "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/DomainEventSubscriptions_Get.json -func ExampleDomainEventSubscriptionsClient_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.NewDomainEventSubscriptionsClient().Get(ctx, "examplerg", "exampleDomain1", "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.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"), - // 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"), - // }, - // }, - // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IncludedEventTypes: []*string{ - // to.Ptr("Microsoft.Storage.BlobCreated"), - // to.Ptr("Microsoft.Storage.BlobDeleted")}, - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // RetryPolicy: &armeventgrid.RetryPolicy{ - // 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"), - // }, - // } -} - -// 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 -func ExampleDomainEventSubscriptionsClient_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.NewDomainEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "examplerg", "exampleDomain1", "exampleEventSubscriptionName1", armeventgrid.EventSubscription{ - Properties: &armeventgrid.EventSubscriptionProperties{ - Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(false), - SubjectBeginsWith: to.Ptr("ExamplePrefix"), - SubjectEndsWith: to.Ptr("ExampleSuffix"), - }, - }, - }, 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.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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // RetryPolicy: &armeventgrid.RetryPolicy{ - // 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"), - // }, - // } -} - -// 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 -func ExampleDomainEventSubscriptionsClient_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.NewDomainEventSubscriptionsClient().BeginDelete(ctx, "examplerg", "exampleDomain1", "examplesubscription1", 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/DomainEventSubscriptions_Update.json -func ExampleDomainEventSubscriptionsClient_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.NewDomainEventSubscriptionsClient().BeginUpdate(ctx, "examplerg", "exampleDomain1", "exampleEventSubscriptionName1", armeventgrid.EventSubscriptionUpdateParameters{ - Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(true), - SubjectBeginsWith: to.Ptr("existingPrefix"), - SubjectEndsWith: to.Ptr("newSuffix"), - }, - Labels: []*string{ - to.Ptr("label1"), - to.Ptr("label2")}, - }, 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/DomainEventSubscriptions_GetFullUrl.json -func ExampleDomainEventSubscriptionsClient_GetFullURL() { - 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.NewDomainEventSubscriptionsClient().GetFullURL(ctx, "examplerg", "exampleDomain1", "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.EventSubscriptionFullURL = armeventgrid.EventSubscriptionFullURL{ - // EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - // } -} - -// 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 -func ExampleDomainEventSubscriptionsClient_NewListPager() { - 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.NewDomainEventSubscriptionsClient().NewListPager("examplerg", "exampleDomain1", &armeventgrid.DomainEventSubscriptionsClientListOptions{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.EventSubscriptionsListResult = armeventgrid.EventSubscriptionsListResult{ - // Value: []*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"), - // 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"), - // }, - // }, - // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IncludedEventTypes: []*string{ - // to.Ptr("Microsoft.Storage.BlobCreated"), - // to.Ptr("Microsoft.Storage.BlobDeleted")}, - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // RetryPolicy: &armeventgrid.RetryPolicy{ - // 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"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/domains_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/domains_client.go index fd2643299aaa..9f9db988406b 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 @@ -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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the domain. // - domainInfo - Domain information. @@ -61,7 +60,8 @@ 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[DomainsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DomainsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *DomainsClient) BeginCreateOrUpdate(ctx context.Context, resourceGr // 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 2023-12-15-preview func (client *DomainsClient) createOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainInfo Domain, options *DomainsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error 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 +108,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", "2023-12-15-preview") 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 2023-12-15-preview // - 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,7 +130,8 @@ 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[DomainsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DomainsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -134,20 +140,22 @@ func (client *DomainsClient) BeginDelete(ctx context.Context, resourceGroupName // 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 2023-12-15-preview func (client *DomainsClient) deleteOperation(ctx context.Context, resourceGroupName string, domainName string, options *DomainsClientBeginDeleteOptions) (*http.Response, error) { + var err error 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 +178,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -178,23 +186,26 @@ 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 2023-12-15-preview // - 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 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 +228,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -234,7 +245,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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - options - DomainsClientListByResourceGroupOptions contains the optional parameters for the DomainsClient.NewListByResourceGroupPager // method. @@ -282,7 +293,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -305,7 +316,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 2023-12-15-preview // - options - DomainsClientListBySubscriptionOptions contains the optional parameters for the DomainsClient.NewListBySubscriptionPager // method. func (client *DomainsClient) NewListBySubscriptionPager(options *DomainsClientListBySubscriptionOptions) *runtime.Pager[DomainsClientListBySubscriptionResponse] { @@ -348,7 +359,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -372,24 +383,27 @@ 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 2023-12-15-preview // - 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 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 +426,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -430,24 +444,27 @@ 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 2023-12-15-preview // - 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 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 +487,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", "2023-12-15-preview") 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 +508,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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the domain. // - domainUpdateParameters - Domain update information. @@ -499,7 +519,8 @@ 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[DomainsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DomainsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -508,20 +529,22 @@ func (client *DomainsClient) BeginUpdate(ctx context.Context, resourceGroupName // 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 2023-12-15-preview func (client *DomainsClient) update(ctx context.Context, resourceGroupName string, domainName string, domainUpdateParameters DomainUpdateParameters, options *DomainsClientBeginUpdateOptions) (*http.Response, error) { + var err error 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 +567,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", "2023-12-15-preview") 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 deleted file mode 100644 index 32b3e1de60bb..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/domains_client_example_test.go +++ /dev/null @@ -1,317 +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/Domains_Get.json -func ExampleDomainsClient_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.NewDomainsClient().Get(ctx, "examplerg", "exampledomain2", 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.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"), - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armeventgrid.DomainProperties{ - // Endpoint: to.Ptr("https://exampledomain2.westcentralus-1.eventgrid.azure.net/api/events"), - // ProvisioningState: to.Ptr(armeventgrid.DomainProvisioningStateSucceeded), - // }, - // } -} - -// 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 -func ExampleDomainsClient_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.NewDomainsClient().BeginCreateOrUpdate(ctx, "examplerg", "exampledomain1", armeventgrid.Domain{ - Location: to.Ptr("westus2"), - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - Properties: &armeventgrid.DomainProperties{ - InboundIPRules: []*armeventgrid.InboundIPRule{ - { - Action: to.Ptr(armeventgrid.IPActionTypeAllow), - IPMask: to.Ptr("12.18.30.15"), - }, - { - Action: to.Ptr(armeventgrid.IPActionTypeAllow), - IPMask: to.Ptr("12.18.176.1"), - }}, - PublicNetworkAccess: to.Ptr(armeventgrid.PublicNetworkAccessEnabled), - }, - }, 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/Domains_Delete.json -func ExampleDomainsClient_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.NewDomainsClient().BeginDelete(ctx, "examplerg", "exampledomain1", 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/Domains_Update.json -func ExampleDomainsClient_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.NewDomainsClient().BeginUpdate(ctx, "examplerg", "exampledomain1", armeventgrid.DomainUpdateParameters{ - Properties: &armeventgrid.DomainUpdateParameterProperties{ - InboundIPRules: []*armeventgrid.InboundIPRule{ - { - Action: to.Ptr(armeventgrid.IPActionTypeAllow), - IPMask: to.Ptr("12.18.30.15"), - }, - { - Action: to.Ptr(armeventgrid.IPActionTypeAllow), - IPMask: to.Ptr("12.18.176.1"), - }}, - PublicNetworkAccess: to.Ptr(armeventgrid.PublicNetworkAccessEnabled), - }, - 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) - } - _, 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/Domains_ListBySubscription.json -func ExampleDomainsClient_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.NewDomainsClient().NewListBySubscriptionPager(&armeventgrid.DomainsClientListBySubscriptionOptions{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.DomainsListResult = armeventgrid.DomainsListResult{ - // Value: []*armeventgrid.Domain{ - // { - // 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"), - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armeventgrid.DomainProperties{ - // Endpoint: to.Ptr("https://exampledomain1.westus2-1.eventgrid.azure.net/api/events"), - // ProvisioningState: to.Ptr(armeventgrid.DomainProvisioningStateSucceeded), - // }, - // }, - // { - // 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"), - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armeventgrid.DomainProperties{ - // Endpoint: to.Ptr("https://exampledomain2.westcentralus-1.eventgrid.azure.net/api/events"), - // ProvisioningState: to.Ptr(armeventgrid.DomainProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// 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 -func ExampleDomainsClient_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.NewDomainsClient().NewListByResourceGroupPager("examplerg", &armeventgrid.DomainsClientListByResourceGroupOptions{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.DomainsListResult = armeventgrid.DomainsListResult{ - // Value: []*armeventgrid.Domain{ - // { - // 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"), - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armeventgrid.DomainProperties{ - // Endpoint: to.Ptr("https://exampledomain1.westus2-1.eventgrid.azure.net/api/events"), - // ProvisioningState: to.Ptr(armeventgrid.DomainProvisioningStateSucceeded), - // }, - // }, - // { - // 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"), - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armeventgrid.DomainProperties{ - // Endpoint: to.Ptr("https://exampledomain2.westcentralus-1.eventgrid.azure.net/api/events"), - // ProvisioningState: to.Ptr(armeventgrid.DomainProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// 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 -func ExampleDomainsClient_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.NewDomainsClient().ListSharedAccessKeys(ctx, "examplerg", "exampledomain2", 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.DomainSharedAccessKeys = armeventgrid.DomainSharedAccessKeys{ - // 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/Domains_RegenerateKey.json -func ExampleDomainsClient_RegenerateKey() { - 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.NewDomainsClient().RegenerateKey(ctx, "examplerg", "exampledomain2", armeventgrid.DomainRegenerateKeyRequest{ - KeyName: to.Ptr("key1"), - }, 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.DomainSharedAccessKeys = armeventgrid.DomainSharedAccessKeys{ - // Key1: to.Ptr("testKey1Value"), - // Key2: to.Ptr("testKey2Value"), - // } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/domaintopiceventsubscriptions_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/domaintopiceventsubscriptions_client.go index 556e9a6f5cd8..3b6be44bffd6 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 @@ -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 2023-12-15-preview // - 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,7 +63,8 @@ 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[DomainTopicEventSubscriptionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DomainTopicEventSubscriptionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -73,20 +73,22 @@ func (client *DomainTopicEventSubscriptionsClient) BeginCreateOrUpdate(ctx conte // 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 2023-12-15-preview 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 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 +119,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", "2023-12-15-preview") 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 2023-12-15-preview // - 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,7 +145,8 @@ 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[DomainTopicEventSubscriptionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DomainTopicEventSubscriptionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -149,20 +155,22 @@ func (client *DomainTopicEventSubscriptionsClient) BeginDelete(ctx context.Conte // 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 2023-12-15-preview func (client *DomainTopicEventSubscriptionsClient) deleteOperation(ctx context.Context, resourceGroupName string, domainName string, topicName string, eventSubscriptionName string, options *DomainTopicEventSubscriptionsClientBeginDeleteOptions) (*http.Response, error) { + var err error 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 +201,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -201,7 +209,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 2023-12-15-preview // - 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 +217,21 @@ 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 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 +262,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,7 +280,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 2023-12-15-preview // - 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 +288,21 @@ 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 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 +333,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -337,7 +351,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 2023-12-15-preview // - 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 +359,21 @@ 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 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 +404,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -404,7 +421,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 2023-12-15-preview // - 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. @@ -462,7 +479,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -486,7 +503,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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the domain. // - topicName - Name of the topic. @@ -500,7 +517,8 @@ 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[DomainTopicEventSubscriptionsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DomainTopicEventSubscriptionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -509,20 +527,22 @@ func (client *DomainTopicEventSubscriptionsClient) BeginUpdate(ctx context.Conte // 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 2023-12-15-preview 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 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 +573,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", "2023-12-15-preview") 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 deleted file mode 100644 index 360872484716..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/domaintopiceventsubscriptions_client_example_test.go +++ /dev/null @@ -1,322 +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/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 -func ExampleDomainTopicEventSubscriptionsClient_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.NewDomainTopicEventSubscriptionsClient().Get(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.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"), - // 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"), - // }, - // }, - // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IncludedEventTypes: []*string{ - // to.Ptr("Microsoft.Storage.BlobCreated"), - // to.Ptr("Microsoft.Storage.BlobDeleted")}, - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // RetryPolicy: &armeventgrid.RetryPolicy{ - // 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"), - // }, - // } -} - -// 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 -func ExampleDomainTopicEventSubscriptionsClient_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.NewDomainTopicEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "examplerg", "exampleDomain1", "exampleDomainTopic1", "exampleEventSubscriptionName1", armeventgrid.EventSubscription{ - Properties: &armeventgrid.EventSubscriptionProperties{ - Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(false), - SubjectBeginsWith: to.Ptr("ExamplePrefix"), - SubjectEndsWith: to.Ptr("ExampleSuffix"), - }, - }, - }, 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.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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // RetryPolicy: &armeventgrid.RetryPolicy{ - // 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"), - // }, - // } -} - -// 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 -func ExampleDomainTopicEventSubscriptionsClient_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.NewDomainTopicEventSubscriptionsClient().BeginDelete(ctx, "examplerg", "exampleDomain1", "exampleDomainTopic1", "examplesubscription1", 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/DomainTopicEventSubscriptions_Update.json -func ExampleDomainTopicEventSubscriptionsClient_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.NewDomainTopicEventSubscriptionsClient().BeginUpdate(ctx, "examplerg", "exampleDomain1", "exampleDomainTopic1", "exampleEventSubscriptionName1", armeventgrid.EventSubscriptionUpdateParameters{ - Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(true), - SubjectBeginsWith: to.Ptr("existingPrefix"), - SubjectEndsWith: to.Ptr("newSuffix"), - }, - Labels: []*string{ - to.Ptr("label1"), - to.Ptr("label2")}, - }, 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/DomainTopicEventSubscriptions_GetFullUrl.json -func ExampleDomainTopicEventSubscriptionsClient_GetFullURL() { - 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().GetFullURL(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.EventSubscriptionFullURL = armeventgrid.EventSubscriptionFullURL{ - // EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - // } -} - -// 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 -func ExampleDomainTopicEventSubscriptionsClient_NewListPager() { - 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.NewDomainTopicEventSubscriptionsClient().NewListPager("examplerg", "exampleDomain1", "exampleDomainTopic1", &armeventgrid.DomainTopicEventSubscriptionsClientListOptions{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.EventSubscriptionsListResult = armeventgrid.EventSubscriptionsListResult{ - // Value: []*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"), - // 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"), - // }, - // }, - // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IncludedEventTypes: []*string{ - // to.Ptr("Microsoft.Storage.BlobCreated"), - // to.Ptr("Microsoft.Storage.BlobDeleted")}, - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // RetryPolicy: &armeventgrid.RetryPolicy{ - // 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"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/domaintopics_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/domaintopics_client.go index 6f0dd8d66720..361a243678ce 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 @@ -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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the domain. // - domainTopicName - Name of the domain topic. @@ -61,7 +60,8 @@ 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[DomainTopicsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DomainTopicsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *DomainTopicsClient) BeginCreateOrUpdate(ctx context.Context, resou // 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 2023-12-15-preview func (client *DomainTopicsClient) createOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string, options *DomainTopicsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error 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 +112,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -119,7 +121,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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - domainName - Name of the domain. // - domainTopicName - Name of the domain topic. @@ -131,7 +133,8 @@ 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[DomainTopicsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DomainTopicsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -140,20 +143,22 @@ func (client *DomainTopicsClient) BeginDelete(ctx context.Context, resourceGroup // 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 2023-12-15-preview func (client *DomainTopicsClient) deleteOperation(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string, options *DomainTopicsClientBeginDeleteOptions) (*http.Response, error) { + var err error 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 +185,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -188,24 +193,27 @@ 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 2023-12-15-preview // - 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 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 +240,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -249,7 +257,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 2023-12-15-preview // - 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 @@ -302,7 +310,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", "2023-12-15-preview") 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 deleted file mode 100644 index 70a172ece9d2..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/domaintopics_client_example_test.go +++ /dev/null @@ -1,134 +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/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/DomainTopics_Get.json -func ExampleDomainTopicsClient_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.NewDomainTopicsClient().Get(ctx, "examplerg", "exampledomain2", "topic1", 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.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"), - // 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 -func ExampleDomainTopicsClient_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.NewDomainTopicsClient().BeginCreateOrUpdate(ctx, "examplerg", "exampledomain1", "exampledomaintopic1", 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/DomainTopics_Delete.json -func ExampleDomainTopicsClient_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.NewDomainTopicsClient().BeginDelete(ctx, "examplerg", "exampledomain1", "exampledomaintopic1", 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/DomainTopics_ListByDomain.json -func ExampleDomainTopicsClient_NewListByDomainPager() { - 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.NewDomainTopicsClient().NewListByDomainPager("examplerg", "exampledomain2", &armeventgrid.DomainTopicsClientListByDomainOptions{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.DomainTopicsListResult = armeventgrid.DomainTopicsListResult{ - // Value: []*armeventgrid.DomainTopic{ - // { - // 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"), - // Properties: &armeventgrid.DomainTopicProperties{ - // ProvisioningState: to.Ptr(armeventgrid.DomainTopicProvisioningStateSucceeded), - // }, - // }, - // { - // 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"), - // Properties: &armeventgrid.DomainTopicProperties{ - // ProvisioningState: to.Ptr(armeventgrid.DomainTopicProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/eventsubscriptions_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/eventsubscriptions_client.go index 5ddd63bda359..09944cc2e138 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 @@ -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 2023-12-15-preview // - 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,7 +69,8 @@ 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[EventSubscriptionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[EventSubscriptionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -80,20 +80,22 @@ 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 2023-12-15-preview func (client *EventSubscriptionsClient) createOrUpdate(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription, options *EventSubscriptionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error 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 +111,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", "2023-12-15-preview") 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 2023-12-15-preview // - 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,7 +141,8 @@ 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[EventSubscriptionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[EventSubscriptionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -145,20 +151,22 @@ func (client *EventSubscriptionsClient) BeginDelete(ctx context.Context, scope s // 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 2023-12-15-preview func (client *EventSubscriptionsClient) deleteOperation(ctx context.Context, scope string, eventSubscriptionName string, options *EventSubscriptionsClientBeginDeleteOptions) (*http.Response, error) { + var err error 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 +182,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -182,7 +190,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 2023-12-15-preview // - 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 +202,21 @@ 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 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 +232,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -239,7 +250,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 2023-12-15-preview // - 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 +263,21 @@ 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 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 +293,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -297,7 +311,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 2023-12-15-preview // - 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 +324,21 @@ 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 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 +354,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -354,7 +371,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 2023-12-15-preview // - 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. @@ -412,7 +429,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -435,7 +452,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 2023-12-15-preview // - 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. @@ -498,7 +515,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -522,7 +539,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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - options - EventSubscriptionsClientListGlobalByResourceGroupOptions contains the optional parameters for the EventSubscriptionsClient.NewListGlobalByResourceGroupPager // method. @@ -570,7 +587,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -594,7 +611,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 2023-12-15-preview // - 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 @@ -647,7 +664,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -670,7 +687,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 2023-12-15-preview // - options - EventSubscriptionsClientListGlobalBySubscriptionOptions contains the optional parameters for the EventSubscriptionsClient.NewListGlobalBySubscriptionPager // method. func (client *EventSubscriptionsClient) NewListGlobalBySubscriptionPager(options *EventSubscriptionsClientListGlobalBySubscriptionOptions) *runtime.Pager[EventSubscriptionsClientListGlobalBySubscriptionResponse] { @@ -713,7 +730,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -737,7 +754,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 2023-12-15-preview // - topicTypeName - Name of the topic type. // - options - EventSubscriptionsClientListGlobalBySubscriptionForTopicTypeOptions contains the optional parameters for the // EventSubscriptionsClient.NewListGlobalBySubscriptionForTopicTypePager method. @@ -785,7 +802,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -809,7 +826,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 2023-12-15-preview // - 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 @@ -862,7 +879,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -886,7 +903,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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - location - Name of the location. // - topicTypeName - Name of the topic type. @@ -944,7 +961,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -967,7 +984,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 2023-12-15-preview // - location - Name of the location. // - options - EventSubscriptionsClientListRegionalBySubscriptionOptions contains the optional parameters for the EventSubscriptionsClient.NewListRegionalBySubscriptionPager // method. @@ -1015,7 +1032,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -1039,7 +1056,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 2023-12-15-preview // - location - Name of the location. // - topicTypeName - Name of the topic type. // - options - EventSubscriptionsClientListRegionalBySubscriptionForTopicTypeOptions contains the optional parameters for the @@ -1092,7 +1109,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -1116,7 +1133,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 2023-12-15-preview // - 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,7 +1152,8 @@ 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[EventSubscriptionsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[EventSubscriptionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1144,20 +1162,22 @@ func (client *EventSubscriptionsClient) BeginUpdate(ctx context.Context, scope s // 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 2023-12-15-preview func (client *EventSubscriptionsClient) update(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters, options *EventSubscriptionsClientBeginUpdateOptions) (*http.Response, error) { + var err error 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 +1193,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", "2023-12-15-preview") 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 deleted file mode 100644 index 7a52f4805e62..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/eventsubscriptions_client_example_test.go +++ /dev/null @@ -1,2287 +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/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 -func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopic() { - 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().Get(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.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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // 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"), - // }, - // } -} - -// 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 -func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicAzureFunctionDestination() { - 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().Get(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.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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.AzureFunctionEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeAzureFunction), - // Properties: &armeventgrid.AzureFunctionEventSubscriptionDestinationProperties{ - // ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Web/sites/ContosoSite/funtions/ContosoFunc"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // 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"), - // }, - // } -} - -// 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 -func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicEventHubDestination() { - 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().Get(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.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"), - // 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"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // 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"), - // }, - // } -} - -// 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 -func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicHybridConnectionDestination() { - 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().Get(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.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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.HybridConnectionEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeHybridConnection), - // Properties: &armeventgrid.HybridConnectionEventSubscriptionDestinationProperties{ - // ResourceID: to.Ptr("/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Relay/namespaces/ContosoNamespace/hybridConnections/HC1"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // 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"), - // }, - // } -} - -// 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 -func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicServiceBusQueueDestination() { - 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().Get(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.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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.ServiceBusQueueEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeServiceBusQueue), - // Properties: &armeventgrid.ServiceBusQueueEventSubscriptionDestinationProperties{ - // ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ContosoNamespace/queues/SBQ"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // 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"), - // }, - // } -} - -// 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 -func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicServiceBusTopicDestination() { - 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().Get(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.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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.ServiceBusTopicEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeServiceBusTopic), - // Properties: &armeventgrid.ServiceBusTopicEventSubscriptionDestinationProperties{ - // ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ContosoNamespace/topics/SBT"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // 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"), - // }, - // } -} - -// 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 -func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicStorageQueueDestination() { - 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().Get(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.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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // 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"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // 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"), - // }, - // } -} - -// 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 -func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForCustomTopicWebhookDestination() { - 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().Get(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.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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // 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"), - // }, - // } -} - -// 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 -func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForResource() { - 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().Get(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", "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.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"), - // 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"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // 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"), - // }, - // } -} - -// 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 -func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForResourceGroup() { - 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().Get(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg", "examplesubscription2", 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.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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/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 -func ExampleEventSubscriptionsClient_Get_eventSubscriptionsGetForSubscription() { - 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().Get(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40", "examplesubscription3", 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.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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40"), - // }, - // } -} - -// 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 -func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForCustomTopic() { - 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.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/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"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(false), - SubjectBeginsWith: to.Ptr("ExamplePrefix"), - SubjectEndsWith: to.Ptr("ExampleSuffix"), - }, - }, - }, 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/EventSubscriptions_CreateOrUpdateForCustomTopic_AzureFunctionDestination.json -func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForCustomTopicAzureFunctionDestination() { - 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.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{ - Properties: &armeventgrid.EventSubscriptionProperties{ - DeadLetterDestination: &armeventgrid.StorageBlobDeadLetterDestination{ - EndpointType: to.Ptr(armeventgrid.DeadLetterEndPointTypeStorageBlob), - Properties: &armeventgrid.StorageBlobDeadLetterDestinationProperties{ - BlobContainerName: to.Ptr("contosocontainer"), - ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"), - }, - }, - Destination: &armeventgrid.AzureFunctionEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeAzureFunction), - Properties: &armeventgrid.AzureFunctionEventSubscriptionDestinationProperties{ - ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Web/sites/ContosoSite/funtions/ContosoFunc"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(false), - SubjectBeginsWith: to.Ptr("ExamplePrefix"), - SubjectEndsWith: to.Ptr("ExampleSuffix"), - }, - }, - }, 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/EventSubscriptions_CreateOrUpdateForCustomTopic_EventHubDestination.json -func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForCustomTopicEventHubDestination() { - 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.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{ - Properties: &armeventgrid.EventSubscriptionProperties{ - DeadLetterDestination: &armeventgrid.StorageBlobDeadLetterDestination{ - EndpointType: to.Ptr(armeventgrid.DeadLetterEndPointTypeStorageBlob), - Properties: &armeventgrid.StorageBlobDeadLetterDestinationProperties{ - BlobContainerName: to.Ptr("contosocontainer"), - ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"), - }, - }, - 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"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(false), - SubjectBeginsWith: to.Ptr("ExamplePrefix"), - SubjectEndsWith: to.Ptr("ExampleSuffix"), - }, - }, - }, 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/EventSubscriptions_CreateOrUpdateForCustomTopic_HybridConnectionDestination.json -func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForCustomTopicHybridConnectionDestination() { - 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.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{ - Properties: &armeventgrid.EventSubscriptionProperties{ - DeadLetterDestination: &armeventgrid.StorageBlobDeadLetterDestination{ - EndpointType: to.Ptr(armeventgrid.DeadLetterEndPointTypeStorageBlob), - Properties: &armeventgrid.StorageBlobDeadLetterDestinationProperties{ - BlobContainerName: to.Ptr("contosocontainer"), - ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"), - }, - }, - Destination: &armeventgrid.HybridConnectionEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeHybridConnection), - Properties: &armeventgrid.HybridConnectionEventSubscriptionDestinationProperties{ - ResourceID: to.Ptr("/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Relay/namespaces/ContosoNamespace/hybridConnections/HC1"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(false), - SubjectBeginsWith: to.Ptr("ExamplePrefix"), - SubjectEndsWith: to.Ptr("ExampleSuffix"), - }, - }, - }, 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/EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusQueueDestination.json -func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForCustomTopicServiceBusQueueDestination() { - 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.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{ - Properties: &armeventgrid.EventSubscriptionProperties{ - DeadLetterDestination: &armeventgrid.StorageBlobDeadLetterDestination{ - EndpointType: to.Ptr(armeventgrid.DeadLetterEndPointTypeStorageBlob), - Properties: &armeventgrid.StorageBlobDeadLetterDestinationProperties{ - BlobContainerName: to.Ptr("contosocontainer"), - ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"), - }, - }, - Destination: &armeventgrid.ServiceBusQueueEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeServiceBusQueue), - Properties: &armeventgrid.ServiceBusQueueEventSubscriptionDestinationProperties{ - ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ContosoNamespace/queues/SBQ"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(false), - SubjectBeginsWith: to.Ptr("ExamplePrefix"), - SubjectEndsWith: to.Ptr("ExampleSuffix"), - }, - }, - }, 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/EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusTopicDestination.json -func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForCustomTopicServiceBusTopicDestination() { - 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.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{ - Properties: &armeventgrid.EventSubscriptionProperties{ - DeadLetterDestination: &armeventgrid.StorageBlobDeadLetterDestination{ - EndpointType: to.Ptr(armeventgrid.DeadLetterEndPointTypeStorageBlob), - Properties: &armeventgrid.StorageBlobDeadLetterDestinationProperties{ - BlobContainerName: to.Ptr("contosocontainer"), - ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"), - }, - }, - Destination: &armeventgrid.ServiceBusTopicEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeServiceBusTopic), - Properties: &armeventgrid.ServiceBusTopicEventSubscriptionDestinationProperties{ - ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ContosoNamespace/topics/SBT"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(false), - SubjectBeginsWith: to.Ptr("ExamplePrefix"), - SubjectEndsWith: to.Ptr("ExampleSuffix"), - }, - }, - }, 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/EventSubscriptions_CreateOrUpdateForCustomTopic_StorageQueueDestination.json -func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForCustomTopicStorageQueueDestination() { - 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.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscription{ - Properties: &armeventgrid.EventSubscriptionProperties{ - DeadLetterDestination: &armeventgrid.StorageBlobDeadLetterDestination{ - EndpointType: to.Ptr(armeventgrid.DeadLetterEndPointTypeStorageBlob), - Properties: &armeventgrid.StorageBlobDeadLetterDestinationProperties{ - BlobContainerName: to.Ptr("contosocontainer"), - ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"), - }, - }, - 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"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(false), - SubjectBeginsWith: to.Ptr("ExamplePrefix"), - SubjectEndsWith: to.Ptr("ExampleSuffix"), - }, - }, - }, 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/EventSubscriptions_CreateOrUpdateForCustomTopic_WebhookDestination.json -func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForCustomTopicWebhookDestination() { - 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.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/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"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(false), - SubjectBeginsWith: to.Ptr("ExamplePrefix"), - SubjectEndsWith: to.Ptr("ExampleSuffix"), - }, - }, - }, 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/EventSubscriptions_CreateOrUpdateForResource.json -func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForResource() { - 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.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", "examplesubscription10", armeventgrid.EventSubscription{ - Properties: &armeventgrid.EventSubscriptionProperties{ - Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(false), - SubjectBeginsWith: to.Ptr("ExamplePrefix"), - SubjectEndsWith: to.Ptr("ExampleSuffix"), - }, - }, - }, 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/EventSubscriptions_CreateOrUpdateForResourceGroup.json -func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForResourceGroup() { - 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.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg", "examplesubscription2", armeventgrid.EventSubscription{ - Properties: &armeventgrid.EventSubscriptionProperties{ - Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(false), - SubjectBeginsWith: to.Ptr("ExamplePrefix"), - SubjectEndsWith: to.Ptr("ExampleSuffix"), - }, - }, - }, 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/EventSubscriptions_CreateOrUpdateForSubscription.json -func ExampleEventSubscriptionsClient_BeginCreateOrUpdate_eventSubscriptionsCreateOrUpdateForSubscription() { - 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.NewEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40", "examplesubscription3", armeventgrid.EventSubscription{ - Properties: &armeventgrid.EventSubscriptionProperties{ - Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(false), - }, - }, - }, 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/EventSubscriptions_DeleteForCustomTopic.json -func ExampleEventSubscriptionsClient_BeginDelete_eventSubscriptionsDeleteForCustomTopic() { - 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.NewEventSubscriptionsClient().BeginDelete(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", 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/EventSubscriptions_DeleteForResource.json -func ExampleEventSubscriptionsClient_BeginDelete_eventSubscriptionsDeleteForResource() { - 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.NewEventSubscriptionsClient().BeginDelete(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", "examplesubscription10", 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/EventSubscriptions_DeleteForResourceGroup.json -func ExampleEventSubscriptionsClient_BeginDelete_eventSubscriptionsDeleteForResourceGroup() { - 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.NewEventSubscriptionsClient().BeginDelete(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg", "examplesubscription2", 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/EventSubscriptions_DeleteForSubscription.json -func ExampleEventSubscriptionsClient_BeginDelete_eventSubscriptionsDeleteForSubscription() { - 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.NewEventSubscriptionsClient().BeginDelete(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40", "examplesubscription3", 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/EventSubscriptions_UpdateForCustomTopic.json -func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCustomTopic() { - 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.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ - Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(true), - SubjectBeginsWith: to.Ptr("existingPrefix"), - SubjectEndsWith: to.Ptr("newSuffix"), - }, - Labels: []*string{ - to.Ptr("label1"), - to.Ptr("label2")}, - }, 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/EventSubscriptions_UpdateForCustomTopic_AzureFunctionDestination.json -func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCustomTopicAzureFunctionDestination() { - 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.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ - DeadLetterDestination: &armeventgrid.StorageBlobDeadLetterDestination{ - EndpointType: to.Ptr(armeventgrid.DeadLetterEndPointTypeStorageBlob), - Properties: &armeventgrid.StorageBlobDeadLetterDestinationProperties{ - BlobContainerName: to.Ptr("contosocontainer"), - ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"), - }, - }, - Destination: &armeventgrid.AzureFunctionEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeAzureFunction), - Properties: &armeventgrid.AzureFunctionEventSubscriptionDestinationProperties{ - ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Web/sites/ContosoSite/funtions/ContosoFunc"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(false), - SubjectBeginsWith: to.Ptr("ExamplePrefix"), - SubjectEndsWith: to.Ptr("ExampleSuffix"), - }, - }, 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/EventSubscriptions_UpdateForCustomTopic_EventHubDestination.json -func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCustomTopicEventHubDestination() { - 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.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ - 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"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(true), - SubjectBeginsWith: to.Ptr("existingPrefix"), - SubjectEndsWith: to.Ptr("newSuffix"), - }, - Labels: []*string{ - to.Ptr("label1"), - to.Ptr("label2")}, - }, 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/EventSubscriptions_UpdateForCustomTopic_HybridConnectionDestination.json -func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCustomTopicHybridConnectionDestination() { - 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.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ - Destination: &armeventgrid.HybridConnectionEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeHybridConnection), - Properties: &armeventgrid.HybridConnectionEventSubscriptionDestinationProperties{ - ResourceID: to.Ptr("/subscriptions/d33c5f7a-02ea-40f4-bf52-07f17e84d6a8/resourceGroups/TestRG/providers/Microsoft.Relay/namespaces/ContosoNamespace/hybridConnections/HC1"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(true), - SubjectBeginsWith: to.Ptr("existingPrefix"), - SubjectEndsWith: to.Ptr("newSuffix"), - }, - Labels: []*string{ - to.Ptr("label1"), - to.Ptr("label2")}, - }, 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/EventSubscriptions_UpdateForCustomTopic_ServiceBusQueueDestination.json -func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCustomTopicServiceBusQueueDestination() { - 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.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ - DeadLetterDestination: &armeventgrid.StorageBlobDeadLetterDestination{ - EndpointType: to.Ptr(armeventgrid.DeadLetterEndPointTypeStorageBlob), - Properties: &armeventgrid.StorageBlobDeadLetterDestinationProperties{ - BlobContainerName: to.Ptr("contosocontainer"), - ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"), - }, - }, - Destination: &armeventgrid.ServiceBusQueueEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeServiceBusQueue), - Properties: &armeventgrid.ServiceBusQueueEventSubscriptionDestinationProperties{ - ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ContosoNamespace/queues/SBQ"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(false), - SubjectBeginsWith: to.Ptr("ExamplePrefix"), - SubjectEndsWith: to.Ptr("ExampleSuffix"), - }, - }, 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/EventSubscriptions_UpdateForCustomTopic_ServiceBusTopicDestination.json -func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCustomTopicServiceBusTopicDestination() { - 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.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ - Destination: &armeventgrid.ServiceBusTopicEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeServiceBusTopic), - Properties: &armeventgrid.ServiceBusTopicEventSubscriptionDestinationProperties{ - ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.ServiceBus/namespaces/ContosoNamespace/topics/SBT"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(true), - SubjectBeginsWith: to.Ptr("existingPrefix"), - SubjectEndsWith: to.Ptr("newSuffix"), - }, - Labels: []*string{ - to.Ptr("label1"), - to.Ptr("label2")}, - }, 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/EventSubscriptions_UpdateForCustomTopic_StorageQueueDestination.json -func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCustomTopicStorageQueueDestination() { - 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.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic1", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ - DeadLetterDestination: &armeventgrid.StorageBlobDeadLetterDestination{ - EndpointType: to.Ptr(armeventgrid.DeadLetterEndPointTypeStorageBlob), - Properties: &armeventgrid.StorageBlobDeadLetterDestinationProperties{ - BlobContainerName: to.Ptr("contosocontainer"), - ResourceID: to.Ptr("/subscriptions/55f3dcd4-cac7-43b4-990b-a139d62a1eb2/resourceGroups/TestRG/providers/Microsoft.Storage/storageAccounts/contosostg"), - }, - }, - 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"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(false), - SubjectBeginsWith: to.Ptr("ExamplePrefix"), - SubjectEndsWith: to.Ptr("ExampleSuffix"), - }, - }, 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/EventSubscriptions_UpdateForCustomTopic_WebhookDestination.json -func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForCustomTopicWebhookDestination() { - 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.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ - Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(true), - SubjectBeginsWith: to.Ptr("existingPrefix"), - SubjectEndsWith: to.Ptr("newSuffix"), - }, - Labels: []*string{ - to.Ptr("label1"), - to.Ptr("label2")}, - }, 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/EventSubscriptions_UpdateForResource.json -func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForResource() { - 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.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", "examplesubscription1", armeventgrid.EventSubscriptionUpdateParameters{ - Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(true), - SubjectBeginsWith: to.Ptr("existingPrefix"), - SubjectEndsWith: to.Ptr("newSuffix"), - }, - Labels: []*string{ - to.Ptr("label1"), - to.Ptr("label2")}, - }, 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/EventSubscriptions_UpdateForResourceGroup.json -func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForResourceGroup() { - 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.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg", "examplesubscription2", armeventgrid.EventSubscriptionUpdateParameters{ - 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"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(true), - SubjectBeginsWith: to.Ptr("existingPrefix"), - SubjectEndsWith: to.Ptr("newSuffix"), - }, - Labels: []*string{ - to.Ptr("label1"), - to.Ptr("label2")}, - }, 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/EventSubscriptions_UpdateForSubscription.json -func ExampleEventSubscriptionsClient_BeginUpdate_eventSubscriptionsUpdateForSubscription() { - 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.NewEventSubscriptionsClient().BeginUpdate(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40", "examplesubscription3", armeventgrid.EventSubscriptionUpdateParameters{ - Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(true), - SubjectBeginsWith: to.Ptr("existingPrefix"), - SubjectEndsWith: to.Ptr("newSuffix"), - }, - Labels: []*string{ - to.Ptr("label1"), - to.Ptr("label2")}, - }, 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/EventSubscriptions_GetFullUrlForCustomTopic.json -func ExampleEventSubscriptionsClient_GetFullURL_eventSubscriptionsGetFullUrlForCustomTopic() { - 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().GetFullURL(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.EventSubscriptionFullURL = armeventgrid.EventSubscriptionFullURL{ - // EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - // } -} - -// 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 -func ExampleEventSubscriptionsClient_GetFullURL_eventSubscriptionsGetFullUrlForResource() { - 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().GetFullURL(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventHub/namespaces/examplenamespace1", "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.EventSubscriptionFullURL = armeventgrid.EventSubscriptionFullURL{ - // EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - // } -} - -// 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 -func ExampleEventSubscriptionsClient_GetFullURL_eventSubscriptionsGetFullUrlForResourceGroup() { - 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().GetFullURL(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg", "examplesubscription2", 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.EventSubscriptionFullURL = armeventgrid.EventSubscriptionFullURL{ - // EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - // } -} - -// 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 -func ExampleEventSubscriptionsClient_GetFullURL_eventSubscriptionsGetFullUrlForSubscription() { - 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().GetFullURL(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40", "examplesubscription3", 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.EventSubscriptionFullURL = armeventgrid.EventSubscriptionFullURL{ - // EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - // } -} - -// 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 -func ExampleEventSubscriptionsClient_NewListGlobalBySubscriptionPager() { - 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.NewEventSubscriptionsClient().NewListGlobalBySubscriptionPager(&armeventgrid.EventSubscriptionsClientListGlobalBySubscriptionOptions{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.EventSubscriptionsListResult = armeventgrid.EventSubscriptionsListResult{ - // Value: []*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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr(""), - // SubjectEndsWith: to.Ptr(""), - // }, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr(""), - // SubjectEndsWith: to.Ptr(""), - // }, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/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 -func ExampleEventSubscriptionsClient_NewListGlobalBySubscriptionForTopicTypePager() { - 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.NewEventSubscriptionsClient().NewListGlobalBySubscriptionForTopicTypePager("Microsoft.Resources.Subscriptions", &armeventgrid.EventSubscriptionsClientListGlobalBySubscriptionForTopicTypeOptions{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.EventSubscriptionsListResult = armeventgrid.EventSubscriptionsListResult{ - // Value: []*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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // to.Ptr("Finance"), - // to.Ptr("HR")}, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40"), - // }, - // }}, - // } - } -} - -// 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 -func ExampleEventSubscriptionsClient_NewListGlobalByResourceGroupPager() { - 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.NewEventSubscriptionsClient().NewListGlobalByResourceGroupPager("examplerg", &armeventgrid.EventSubscriptionsClientListGlobalByResourceGroupOptions{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.EventSubscriptionsListResult = armeventgrid.EventSubscriptionsListResult{ - // Value: []*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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr(""), - // SubjectEndsWith: to.Ptr(""), - // }, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr(""), - // SubjectEndsWith: to.Ptr(""), - // }, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/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 -func ExampleEventSubscriptionsClient_NewListGlobalByResourceGroupForTopicTypePager() { - 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.NewEventSubscriptionsClient().NewListGlobalByResourceGroupForTopicTypePager("examplerg", "Microsoft.Resources.ResourceGroups", &armeventgrid.EventSubscriptionsClientListGlobalByResourceGroupForTopicTypeOptions{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.EventSubscriptionsListResult = armeventgrid.EventSubscriptionsListResult{ - // Value: []*armeventgrid.EventSubscription{ - // { - // 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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // to.Ptr("Finance"), - // to.Ptr("HR")}, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/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 -func ExampleEventSubscriptionsClient_NewListRegionalBySubscriptionPager() { - 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.NewEventSubscriptionsClient().NewListRegionalBySubscriptionPager("westus2", &armeventgrid.EventSubscriptionsClientListRegionalBySubscriptionOptions{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.EventSubscriptionsListResult = armeventgrid.EventSubscriptionsListResult{ - // Value: []*armeventgrid.EventSubscription{ - // { - // 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"), - // 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"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // 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"), - // }, - // }, - // { - // 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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // 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"), - // }, - // }}, - // } - } -} - -// 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 -func ExampleEventSubscriptionsClient_NewListRegionalByResourceGroupPager() { - 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.NewEventSubscriptionsClient().NewListRegionalByResourceGroupPager("examplerg", "westus2", &armeventgrid.EventSubscriptionsClientListRegionalByResourceGroupOptions{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.EventSubscriptionsListResult = armeventgrid.EventSubscriptionsListResult{ - // Value: []*armeventgrid.EventSubscription{ - // { - // 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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // 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"), - // }, - // }, - // { - // 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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // 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"), - // }, - // }}, - // } - } -} - -// 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 -func ExampleEventSubscriptionsClient_NewListRegionalBySubscriptionForTopicTypePager() { - 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.NewEventSubscriptionsClient().NewListRegionalBySubscriptionForTopicTypePager("westus2", "Microsoft.EventHub.namespaces", &armeventgrid.EventSubscriptionsClientListRegionalBySubscriptionForTopicTypeOptions{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.EventSubscriptionsListResult = armeventgrid.EventSubscriptionsListResult{ - // Value: []*armeventgrid.EventSubscription{ - // { - // 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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // 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"), - // }, - // }, - // { - // 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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // 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"), - // }, - // }}, - // } - } -} - -// 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 -func ExampleEventSubscriptionsClient_NewListRegionalByResourceGroupForTopicTypePager() { - 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.NewEventSubscriptionsClient().NewListRegionalByResourceGroupForTopicTypePager("examplerg", "westus2", "Microsoft.EventHub.namespaces", &armeventgrid.EventSubscriptionsClientListRegionalByResourceGroupForTopicTypeOptions{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.EventSubscriptionsListResult = armeventgrid.EventSubscriptionsListResult{ - // Value: []*armeventgrid.EventSubscription{ - // { - // 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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // 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"), - // }, - // }, - // { - // 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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // 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"), - // }, - // }}, - // } - } -} - -// 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 -func ExampleEventSubscriptionsClient_NewListByResourcePager() { - 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.NewEventSubscriptionsClient().NewListByResourcePager("examplerg", "Microsoft.EventGrid", "topics", "exampletopic2", &armeventgrid.EventSubscriptionsClientListByResourceOptions{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.EventSubscriptionsListResult = armeventgrid.EventSubscriptionsListResult{ - // Value: []*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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr(""), - // SubjectEndsWith: to.Ptr(""), - // }, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr(""), - // SubjectEndsWith: to.Ptr(""), - // }, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr(""), - // SubjectEndsWith: to.Ptr(""), - // }, - // Labels: []*string{ - // }, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // Topic: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/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 -func ExampleEventSubscriptionsClient_NewListByDomainTopicPager() { - 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.NewEventSubscriptionsClient().NewListByDomainTopicPager("examplerg", "domain1", "topic1", &armeventgrid.EventSubscriptionsClientListByDomainTopicOptions{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.EventSubscriptionsListResult = armeventgrid.EventSubscriptionsListResult{ - // Value: []*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/domains/domain1/topics/topic1/providers/Microsoft.EventGrid/eventSubscriptions/examplesubscription1"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr(""), - // 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"), - // }, - // }, - // { - // 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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr(""), - // 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"), - // }, - // }, - // { - // 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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr(""), - // SubjectEndsWith: to.Ptr(""), - // }, - // 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"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/extensiontopics_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/extensiontopics_client.go index 2044c89f1c93..0517ab08dd52 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 @@ -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 2023-12-15-preview // - 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,21 @@ 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 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 +81,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", "2023-12-15-preview") 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 deleted file mode 100644 index 87b8c901fa0e..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/extensiontopics_client_example_test.go +++ /dev/null @@ -1,47 +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/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/ExtensionTopics_Get.json -func ExampleExtensionTopicsClient_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.NewExtensionTopicsClient().Get(ctx, "subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/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) - } - // 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.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"), - // 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"), - // }, - // } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/go.mod b/sdk/resourcemanager/eventgrid/armeventgrid/go.mod index 0d5d5486a777..eea5973499ff 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/go.mod +++ b/sdk/resourcemanager/eventgrid/armeventgrid/go.mod @@ -3,8 +3,7 @@ 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/azcore v1.6.1 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 @@ -12,6 +11,7 @@ require ( ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dnaeon/go-vcr v1.1.0 // indirect @@ -21,9 +21,9 @@ require ( 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/net v0.8.0 // indirect + golang.org/x/sys v0.6.0 // indirect + golang.org/x/text v0.8.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/go.sum b/sdk/resourcemanager/eventgrid/armeventgrid/go.sum index 57a48677bc2c..93fdfc2850cd 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/go.sum +++ b/sdk/resourcemanager/eventgrid/armeventgrid/go.sum @@ -1,5 +1,5 @@ -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/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= 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= @@ -31,13 +31,13 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc 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= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= 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.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= 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= diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/interfaces.go b/sdk/resourcemanager/eventgrid/armeventgrid/interfaces.go new file mode 100644 index 000000000000..5bfaba4ce84b --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/interfaces.go @@ -0,0 +1,100 @@ +//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, +// - *MonitorAlertEventSubscriptionDestination, *NamespaceTopicEventSubscriptionDestination, *PartnerEventSubscriptionDestination, +// - *ServiceBusQueueEventSubscriptionDestination, *ServiceBusTopicEventSubscriptionDestination, *StorageQueueEventSubscriptionDestination, +// - *WebHookEventSubscriptionDestination +type EventSubscriptionDestinationClassification interface { + // GetEventSubscriptionDestination returns the EventSubscriptionDestination content of the underlying type. + GetEventSubscriptionDestination() *EventSubscriptionDestination +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/models.go b/sdk/resourcemanager/eventgrid/armeventgrid/models.go index deeaf01513e5..0db2deefaa68 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 @@ -112,8 +98,8 @@ type BoolEqualsAdvancedFilter struct { // GetAdvancedFilter implements the AdvancedFilterClassification interface for type BoolEqualsAdvancedFilter. func (b *BoolEqualsAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { return &AdvancedFilter{ - OperatorType: b.OperatorType, Key: b.Key, + OperatorType: b.OperatorType, } } @@ -132,8 +118,8 @@ type BoolEqualsFilter struct { // GetFilter implements the FilterClassification interface for type BoolEqualsFilter. func (b *BoolEqualsFilter) GetFilter() *Filter { return &Filter{ - OperatorType: b.OperatorType, Key: b.Key, + OperatorType: b.OperatorType, } } @@ -173,39 +159,6 @@ type CaCertificateProperties struct { 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. @@ -280,47 +233,6 @@ type ChannelUpdateParametersProperties struct { 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. @@ -348,15 +260,6 @@ type Client struct { 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. @@ -373,34 +276,6 @@ type ClientCertificateAuthentication struct { 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. @@ -431,39 +306,6 @@ type ClientGroupProperties struct { 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. @@ -479,9 +321,6 @@ type ClientProperties struct { // 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 @@ -498,37 +337,6 @@ type ClientProperties struct { 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. @@ -550,15 +358,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 +386,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. @@ -613,6 +403,9 @@ type DeliveryConfiguration struct { // Delivery mode of the event subscription. DeliveryMode *DeliveryMode + // This property should be populated when deliveryMode is push and represents information about the push subscription. + Push *PushInfo + // This property should be populated when deliveryMode is queue and represents information about the queue subscription. Queue *QueueInfo } @@ -658,59 +451,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 @@ -811,99 +551,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. @@ -976,69 +629,6 @@ type DomainUpdateParameters struct { 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. @@ -1159,17 +749,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 +884,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 @@ -1586,23 +977,6 @@ 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. @@ -1695,15 +1069,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,8 +1092,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, + OperatorType: i.OperatorType, } } @@ -1744,8 +1109,8 @@ type IsNotNullFilter struct { // GetFilter implements the FilterClassification interface for type IsNotNullFilter. func (i *IsNotNullFilter) GetFilter() *Filter { return &Filter{ - OperatorType: i.OperatorType, Key: i.Key, + OperatorType: i.OperatorType, } } @@ -1761,8 +1126,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, + OperatorType: i.OperatorType, } } @@ -1778,8 +1143,8 @@ type IsNullOrUndefinedFilter struct { // GetFilter implements the FilterClassification interface for type IsNullOrUndefinedFilter. func (i *IsNullOrUndefinedFilter) GetFilter() *Filter { return &Filter{ - OperatorType: i.OperatorType, Key: i.Key, + OperatorType: i.OperatorType, } } @@ -1843,6 +1208,37 @@ type JSONInputSchemaMappingProperties struct { Topic *JSONField } +// MonitorAlertEventSubscriptionDestination - Information about the Monitor Alert destination for an event subscription. +type MonitorAlertEventSubscriptionDestination struct { + // REQUIRED; Type of the endpoint for the event subscription destination. + EndpointType *EndpointType + + // Monitor Alert properties of the event subscription destination. + Properties *MonitorAlertEventSubscriptionDestinationProperties +} + +// GetEventSubscriptionDestination implements the EventSubscriptionDestinationClassification interface for type MonitorAlertEventSubscriptionDestination. +func (m *MonitorAlertEventSubscriptionDestination) GetEventSubscriptionDestination() *EventSubscriptionDestination { + return &EventSubscriptionDestination{ + EndpointType: m.EndpointType, + } +} + +// MonitorAlertEventSubscriptionDestinationProperties - The properties that represent the Monitor Alert destination of an +// event subscription. +type MonitorAlertEventSubscriptionDestinationProperties struct { + // The list of ARM Ids of Action Groups that will be triggered on every Alert fired through this event subscription. Each + // resource ARM Id should follow this pattern: + // /subscriptions/{AzureSubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Insights/actionGroups/{ActionGroupName}. + ActionGroups []*string + + // The description that will be attached to every Alert fired through this event subscription. + Description *string + + // The severity that will be attached to every Alert fired through this event subscription. This field must be provided. + Severity *MonitorAlertSeverity +} + // Namespace resource. type Namespace struct { // REQUIRED; Location of the resource. @@ -1879,8 +1275,11 @@ type NamespaceProperties struct { // 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. + // This is an optional property and it allows the user to specify if the namespace resource supports zone-redundancy capability + // or not. If this property is not specified explicitly by the user, its + // default value depends on the following conditions: a. For Availability Zones enabled regions - The default property value + // would be true. b. For non-Availability Zones enabled regions - The default + // property value would be false. 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. @@ -1945,46 +1344,30 @@ type NamespaceTopic struct { 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 -} +// NamespaceTopicEventSubscriptionDestination - Information about the Namespace Topic destination for an event subscription. +type NamespaceTopicEventSubscriptionDestination struct { + // REQUIRED; Type of the endpoint for the event subscription destination. + EndpointType *EndpointType -// NamespaceTopicEventSubscriptionsClientBeginUpdateOptions contains the optional parameters for the NamespaceTopicEventSubscriptionsClient.BeginUpdate -// method. -type NamespaceTopicEventSubscriptionsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string + // Namespace Topic properties of the event subscription destination. + Properties *NamespaceTopicEventSubscriptionDestinationProperties } -// NamespaceTopicEventSubscriptionsClientGetOptions contains the optional parameters for the NamespaceTopicEventSubscriptionsClient.Get -// method. -type NamespaceTopicEventSubscriptionsClientGetOptions struct { - // placeholder for future optional parameters +// GetEventSubscriptionDestination implements the EventSubscriptionDestinationClassification interface for type NamespaceTopicEventSubscriptionDestination. +func (n *NamespaceTopicEventSubscriptionDestination) GetEventSubscriptionDestination() *EventSubscriptionDestination { + return &EventSubscriptionDestination{ + EndpointType: n.EndpointType, + } } -// 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 +// NamespaceTopicEventSubscriptionDestinationProperties - The properties that represent the Event Grid Namespace Topic destination +// of an event subscription. +type NamespaceTopicEventSubscriptionDestinationProperties struct { + // The Azure resource Id that represents the endpoint of the Event Grid Namespace Topic destination of an event subscription. + // This field is required and the Namespace Topic resource listed must already + // exist. The resource ARM Id should follow this pattern: + // /subscriptions/{AzureSubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.EventGrid/namespaces/{NamespaceName}/topics/{TopicName}. + ResourceID *string } // NamespaceTopicProperties - Properties of the namespace topic. @@ -2016,58 +1399,6 @@ type NamespaceTopicUpdateParameters struct { 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. @@ -2106,80 +1437,152 @@ type NamespaceUpdateParameters struct { 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 +// 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 +} + +// NetworkSecurityPerimeterConfiguration - Network security perimeter configuration. +type NetworkSecurityPerimeterConfiguration struct { + // Properties of the network security perimeter configuration. + Properties *NetworkSecurityPerimeterConfigurationProperties + + // READ-ONLY; Fully qualified identifier of the resource. + ID *string + + // READ-ONLY; Name of the resource. + Name *string + + // READ-ONLY; Type of the resource. + Type *string } -// NamespacesClientBeginDeleteOptions contains the optional parameters for the NamespacesClient.BeginDelete method. -type NamespacesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string +// NetworkSecurityPerimeterConfigurationIssues - Network security perimeter configuration issues. +type NetworkSecurityPerimeterConfigurationIssues struct { + // Provisioning issue name. + Name *string + + // Provisioning issue properties. + Properties *NetworkSecurityPerimeterConfigurationIssuesProperties } -// NamespacesClientBeginRegenerateKeyOptions contains the optional parameters for the NamespacesClient.BeginRegenerateKey -// method. -type NamespacesClientBeginRegenerateKeyOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string +// NetworkSecurityPerimeterConfigurationIssuesProperties - Network security perimeter configuration issues properties. +type NetworkSecurityPerimeterConfigurationIssuesProperties struct { + // Provisioning issue description. + Description *string + + // Provisioning issue type. + IssueType *NetworkSecurityPerimeterConfigurationIssueType + + // Provisioning issue severity. + Severity *NetworkSecurityPerimeterConfigurationIssueSeverity + + // Access rules that can be added to the same profile to remediate the issue. + SuggestedAccessRules []*string + + // ARM IDs of resources that can be associated to the same perimeter to remediate the issue. + SuggestedResourceIDs []*string } -// NamespacesClientBeginUpdateOptions contains the optional parameters for the NamespacesClient.BeginUpdate method. -type NamespacesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string +// NetworkSecurityPerimeterConfigurationList - Network security perimeter configuration List. +type NetworkSecurityPerimeterConfigurationList struct { + // A link for the next page of Network Security Perimeter Configuration. + NextLink *string + + // List of all network security parameter configurations. + Value []*NetworkSecurityPerimeterConfiguration } -// NamespacesClientGetOptions contains the optional parameters for the NamespacesClient.Get method. -type NamespacesClientGetOptions struct { - // placeholder for future optional parameters +// NetworkSecurityPerimeterConfigurationProfile - Nsp configuration with profile information. +type NetworkSecurityPerimeterConfigurationProfile struct { + // List of inbound or outbound access rule setup on the nsp profile. + AccessRules []*NetworkSecurityPerimeterProfileAccessRule + + // Access rules version number for nsp profile. + AccessRulesVersion *string + + // Diagnostic settings version number for nsp profile. + DiagnosticSettingsVersion *string + + // Enabled log categories for nsp profile. + EnabledLogCategories []*string + + // Nsp configuration profile name. + Name *string } -// 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 +// NetworkSecurityPerimeterConfigurationProperties - Network security perimeter configuration information to reflect latest +// association and nsp profile configuration. +type NetworkSecurityPerimeterConfigurationProperties struct { + // Perimeter info for nsp association. + NetworkSecurityPerimeter *NetworkSecurityPerimeterInfo + + // Nsp profile configuration, access rules and diagnostic settings. + Profile *NetworkSecurityPerimeterConfigurationProfile + + // Provisioning issues to reflect status when attempting to retrieve nsp profile configuration. + ProvisioningIssues []*NetworkSecurityPerimeterConfigurationIssues + + // Provisioning state to reflect configuration state and indicate status of nsp profile configuration retrieval. + ProvisioningState *NetworkSecurityPerimeterConfigProvisioningState + + // Nsp association name and access mode of association. + ResourceAssociation *ResourceAssociation } -// 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 +// NetworkSecurityPerimeterInfo - Network security perimeter info. +type NetworkSecurityPerimeterInfo struct { + // Arm id for network security perimeter. + ID *string + + // Network security perimeter location. + Location *string + + // Network security perimeter guid. + PerimeterGUID *string } -// NamespacesClientListSharedAccessKeysOptions contains the optional parameters for the NamespacesClient.ListSharedAccessKeys -// method. -type NamespacesClientListSharedAccessKeysOptions struct { - // placeholder for future optional parameters +// NetworkSecurityPerimeterProfileAccessRule - Network security perimeter profile access rule. +type NetworkSecurityPerimeterProfileAccessRule struct { + // Fully Qualified Arm id for network security perimeter profile access rule. + FullyQualifiedArmID *string + + // Name for nsp access rule. + Name *string + + // NSP access rule properties. + Properties *NetworkSecurityPerimeterProfileAccessRuleProperties + + // nsp access rule type. + Type *string } -// NamespacesListResult - Result of the List Namespaces operation. -type NamespacesListResult struct { - // A link for the next page of namespaces. - NextLink *string +// NetworkSecurityPerimeterProfileAccessRuleProperties - Network security perimeter profile access rule properties. +type NetworkSecurityPerimeterProfileAccessRuleProperties struct { + // Address prefixes. + AddressPrefixes []*string - // A collection of namespaces. - Value []*Namespace + // NSP access rule direction. + Direction *NetworkSecurityPerimeterProfileAccessRuleDirection + + // List of email addresses. + EmailAddresses []*string + + // Fully qualified domain names. + FullyQualifiedDomainNames []*string + + // Network security perimeters. + NetworkSecurityPerimeters []*NetworkSecurityPerimeterInfo + + // List of phone numbers. + PhoneNumbers []*string + + // List of subscriptions. + Subscriptions []*string } // NumberGreaterThanAdvancedFilter - NumberGreaterThan Advanced Filter. @@ -2197,8 +1600,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, + OperatorType: n.OperatorType, } } @@ -2217,8 +1620,8 @@ type NumberGreaterThanFilter struct { // GetFilter implements the FilterClassification interface for type NumberGreaterThanFilter. func (n *NumberGreaterThanFilter) GetFilter() *Filter { return &Filter{ - OperatorType: n.OperatorType, Key: n.Key, + OperatorType: n.OperatorType, } } @@ -2237,8 +1640,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, + OperatorType: n.OperatorType, } } @@ -2257,8 +1660,8 @@ type NumberGreaterThanOrEqualsFilter struct { // GetFilter implements the FilterClassification interface for type NumberGreaterThanOrEqualsFilter. func (n *NumberGreaterThanOrEqualsFilter) GetFilter() *Filter { return &Filter{ - OperatorType: n.OperatorType, Key: n.Key, + OperatorType: n.OperatorType, } } @@ -2277,8 +1680,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, + OperatorType: n.OperatorType, } } @@ -2297,8 +1700,8 @@ type NumberInFilter struct { // GetFilter implements the FilterClassification interface for type NumberInFilter. func (n *NumberInFilter) GetFilter() *Filter { return &Filter{ - OperatorType: n.OperatorType, Key: n.Key, + OperatorType: n.OperatorType, } } @@ -2317,8 +1720,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, + OperatorType: n.OperatorType, } } @@ -2337,8 +1740,8 @@ type NumberInRangeFilter struct { // GetFilter implements the FilterClassification interface for type NumberInRangeFilter. func (n *NumberInRangeFilter) GetFilter() *Filter { return &Filter{ - OperatorType: n.OperatorType, Key: n.Key, + OperatorType: n.OperatorType, } } @@ -2357,8 +1760,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, + OperatorType: n.OperatorType, } } @@ -2377,8 +1780,8 @@ type NumberLessThanFilter struct { // GetFilter implements the FilterClassification interface for type NumberLessThanFilter. func (n *NumberLessThanFilter) GetFilter() *Filter { return &Filter{ - OperatorType: n.OperatorType, Key: n.Key, + OperatorType: n.OperatorType, } } @@ -2397,8 +1800,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, + OperatorType: n.OperatorType, } } @@ -2417,8 +1820,8 @@ type NumberLessThanOrEqualsFilter struct { // GetFilter implements the FilterClassification interface for type NumberLessThanOrEqualsFilter. func (n *NumberLessThanOrEqualsFilter) GetFilter() *Filter { return &Filter{ - OperatorType: n.OperatorType, Key: n.Key, + OperatorType: n.OperatorType, } } @@ -2437,8 +1840,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, + OperatorType: n.OperatorType, } } @@ -2457,8 +1860,8 @@ type NumberNotInFilter struct { // GetFilter implements the FilterClassification interface for type NumberNotInFilter. func (n *NumberNotInFilter) GetFilter() *Filter { return &Filter{ - OperatorType: n.OperatorType, Key: n.Key, + OperatorType: n.OperatorType, } } @@ -2477,8 +1880,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, + OperatorType: n.OperatorType, } } @@ -2497,8 +1900,8 @@ type NumberNotInRangeFilter struct { // GetFilter implements the FilterClassification interface for type NumberNotInRangeFilter. func (n *NumberNotInRangeFilter) GetFilter() *Filter { return &Filter{ - OperatorType: n.OperatorType, Key: n.Key, + OperatorType: n.OperatorType, } } @@ -2535,11 +1938,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,15 +1971,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 @@ -2642,65 +2031,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. @@ -2734,15 +2064,6 @@ type PartnerDestination struct { 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 @@ -2800,67 +2121,6 @@ type PartnerDestinationUpdateParameters struct { 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. @@ -3007,74 +2267,6 @@ type PartnerNamespaceUpdateParameters struct { 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 -} - -// PartnerNamespacesClientRegenerateKeyOptions contains the optional parameters for the PartnerNamespacesClient.RegenerateKey -// method. -type PartnerNamespacesClientRegenerateKeyOptions struct { - // placeholder for future optional parameters -} - // PartnerNamespacesListResult - Result of the List Partner Namespaces operation type PartnerNamespacesListResult struct { // A link for the next page of partner namespaces. @@ -3124,62 +2316,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 +2352,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 +2414,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,15 +2423,6 @@ 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 @@ -3466,40 +2478,6 @@ type PermissionBindingProperties struct { 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. @@ -3553,41 +2531,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 +2553,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,6 +2562,39 @@ type PrivateLinkResourcesListResult struct { Value []*PrivateLinkResource } +// PushInfo - Properties of the destination info for event subscription supporting push. +type PushInfo 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, namespace) to acquire the authentication tokens being used during delivery / dead-lettering. + DeadLetterDestinationWithResourceIdentity *DeadLetterWithResourceIdentity + + // Information about the destination where events have to be delivered for the event subscription. Uses the managed identity + // setup on the parent resource (namely, topic or domain) to acquire the + // authentication tokens being used during delivery / dead-lettering. + DeliveryWithResourceIdentity *DeliveryWithResourceIdentity + + // 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 +} + // 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 @@ -3686,6 +2642,15 @@ type Resource struct { Type *string } +// ResourceAssociation - Nsp resource association +type ResourceAssociation struct { + // Network security perimeter access mode. + AccessMode *NetworkSecurityPerimeterAssociationAccessMode + + // Association name + Name *string +} + // ResourceMoveChangeHistory - The change history of the resource move. type ResourceMoveChangeHistory struct { // Azure subscription ID of the resource. @@ -3882,8 +2847,8 @@ type StringBeginsWithAdvancedFilter struct { // GetAdvancedFilter implements the AdvancedFilterClassification interface for type StringBeginsWithAdvancedFilter. func (s *StringBeginsWithAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { return &AdvancedFilter{ - OperatorType: s.OperatorType, Key: s.Key, + OperatorType: s.OperatorType, } } @@ -3902,8 +2867,8 @@ type StringBeginsWithFilter struct { // GetFilter implements the FilterClassification interface for type StringBeginsWithFilter. func (s *StringBeginsWithFilter) GetFilter() *Filter { return &Filter{ - OperatorType: s.OperatorType, Key: s.Key, + OperatorType: s.OperatorType, } } @@ -3922,8 +2887,8 @@ type StringContainsAdvancedFilter struct { // GetAdvancedFilter implements the AdvancedFilterClassification interface for type StringContainsAdvancedFilter. func (s *StringContainsAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { return &AdvancedFilter{ - OperatorType: s.OperatorType, Key: s.Key, + OperatorType: s.OperatorType, } } @@ -3942,8 +2907,8 @@ type StringContainsFilter struct { // GetFilter implements the FilterClassification interface for type StringContainsFilter. func (s *StringContainsFilter) GetFilter() *Filter { return &Filter{ - OperatorType: s.OperatorType, Key: s.Key, + OperatorType: s.OperatorType, } } @@ -3962,8 +2927,8 @@ type StringEndsWithAdvancedFilter struct { // GetAdvancedFilter implements the AdvancedFilterClassification interface for type StringEndsWithAdvancedFilter. func (s *StringEndsWithAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { return &AdvancedFilter{ - OperatorType: s.OperatorType, Key: s.Key, + OperatorType: s.OperatorType, } } @@ -3982,8 +2947,8 @@ type StringEndsWithFilter struct { // GetFilter implements the FilterClassification interface for type StringEndsWithFilter. func (s *StringEndsWithFilter) GetFilter() *Filter { return &Filter{ - OperatorType: s.OperatorType, Key: s.Key, + OperatorType: s.OperatorType, } } @@ -4002,8 +2967,8 @@ type StringInAdvancedFilter struct { // GetAdvancedFilter implements the AdvancedFilterClassification interface for type StringInAdvancedFilter. func (s *StringInAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { return &AdvancedFilter{ - OperatorType: s.OperatorType, Key: s.Key, + OperatorType: s.OperatorType, } } @@ -4022,8 +2987,8 @@ type StringInFilter struct { // GetFilter implements the FilterClassification interface for type StringInFilter. func (s *StringInFilter) GetFilter() *Filter { return &Filter{ - OperatorType: s.OperatorType, Key: s.Key, + OperatorType: s.OperatorType, } } @@ -4042,8 +3007,8 @@ type StringNotBeginsWithAdvancedFilter struct { // GetAdvancedFilter implements the AdvancedFilterClassification interface for type StringNotBeginsWithAdvancedFilter. func (s *StringNotBeginsWithAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { return &AdvancedFilter{ - OperatorType: s.OperatorType, Key: s.Key, + OperatorType: s.OperatorType, } } @@ -4062,8 +3027,8 @@ type StringNotBeginsWithFilter struct { // GetFilter implements the FilterClassification interface for type StringNotBeginsWithFilter. func (s *StringNotBeginsWithFilter) GetFilter() *Filter { return &Filter{ - OperatorType: s.OperatorType, Key: s.Key, + OperatorType: s.OperatorType, } } @@ -4082,8 +3047,8 @@ type StringNotContainsAdvancedFilter struct { // GetAdvancedFilter implements the AdvancedFilterClassification interface for type StringNotContainsAdvancedFilter. func (s *StringNotContainsAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { return &AdvancedFilter{ - OperatorType: s.OperatorType, Key: s.Key, + OperatorType: s.OperatorType, } } @@ -4102,8 +3067,8 @@ type StringNotContainsFilter struct { // GetFilter implements the FilterClassification interface for type StringNotContainsFilter. func (s *StringNotContainsFilter) GetFilter() *Filter { return &Filter{ - OperatorType: s.OperatorType, Key: s.Key, + OperatorType: s.OperatorType, } } @@ -4122,8 +3087,8 @@ type StringNotEndsWithAdvancedFilter struct { // GetAdvancedFilter implements the AdvancedFilterClassification interface for type StringNotEndsWithAdvancedFilter. func (s *StringNotEndsWithAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { return &AdvancedFilter{ - OperatorType: s.OperatorType, Key: s.Key, + OperatorType: s.OperatorType, } } @@ -4142,8 +3107,8 @@ type StringNotEndsWithFilter struct { // GetFilter implements the FilterClassification interface for type StringNotEndsWithFilter. func (s *StringNotEndsWithFilter) GetFilter() *Filter { return &Filter{ - OperatorType: s.OperatorType, Key: s.Key, + OperatorType: s.OperatorType, } } @@ -4162,8 +3127,8 @@ type StringNotInAdvancedFilter struct { // GetAdvancedFilter implements the AdvancedFilterClassification interface for type StringNotInAdvancedFilter. func (s *StringNotInAdvancedFilter) GetAdvancedFilter() *AdvancedFilter { return &AdvancedFilter{ - OperatorType: s.OperatorType, Key: s.Key, + OperatorType: s.OperatorType, } } @@ -4182,8 +3147,8 @@ type StringNotInFilter struct { // GetFilter implements the FilterClassification interface for type StringNotInFilter. func (s *StringNotInFilter) GetFilter() *Filter { return &Filter{ - OperatorType: s.OperatorType, Key: s.Key, + OperatorType: s.OperatorType, } } @@ -4295,60 +3260,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 +3284,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. @@ -4472,59 +3329,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. @@ -4615,39 +3419,6 @@ type TopicSpaceProperties struct { 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. @@ -4689,6 +3460,11 @@ type TopicSpacesListResult struct { Value []*TopicSpace } +type TopicTypeAdditionalEnforcedPermission struct { + IsDataAction *bool + PermissionName *string +} + // TopicTypeInfo - Properties of a topic type info. type TopicTypeInfo struct { // Properties of the topic type info @@ -4706,7 +3482,10 @@ 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 + // Permissions which are enforced for creating and updating system topics of this this topic type. + AdditionalEnforcedPermissions []*TopicTypeAdditionalEnforcedPermission + + // Flag to indicate that a topic type can support both regional or global system topics. AreRegionalAndGlobalSourcesSupported *bool // Description of the topic type. @@ -4718,7 +3497,7 @@ type TopicTypeProperties struct { // Namespace of the provider of the topic type. Provider *string - // Provisioning state of the topic type + // Provisioning state of the topic type. ProvisioningState *TopicTypeProvisioningState // Region type of the resource. @@ -4734,22 +3513,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 @@ -4795,75 +3558,6 @@ type TopicUpdateParameters struct { 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. @@ -4971,25 +3665,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. @@ -5073,10 +3748,10 @@ type WebhookPartnerDestinationInfo struct { func (w *WebhookPartnerDestinationInfo) GetPartnerDestinationInfo() *PartnerDestinationInfo { return &PartnerDestinationInfo{ AzureSubscriptionID: w.AzureSubscriptionID, - ResourceGroupName: w.ResourceGroupName, - Name: w.Name, - EndpointType: w.EndpointType, EndpointServiceContext: w.EndpointServiceContext, + EndpointType: w.EndpointType, + Name: w.Name, + ResourceGroupName: w.ResourceGroupName, ResourceMoveChangeHistory: w.ResourceMoveChangeHistory, } } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/models_serde.go b/sdk/resourcemanager/eventgrid/armeventgrid/models_serde.go index 8359738815c0..d877bad6e0a9 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 @@ -596,37 +595,6 @@ func (c *Client) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ClientAuthentication. -func (c ClientAuthentication) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "certificateSubject", c.CertificateSubject) - populate(objectMap, "certificateThumbprint", c.CertificateThumbprint) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientAuthentication. -func (c *ClientAuthentication) 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 "certificateSubject": - err = unpopulate(val, "CertificateSubject", &c.CertificateSubject) - delete(rawMsg, key) - case "certificateThumbprint": - err = unpopulate(val, "CertificateThumbprint", &c.CertificateThumbprint) - 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 ClientAuthenticationSettings. func (c ClientAuthenticationSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -685,76 +653,6 @@ func (c *ClientCertificateAuthentication) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ClientCertificateSubjectDistinguishedName. -func (c ClientCertificateSubjectDistinguishedName) 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) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientCertificateSubjectDistinguishedName. -func (c *ClientCertificateSubjectDistinguishedName) 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 "commonName": - err = unpopulate(val, "CommonName", &c.CommonName) - 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) - 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 ClientCertificateThumbprint. -func (c ClientCertificateThumbprint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "primary", c.Primary) - populate(objectMap, "secondary", c.Secondary) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientCertificateThumbprint. -func (c *ClientCertificateThumbprint) 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 "primary": - err = unpopulate(val, "Primary", &c.Primary) - delete(rawMsg, key) - case "secondary": - err = unpopulate(val, "Secondary", &c.Secondary) - 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 ClientGroup. func (c ClientGroup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -868,7 +766,6 @@ func (c *ClientGroupsListResult) UnmarshalJSON(data []byte) error { func (c ClientProperties) 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) @@ -889,9 +786,6 @@ func (c *ClientProperties) UnmarshalJSON(data []byte) error { 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) @@ -1101,6 +995,7 @@ func (d *DeliveryAttributeMapping) UnmarshalJSON(data []byte) error { func (d DeliveryConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "deliveryMode", d.DeliveryMode) + populate(objectMap, "push", d.Push) populate(objectMap, "queue", d.Queue) return json.Marshal(objectMap) } @@ -1117,6 +1012,9 @@ func (d *DeliveryConfiguration) UnmarshalJSON(data []byte) error { case "deliveryMode": err = unpopulate(val, "DeliveryMode", &d.DeliveryMode) delete(rawMsg, key) + case "push": + err = unpopulate(val, "Push", &d.Push) + delete(rawMsg, key) case "queue": err = unpopulate(val, "Queue", &d.Queue) delete(rawMsg, key) @@ -2930,6 +2828,72 @@ func (j *JSONInputSchemaMappingProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type MonitorAlertEventSubscriptionDestination. +func (m MonitorAlertEventSubscriptionDestination) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["endpointType"] = EndpointTypeMonitorAlert + populate(objectMap, "properties", m.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MonitorAlertEventSubscriptionDestination. +func (m *MonitorAlertEventSubscriptionDestination) 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", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endpointType": + err = unpopulate(val, "EndpointType", &m.EndpointType) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MonitorAlertEventSubscriptionDestinationProperties. +func (m MonitorAlertEventSubscriptionDestinationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionGroups", m.ActionGroups) + populate(objectMap, "description", m.Description) + populate(objectMap, "severity", m.Severity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MonitorAlertEventSubscriptionDestinationProperties. +func (m *MonitorAlertEventSubscriptionDestinationProperties) 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", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionGroups": + err = unpopulate(val, "ActionGroups", &m.ActionGroups) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &m.Description) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &m.Severity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Namespace. func (n Namespace) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3176,6 +3140,64 @@ func (n *NamespaceTopic) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type NamespaceTopicEventSubscriptionDestination. +func (n NamespaceTopicEventSubscriptionDestination) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["endpointType"] = EndpointTypeNamespaceTopic + populate(objectMap, "properties", n.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NamespaceTopicEventSubscriptionDestination. +func (n *NamespaceTopicEventSubscriptionDestination) 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 "endpointType": + err = unpopulate(val, "EndpointType", &n.EndpointType) + delete(rawMsg, 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 NamespaceTopicEventSubscriptionDestinationProperties. +func (n NamespaceTopicEventSubscriptionDestinationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resourceId", n.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NamespaceTopicEventSubscriptionDestinationProperties. +func (n *NamespaceTopicEventSubscriptionDestinationProperties) 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 "resourceId": + err = unpopulate(val, "ResourceID", &n.ResourceID) + 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) @@ -3405,6 +3427,361 @@ func (n *NamespacesListResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type NetworkSecurityPerimeterConfiguration. +func (n NetworkSecurityPerimeterConfiguration) 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, "type", n.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeterConfiguration. +func (n *NetworkSecurityPerimeterConfiguration) 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 "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 NetworkSecurityPerimeterConfigurationIssues. +func (n NetworkSecurityPerimeterConfigurationIssues) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", n.Name) + populate(objectMap, "properties", n.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeterConfigurationIssues. +func (n *NetworkSecurityPerimeterConfigurationIssues) 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 "name": + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, 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 NetworkSecurityPerimeterConfigurationIssuesProperties. +func (n NetworkSecurityPerimeterConfigurationIssuesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", n.Description) + populate(objectMap, "issueType", n.IssueType) + populate(objectMap, "severity", n.Severity) + populate(objectMap, "suggestedAccessRules", n.SuggestedAccessRules) + populate(objectMap, "suggestedResourceIds", n.SuggestedResourceIDs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeterConfigurationIssuesProperties. +func (n *NetworkSecurityPerimeterConfigurationIssuesProperties) 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 "description": + err = unpopulate(val, "Description", &n.Description) + delete(rawMsg, key) + case "issueType": + err = unpopulate(val, "IssueType", &n.IssueType) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &n.Severity) + delete(rawMsg, key) + case "suggestedAccessRules": + err = unpopulate(val, "SuggestedAccessRules", &n.SuggestedAccessRules) + delete(rawMsg, key) + case "suggestedResourceIds": + err = unpopulate(val, "SuggestedResourceIDs", &n.SuggestedResourceIDs) + 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 NetworkSecurityPerimeterConfigurationList. +func (n NetworkSecurityPerimeterConfigurationList) 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 NetworkSecurityPerimeterConfigurationList. +func (n *NetworkSecurityPerimeterConfigurationList) 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 NetworkSecurityPerimeterConfigurationProfile. +func (n NetworkSecurityPerimeterConfigurationProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accessRules", n.AccessRules) + populate(objectMap, "accessRulesVersion", n.AccessRulesVersion) + populate(objectMap, "diagnosticSettingsVersion", n.DiagnosticSettingsVersion) + populate(objectMap, "enabledLogCategories", n.EnabledLogCategories) + populate(objectMap, "name", n.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeterConfigurationProfile. +func (n *NetworkSecurityPerimeterConfigurationProfile) 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 "accessRules": + err = unpopulate(val, "AccessRules", &n.AccessRules) + delete(rawMsg, key) + case "accessRulesVersion": + err = unpopulate(val, "AccessRulesVersion", &n.AccessRulesVersion) + delete(rawMsg, key) + case "diagnosticSettingsVersion": + err = unpopulate(val, "DiagnosticSettingsVersion", &n.DiagnosticSettingsVersion) + delete(rawMsg, key) + case "enabledLogCategories": + err = unpopulate(val, "EnabledLogCategories", &n.EnabledLogCategories) + 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 NetworkSecurityPerimeterConfigurationProperties. +func (n NetworkSecurityPerimeterConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "networkSecurityPerimeter", n.NetworkSecurityPerimeter) + populate(objectMap, "profile", n.Profile) + populate(objectMap, "provisioningIssues", n.ProvisioningIssues) + populate(objectMap, "provisioningState", n.ProvisioningState) + populate(objectMap, "resourceAssociation", n.ResourceAssociation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeterConfigurationProperties. +func (n *NetworkSecurityPerimeterConfigurationProperties) 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 "networkSecurityPerimeter": + err = unpopulate(val, "NetworkSecurityPerimeter", &n.NetworkSecurityPerimeter) + delete(rawMsg, key) + case "profile": + err = unpopulate(val, "Profile", &n.Profile) + delete(rawMsg, key) + case "provisioningIssues": + err = unpopulate(val, "ProvisioningIssues", &n.ProvisioningIssues) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &n.ProvisioningState) + delete(rawMsg, key) + case "resourceAssociation": + err = unpopulate(val, "ResourceAssociation", &n.ResourceAssociation) + 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 NetworkSecurityPerimeterInfo. +func (n NetworkSecurityPerimeterInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", n.ID) + populate(objectMap, "location", n.Location) + populate(objectMap, "perimeterGuid", n.PerimeterGUID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeterInfo. +func (n *NetworkSecurityPerimeterInfo) 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 "location": + err = unpopulate(val, "Location", &n.Location) + delete(rawMsg, key) + case "perimeterGuid": + err = unpopulate(val, "PerimeterGUID", &n.PerimeterGUID) + 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 NetworkSecurityPerimeterProfileAccessRule. +func (n NetworkSecurityPerimeterProfileAccessRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "fullyQualifiedArmId", n.FullyQualifiedArmID) + populate(objectMap, "name", n.Name) + populate(objectMap, "properties", n.Properties) + populate(objectMap, "type", n.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeterProfileAccessRule. +func (n *NetworkSecurityPerimeterProfileAccessRule) 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 "fullyQualifiedArmId": + err = unpopulate(val, "FullyQualifiedArmID", &n.FullyQualifiedArmID) + 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 "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 NetworkSecurityPerimeterProfileAccessRuleProperties. +func (n NetworkSecurityPerimeterProfileAccessRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "addressPrefixes", n.AddressPrefixes) + populate(objectMap, "direction", n.Direction) + populate(objectMap, "emailAddresses", n.EmailAddresses) + populate(objectMap, "fullyQualifiedDomainNames", n.FullyQualifiedDomainNames) + populate(objectMap, "networkSecurityPerimeters", n.NetworkSecurityPerimeters) + populate(objectMap, "phoneNumbers", n.PhoneNumbers) + populate(objectMap, "subscriptions", n.Subscriptions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeterProfileAccessRuleProperties. +func (n *NetworkSecurityPerimeterProfileAccessRuleProperties) 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 "addressPrefixes": + err = unpopulate(val, "AddressPrefixes", &n.AddressPrefixes) + delete(rawMsg, key) + case "direction": + err = unpopulate(val, "Direction", &n.Direction) + delete(rawMsg, key) + case "emailAddresses": + err = unpopulate(val, "EmailAddresses", &n.EmailAddresses) + delete(rawMsg, key) + case "fullyQualifiedDomainNames": + err = unpopulate(val, "FullyQualifiedDomainNames", &n.FullyQualifiedDomainNames) + delete(rawMsg, key) + case "networkSecurityPerimeters": + err = unpopulate(val, "NetworkSecurityPerimeters", &n.NetworkSecurityPerimeters) + delete(rawMsg, key) + case "phoneNumbers": + err = unpopulate(val, "PhoneNumbers", &n.PhoneNumbers) + delete(rawMsg, key) + case "subscriptions": + err = unpopulate(val, "Subscriptions", &n.Subscriptions) + 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) @@ -5678,6 +6055,45 @@ func (p *PrivateLinkResourcesListResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type PushInfo. +func (p PushInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "deadLetterDestinationWithResourceIdentity", p.DeadLetterDestinationWithResourceIdentity) + populate(objectMap, "deliveryWithResourceIdentity", p.DeliveryWithResourceIdentity) + populate(objectMap, "eventTimeToLive", p.EventTimeToLive) + populate(objectMap, "maxDeliveryCount", p.MaxDeliveryCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PushInfo. +func (p *PushInfo) 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 "deadLetterDestinationWithResourceIdentity": + err = unpopulate(val, "DeadLetterDestinationWithResourceIdentity", &p.DeadLetterDestinationWithResourceIdentity) + delete(rawMsg, key) + case "deliveryWithResourceIdentity": + err = unpopulate(val, "DeliveryWithResourceIdentity", &p.DeliveryWithResourceIdentity) + delete(rawMsg, key) + case "eventTimeToLive": + err = unpopulate(val, "EventTimeToLive", &p.EventTimeToLive) + delete(rawMsg, key) + case "maxDeliveryCount": + err = unpopulate(val, "MaxDeliveryCount", &p.MaxDeliveryCount) + 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 QueueInfo. func (q QueueInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -5752,6 +6168,37 @@ func (r *Resource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ResourceAssociation. +func (r ResourceAssociation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accessMode", r.AccessMode) + populate(objectMap, "name", r.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAssociation. +func (r *ResourceAssociation) 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 "accessMode": + err = unpopulate(val, "AccessMode", &r.AccessMode) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + 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) @@ -7554,6 +8001,37 @@ func (t *TopicSpacesListResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type TopicTypeAdditionalEnforcedPermission. +func (t TopicTypeAdditionalEnforcedPermission) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "isDataAction", t.IsDataAction) + populate(objectMap, "permissionName", t.PermissionName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TopicTypeAdditionalEnforcedPermission. +func (t *TopicTypeAdditionalEnforcedPermission) 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 "isDataAction": + err = unpopulate(val, "IsDataAction", &t.IsDataAction) + delete(rawMsg, key) + case "permissionName": + err = unpopulate(val, "PermissionName", &t.PermissionName) + 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 TopicTypeInfo. func (t TopicTypeInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -7596,6 +8074,7 @@ 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, "additionalEnforcedPermissions", t.AdditionalEnforcedPermissions) populate(objectMap, "areRegionalAndGlobalSourcesSupported", t.AreRegionalAndGlobalSourcesSupported) populate(objectMap, "description", t.Description) populate(objectMap, "displayName", t.DisplayName) @@ -7617,6 +8096,9 @@ func (t *TopicTypeProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "additionalEnforcedPermissions": + err = unpopulate(val, "AdditionalEnforcedPermissions", &t.AdditionalEnforcedPermissions) + delete(rawMsg, key) case "areRegionalAndGlobalSourcesSupported": err = unpopulate(val, "AreRegionalAndGlobalSourcesSupported", &t.AreRegionalAndGlobalSourcesSupported) delete(rawMsg, key) diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/namespaces_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/namespaces_client.go index 6c54f0b4530a..f8db4c7f82f5 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/namespaces_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/namespaces_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 @@ -49,7 +48,7 @@ func NewNamespacesClient(subscriptionID string, credential azcore.TokenCredentia // 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 +// Generated from API version 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - namespaceName - Name of the namespace. // - namespaceInfo - Namespace information. @@ -61,9 +60,10 @@ func (client *NamespacesClient) BeginCreateOrUpdate(ctx context.Context, resourc if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespacesClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespacesClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[NamespacesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -72,20 +72,22 @@ func (client *NamespacesClient) BeginCreateOrUpdate(ctx context.Context, resourc // 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 +// Generated from API version 2023-12-15-preview func (client *NamespacesClient) createOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, namespaceInfo Namespace, options *NamespacesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, namespaceName, namespaceInfo, 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. @@ -108,16 +110,19 @@ func (client *NamespacesClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, namespaceInfo) + if err := runtime.MarshalAsJSON(req, namespaceInfo); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete existing namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-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. @@ -127,9 +132,10 @@ func (client *NamespacesClient) BeginDelete(ctx context.Context, resourceGroupNa if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespacesClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespacesClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[NamespacesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -138,20 +144,22 @@ func (client *NamespacesClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Delete existing namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-preview func (client *NamespacesClient) deleteOperation(ctx context.Context, resourceGroupName string, namespaceName string, options *NamespacesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, namespaceName, 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 +182,7 @@ func (client *NamespacesClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -183,23 +191,26 @@ func (client *NamespacesClient) deleteCreateRequest(ctx context.Context, resourc // Get - Get properties of a namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-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) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, namespaceName, options) if err != nil { return NamespacesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return NamespacesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return NamespacesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return NamespacesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -222,7 +233,7 @@ func (client *NamespacesClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -239,7 +250,7 @@ func (client *NamespacesClient) getHandleResponse(resp *http.Response) (Namespac // NewListByResourceGroupPager - List all the namespaces under a resource group. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - options - NamespacesClientListByResourceGroupOptions contains the optional parameters for the NamespacesClient.NewListByResourceGroupPager // method. @@ -287,7 +298,7 @@ func (client *NamespacesClient) listByResourceGroupCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -310,7 +321,7 @@ func (client *NamespacesClient) listByResourceGroupHandleResponse(resp *http.Res // NewListBySubscriptionPager - List all the namespaces under an Azure subscription. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-preview // - options - NamespacesClientListBySubscriptionOptions contains the optional parameters for the NamespacesClient.NewListBySubscriptionPager // method. func (client *NamespacesClient) NewListBySubscriptionPager(options *NamespacesClientListBySubscriptionOptions) *runtime.Pager[NamespacesClientListBySubscriptionResponse] { @@ -353,7 +364,7 @@ func (client *NamespacesClient) listBySubscriptionCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -377,24 +388,27 @@ func (client *NamespacesClient) listBySubscriptionHandleResponse(resp *http.Resp // 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 +// Generated from API version 2023-12-15-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) { + var err error req, err := client.listSharedAccessKeysCreateRequest(ctx, resourceGroupName, namespaceName, options) if err != nil { return NamespacesClientListSharedAccessKeysResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return NamespacesClientListSharedAccessKeysResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return NamespacesClientListSharedAccessKeysResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return NamespacesClientListSharedAccessKeysResponse{}, err } - return client.listSharedAccessKeysHandleResponse(resp) + resp, err := client.listSharedAccessKeysHandleResponse(httpResp) + return resp, err } // listSharedAccessKeysCreateRequest creates the ListSharedAccessKeys request. @@ -417,7 +431,7 @@ func (client *NamespacesClient) listSharedAccessKeysCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -435,7 +449,7 @@ func (client *NamespacesClient) listSharedAccessKeysHandleResponse(resp *http.Re // 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 +// Generated from API version 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - namespaceName - Name of the Namespace. // - regenerateKeyRequest - Request body to regenerate key. @@ -447,9 +461,10 @@ func (client *NamespacesClient) BeginRegenerateKey(ctx context.Context, resource if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespacesClientRegenerateKeyResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespacesClientRegenerateKeyResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[NamespacesClientRegenerateKeyResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -458,20 +473,22 @@ func (client *NamespacesClient) BeginRegenerateKey(ctx context.Context, resource // 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 +// Generated from API version 2023-12-15-preview func (client *NamespacesClient) regenerateKey(ctx context.Context, resourceGroupName string, namespaceName string, regenerateKeyRequest NamespaceRegenerateKeyRequest, options *NamespacesClientBeginRegenerateKeyOptions) (*http.Response, error) { + var err error req, err := client.regenerateKeyCreateRequest(ctx, resourceGroupName, namespaceName, 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. @@ -494,16 +511,19 @@ func (client *NamespacesClient) regenerateKeyCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") 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 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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - namespaceName - Name of the namespace. // - namespaceUpdateParameters - Namespace update information. @@ -514,9 +534,10 @@ func (client *NamespacesClient) BeginUpdate(ctx context.Context, resourceGroupNa if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespacesClientUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespacesClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[NamespacesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -525,20 +546,22 @@ func (client *NamespacesClient) BeginUpdate(ctx context.Context, resourceGroupNa // 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 +// Generated from API version 2023-12-15-preview func (client *NamespacesClient) update(ctx context.Context, resourceGroupName string, namespaceName string, namespaceUpdateParameters NamespaceUpdateParameters, options *NamespacesClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, namespaceName, namespaceUpdateParameters, 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 } // updateCreateRequest creates the Update request. @@ -561,8 +584,11 @@ func (client *NamespacesClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, namespaceUpdateParameters) + if err := runtime.MarshalAsJSON(req, namespaceUpdateParameters); err != nil { + return nil, err + } + return req, nil } 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 index 862824db5744..754689f467c6 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/namespacetopiceventsubscriptions_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/namespacetopiceventsubscriptions_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 @@ -50,7 +49,7 @@ func NewNamespaceTopicEventSubscriptionsClient(subscriptionID string, credential // 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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - namespaceName - Name of the namespace. // - topicName - Name of the namespace topic. @@ -65,9 +64,10 @@ func (client *NamespaceTopicEventSubscriptionsClient) BeginCreateOrUpdate(ctx co if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespaceTopicEventSubscriptionsClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespaceTopicEventSubscriptionsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[NamespaceTopicEventSubscriptionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -77,20 +77,22 @@ func (client *NamespaceTopicEventSubscriptionsClient) BeginCreateOrUpdate(ctx co // 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 2023-12-15-preview func (client *NamespaceTopicEventSubscriptionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, eventSubscriptionName string, eventSubscriptionInfo Subscription, options *NamespaceTopicEventSubscriptionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err 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) + 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. @@ -121,16 +123,19 @@ func (client *NamespaceTopicEventSubscriptionsClient) createOrUpdateCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") 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 namespace topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - namespaceName - Name of the namespace. // - topicName - Name of the namespace topic. @@ -144,9 +149,10 @@ func (client *NamespaceTopicEventSubscriptionsClient) BeginDelete(ctx context.Co if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespaceTopicEventSubscriptionsClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespaceTopicEventSubscriptionsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[NamespaceTopicEventSubscriptionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -155,20 +161,22 @@ func (client *NamespaceTopicEventSubscriptionsClient) BeginDelete(ctx context.Co // 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 +// Generated from API version 2023-12-15-preview func (client *NamespaceTopicEventSubscriptionsClient) deleteOperation(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, eventSubscriptionName string, options *NamespaceTopicEventSubscriptionsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, namespaceName, 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. @@ -199,7 +207,7 @@ func (client *NamespaceTopicEventSubscriptionsClient) deleteCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -208,7 +216,7 @@ func (client *NamespaceTopicEventSubscriptionsClient) deleteCreateRequest(ctx co // 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 +// Generated from API version 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - namespaceName - Name of the namespace. // - topicName - Name of the namespace topic. @@ -217,18 +225,21 @@ func (client *NamespaceTopicEventSubscriptionsClient) deleteCreateRequest(ctx co // - 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) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, namespaceName, topicName, eventSubscriptionName, options) if err != nil { return NamespaceTopicEventSubscriptionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return NamespaceTopicEventSubscriptionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return NamespaceTopicEventSubscriptionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return NamespaceTopicEventSubscriptionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -259,7 +270,7 @@ func (client *NamespaceTopicEventSubscriptionsClient) getCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -274,9 +285,81 @@ func (client *NamespaceTopicEventSubscriptionsClient) getHandleResponse(resp *ht return result, nil } +// GetDeliveryAttributes - Get all delivery attributes for an event subscription of a namespace topic. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-12-15-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 - NamespaceTopicEventSubscriptionsClientGetDeliveryAttributesOptions contains the optional parameters for the NamespaceTopicEventSubscriptionsClient.GetDeliveryAttributes +// method. +func (client *NamespaceTopicEventSubscriptionsClient) GetDeliveryAttributes(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, eventSubscriptionName string, options *NamespaceTopicEventSubscriptionsClientGetDeliveryAttributesOptions) (NamespaceTopicEventSubscriptionsClientGetDeliveryAttributesResponse, error) { + var err error + req, err := client.getDeliveryAttributesCreateRequest(ctx, resourceGroupName, namespaceName, topicName, eventSubscriptionName, options) + if err != nil { + return NamespaceTopicEventSubscriptionsClientGetDeliveryAttributesResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NamespaceTopicEventSubscriptionsClientGetDeliveryAttributesResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return NamespaceTopicEventSubscriptionsClientGetDeliveryAttributesResponse{}, err + } + resp, err := client.getDeliveryAttributesHandleResponse(httpResp) + return resp, err +} + +// getDeliveryAttributesCreateRequest creates the GetDeliveryAttributes request. +func (client *NamespaceTopicEventSubscriptionsClient) getDeliveryAttributesCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, eventSubscriptionName string, options *NamespaceTopicEventSubscriptionsClientGetDeliveryAttributesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes" + 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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-12-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getDeliveryAttributesHandleResponse handles the GetDeliveryAttributes response. +func (client *NamespaceTopicEventSubscriptionsClient) getDeliveryAttributesHandleResponse(resp *http.Response) (NamespaceTopicEventSubscriptionsClientGetDeliveryAttributesResponse, error) { + result := NamespaceTopicEventSubscriptionsClientGetDeliveryAttributesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeliveryAttributeListResult); err != nil { + return NamespaceTopicEventSubscriptionsClientGetDeliveryAttributesResponse{}, err + } + return result, nil +} + // NewListByNamespaceTopicPager - List event subscriptions that belong to a specific namespace topic. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - namespaceName - Name of the namespace. // - topicName - Name of the namespace topic. @@ -334,7 +417,7 @@ func (client *NamespaceTopicEventSubscriptionsClient) listByNamespaceTopicCreate return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -358,7 +441,7 @@ func (client *NamespaceTopicEventSubscriptionsClient) listByNamespaceTopicHandle // 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 +// Generated from API version 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - namespaceName - Name of the namespace. // - topicName - Name of the namespace topic. @@ -373,9 +456,10 @@ func (client *NamespaceTopicEventSubscriptionsClient) BeginUpdate(ctx context.Co if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespaceTopicEventSubscriptionsClientUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespaceTopicEventSubscriptionsClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[NamespaceTopicEventSubscriptionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -384,20 +468,22 @@ func (client *NamespaceTopicEventSubscriptionsClient) BeginUpdate(ctx context.Co // 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 +// Generated from API version 2023-12-15-preview func (client *NamespaceTopicEventSubscriptionsClient) update(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters SubscriptionUpdateParameters, options *NamespaceTopicEventSubscriptionsClientBeginUpdateOptions) (*http.Response, error) { + var err 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) + 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 } // updateCreateRequest creates the Update request. @@ -428,8 +514,11 @@ func (client *NamespaceTopicEventSubscriptionsClient) updateCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") 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/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 index 8c974ea819f7..c34598c9e40f 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/namespacetopics_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/namespacetopics_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 @@ -49,7 +48,7 @@ func NewNamespaceTopicsClient(subscriptionID string, credential azcore.TokenCred // 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 +// Generated from API version 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - namespaceName - Name of the namespace. // - topicName - Name of the namespace topic. @@ -62,9 +61,10 @@ func (client *NamespaceTopicsClient) BeginCreateOrUpdate(ctx context.Context, re if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespaceTopicsClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespaceTopicsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[NamespaceTopicsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -73,20 +73,22 @@ func (client *NamespaceTopicsClient) BeginCreateOrUpdate(ctx context.Context, re // 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 +// Generated from API version 2023-12-15-preview func (client *NamespaceTopicsClient) createOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, namespaceTopicInfo NamespaceTopic, options *NamespaceTopicsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, namespaceName, topicName, namespaceTopicInfo, 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. @@ -113,16 +115,19 @@ func (client *NamespaceTopicsClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, namespaceTopicInfo) + if err := runtime.MarshalAsJSON(req, namespaceTopicInfo); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete existing namespace topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - namespaceName - Name of the namespace. // - topicName - Name of the topic. @@ -134,9 +139,10 @@ func (client *NamespaceTopicsClient) BeginDelete(ctx context.Context, resourceGr if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespaceTopicsClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespaceTopicsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[NamespaceTopicsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -145,20 +151,22 @@ func (client *NamespaceTopicsClient) BeginDelete(ctx context.Context, resourceGr // Delete - Delete existing namespace topic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-preview func (client *NamespaceTopicsClient) deleteOperation(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, options *NamespaceTopicsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, namespaceName, 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.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 +193,7 @@ func (client *NamespaceTopicsClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -194,24 +202,27 @@ func (client *NamespaceTopicsClient) deleteCreateRequest(ctx context.Context, re // 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 +// Generated from API version 2023-12-15-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) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, namespaceName, topicName, options) if err != nil { return NamespaceTopicsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return NamespaceTopicsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return NamespaceTopicsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return NamespaceTopicsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -238,7 +249,7 @@ func (client *NamespaceTopicsClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -255,7 +266,7 @@ func (client *NamespaceTopicsClient) getHandleResponse(resp *http.Response) (Nam // NewListByNamespacePager - List all the namespace topics under a namespace. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-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 @@ -308,7 +319,7 @@ func (client *NamespaceTopicsClient) listByNamespaceCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -332,25 +343,28 @@ func (client *NamespaceTopicsClient) listByNamespaceHandleResponse(resp *http.Re // 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 +// Generated from API version 2023-12-15-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) { + var err error req, err := client.listSharedAccessKeysCreateRequest(ctx, resourceGroupName, namespaceName, topicName, options) if err != nil { return NamespaceTopicsClientListSharedAccessKeysResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return NamespaceTopicsClientListSharedAccessKeysResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return NamespaceTopicsClientListSharedAccessKeysResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return NamespaceTopicsClientListSharedAccessKeysResponse{}, err } - return client.listSharedAccessKeysHandleResponse(resp) + resp, err := client.listSharedAccessKeysHandleResponse(httpResp) + return resp, err } // listSharedAccessKeysCreateRequest creates the ListSharedAccessKeys request. @@ -377,7 +391,7 @@ func (client *NamespaceTopicsClient) listSharedAccessKeysCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -395,7 +409,7 @@ func (client *NamespaceTopicsClient) listSharedAccessKeysHandleResponse(resp *ht // 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 +// Generated from API version 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - namespaceName - Name of the namespace. // - topicName - Name of the topic. @@ -408,9 +422,10 @@ func (client *NamespaceTopicsClient) BeginRegenerateKey(ctx context.Context, res if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespaceTopicsClientRegenerateKeyResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespaceTopicsClientRegenerateKeyResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[NamespaceTopicsClientRegenerateKeyResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -419,20 +434,22 @@ func (client *NamespaceTopicsClient) BeginRegenerateKey(ctx context.Context, res // 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 +// Generated from API version 2023-12-15-preview func (client *NamespaceTopicsClient) regenerateKey(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest, options *NamespaceTopicsClientBeginRegenerateKeyOptions) (*http.Response, error) { + var err error req, err := client.regenerateKeyCreateRequest(ctx, resourceGroupName, namespaceName, 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. @@ -459,16 +476,19 @@ func (client *NamespaceTopicsClient) regenerateKeyCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") 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 namespace 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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - namespaceName - Name of the namespace. // - topicName - Name of the namespace topic. @@ -481,9 +501,10 @@ func (client *NamespaceTopicsClient) BeginUpdate(ctx context.Context, resourceGr if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespaceTopicsClientUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespaceTopicsClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[NamespaceTopicsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -492,20 +513,22 @@ func (client *NamespaceTopicsClient) BeginUpdate(ctx context.Context, resourceGr // 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 +// Generated from API version 2023-12-15-preview func (client *NamespaceTopicsClient) update(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, namespaceTopicUpdateParameters NamespaceTopicUpdateParameters, options *NamespaceTopicsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, namespaceName, topicName, namespaceTopicUpdateParameters, 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 } // updateCreateRequest creates the Update request. @@ -532,8 +555,11 @@ func (client *NamespaceTopicsClient) updateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, namespaceTopicUpdateParameters) + if err := runtime.MarshalAsJSON(req, namespaceTopicUpdateParameters); err != nil { + return nil, err + } + return req, nil } 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/networksecurityperimeterconfigurations_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/networksecurityperimeterconfigurations_client.go new file mode 100644 index 000000000000..38f9b3e73c56 --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/networksecurityperimeterconfigurations_client.go @@ -0,0 +1,277 @@ +//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 + +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" + "strings" +) + +// NetworkSecurityPerimeterConfigurationsClient contains the methods for the NetworkSecurityPerimeterConfigurations group. +// Don't use this type directly, use NewNetworkSecurityPerimeterConfigurationsClient() instead. +type NetworkSecurityPerimeterConfigurationsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewNetworkSecurityPerimeterConfigurationsClient creates a new instance of NetworkSecurityPerimeterConfigurationsClient 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 NewNetworkSecurityPerimeterConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*NetworkSecurityPerimeterConfigurationsClient, error) { + cl, err := arm.NewClient(moduleName+".NetworkSecurityPerimeterConfigurationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &NetworkSecurityPerimeterConfigurationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a specific network security perimeter configuration with a topic or domain. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-12-15-preview +// - resourceGroupName - The name of the resource group within the user's subscription. +// - resourceType - The type of the resource. This can be either \'topics\', or \'domains\'. +// - resourceName - The name of the resource (namely, either, the topic name or domain name). +// - perimeterGUID - Unique identifier for perimeter +// - associationName - Association name to association network security perimeter resource to profile +// - options - NetworkSecurityPerimeterConfigurationsClientGetOptions contains the optional parameters for the NetworkSecurityPerimeterConfigurationsClient.Get +// method. +func (client *NetworkSecurityPerimeterConfigurationsClient) Get(ctx context.Context, resourceGroupName string, resourceType NetworkSecurityPerimeterResourceType, resourceName string, perimeterGUID string, associationName string, options *NetworkSecurityPerimeterConfigurationsClientGetOptions) (NetworkSecurityPerimeterConfigurationsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceType, resourceName, perimeterGUID, associationName, options) + if err != nil { + return NetworkSecurityPerimeterConfigurationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NetworkSecurityPerimeterConfigurationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return NetworkSecurityPerimeterConfigurationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *NetworkSecurityPerimeterConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceType NetworkSecurityPerimeterResourceType, resourceName string, perimeterGUID string, associationName string, options *NetworkSecurityPerimeterConfigurationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{resourceType}/{resourceName}/networkSecurityPerimeterConfigurations/{perimeterGuid}.{associationName}" + 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 resourceType == "" { + return nil, errors.New("parameter resourceType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceType}", url.PathEscape(string(resourceType))) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if perimeterGUID == "" { + return nil, errors.New("parameter perimeterGUID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{perimeterGuid}", url.PathEscape(perimeterGUID)) + if associationName == "" { + return nil, errors.New("parameter associationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{associationName}", url.PathEscape(associationName)) + 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-12-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *NetworkSecurityPerimeterConfigurationsClient) getHandleResponse(resp *http.Response) (NetworkSecurityPerimeterConfigurationsClientGetResponse, error) { + result := NetworkSecurityPerimeterConfigurationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkSecurityPerimeterConfiguration); err != nil { + return NetworkSecurityPerimeterConfigurationsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get all network security perimeter configurations associated with a topic or domain. +// +// Generated from API version 2023-12-15-preview +// - resourceGroupName - The name of the resource group within the user's subscription. +// - resourceType - The type of the resource. This can be either \'topics\' or \'domains\'. +// - resourceName - The name of the resource (namely, either, the topic name or domain name). +// - options - NetworkSecurityPerimeterConfigurationsClientListOptions contains the optional parameters for the NetworkSecurityPerimeterConfigurationsClient.NewListPager +// method. +func (client *NetworkSecurityPerimeterConfigurationsClient) NewListPager(resourceGroupName string, resourceType NetworkSecurityPerimeterResourceType, resourceName string, options *NetworkSecurityPerimeterConfigurationsClientListOptions) *runtime.Pager[NetworkSecurityPerimeterConfigurationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[NetworkSecurityPerimeterConfigurationsClientListResponse]{ + More: func(page NetworkSecurityPerimeterConfigurationsClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *NetworkSecurityPerimeterConfigurationsClientListResponse) (NetworkSecurityPerimeterConfigurationsClientListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, resourceType, resourceName, options) + if err != nil { + return NetworkSecurityPerimeterConfigurationsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NetworkSecurityPerimeterConfigurationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NetworkSecurityPerimeterConfigurationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *NetworkSecurityPerimeterConfigurationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceType NetworkSecurityPerimeterResourceType, resourceName string, options *NetworkSecurityPerimeterConfigurationsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{resourceType}/{resourceName}/networkSecurityPerimeterConfigurations" + 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 resourceType == "" { + return nil, errors.New("parameter resourceType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceType}", url.PathEscape(string(resourceType))) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + 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-12-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *NetworkSecurityPerimeterConfigurationsClient) listHandleResponse(resp *http.Response) (NetworkSecurityPerimeterConfigurationsClientListResponse, error) { + result := NetworkSecurityPerimeterConfigurationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkSecurityPerimeterConfigurationList); err != nil { + return NetworkSecurityPerimeterConfigurationsClientListResponse{}, err + } + return result, nil +} + +// BeginReconcile - Reconcile a specific network security perimeter configuration for a given network security perimeter association +// with a topic or domain. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-12-15-preview +// - resourceGroupName - The name of the resource group within the user's subscription. +// - resourceType - The type of the resource. This can be either \'topics\' or \'domains\'. +// - resourceName - The name of the resource (namely, either, the topic name or domain name). +// - perimeterGUID - Unique identifier for perimeter +// - associationName - Association name to association network security perimeter resource to profile +// - options - NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions contains the optional parameters for the NetworkSecurityPerimeterConfigurationsClient.BeginReconcile +// method. +func (client *NetworkSecurityPerimeterConfigurationsClient) BeginReconcile(ctx context.Context, resourceGroupName string, resourceType NetworkSecurityPerimeterResourceType, resourceName string, perimeterGUID string, associationName string, options *NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions) (*runtime.Poller[NetworkSecurityPerimeterConfigurationsClientReconcileResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.reconcile(ctx, resourceGroupName, resourceType, resourceName, perimeterGUID, associationName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NetworkSecurityPerimeterConfigurationsClientReconcileResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[NetworkSecurityPerimeterConfigurationsClientReconcileResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Reconcile - Reconcile a specific network security perimeter configuration for a given network security perimeter association +// with a topic or domain. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-12-15-preview +func (client *NetworkSecurityPerimeterConfigurationsClient) reconcile(ctx context.Context, resourceGroupName string, resourceType NetworkSecurityPerimeterResourceType, resourceName string, perimeterGUID string, associationName string, options *NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions) (*http.Response, error) { + var err error + req, err := client.reconcileCreateRequest(ctx, resourceGroupName, resourceType, resourceName, perimeterGUID, associationName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// reconcileCreateRequest creates the Reconcile request. +func (client *NetworkSecurityPerimeterConfigurationsClient) reconcileCreateRequest(ctx context.Context, resourceGroupName string, resourceType NetworkSecurityPerimeterResourceType, resourceName string, perimeterGUID string, associationName string, options *NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{resourceType}/{resourceName}/networkSecurityPerimeterConfigurations/{perimeterGuid}.{associationName}/reconcile" + 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 resourceType == "" { + return nil, errors.New("parameter resourceType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceType}", url.PathEscape(string(resourceType))) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if perimeterGUID == "" { + return nil, errors.New("parameter perimeterGUID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{perimeterGuid}", url.PathEscape(perimeterGUID)) + if associationName == "" { + return nil, errors.New("parameter associationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{associationName}", url.PathEscape(associationName)) + 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-12-15-preview") + 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.go b/sdk/resourcemanager/eventgrid/armeventgrid/operations_client.go index 6fa8f0b4b3d3..eee1898ba19e 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 @@ -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 2023-12-15-preview // - 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]{ @@ -72,7 +71,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", "2023-12-15-preview") 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 deleted file mode 100644 index de6f55d8f0b3..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/operations_client_example_test.go +++ /dev/null @@ -1,116 +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/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/Operations_List.json -func ExampleOperationsClient_NewListPager() { - 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.NewOperationsClient().NewListPager(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.OperationsListResult = armeventgrid.OperationsListResult{ - // Value: []*armeventgrid.Operation{ - // { - // Name: to.Ptr("Microsoft.EventGrid/register/action"), - // Display: &armeventgrid.OperationInfo{ - // Description: to.Ptr("Registers the eventSubscription for the EventGrid resource provider and enables the creation of Event Grid subscriptions."), - // Operation: to.Ptr("Registers the EventGrid Resource Provider"), - // Provider: to.Ptr("Microsoft Event Grid"), - // Resource: to.Ptr("EventGrid Resource Provider"), - // }, - // Origin: to.Ptr("UserAndSystem"), - // }, - // { - // Name: to.Ptr("Microsoft.EventGrid/eventSubscriptions/write"), - // Display: &armeventgrid.OperationInfo{ - // Description: to.Ptr("Create or update a eventSubscription"), - // Operation: to.Ptr("Write EventSubscription"), - // Provider: to.Ptr("Microsoft Event Grid"), - // Resource: to.Ptr("eventSubscriptions"), - // }, - // Origin: to.Ptr("UserAndSystem"), - // }, - // { - // Name: to.Ptr("Microsoft.EventGrid/eventSubscriptions/read"), - // Display: &armeventgrid.OperationInfo{ - // Description: to.Ptr("Read a eventSubscription"), - // Operation: to.Ptr("Read EventSubscription"), - // Provider: to.Ptr("Microsoft Event Grid"), - // Resource: to.Ptr("eventSubscriptions"), - // }, - // Origin: to.Ptr("UserAndSystem"), - // }, - // { - // Name: to.Ptr("Microsoft.EventGrid/eventSubscriptions/delete"), - // Display: &armeventgrid.OperationInfo{ - // Description: to.Ptr("Delete a eventSubscription"), - // Operation: to.Ptr("Delete EventSubscription"), - // Provider: to.Ptr("Microsoft Event Grid"), - // Resource: to.Ptr("eventSubscriptions"), - // }, - // Origin: to.Ptr("UserAndSystem"), - // }, - // { - // Name: to.Ptr("Microsoft.EventGrid/topics/write"), - // Display: &armeventgrid.OperationInfo{ - // Description: to.Ptr("Create or update a topic"), - // Operation: to.Ptr("Write Topic"), - // Provider: to.Ptr("Microsoft Event Grid"), - // Resource: to.Ptr("topics"), - // }, - // Origin: to.Ptr("UserAndSystem"), - // }, - // { - // Name: to.Ptr("Microsoft.EventGrid/topics/read"), - // Display: &armeventgrid.OperationInfo{ - // Description: to.Ptr("Read a topic"), - // Operation: to.Ptr("Read Topic"), - // Provider: to.Ptr("Microsoft Event Grid"), - // Resource: to.Ptr("topics"), - // }, - // Origin: to.Ptr("UserAndSystem"), - // }, - // { - // Name: to.Ptr("Microsoft.EventGrid/topics/delete"), - // Display: &armeventgrid.OperationInfo{ - // Description: to.Ptr("Delete a topic"), - // Operation: to.Ptr("Delete Topic"), - // Provider: to.Ptr("Microsoft Event Grid"), - // Resource: to.Ptr("topics"), - // }, - // Origin: to.Ptr("UserAndSystem"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/options.go b/sdk/resourcemanager/eventgrid/armeventgrid/options.go new file mode 100644 index 000000000000..c769a02fb5f8 --- /dev/null +++ b/sdk/resourcemanager/eventgrid/armeventgrid/options.go @@ -0,0 +1,1524 @@ +//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 + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// NamespaceTopicEventSubscriptionsClientGetDeliveryAttributesOptions contains the optional parameters for the NamespaceTopicEventSubscriptionsClient.GetDeliveryAttributes +// method. +type NamespaceTopicEventSubscriptionsClientGetDeliveryAttributesOptions struct { + // placeholder for future optional parameters +} + +// 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 +} + +// 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 +} + +// 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 +} + +// NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions contains the optional parameters for the NetworkSecurityPerimeterConfigurationsClient.BeginReconcile +// method. +type NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// NetworkSecurityPerimeterConfigurationsClientGetOptions contains the optional parameters for the NetworkSecurityPerimeterConfigurationsClient.Get +// method. +type NetworkSecurityPerimeterConfigurationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// NetworkSecurityPerimeterConfigurationsClientListOptions contains the optional parameters for the NetworkSecurityPerimeterConfigurationsClient.NewListPager +// method. +type NetworkSecurityPerimeterConfigurationsClientListOptions 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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..c0b928435d08 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 @@ -49,24 +48,27 @@ 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 2023-12-15-preview // - 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 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 +87,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", "2023-12-15-preview") 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 +108,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 2023-12-15-preview // - 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,7 +119,8 @@ 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[PartnerConfigurationsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PartnerConfigurationsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -123,20 +129,22 @@ func (client *PartnerConfigurationsClient) BeginCreateOrUpdate(ctx context.Conte // 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 2023-12-15-preview func (client *PartnerConfigurationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, partnerConfigurationInfo PartnerConfiguration, options *PartnerConfigurationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error 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 +163,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", "2023-12-15-preview") 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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - options - PartnerConfigurationsClientBeginDeleteOptions contains the optional parameters for the PartnerConfigurationsClient.BeginDelete // method. @@ -174,7 +185,8 @@ 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[PartnerConfigurationsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PartnerConfigurationsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -183,20 +195,22 @@ func (client *PartnerConfigurationsClient) BeginDelete(ctx context.Context, reso // 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 2023-12-15-preview func (client *PartnerConfigurationsClient) deleteOperation(ctx context.Context, resourceGroupName string, options *PartnerConfigurationsClientBeginDeleteOptions) (*http.Response, error) { + var err error 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 +229,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -223,23 +237,26 @@ 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 2023-12-15-preview // - 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 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 +275,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -275,7 +292,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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - options - PartnerConfigurationsClientListByResourceGroupOptions contains the optional parameters for the PartnerConfigurationsClient.NewListByResourceGroupPager // method. @@ -317,7 +334,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -334,7 +351,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 2023-12-15-preview // - options - PartnerConfigurationsClientListBySubscriptionOptions contains the optional parameters for the PartnerConfigurationsClient.NewListBySubscriptionPager // method. func (client *PartnerConfigurationsClient) NewListBySubscriptionPager(options *PartnerConfigurationsClientListBySubscriptionOptions) *runtime.Pager[PartnerConfigurationsClientListBySubscriptionResponse] { @@ -377,7 +394,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -401,24 +418,27 @@ 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 2023-12-15-preview // - 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 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 +457,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", "2023-12-15-preview") 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 +478,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 2023-12-15-preview // - 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,7 +489,8 @@ 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[PartnerConfigurationsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PartnerConfigurationsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -475,20 +499,22 @@ func (client *PartnerConfigurationsClient) BeginUpdate(ctx context.Context, reso // 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 2023-12-15-preview func (client *PartnerConfigurationsClient) update(ctx context.Context, resourceGroupName string, partnerConfigurationUpdateParameters PartnerConfigurationUpdateParameters, options *PartnerConfigurationsClientBeginUpdateOptions) (*http.Response, error) { + var err error 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 +533,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", "2023-12-15-preview") 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 deleted file mode 100644 index b28a023a14c3..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/partnerconfigurations_client_example_test.go +++ /dev/null @@ -1,418 +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/PartnerConfigurations_Get.json -func ExamplePartnerConfigurationsClient_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.NewPartnerConfigurationsClient().Get(ctx, "examplerg", 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.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"), - // Location: to.Ptr("global"), - // Properties: &armeventgrid.PartnerConfigurationProperties{ - // PartnerAuthorization: &armeventgrid.PartnerAuthorization{ - // AuthorizedPartnersList: []*armeventgrid.Partner{ - // { - // AuthorizationExpirationTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-28T01:20:55.142Z"); return t}()), - // PartnerName: to.Ptr("Contoso.Finance"), - // PartnerRegistrationImmutableID: to.Ptr("941892bc-f5d0-4d1c-8fb5-477570fc2b71"), - // }, - // { - // AuthorizationExpirationTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-20T01:00:00.142Z"); return t}()), - // PartnerName: to.Ptr("fabrikam.HR"), - // PartnerRegistrationImmutableID: to.Ptr("5362bdb6-ce3e-4d0d-9a5b-3eb92c8aab38"), - // }}, - // DefaultMaximumExpirationTimeInDays: to.Ptr[int32](10), - // }, - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // } -} - -// 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 -func ExamplePartnerConfigurationsClient_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.NewPartnerConfigurationsClient().BeginCreateOrUpdate(ctx, "examplerg", armeventgrid.PartnerConfiguration{ - Properties: &armeventgrid.PartnerConfigurationProperties{ - PartnerAuthorization: &armeventgrid.PartnerAuthorization{ - AuthorizedPartnersList: []*armeventgrid.Partner{ - { - AuthorizationExpirationTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-28T01:20:55.142Z"); return t }()), - PartnerName: to.Ptr("Contoso.Finance"), - PartnerRegistrationImmutableID: to.Ptr("941892bc-f5d0-4d1c-8fb5-477570fc2b71"), - }, - { - AuthorizationExpirationTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-20T01:00:00.142Z"); return t }()), - PartnerName: to.Ptr("fabrikam.HR"), - PartnerRegistrationImmutableID: to.Ptr("5362bdb6-ce3e-4d0d-9a5b-3eb92c8aab38"), - }}, - DefaultMaximumExpirationTimeInDays: to.Ptr[int32](10), - }, - }, - }, 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.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"), - // Location: to.Ptr("global"), - // Properties: &armeventgrid.PartnerConfigurationProperties{ - // PartnerAuthorization: &armeventgrid.PartnerAuthorization{ - // AuthorizedPartnersList: []*armeventgrid.Partner{ - // { - // AuthorizationExpirationTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-28T01:20:55.142Z"); return t}()), - // PartnerName: to.Ptr("Contoso.Finance"), - // PartnerRegistrationImmutableID: to.Ptr("941892bc-f5d0-4d1c-8fb5-477570fc2b71"), - // }, - // { - // AuthorizationExpirationTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-20T01:00:00.142Z"); return t}()), - // PartnerName: to.Ptr("fabrikam.HR"), - // PartnerRegistrationImmutableID: to.Ptr("5362bdb6-ce3e-4d0d-9a5b-3eb92c8aab38"), - // }}, - // DefaultMaximumExpirationTimeInDays: to.Ptr[int32](10), - // }, - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // } -} - -// 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 -func ExamplePartnerConfigurationsClient_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.NewPartnerConfigurationsClient().BeginDelete(ctx, "examplerg", 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/PartnerConfigurations_Update.json -func ExamplePartnerConfigurationsClient_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.NewPartnerConfigurationsClient().BeginUpdate(ctx, "examplerg", armeventgrid.PartnerConfigurationUpdateParameters{ - Properties: &armeventgrid.PartnerConfigurationUpdateParameterProperties{ - DefaultMaximumExpirationTimeInDays: to.Ptr[int32](100), - }, - Tags: map[string]*string{ - "tag1": to.Ptr("value11"), - "tag2": to.Ptr("value22"), - }, - }, 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.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"), - // Location: to.Ptr("global"), - // Properties: &armeventgrid.PartnerConfigurationProperties{ - // PartnerAuthorization: &armeventgrid.PartnerAuthorization{ - // AuthorizedPartnersList: []*armeventgrid.Partner{ - // { - // AuthorizationExpirationTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-28T01:20:55.142Z"); return t}()), - // PartnerName: to.Ptr("Contoso.Finance"), - // PartnerRegistrationImmutableID: to.Ptr("941892bc-f5d0-4d1c-8fb5-477570fc2b71"), - // }, - // { - // AuthorizationExpirationTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-20T01:00:00.142Z"); return t}()), - // PartnerName: to.Ptr("fabrikam.HR"), - // PartnerRegistrationImmutableID: to.Ptr("5362bdb6-ce3e-4d0d-9a5b-3eb92c8aab38"), - // }}, - // DefaultMaximumExpirationTimeInDays: to.Ptr[int32](100), - // }, - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("value11"), - // "tag2": to.Ptr("value22"), - // }, - // } -} - -// 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 -func ExamplePartnerConfigurationsClient_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.NewPartnerConfigurationsClient().NewListByResourceGroupPager("examplerg", 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.PartnerConfigurationsListResult = armeventgrid.PartnerConfigurationsListResult{ - // Value: []*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"), - // Location: to.Ptr("global"), - // Properties: &armeventgrid.PartnerConfigurationProperties{ - // PartnerAuthorization: &armeventgrid.PartnerAuthorization{ - // AuthorizedPartnersList: []*armeventgrid.Partner{ - // { - // AuthorizationExpirationTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-28T01:20:55.142Z"); return t}()), - // PartnerName: to.Ptr("Contoso.Finance"), - // PartnerRegistrationImmutableID: to.Ptr("941892bc-f5d0-4d1c-8fb5-477570fc2b71"), - // }, - // { - // AuthorizationExpirationTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-20T01:00:00.142Z"); return t}()), - // PartnerName: to.Ptr("fabrikam.HR"), - // PartnerRegistrationImmutableID: to.Ptr("5362bdb6-ce3e-4d0d-9a5b-3eb92c8aab38"), - // }}, - // DefaultMaximumExpirationTimeInDays: to.Ptr[int32](10), - // }, - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // }}, - // } - } -} - -// 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 -func ExamplePartnerConfigurationsClient_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.NewPartnerConfigurationsClient().NewListBySubscriptionPager(&armeventgrid.PartnerConfigurationsClientListBySubscriptionOptions{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.PartnerConfigurationsListResult = armeventgrid.PartnerConfigurationsListResult{ - // Value: []*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"), - // Location: to.Ptr("global"), - // Properties: &armeventgrid.PartnerConfigurationProperties{ - // PartnerAuthorization: &armeventgrid.PartnerAuthorization{ - // AuthorizedPartnersList: []*armeventgrid.Partner{ - // { - // AuthorizationExpirationTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-28T01:20:55.142Z"); return t}()), - // PartnerName: to.Ptr("Contoso.Finance"), - // PartnerRegistrationImmutableID: to.Ptr("941892bc-f5d0-4d1c-8fb5-477570fc2b71"), - // }, - // { - // AuthorizationExpirationTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-20T01:00:00.142Z"); return t}()), - // PartnerName: to.Ptr("fabrikam.HR"), - // PartnerRegistrationImmutableID: to.Ptr("5362bdb6-ce3e-4d0d-9a5b-3eb92c8aab38"), - // }}, - // DefaultMaximumExpirationTimeInDays: to.Ptr[int32](10), - // }, - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // }}, - // } - } -} - -// 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 -func ExamplePartnerConfigurationsClient_AuthorizePartner() { - 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.NewPartnerConfigurationsClient().AuthorizePartner(ctx, "examplerg", armeventgrid.Partner{ - AuthorizationExpirationTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-28T01:20:55.142Z"); return t }()), - PartnerName: to.Ptr("Contoso.Finance"), - PartnerRegistrationImmutableID: to.Ptr("941892bc-f5d0-4d1c-8fb5-477570fc2b71"), - }, 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.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"), - // Location: to.Ptr("global"), - // Properties: &armeventgrid.PartnerConfigurationProperties{ - // PartnerAuthorization: &armeventgrid.PartnerAuthorization{ - // AuthorizedPartnersList: []*armeventgrid.Partner{ - // { - // AuthorizationExpirationTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-28T01:20:55.142Z"); return t}()), - // PartnerName: to.Ptr("Contoso.Finance"), - // PartnerRegistrationImmutableID: to.Ptr("941892bc-f5d0-4d1c-8fb5-477570fc2b71"), - // }, - // { - // AuthorizationExpirationTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-20T01:00:00.142Z"); return t}()), - // PartnerName: to.Ptr("fabrikam.HR"), - // PartnerRegistrationImmutableID: to.Ptr("5362bdb6-ce3e-4d0d-9a5b-3eb92c8aab38"), - // }}, - // DefaultMaximumExpirationTimeInDays: to.Ptr[int32](10), - // }, - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // } -} - -// 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 -func ExamplePartnerConfigurationsClient_UnauthorizePartner() { - 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.NewPartnerConfigurationsClient().UnauthorizePartner(ctx, "examplerg", armeventgrid.Partner{ - AuthorizationExpirationTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-28T01:20:55.142Z"); return t }()), - PartnerName: to.Ptr("Contoso.Finance"), - PartnerRegistrationImmutableID: to.Ptr("941892bc-f5d0-4d1c-8fb5-477570fc2b71"), - }, 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.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"), - // Location: to.Ptr("global"), - // Properties: &armeventgrid.PartnerConfigurationProperties{ - // PartnerAuthorization: &armeventgrid.PartnerAuthorization{ - // AuthorizedPartnersList: []*armeventgrid.Partner{ - // { - // AuthorizationExpirationTimeInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-20T01:00:00.142Z"); return t}()), - // PartnerName: to.Ptr("fabrikam.HR"), - // PartnerRegistrationImmutableID: to.Ptr("5362bdb6-ce3e-4d0d-9a5b-3eb92c8aab38"), - // }}, - // DefaultMaximumExpirationTimeInDays: to.Ptr[int32](10), - // }, - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/partnerdestinations_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/partnerdestinations_client.go index f008d8f37c82..32beb24957fb 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/partnerdestinations_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/partnerdestinations_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 @@ -49,24 +48,27 @@ func NewPartnerDestinationsClient(subscriptionID string, credential azcore.Token // 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 +// Generated from API version 2023-12-15-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) { + var err error req, err := client.activateCreateRequest(ctx, resourceGroupName, partnerDestinationName, options) if err != nil { return PartnerDestinationsClientActivateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PartnerDestinationsClientActivateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerDestinationsClientActivateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PartnerDestinationsClientActivateResponse{}, err } - return client.activateHandleResponse(resp) + resp, err := client.activateHandleResponse(httpResp) + return resp, err } // activateCreateRequest creates the Activate request. @@ -89,7 +91,7 @@ func (client *PartnerDestinationsClient) activateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -107,7 +109,7 @@ func (client *PartnerDestinationsClient) activateHandleResponse(resp *http.Respo // 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 +// Generated from API version 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerDestinationName - Name of the partner destination. // - partnerDestination - Partner destination create information. @@ -119,9 +121,10 @@ func (client *PartnerDestinationsClient) BeginCreateOrUpdate(ctx context.Context if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PartnerDestinationsClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PartnerDestinationsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[PartnerDestinationsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -130,20 +133,22 @@ func (client *PartnerDestinationsClient) BeginCreateOrUpdate(ctx context.Context // 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 +// Generated from API version 2023-12-15-preview func (client *PartnerDestinationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, partnerDestinationName string, partnerDestination PartnerDestination, options *PartnerDestinationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, partnerDestinationName, partnerDestination, 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. @@ -166,16 +171,19 @@ func (client *PartnerDestinationsClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, partnerDestination) + if err := runtime.MarshalAsJSON(req, partnerDestination); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete existing partner destination. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-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 @@ -186,9 +194,10 @@ func (client *PartnerDestinationsClient) BeginDelete(ctx context.Context, resour if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PartnerDestinationsClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PartnerDestinationsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[PartnerDestinationsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -197,20 +206,22 @@ func (client *PartnerDestinationsClient) BeginDelete(ctx context.Context, resour // Delete - Delete existing partner destination. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-preview func (client *PartnerDestinationsClient) deleteOperation(ctx context.Context, resourceGroupName string, partnerDestinationName string, options *PartnerDestinationsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, partnerDestinationName, 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. @@ -233,7 +244,7 @@ func (client *PartnerDestinationsClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -242,23 +253,26 @@ func (client *PartnerDestinationsClient) deleteCreateRequest(ctx context.Context // 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 +// Generated from API version 2023-12-15-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) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, partnerDestinationName, options) if err != nil { return PartnerDestinationsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PartnerDestinationsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerDestinationsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PartnerDestinationsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -281,7 +295,7 @@ func (client *PartnerDestinationsClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -298,7 +312,7 @@ func (client *PartnerDestinationsClient) getHandleResponse(resp *http.Response) // NewListByResourceGroupPager - List all the partner destinations under a resource group. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - options - PartnerDestinationsClientListByResourceGroupOptions contains the optional parameters for the PartnerDestinationsClient.NewListByResourceGroupPager // method. @@ -346,7 +360,7 @@ func (client *PartnerDestinationsClient) listByResourceGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -369,7 +383,7 @@ func (client *PartnerDestinationsClient) listByResourceGroupHandleResponse(resp // NewListBySubscriptionPager - List all the partner destinations under an Azure subscription. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-preview // - options - PartnerDestinationsClientListBySubscriptionOptions contains the optional parameters for the PartnerDestinationsClient.NewListBySubscriptionPager // method. func (client *PartnerDestinationsClient) NewListBySubscriptionPager(options *PartnerDestinationsClientListBySubscriptionOptions) *runtime.Pager[PartnerDestinationsClientListBySubscriptionResponse] { @@ -412,7 +426,7 @@ func (client *PartnerDestinationsClient) listBySubscriptionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -436,7 +450,7 @@ func (client *PartnerDestinationsClient) listBySubscriptionHandleResponse(resp * // 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 +// Generated from API version 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerDestinationName - Name of the partner destination. // - partnerDestinationUpdateParameters - Partner destination update information. @@ -448,9 +462,10 @@ func (client *PartnerDestinationsClient) BeginUpdate(ctx context.Context, resour if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PartnerDestinationsClientUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PartnerDestinationsClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[PartnerDestinationsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -459,20 +474,22 @@ func (client *PartnerDestinationsClient) BeginUpdate(ctx context.Context, resour // 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 +// Generated from API version 2023-12-15-preview func (client *PartnerDestinationsClient) update(ctx context.Context, resourceGroupName string, partnerDestinationName string, partnerDestinationUpdateParameters PartnerDestinationUpdateParameters, options *PartnerDestinationsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, partnerDestinationName, partnerDestinationUpdateParameters, 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, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -495,8 +512,11 @@ func (client *PartnerDestinationsClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, partnerDestinationUpdateParameters) + if err := runtime.MarshalAsJSON(req, partnerDestinationUpdateParameters); err != nil { + return nil, err + } + return req, nil } 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..ac140e1941ed 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 @@ -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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerNamespaceName - Name of the partner namespace. // - partnerNamespaceInfo - PartnerNamespace information. @@ -61,7 +60,8 @@ 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[PartnerNamespacesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PartnerNamespacesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *PartnerNamespacesClient) BeginCreateOrUpdate(ctx context.Context, // 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 2023-12-15-preview func (client *PartnerNamespacesClient) createOrUpdate(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceInfo PartnerNamespace, options *PartnerNamespacesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error 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 +108,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", "2023-12-15-preview") 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 2023-12-15-preview // - 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,7 +131,8 @@ 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[PartnerNamespacesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PartnerNamespacesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -135,20 +141,22 @@ func (client *PartnerNamespacesClient) BeginDelete(ctx context.Context, resource // 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 2023-12-15-preview func (client *PartnerNamespacesClient) deleteOperation(ctx context.Context, resourceGroupName string, partnerNamespaceName string, options *PartnerNamespacesClientBeginDeleteOptions) (*http.Response, error) { + var err error 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 +179,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -179,23 +187,26 @@ 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 2023-12-15-preview // - 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 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 +229,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -235,7 +246,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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - options - PartnerNamespacesClientListByResourceGroupOptions contains the optional parameters for the PartnerNamespacesClient.NewListByResourceGroupPager // method. @@ -283,7 +294,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -306,7 +317,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 2023-12-15-preview // - options - PartnerNamespacesClientListBySubscriptionOptions contains the optional parameters for the PartnerNamespacesClient.NewListBySubscriptionPager // method. func (client *PartnerNamespacesClient) NewListBySubscriptionPager(options *PartnerNamespacesClientListBySubscriptionOptions) *runtime.Pager[PartnerNamespacesClientListBySubscriptionResponse] { @@ -349,7 +360,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -373,24 +384,27 @@ 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 2023-12-15-preview // - 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 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 +427,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -431,25 +445,28 @@ 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 2023-12-15-preview // - 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 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 +489,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", "2023-12-15-preview") 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 +510,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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerNamespaceName - Name of the partner namespace. // - partnerNamespaceUpdateParameters - Partner namespace update information. @@ -502,7 +522,8 @@ 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[PartnerNamespacesClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PartnerNamespacesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -511,20 +532,22 @@ func (client *PartnerNamespacesClient) BeginUpdate(ctx context.Context, resource // 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 2023-12-15-preview func (client *PartnerNamespacesClient) update(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceUpdateParameters PartnerNamespaceUpdateParameters, options *PartnerNamespacesClientBeginUpdateOptions) (*http.Response, error) { + var err error 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 +570,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", "2023-12-15-preview") 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 deleted file mode 100644 index f0fa1d68b601..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/partnernamespaces_client_example_test.go +++ /dev/null @@ -1,273 +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/PartnerNamespaces_Get.json -func ExamplePartnerNamespacesClient_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.NewPartnerNamespacesClient().Get(ctx, "examplerg", "examplePartnerNamespaceName1", 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.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"), - // Location: to.Ptr("Central US EUAP"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // "key3": to.Ptr("value3"), - // }, - // 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"), - // 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 -func ExamplePartnerNamespacesClient_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.NewPartnerNamespacesClient().BeginCreateOrUpdate(ctx, "examplerg", "examplePartnerNamespaceName1", armeventgrid.PartnerNamespace{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - Properties: &armeventgrid.PartnerNamespaceProperties{ - PartnerRegistrationFullyQualifiedID: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/examplerg/providers/Microsoft.EventGrid/partnerRegistrations/ContosoCorpAccount1"), - }, - }, 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/PartnerNamespaces_Delete.json -func ExamplePartnerNamespacesClient_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.NewPartnerNamespacesClient().BeginDelete(ctx, "examplerg", "examplePartnerNamespaceName1", 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/PartnerNamespaces_Update.json -func ExamplePartnerNamespacesClient_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.NewPartnerNamespacesClient().BeginUpdate(ctx, "examplerg", "examplePartnerNamespaceName1", armeventgrid.PartnerNamespaceUpdateParameters{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - }, - }, 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/PartnerNamespaces_ListBySubscription.json -func ExamplePartnerNamespacesClient_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.NewPartnerNamespacesClient().NewListBySubscriptionPager(&armeventgrid.PartnerNamespacesClientListBySubscriptionOptions{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.PartnerNamespacesListResult = armeventgrid.PartnerNamespacesListResult{ - // Value: []*armeventgrid.PartnerNamespace{ - // { - // 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"), - // Location: to.Ptr("Central US EUAP"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // "key3": to.Ptr("value3"), - // }, - // 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"), - // 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_ListByResourceGroup.json -func ExamplePartnerNamespacesClient_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.NewPartnerNamespacesClient().NewListByResourceGroupPager("examplerg", &armeventgrid.PartnerNamespacesClientListByResourceGroupOptions{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.PartnerNamespacesListResult = armeventgrid.PartnerNamespacesListResult{ - // Value: []*armeventgrid.PartnerNamespace{ - // { - // 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"), - // Location: to.Ptr("Central US EUAP"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // "key3": to.Ptr("value3"), - // }, - // 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"), - // 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_ListSharedAccessKeys.json -func ExamplePartnerNamespacesClient_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.NewPartnerNamespacesClient().ListSharedAccessKeys(ctx, "examplerg", "examplePartnerNamespaceName1", 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.PartnerNamespaceSharedAccessKeys = armeventgrid.PartnerNamespaceSharedAccessKeys{ - // 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/PartnerNamespaces_RegenerateKey.json -func ExamplePartnerNamespacesClient_RegenerateKey() { - 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.NewPartnerNamespacesClient().RegenerateKey(ctx, "examplerg", "examplePartnerNamespaceName1", armeventgrid.PartnerNamespaceRegenerateKeyRequest{ - KeyName: to.Ptr("key1"), - }, 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.PartnerNamespaceSharedAccessKeys = armeventgrid.PartnerNamespaceSharedAccessKeys{ - // Key1: to.Ptr("testKey1Value"), - // Key2: to.Ptr("testKey2Value"), - // } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/partnerregistrations_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/partnerregistrations_client.go index 5377204b0598..8bafd91cca8a 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 @@ -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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerRegistrationName - Name of the partner registration. // - partnerRegistrationInfo - PartnerRegistration information. @@ -61,7 +60,8 @@ 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[PartnerRegistrationsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PartnerRegistrationsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *PartnerRegistrationsClient) BeginCreateOrUpdate(ctx context.Contex // 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 2023-12-15-preview func (client *PartnerRegistrationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationInfo PartnerRegistration, options *PartnerRegistrationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error 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 +108,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", "2023-12-15-preview") 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 2023-12-15-preview // - 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,7 +131,8 @@ 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[PartnerRegistrationsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PartnerRegistrationsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -135,20 +141,22 @@ func (client *PartnerRegistrationsClient) BeginDelete(ctx context.Context, resou // 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 2023-12-15-preview func (client *PartnerRegistrationsClient) deleteOperation(ctx context.Context, resourceGroupName string, partnerRegistrationName string, options *PartnerRegistrationsClientBeginDeleteOptions) (*http.Response, error) { + var err error 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 +179,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -179,24 +187,27 @@ 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 2023-12-15-preview // - 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 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 +230,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -236,7 +247,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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - options - PartnerRegistrationsClientListByResourceGroupOptions contains the optional parameters for the PartnerRegistrationsClient.NewListByResourceGroupPager // method. @@ -284,7 +295,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -307,7 +318,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 2023-12-15-preview // - options - PartnerRegistrationsClientListBySubscriptionOptions contains the optional parameters for the PartnerRegistrationsClient.NewListBySubscriptionPager // method. func (client *PartnerRegistrationsClient) NewListBySubscriptionPager(options *PartnerRegistrationsClientListBySubscriptionOptions) *runtime.Pager[PartnerRegistrationsClientListBySubscriptionResponse] { @@ -350,7 +361,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -374,7 +385,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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - partnerRegistrationName - Name of the partner registration. // - partnerRegistrationUpdateParameters - Partner registration update information. @@ -386,7 +397,8 @@ 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[PartnerRegistrationsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PartnerRegistrationsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -395,20 +407,22 @@ func (client *PartnerRegistrationsClient) BeginUpdate(ctx context.Context, resou // 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 2023-12-15-preview func (client *PartnerRegistrationsClient) update(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationUpdateParameters PartnerRegistrationUpdateParameters, options *PartnerRegistrationsClientBeginUpdateOptions) (*http.Response, error) { + var err error 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 +445,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", "2023-12-15-preview") 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 deleted file mode 100644 index 9e1f91b7b98e..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/partnerregistrations_client_example_test.go +++ /dev/null @@ -1,236 +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/PartnerRegistrations_Get.json -func ExamplePartnerRegistrationsClient_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.NewPartnerRegistrationsClient().Get(ctx, "examplerg", "examplePartnerRegistrationName1", 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.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"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("Value2"), - // "key3": to.Ptr("Value3"), - // }, - // Properties: &armeventgrid.PartnerRegistrationProperties{ - // PartnerRegistrationImmutableID: to.Ptr("cda82399-79fe-4d5a-bc6d-b05a437204d9"), - // 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 -func ExamplePartnerRegistrationsClient_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.NewPartnerRegistrationsClient().BeginCreateOrUpdate(ctx, "examplerg", "examplePartnerRegistrationName1", armeventgrid.PartnerRegistration{ - Location: to.Ptr("global"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("Value2"), - "key3": to.Ptr("Value3"), - }, - }, 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.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"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("Value2"), - // "key3": to.Ptr("Value3"), - // }, - // Properties: &armeventgrid.PartnerRegistrationProperties{ - // PartnerRegistrationImmutableID: to.Ptr("cda82399-79fe-4d5a-bc6d-b05a437204d9"), - // 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 -func ExamplePartnerRegistrationsClient_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.NewPartnerRegistrationsClient().BeginDelete(ctx, "examplerg", "examplePartnerRegistrationName1", 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/PartnerRegistrations_Update.json -func ExamplePartnerRegistrationsClient_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.NewPartnerRegistrationsClient().BeginUpdate(ctx, "examplerg", "examplePartnerRegistrationName1", armeventgrid.PartnerRegistrationUpdateParameters{ - Tags: map[string]*string{ - "NewKey": to.Ptr("NewValue"), - }, - }, 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/PartnerRegistrations_ListBySubscription.json -func ExamplePartnerRegistrationsClient_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.NewPartnerRegistrationsClient().NewListBySubscriptionPager(&armeventgrid.PartnerRegistrationsClientListBySubscriptionOptions{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.PartnerRegistrationsListResult = armeventgrid.PartnerRegistrationsListResult{ - // Value: []*armeventgrid.PartnerRegistration{ - // { - // 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"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("Value2"), - // "key3": to.Ptr("Value3"), - // }, - // Properties: &armeventgrid.PartnerRegistrationProperties{ - // PartnerRegistrationImmutableID: to.Ptr("cda82399-79fe-4d5a-bc6d-b05a437204d9"), - // 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_ListByResourceGroup.json -func ExamplePartnerRegistrationsClient_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.NewPartnerRegistrationsClient().NewListByResourceGroupPager("examplerg", &armeventgrid.PartnerRegistrationsClientListByResourceGroupOptions{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.PartnerRegistrationsListResult = armeventgrid.PartnerRegistrationsListResult{ - // Value: []*armeventgrid.PartnerRegistration{ - // { - // 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"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("Value2"), - // "key3": to.Ptr("Value3"), - // }, - // Properties: &armeventgrid.PartnerRegistrationProperties{ - // PartnerRegistrationImmutableID: to.Ptr("cda82399-79fe-4d5a-bc6d-b05a437204d9"), - // 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..28502cd1358c 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 @@ -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 2023-12-15-preview // - 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,7 +63,8 @@ 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[PartnerTopicEventSubscriptionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PartnerTopicEventSubscriptionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -74,20 +74,22 @@ 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 2023-12-15-preview func (client *PartnerTopicEventSubscriptionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription, options *PartnerTopicEventSubscriptionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error 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 +116,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", "2023-12-15-preview") 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 2023-12-15-preview // - 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,7 +141,8 @@ 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[PartnerTopicEventSubscriptionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PartnerTopicEventSubscriptionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -145,20 +151,22 @@ func (client *PartnerTopicEventSubscriptionsClient) BeginDelete(ctx context.Cont // 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 2023-12-15-preview func (client *PartnerTopicEventSubscriptionsClient) deleteOperation(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, options *PartnerTopicEventSubscriptionsClientBeginDeleteOptions) (*http.Response, error) { + var err error 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 +193,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -193,7 +201,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 2023-12-15-preview // - 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 +209,21 @@ 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 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 +250,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -257,7 +268,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 2023-12-15-preview // - 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 +276,21 @@ 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 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 +317,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -321,7 +335,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 2023-12-15-preview // - 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 +343,21 @@ 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 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 +384,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -384,7 +401,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 2023-12-15-preview // - 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 @@ -437,7 +454,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -461,7 +478,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 2023-12-15-preview // - 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,7 +492,8 @@ 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[PartnerTopicEventSubscriptionsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PartnerTopicEventSubscriptionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -484,20 +502,22 @@ func (client *PartnerTopicEventSubscriptionsClient) BeginUpdate(ctx context.Cont // 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 2023-12-15-preview func (client *PartnerTopicEventSubscriptionsClient) update(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters, options *PartnerTopicEventSubscriptionsClientBeginUpdateOptions) (*http.Response, error) { + var err error 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 +544,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", "2023-12-15-preview") 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 deleted file mode 100644 index febc1b1aa5ca..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/partnertopiceventsubscriptions_client_example_test.go +++ /dev/null @@ -1,349 +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/PartnerTopicEventSubscriptions_Get.json -func ExamplePartnerTopicEventSubscriptionsClient_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.NewPartnerTopicEventSubscriptionsClient().Get(ctx, "examplerg", "examplePartnerTopic1", "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.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"), - // 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"), - // }, - // }, - // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IncludedEventTypes: []*string{ - // to.Ptr("Microsoft.Storage.BlobCreated"), - // to.Ptr("Microsoft.Storage.BlobDeleted")}, - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // RetryPolicy: &armeventgrid.RetryPolicy{ - // 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"), - // }, - // } -} - -// 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 -func ExamplePartnerTopicEventSubscriptionsClient_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.NewPartnerTopicEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "examplerg", "examplePartnerTopic1", "exampleEventSubscriptionName1", armeventgrid.EventSubscription{ - Properties: &armeventgrid.EventSubscriptionProperties{ - Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(false), - SubjectBeginsWith: to.Ptr("ExamplePrefix"), - SubjectEndsWith: to.Ptr("ExampleSuffix"), - }, - }, - }, 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.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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // RetryPolicy: &armeventgrid.RetryPolicy{ - // 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"), - // }, - // } -} - -// 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 -func ExamplePartnerTopicEventSubscriptionsClient_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.NewPartnerTopicEventSubscriptionsClient().BeginDelete(ctx, "examplerg", "examplePartnerTopic1", "examplesubscription1", 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/PartnerTopicEventSubscriptions_Update.json -func ExamplePartnerTopicEventSubscriptionsClient_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.NewPartnerTopicEventSubscriptionsClient().BeginUpdate(ctx, "examplerg", "examplePartnerTopic1", "exampleEventSubscriptionName1", armeventgrid.EventSubscriptionUpdateParameters{ - Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(true), - SubjectBeginsWith: to.Ptr("existingPrefix"), - SubjectEndsWith: to.Ptr("newSuffix"), - }, - Labels: []*string{ - to.Ptr("label1"), - to.Ptr("label2")}, - }, 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/PartnerTopicEventSubscriptions_GetFullUrl.json -func ExamplePartnerTopicEventSubscriptionsClient_GetFullURL() { - 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.NewPartnerTopicEventSubscriptionsClient().GetFullURL(ctx, "examplerg", "examplePartnerTopic1", "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.EventSubscriptionFullURL = armeventgrid.EventSubscriptionFullURL{ - // EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - // } -} - -// 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 -func ExamplePartnerTopicEventSubscriptionsClient_NewListByPartnerTopicPager() { - 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.NewPartnerTopicEventSubscriptionsClient().NewListByPartnerTopicPager("examplerg", "examplePartnerTopic1", &armeventgrid.PartnerTopicEventSubscriptionsClientListByPartnerTopicOptions{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.EventSubscriptionsListResult = armeventgrid.EventSubscriptionsListResult{ - // Value: []*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"), - // 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"), - // }, - // }, - // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), - // Filter: &armeventgrid.EventSubscriptionFilter{ - // SubjectBeginsWith: to.Ptr(""), - // SubjectEndsWith: to.Ptr(""), - // }, - // Labels: []*string{ - // }, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // RetryPolicy: &armeventgrid.RetryPolicy{ - // 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"), - // }, - // }, - // { - // 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"), - // 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"), - // }, - // }, - // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IncludedEventTypes: []*string{ - // to.Ptr("Microsoft.Storage.BlobCreated"), - // to.Ptr("Microsoft.Storage.BlobDeleted")}, - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // RetryPolicy: &armeventgrid.RetryPolicy{ - // 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"), - // }, - // }}, - // } - } -} - -// 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 -func ExamplePartnerTopicEventSubscriptionsClient_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.NewPartnerTopicEventSubscriptionsClient().GetDeliveryAttributes(ctx, "examplerg", "examplePartnerTopic1", "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/partnertopics_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/partnertopics_client.go index a3b9502ee296..168cdc596436 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 @@ -49,23 +48,26 @@ 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 2023-12-15-preview // - 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 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 +90,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -106,25 +108,28 @@ 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 2023-12-15-preview // - 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 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 +152,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", "2023-12-15-preview") 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 +173,27 @@ 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 2023-12-15-preview // - 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 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 +216,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -223,7 +234,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 2023-12-15-preview // - 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,7 +245,8 @@ 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[PartnerTopicsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PartnerTopicsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -243,20 +255,22 @@ func (client *PartnerTopicsClient) BeginDelete(ctx context.Context, resourceGrou // 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 2023-12-15-preview func (client *PartnerTopicsClient) deleteOperation(ctx context.Context, resourceGroupName string, partnerTopicName string, options *PartnerTopicsClientBeginDeleteOptions) (*http.Response, error) { + var err error 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 +293,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -287,23 +301,26 @@ 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 2023-12-15-preview // - 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 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 +343,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -343,7 +360,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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - options - PartnerTopicsClientListByResourceGroupOptions contains the optional parameters for the PartnerTopicsClient.NewListByResourceGroupPager // method. @@ -391,7 +408,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -414,7 +431,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 2023-12-15-preview // - options - PartnerTopicsClientListBySubscriptionOptions contains the optional parameters for the PartnerTopicsClient.NewListBySubscriptionPager // method. func (client *PartnerTopicsClient) NewListBySubscriptionPager(options *PartnerTopicsClientListBySubscriptionOptions) *runtime.Pager[PartnerTopicsClientListBySubscriptionResponse] { @@ -457,7 +474,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -481,24 +498,27 @@ 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 2023-12-15-preview // - 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 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 +541,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", "2023-12-15-preview") 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 deleted file mode 100644 index 9cd7e203ab7a..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/partnertopics_client_example_test.go +++ /dev/null @@ -1,287 +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/PartnerTopics_Get.json -func ExamplePartnerTopicsClient_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.NewPartnerTopicsClient().Get(ctx, "examplerg", "examplePartnerTopicName1", 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.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"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armeventgrid.PartnerTopicProperties{ - // ActivationState: to.Ptr(armeventgrid.PartnerTopicActivationStateNeverActivated), - // ProvisioningState: to.Ptr(armeventgrid.PartnerTopicProvisioningStateSucceeded), - // Source: to.Ptr("ContosoCorp.Accounts.User1"), - // }, - // } -} - -// 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 -func ExamplePartnerTopicsClient_CreateOrUpdate() { - 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.NewPartnerTopicsClient().CreateOrUpdate(ctx, "examplerg", "examplePartnerTopicName1", armeventgrid.PartnerTopic{ - Location: to.Ptr("westus2"), - Properties: &armeventgrid.PartnerTopicProperties{ - ExpirationTimeIfNotActivatedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T23:06:13.109Z"); return t }()), - MessageForActivation: to.Ptr("Example message for activation"), - PartnerRegistrationImmutableID: to.Ptr("6f541064-031d-4cc8-9ec3-a3b4fc0f7185"), - PartnerTopicFriendlyDescription: to.Ptr("Example description"), - Source: to.Ptr("ContosoCorp.Accounts.User1"), - }, - }, 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.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"), - // Location: to.Ptr("centraluseuap"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armeventgrid.PartnerTopicProperties{ - // ActivationState: to.Ptr(armeventgrid.PartnerTopicActivationStateNeverActivated), - // ExpirationTimeIfNotActivatedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T23:06:13.109Z"); return t}()), - // MessageForActivation: to.Ptr("Example message for activation"), - // PartnerRegistrationImmutableID: to.Ptr("6f541064-031d-4cc8-9ec3-a3b4fc0f7185"), - // PartnerTopicFriendlyDescription: to.Ptr("Example description"), - // ProvisioningState: to.Ptr(armeventgrid.PartnerTopicProvisioningStateSucceeded), - // Source: to.Ptr("ContosoCorp.Accounts.User1"), - // }, - // } -} - -// 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 -func ExamplePartnerTopicsClient_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.NewPartnerTopicsClient().BeginDelete(ctx, "examplerg", "examplePartnerTopicName1", 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/PartnerTopics_Update.json -func ExamplePartnerTopicsClient_Update() { - 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) - } - _, err = clientFactory.NewPartnerTopicsClient().Update(ctx, "examplerg", "examplePartnerTopicName1", armeventgrid.PartnerTopicUpdateParameters{ - 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) - } -} - -// 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 -func ExamplePartnerTopicsClient_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.NewPartnerTopicsClient().NewListBySubscriptionPager(&armeventgrid.PartnerTopicsClientListBySubscriptionOptions{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.PartnerTopicsListResult = armeventgrid.PartnerTopicsListResult{ - // Value: []*armeventgrid.PartnerTopic{ - // { - // 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"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armeventgrid.PartnerTopicProperties{ - // ActivationState: to.Ptr(armeventgrid.PartnerTopicActivationStateNeverActivated), - // ProvisioningState: to.Ptr(armeventgrid.PartnerTopicProvisioningStateSucceeded), - // Source: to.Ptr("ContosoCorp.Accounts.User1"), - // }, - // }}, - // } - } -} - -// 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 -func ExamplePartnerTopicsClient_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.NewPartnerTopicsClient().NewListByResourceGroupPager("examplerg", &armeventgrid.PartnerTopicsClientListByResourceGroupOptions{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.PartnerTopicsListResult = armeventgrid.PartnerTopicsListResult{ - // Value: []*armeventgrid.PartnerTopic{ - // { - // 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"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armeventgrid.PartnerTopicProperties{ - // ActivationState: to.Ptr(armeventgrid.PartnerTopicActivationStateNeverActivated), - // ProvisioningState: to.Ptr(armeventgrid.PartnerTopicProvisioningStateSucceeded), - // Source: to.Ptr("ContosoCorp.Accounts.User1"), - // }, - // }}, - // } - } -} - -// 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 -func ExamplePartnerTopicsClient_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.NewPartnerTopicsClient().Activate(ctx, "examplerg", "examplePartnerTopic1", 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.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"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armeventgrid.PartnerTopicProperties{ - // ActivationState: to.Ptr(armeventgrid.PartnerTopicActivationStateActivated), - // ProvisioningState: to.Ptr(armeventgrid.PartnerTopicProvisioningStateSucceeded), - // Source: to.Ptr("ContosoCorp.Accounts.User1"), - // }, - // } -} - -// 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 -func ExamplePartnerTopicsClient_Deactivate() { - 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.NewPartnerTopicsClient().Deactivate(ctx, "examplerg", "examplePartnerTopic1", 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.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"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armeventgrid.PartnerTopicProperties{ - // ActivationState: to.Ptr(armeventgrid.PartnerTopicActivationStateDeactivated), - // ProvisioningState: to.Ptr(armeventgrid.PartnerTopicProvisioningStateSucceeded), - // Source: to.Ptr("ContosoCorp.Accounts.User1"), - // }, - // } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/permissionbindings_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/permissionbindings_client.go index 2bb17aa1d5af..886705f50ed6 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/permissionbindings_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/permissionbindings_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 @@ -49,7 +48,7 @@ func NewPermissionBindingsClient(subscriptionID string, credential azcore.TokenC // 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 +// Generated from API version 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - namespaceName - Name of the namespace. // - permissionBindingName - The permission binding name. @@ -62,9 +61,10 @@ func (client *PermissionBindingsClient) BeginCreateOrUpdate(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PermissionBindingsClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PermissionBindingsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[PermissionBindingsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -73,20 +73,22 @@ func (client *PermissionBindingsClient) BeginCreateOrUpdate(ctx context.Context, // 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 +// Generated from API version 2023-12-15-preview func (client *PermissionBindingsClient) createOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, permissionBindingName string, permissionBindingInfo PermissionBinding, options *PermissionBindingsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, namespaceName, permissionBindingName, permissionBindingInfo, 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. @@ -113,16 +115,19 @@ func (client *PermissionBindingsClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, permissionBindingInfo) + if err := runtime.MarshalAsJSON(req, permissionBindingInfo); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete an existing permission binding. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - namespaceName - Name of the namespace. // - permissionBindingName - Name of the permission binding. @@ -134,9 +139,10 @@ func (client *PermissionBindingsClient) BeginDelete(ctx context.Context, resourc if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PermissionBindingsClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PermissionBindingsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[PermissionBindingsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -145,20 +151,22 @@ func (client *PermissionBindingsClient) BeginDelete(ctx context.Context, resourc // Delete - Delete an existing permission binding. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-preview func (client *PermissionBindingsClient) deleteOperation(ctx context.Context, resourceGroupName string, namespaceName string, permissionBindingName string, options *PermissionBindingsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, namespaceName, permissionBindingName, 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 +193,7 @@ func (client *PermissionBindingsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -194,24 +202,27 @@ func (client *PermissionBindingsClient) deleteCreateRequest(ctx context.Context, // 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 +// Generated from API version 2023-12-15-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) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, namespaceName, permissionBindingName, options) if err != nil { return PermissionBindingsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PermissionBindingsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PermissionBindingsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PermissionBindingsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -238,7 +249,7 @@ func (client *PermissionBindingsClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -255,7 +266,7 @@ func (client *PermissionBindingsClient) getHandleResponse(resp *http.Response) ( // NewListByNamespacePager - Get all the permission bindings under a namespace. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-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 @@ -308,7 +319,7 @@ func (client *PermissionBindingsClient) listByNamespaceCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } 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..27a10d630c8c 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,6 +165,10 @@ func unmarshalEventSubscriptionDestinationClassification(rawMsg json.RawMessage) b = &EventHubEventSubscriptionDestination{} case string(EndpointTypeHybridConnection): b = &HybridConnectionEventSubscriptionDestination{} + case string(EndpointTypeMonitorAlert): + b = &MonitorAlertEventSubscriptionDestination{} + case string(EndpointTypeNamespaceTopic): + b = &NamespaceTopicEventSubscriptionDestination{} case string(EndpointTypePartnerDestination): b = &PartnerEventSubscriptionDestination{} case string(EndpointTypeServiceBusQueue): @@ -170,7 +182,10 @@ func unmarshalEventSubscriptionDestinationClassification(rawMsg json.RawMessage) default: b = &EventSubscriptionDestination{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalFilterClassification(rawMsg json.RawMessage) (FilterClassification, error) { @@ -224,7 +239,10 @@ func unmarshalFilterClassification(rawMsg json.RawMessage) (FilterClassification default: b = &Filter{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalFilterClassificationArray(rawMsg json.RawMessage) ([]FilterClassification, error) { @@ -261,7 +279,10 @@ func unmarshalInputSchemaMappingClassification(rawMsg json.RawMessage) (InputSch default: b = &InputSchemaMapping{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalPartnerClientAuthenticationClassification(rawMsg json.RawMessage) (PartnerClientAuthenticationClassification, error) { @@ -279,7 +300,10 @@ func unmarshalPartnerClientAuthenticationClassification(rawMsg json.RawMessage) default: b = &PartnerClientAuthentication{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalPartnerDestinationInfoClassification(rawMsg json.RawMessage) (PartnerDestinationInfoClassification, error) { @@ -297,7 +321,10 @@ func unmarshalPartnerDestinationInfoClassification(rawMsg json.RawMessage) (Part default: b = &PartnerDestinationInfo{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalPartnerUpdateDestinationInfoClassification(rawMsg json.RawMessage) (PartnerUpdateDestinationInfoClassification, error) { @@ -315,5 +342,8 @@ func unmarshalPartnerUpdateDestinationInfoClassification(rawMsg json.RawMessage) default: b = &PartnerUpdateDestinationInfo{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/privateendpointconnections_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/privateendpointconnections_client.go index bb5870097b9c..e91e467a8dcf 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 @@ -49,7 +48,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginDelete - Delete a specific private endpoint connection under a topic, domain, or partner namespace or namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-preview // - 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 @@ -63,7 +62,8 @@ 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[PrivateEndpointConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -72,20 +72,22 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Delete a specific private endpoint connection under a topic, domain, or partner namespace or namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-preview func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, parentType PrivateEndpointConnectionsParentType, parentName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error 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,7 +118,7 @@ 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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -124,7 +126,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Get a specific private endpoint connection under a topic, domain, or partner namespace or namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-preview // - 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 @@ -133,18 +135,21 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // - 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 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 +180,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -192,7 +197,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListByResourcePager - Get all private endpoint connections under a topic, domain, or partner namespace or namespace. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-preview // - 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 @@ -251,7 +256,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -275,7 +280,7 @@ 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 2023-12-15-preview // - 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 @@ -290,7 +295,8 @@ 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[PrivateEndpointConnectionsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -299,20 +305,22 @@ func (client *PrivateEndpointConnectionsClient) BeginUpdate(ctx context.Context, // 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 2023-12-15-preview 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 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 +351,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", "2023-12-15-preview") 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 deleted file mode 100644 index 56ef21f753f2..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,176 +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/PrivateEndpointConnections_Get.json -func ExamplePrivateEndpointConnectionsClient_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.NewPrivateEndpointConnectionsClient().Get(ctx, "examplerg", armeventgrid.PrivateEndpointConnectionsParentTypeTopics, "exampletopic1", "BMTPE5.8A30D251-4C61-489D-A1AA-B37C4A329B8B", 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.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"), - // 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"), - // }, - // PrivateLinkServiceConnectionState: &armeventgrid.ConnectionState{ - // Description: to.Ptr("Test"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armeventgrid.PersistedConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armeventgrid.ResourceProvisioningStateSucceeded), - // }, - // } -} - -// 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 -func ExamplePrivateEndpointConnectionsClient_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.NewPrivateEndpointConnectionsClient().BeginUpdate(ctx, "examplerg", armeventgrid.PrivateEndpointConnectionsParentTypeTopics, "exampletopic1", "BMTPE5.8A30D251-4C61-489D-A1AA-B37C4A329B8B", armeventgrid.PrivateEndpointConnection{ - Properties: &armeventgrid.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armeventgrid.ConnectionState{ - Description: to.Ptr("approving connection"), - ActionsRequired: to.Ptr("None"), - Status: to.Ptr(armeventgrid.PersistedConnectionStatusApproved), - }, - }, - }, 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.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"), - // 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"), - // }, - // PrivateLinkServiceConnectionState: &armeventgrid.ConnectionState{ - // Description: to.Ptr("approving connection"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armeventgrid.PersistedConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armeventgrid.ResourceProvisioningStateSucceeded), - // }, - // } -} - -// 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 -func ExamplePrivateEndpointConnectionsClient_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.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "examplerg", armeventgrid.PrivateEndpointConnectionsParentTypeTopics, "exampletopic1", "BMTPE5.8A30D251-4C61-489D-A1AA-B37C4A329B8B", 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/PrivateEndpointConnections_ListByResource.json -func ExamplePrivateEndpointConnectionsClient_NewListByResourcePager() { - 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.NewPrivateEndpointConnectionsClient().NewListByResourcePager("examplerg", armeventgrid.PrivateEndpointConnectionsParentTypeTopics, "exampletopic1", &armeventgrid.PrivateEndpointConnectionsClientListByResourceOptions{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.PrivateEndpointConnectionListResult = armeventgrid.PrivateEndpointConnectionListResult{ - // Value: []*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"), - // 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"), - // }, - // PrivateLinkServiceConnectionState: &armeventgrid.ConnectionState{ - // Description: to.Ptr("Test"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armeventgrid.PersistedConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armeventgrid.ResourceProvisioningStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/privatelinkresources_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/privatelinkresources_client.go index 5eb83cc33f63..3ac1a8df8dd6 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 @@ -49,7 +48,7 @@ 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 2023-12-15-preview // - 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 @@ -58,18 +57,21 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // - 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 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 +102,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -117,7 +119,7 @@ func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) // NewListByResourcePager - List all the private link resources under a topic, domain, or partner namespace or namespace. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-preview // - 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 @@ -176,7 +178,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", "2023-12-15-preview") 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 deleted file mode 100644 index dc47547ea069..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/privatelinkresources_client_example_test.go +++ /dev/null @@ -1,94 +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/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/PrivateLinkResources_Get.json -func ExamplePrivateLinkResourcesClient_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.NewPrivateLinkResourcesClient().Get(ctx, "examplerg", "topics", "exampletopic1", "topic", 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.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"), - // Properties: &armeventgrid.PrivateLinkResourceProperties{ - // DisplayName: to.Ptr("Event Grid topic"), - // GroupID: to.Ptr("topic"), - // RequiredMembers: []*string{ - // to.Ptr("topic")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.eventgrid.azure.net")}, - // }, - // } -} - -// 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 -func ExamplePrivateLinkResourcesClient_NewListByResourcePager() { - 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.NewPrivateLinkResourcesClient().NewListByResourcePager("examplerg", "topics", "exampletopic1", &armeventgrid.PrivateLinkResourcesClientListByResourceOptions{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.PrivateLinkResourcesListResult = armeventgrid.PrivateLinkResourcesListResult{ - // Value: []*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"), - // Properties: &armeventgrid.PrivateLinkResourceProperties{ - // DisplayName: to.Ptr("Event Grid topic"), - // GroupID: to.Ptr("topic"), - // RequiredMembers: []*string{ - // to.Ptr("topic")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.eventgrid.azure.net")}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/response_types.go b/sdk/resourcemanager/eventgrid/armeventgrid/response_types.go index 59d8330ca688..2c5ffba283e0 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/response_types.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/response_types.go @@ -3,14 +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 { + // The CA Certificate resource. CaCertificate } @@ -21,16 +21,19 @@ type CaCertificatesClientDeleteResponse struct { // CaCertificatesClientGetResponse contains the response from method CaCertificatesClient.Get. type CaCertificatesClientGetResponse struct { + // The CA Certificate resource. CaCertificate } // CaCertificatesClientListByNamespaceResponse contains the response from method CaCertificatesClient.NewListByNamespacePager. type CaCertificatesClientListByNamespaceResponse struct { + // Result of the List CA Certificate operation. CaCertificatesListResult } // ChannelsClientCreateOrUpdateResponse contains the response from method ChannelsClient.CreateOrUpdate. type ChannelsClientCreateOrUpdateResponse struct { + // Channel info. Channel } @@ -41,16 +44,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 } @@ -61,6 +67,7 @@ type ChannelsClientUpdateResponse struct { // ClientGroupsClientCreateOrUpdateResponse contains the response from method ClientGroupsClient.BeginCreateOrUpdate. type ClientGroupsClientCreateOrUpdateResponse struct { + // The Client group resource. ClientGroup } @@ -71,16 +78,19 @@ type ClientGroupsClientDeleteResponse struct { // ClientGroupsClientGetResponse contains the response from method ClientGroupsClient.Get. type ClientGroupsClientGetResponse struct { + // The Client group resource. ClientGroup } // ClientGroupsClientListByNamespaceResponse contains the response from method ClientGroupsClient.NewListByNamespacePager. type ClientGroupsClientListByNamespaceResponse struct { + // Result of the List Client Group operation. ClientGroupsListResult } // ClientsClientCreateOrUpdateResponse contains the response from method ClientsClient.BeginCreateOrUpdate. type ClientsClientCreateOrUpdateResponse struct { + // The Client resource. Client } @@ -91,16 +101,19 @@ type ClientsClientDeleteResponse struct { // ClientsClientGetResponse contains the response from method ClientsClient.Get. type ClientsClientGetResponse struct { + // The Client resource. Client } // ClientsClientListByNamespaceResponse contains the response from method ClientsClient.NewListByNamespacePager. type ClientsClientListByNamespaceResponse struct { + // Result of the List Client operation. ClientsListResult } // DomainEventSubscriptionsClientCreateOrUpdateResponse contains the response from method DomainEventSubscriptionsClient.BeginCreateOrUpdate. type DomainEventSubscriptionsClientCreateOrUpdateResponse struct { + // Event Subscription. EventSubscription } @@ -111,31 +124,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 +165,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 +206,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 +229,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,81 +276,97 @@ 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 { + // Event Subscription. Subscription } @@ -324,23 +375,33 @@ type NamespaceTopicEventSubscriptionsClientDeleteResponse struct { // placeholder for future response values } +// NamespaceTopicEventSubscriptionsClientGetDeliveryAttributesResponse contains the response from method NamespaceTopicEventSubscriptionsClient.GetDeliveryAttributes. +type NamespaceTopicEventSubscriptionsClientGetDeliveryAttributesResponse struct { + // Result of the Get delivery attributes operation. + DeliveryAttributeListResult +} + // NamespaceTopicEventSubscriptionsClientGetResponse contains the response from method NamespaceTopicEventSubscriptionsClient.Get. type NamespaceTopicEventSubscriptionsClientGetResponse struct { + // Event Subscription. Subscription } // NamespaceTopicEventSubscriptionsClientListByNamespaceTopicResponse contains the response from method NamespaceTopicEventSubscriptionsClient.NewListByNamespaceTopicPager. type NamespaceTopicEventSubscriptionsClientListByNamespaceTopicResponse struct { + // Result of the List event subscriptions operation. SubscriptionsListResult } // NamespaceTopicEventSubscriptionsClientUpdateResponse contains the response from method NamespaceTopicEventSubscriptionsClient.BeginUpdate. type NamespaceTopicEventSubscriptionsClientUpdateResponse struct { + // Event Subscription. Subscription } // NamespaceTopicsClientCreateOrUpdateResponse contains the response from method NamespaceTopicsClient.BeginCreateOrUpdate. type NamespaceTopicsClientCreateOrUpdateResponse struct { + // Namespace topic details. NamespaceTopic } @@ -351,31 +412,37 @@ type NamespaceTopicsClientDeleteResponse struct { // NamespaceTopicsClientGetResponse contains the response from method NamespaceTopicsClient.Get. type NamespaceTopicsClientGetResponse struct { + // Namespace topic details. NamespaceTopic } // NamespaceTopicsClientListByNamespaceResponse contains the response from method NamespaceTopicsClient.NewListByNamespacePager. type NamespaceTopicsClientListByNamespaceResponse struct { + // Result of the List namespace topics operation. NamespaceTopicsListResult } // NamespaceTopicsClientListSharedAccessKeysResponse contains the response from method NamespaceTopicsClient.ListSharedAccessKeys. type NamespaceTopicsClientListSharedAccessKeysResponse struct { + // Shared access keys of the Topic TopicSharedAccessKeys } // NamespaceTopicsClientRegenerateKeyResponse contains the response from method NamespaceTopicsClient.BeginRegenerateKey. type NamespaceTopicsClientRegenerateKeyResponse struct { + // Shared access keys of the Topic TopicSharedAccessKeys } // NamespaceTopicsClientUpdateResponse contains the response from method NamespaceTopicsClient.BeginUpdate. type NamespaceTopicsClientUpdateResponse struct { + // Namespace topic details. NamespaceTopic } // NamespacesClientCreateOrUpdateResponse contains the response from method NamespacesClient.BeginCreateOrUpdate. type NamespacesClientCreateOrUpdateResponse struct { + // Namespace resource. Namespace } @@ -386,46 +453,73 @@ type NamespacesClientDeleteResponse struct { // NamespacesClientGetResponse contains the response from method NamespacesClient.Get. type NamespacesClientGetResponse struct { + // Namespace resource. Namespace } // NamespacesClientListByResourceGroupResponse contains the response from method NamespacesClient.NewListByResourceGroupPager. type NamespacesClientListByResourceGroupResponse struct { + // Result of the List Namespaces operation. NamespacesListResult } // NamespacesClientListBySubscriptionResponse contains the response from method NamespacesClient.NewListBySubscriptionPager. type NamespacesClientListBySubscriptionResponse struct { + // Result of the List Namespaces operation. NamespacesListResult } // NamespacesClientListSharedAccessKeysResponse contains the response from method NamespacesClient.ListSharedAccessKeys. type NamespacesClientListSharedAccessKeysResponse struct { + // Shared access keys of the Namespace. NamespaceSharedAccessKeys } // NamespacesClientRegenerateKeyResponse contains the response from method NamespacesClient.BeginRegenerateKey. type NamespacesClientRegenerateKeyResponse struct { + // Shared access keys of the Namespace. NamespaceSharedAccessKeys } // NamespacesClientUpdateResponse contains the response from method NamespacesClient.BeginUpdate. type NamespacesClientUpdateResponse struct { + // Namespace resource. Namespace } +// NetworkSecurityPerimeterConfigurationsClientGetResponse contains the response from method NetworkSecurityPerimeterConfigurationsClient.Get. +type NetworkSecurityPerimeterConfigurationsClientGetResponse struct { + // Network security perimeter configuration. + NetworkSecurityPerimeterConfiguration +} + +// NetworkSecurityPerimeterConfigurationsClientListResponse contains the response from method NetworkSecurityPerimeterConfigurationsClient.NewListPager. +type NetworkSecurityPerimeterConfigurationsClientListResponse struct { + // Network security perimeter configuration List. + NetworkSecurityPerimeterConfigurationList +} + +// NetworkSecurityPerimeterConfigurationsClientReconcileResponse contains the response from method NetworkSecurityPerimeterConfigurationsClient.BeginReconcile. +type NetworkSecurityPerimeterConfigurationsClientReconcileResponse struct { + // Network security perimeter configuration. + NetworkSecurityPerimeterConfiguration +} + // 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,36 +530,43 @@ 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 { + // Event Grid Partner Destination. PartnerDestination } // PartnerDestinationsClientCreateOrUpdateResponse contains the response from method PartnerDestinationsClient.BeginCreateOrUpdate. type PartnerDestinationsClientCreateOrUpdateResponse struct { + // Event Grid Partner Destination. PartnerDestination } @@ -476,26 +577,31 @@ type PartnerDestinationsClientDeleteResponse struct { // PartnerDestinationsClientGetResponse contains the response from method PartnerDestinationsClient.Get. type PartnerDestinationsClientGetResponse struct { + // Event Grid Partner Destination. PartnerDestination } // PartnerDestinationsClientListByResourceGroupResponse contains the response from method PartnerDestinationsClient.NewListByResourceGroupPager. type PartnerDestinationsClientListByResourceGroupResponse struct { + // Result of the List Partner Destinations operation. PartnerDestinationsListResult } // PartnerDestinationsClientListBySubscriptionResponse contains the response from method PartnerDestinationsClient.NewListBySubscriptionPager. type PartnerDestinationsClientListBySubscriptionResponse struct { + // Result of the List Partner Destinations operation. PartnerDestinationsListResult } // PartnerDestinationsClientUpdateResponse contains the response from method PartnerDestinationsClient.BeginUpdate. type PartnerDestinationsClientUpdateResponse struct { + // Event Grid Partner Destination. PartnerDestination } // PartnerNamespacesClientCreateOrUpdateResponse contains the response from method PartnerNamespacesClient.BeginCreateOrUpdate. type PartnerNamespacesClientCreateOrUpdateResponse struct { + // EventGrid Partner Namespace. PartnerNamespace } @@ -506,36 +612,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 +659,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 +694,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,26 +747,31 @@ 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 { + // The Permission binding resource. PermissionBinding } @@ -651,11 +782,13 @@ type PermissionBindingsClientDeleteResponse struct { // PermissionBindingsClientGetResponse contains the response from method PermissionBindingsClient.Get. type PermissionBindingsClientGetResponse struct { + // The Permission binding resource. PermissionBinding } // PermissionBindingsClientListByNamespaceResponse contains the response from method PermissionBindingsClient.NewListByNamespacePager. type PermissionBindingsClientListByNamespaceResponse struct { + // Result of the List Permission Binding operation. PermissionBindingsListResult } @@ -671,6 +804,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 +815,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 +838,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 +879,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,31 +914,37 @@ 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 { + // The Topic space resource. TopicSpace } @@ -801,31 +955,37 @@ type TopicSpacesClientDeleteResponse struct { // TopicSpacesClientGetResponse contains the response from method TopicSpacesClient.Get. type TopicSpacesClientGetResponse struct { + // The Topic space resource. TopicSpace } // TopicSpacesClientListByNamespaceResponse contains the response from method TopicSpacesClient.NewListByNamespacePager. type TopicSpacesClientListByNamespaceResponse struct { + // Result of the List Topic Space operation. 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 +996,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..b60267dfc330 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 @@ -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 2023-12-15-preview // - 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,7 +63,8 @@ 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[SystemTopicEventSubscriptionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SystemTopicEventSubscriptionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -74,20 +74,22 @@ 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 2023-12-15-preview func (client *SystemTopicEventSubscriptionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription, options *SystemTopicEventSubscriptionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error 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 +116,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", "2023-12-15-preview") 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 2023-12-15-preview // - 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,7 +141,8 @@ 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[SystemTopicEventSubscriptionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SystemTopicEventSubscriptionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -145,20 +151,22 @@ func (client *SystemTopicEventSubscriptionsClient) BeginDelete(ctx context.Conte // 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 2023-12-15-preview func (client *SystemTopicEventSubscriptionsClient) deleteOperation(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, options *SystemTopicEventSubscriptionsClientBeginDeleteOptions) (*http.Response, error) { + var err error 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 +193,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -193,7 +201,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 2023-12-15-preview // - 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 +209,21 @@ 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 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 +250,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -257,7 +268,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 2023-12-15-preview // - 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 +276,21 @@ 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 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 +317,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -321,7 +335,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 2023-12-15-preview // - 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 +343,21 @@ 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 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 +384,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -384,7 +401,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 2023-12-15-preview // - 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 @@ -437,7 +454,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -461,7 +478,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 2023-12-15-preview // - 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,7 +492,8 @@ 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[SystemTopicEventSubscriptionsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SystemTopicEventSubscriptionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -484,20 +502,22 @@ func (client *SystemTopicEventSubscriptionsClient) BeginUpdate(ctx context.Conte // 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 2023-12-15-preview func (client *SystemTopicEventSubscriptionsClient) update(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters, options *SystemTopicEventSubscriptionsClientBeginUpdateOptions) (*http.Response, error) { + var err error 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 +544,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", "2023-12-15-preview") 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 deleted file mode 100644 index 5029df24dfa5..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/systemtopiceventsubscriptions_client_example_test.go +++ /dev/null @@ -1,321 +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/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 -func ExampleSystemTopicEventSubscriptionsClient_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.NewSystemTopicEventSubscriptionsClient().Get(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.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"), - // 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"), - // }, - // }, - // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IncludedEventTypes: []*string{ - // to.Ptr("Microsoft.Storage.BlobCreated"), - // to.Ptr("Microsoft.Storage.BlobDeleted")}, - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // RetryPolicy: &armeventgrid.RetryPolicy{ - // 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"), - // }, - // } -} - -// 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 -func ExampleSystemTopicEventSubscriptionsClient_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.NewSystemTopicEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "examplerg", "exampleSystemTopic1", "exampleEventSubscriptionName1", armeventgrid.EventSubscription{ - Properties: &armeventgrid.EventSubscriptionProperties{ - Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(false), - SubjectBeginsWith: to.Ptr("ExamplePrefix"), - SubjectEndsWith: to.Ptr("ExampleSuffix"), - }, - }, - }, 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/SystemTopicEventSubscriptions_Delete.json -func ExampleSystemTopicEventSubscriptionsClient_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.NewSystemTopicEventSubscriptionsClient().BeginDelete(ctx, "examplerg", "exampleSystemTopic1", "examplesubscription1", 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/SystemTopicEventSubscriptions_Update.json -func ExampleSystemTopicEventSubscriptionsClient_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.NewSystemTopicEventSubscriptionsClient().BeginUpdate(ctx, "examplerg", "exampleSystemTopic1", "exampleEventSubscriptionName1", armeventgrid.EventSubscriptionUpdateParameters{ - Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(true), - SubjectBeginsWith: to.Ptr("existingPrefix"), - SubjectEndsWith: to.Ptr("newSuffix"), - }, - Labels: []*string{ - to.Ptr("label1"), - to.Ptr("label2")}, - }, 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/SystemTopicEventSubscriptions_GetFullUrl.json -func ExampleSystemTopicEventSubscriptionsClient_GetFullURL() { - 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().GetFullURL(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.EventSubscriptionFullURL = armeventgrid.EventSubscriptionFullURL{ - // EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - // } -} - -// 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 -func ExampleSystemTopicEventSubscriptionsClient_NewListBySystemTopicPager() { - 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.NewSystemTopicEventSubscriptionsClient().NewListBySystemTopicPager("examplerg", "exampleSystemTopic1", &armeventgrid.SystemTopicEventSubscriptionsClientListBySystemTopicOptions{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.EventSubscriptionsListResult = armeventgrid.EventSubscriptionsListResult{ - // Value: []*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"), - // 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"), - // }, - // }, - // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), - // Filter: &armeventgrid.EventSubscriptionFilter{ - // SubjectBeginsWith: to.Ptr(""), - // SubjectEndsWith: to.Ptr(""), - // }, - // Labels: []*string{ - // }, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // RetryPolicy: &armeventgrid.RetryPolicy{ - // 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"), - // }, - // }, - // { - // 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"), - // 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"), - // }, - // }, - // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IncludedEventTypes: []*string{ - // to.Ptr("Microsoft.Storage.BlobCreated"), - // to.Ptr("Microsoft.Storage.BlobDeleted")}, - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // RetryPolicy: &armeventgrid.RetryPolicy{ - // 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"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/systemtopics_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/systemtopics_client.go index fcf92cb06b89..d2641175ee29 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 @@ -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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - systemTopicName - Name of the system topic. // - systemTopicInfo - System Topic information. @@ -61,7 +60,8 @@ 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[SystemTopicsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SystemTopicsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *SystemTopicsClient) BeginCreateOrUpdate(ctx context.Context, resou // 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 2023-12-15-preview func (client *SystemTopicsClient) createOrUpdate(ctx context.Context, resourceGroupName string, systemTopicName string, systemTopicInfo SystemTopic, options *SystemTopicsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error 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 +108,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", "2023-12-15-preview") 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 2023-12-15-preview // - 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,7 +131,8 @@ 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[SystemTopicsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SystemTopicsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -135,20 +141,22 @@ func (client *SystemTopicsClient) BeginDelete(ctx context.Context, resourceGroup // 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 2023-12-15-preview func (client *SystemTopicsClient) deleteOperation(ctx context.Context, resourceGroupName string, systemTopicName string, options *SystemTopicsClientBeginDeleteOptions) (*http.Response, error) { + var err error 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 +179,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -179,23 +187,26 @@ 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 2023-12-15-preview // - 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 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 +229,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -235,7 +246,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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - options - SystemTopicsClientListByResourceGroupOptions contains the optional parameters for the SystemTopicsClient.NewListByResourceGroupPager // method. @@ -283,7 +294,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -306,7 +317,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 2023-12-15-preview // - options - SystemTopicsClientListBySubscriptionOptions contains the optional parameters for the SystemTopicsClient.NewListBySubscriptionPager // method. func (client *SystemTopicsClient) NewListBySubscriptionPager(options *SystemTopicsClientListBySubscriptionOptions) *runtime.Pager[SystemTopicsClientListBySubscriptionResponse] { @@ -349,7 +360,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -373,7 +384,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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - systemTopicName - Name of the system topic. // - systemTopicUpdateParameters - SystemTopic update information. @@ -385,7 +396,8 @@ 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[SystemTopicsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SystemTopicsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -394,20 +406,22 @@ func (client *SystemTopicsClient) BeginUpdate(ctx context.Context, resourceGroup // 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 2023-12-15-preview func (client *SystemTopicsClient) update(ctx context.Context, resourceGroupName string, systemTopicName string, systemTopicUpdateParameters SystemTopicUpdateParameters, options *SystemTopicsClientBeginUpdateOptions) (*http.Response, error) { + var err error 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 +444,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", "2023-12-15-preview") 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 deleted file mode 100644 index 703e5527b2dc..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/systemtopics_client_example_test.go +++ /dev/null @@ -1,243 +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/SystemTopics_Get.json -func ExampleSystemTopicsClient_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.NewSystemTopicsClient().Get(ctx, "examplerg", "exampleSystemTopic2", 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.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"), - // 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"), - // 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 -func ExampleSystemTopicsClient_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.NewSystemTopicsClient().BeginCreateOrUpdate(ctx, "examplerg", "exampleSystemTopic1", armeventgrid.SystemTopic{ - Location: to.Ptr("westus2"), - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - Properties: &armeventgrid.SystemTopicProperties{ - Source: to.Ptr("/subscriptions/8f6b6269-84f2-4d09-9e31-1127efcd1e40/resourceGroups/azureeventgridrunnerrgcentraluseuap/providers/microsoft.storage/storageaccounts/pubstgrunnerb71cd29e"), - TopicType: to.Ptr("microsoft.storage.storageaccounts"), - }, - }, 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.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"), - // 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"), - // 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 -func ExampleSystemTopicsClient_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.NewSystemTopicsClient().BeginDelete(ctx, "examplerg", "exampleSystemTopic1", 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/SystemTopics_Update.json -func ExampleSystemTopicsClient_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.NewSystemTopicsClient().BeginUpdate(ctx, "examplerg", "exampleSystemTopic1", armeventgrid.SystemTopicUpdateParameters{ - 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.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"), - // 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"), - // 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 -func ExampleSystemTopicsClient_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.NewSystemTopicsClient().NewListBySubscriptionPager(&armeventgrid.SystemTopicsClientListBySubscriptionOptions{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.SystemTopicsListResult = armeventgrid.SystemTopicsListResult{ - // Value: []*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"), - // 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"), - // 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_ListByResourceGroup.json -func ExampleSystemTopicsClient_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.NewSystemTopicsClient().NewListByResourceGroupPager("examplerg", &armeventgrid.SystemTopicsClientListByResourceGroupOptions{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.SystemTopicsListResult = armeventgrid.SystemTopicsListResult{ - // Value: []*armeventgrid.SystemTopic{ - // { - // 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"), - // 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"), - // 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..923d0d5d6c0c 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 diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/topiceventsubscriptions_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/topiceventsubscriptions_client.go index 1bca4257af6d..fd91edc5c592 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 @@ -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 2023-12-15-preview // - 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,7 +62,8 @@ 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[TopicEventSubscriptionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[TopicEventSubscriptionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -72,20 +72,22 @@ func (client *TopicEventSubscriptionsClient) BeginCreateOrUpdate(ctx context.Con // 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 2023-12-15-preview func (client *TopicEventSubscriptionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, topicName string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription, options *TopicEventSubscriptionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error 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 +114,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", "2023-12-15-preview") 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 2023-12-15-preview // - 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,7 +139,8 @@ 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[TopicEventSubscriptionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[TopicEventSubscriptionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -143,20 +149,22 @@ func (client *TopicEventSubscriptionsClient) BeginDelete(ctx context.Context, re // 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 2023-12-15-preview func (client *TopicEventSubscriptionsClient) deleteOperation(ctx context.Context, resourceGroupName string, topicName string, eventSubscriptionName string, options *TopicEventSubscriptionsClientBeginDeleteOptions) (*http.Response, error) { + var err error 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 +191,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -191,7 +199,7 @@ 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 2023-12-15-preview // - 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 found. Event subscription names must be between 3 and 100 @@ -199,18 +207,21 @@ func (client *TopicEventSubscriptionsClient) deleteCreateRequest(ctx context.Con // - 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 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 +248,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -255,25 +266,28 @@ 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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - topicName - Name of the 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 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 +314,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -318,25 +332,28 @@ 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 2023-12-15-preview // - 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 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 +380,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -380,7 +397,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 2023-12-15-preview // - 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 @@ -433,7 +450,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -457,7 +474,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 2023-12-15-preview // - 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,7 +487,8 @@ 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[TopicEventSubscriptionsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[TopicEventSubscriptionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -479,20 +497,22 @@ func (client *TopicEventSubscriptionsClient) BeginUpdate(ctx context.Context, re // 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 2023-12-15-preview func (client *TopicEventSubscriptionsClient) update(ctx context.Context, resourceGroupName string, topicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters, options *TopicEventSubscriptionsClientBeginUpdateOptions) (*http.Response, error) { + var err error 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 +539,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", "2023-12-15-preview") 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 deleted file mode 100644 index 9ebba17a6c42..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/topiceventsubscriptions_client_example_test.go +++ /dev/null @@ -1,322 +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/TopicEventSubscriptions_GetDeliveryAttributes.json -func ExampleTopicEventSubscriptionsClient_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.NewTopicEventSubscriptionsClient().GetDeliveryAttributes(ctx, "examplerg", "exampleTopic1", "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/TopicEventSubscriptions_Get.json -func ExampleTopicEventSubscriptionsClient_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.NewTopicEventSubscriptionsClient().Get(ctx, "examplerg", "exampleTopic1", "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.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"), - // 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"), - // }, - // }, - // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IncludedEventTypes: []*string{ - // to.Ptr("Microsoft.Storage.BlobCreated"), - // to.Ptr("Microsoft.Storage.BlobDeleted")}, - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // RetryPolicy: &armeventgrid.RetryPolicy{ - // 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"), - // }, - // } -} - -// 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 -func ExampleTopicEventSubscriptionsClient_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.NewTopicEventSubscriptionsClient().BeginCreateOrUpdate(ctx, "examplerg", "exampleTopic1", "exampleEventSubscriptionName1", armeventgrid.EventSubscription{ - Properties: &armeventgrid.EventSubscriptionProperties{ - Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(false), - SubjectBeginsWith: to.Ptr("ExamplePrefix"), - SubjectEndsWith: to.Ptr("ExampleSuffix"), - }, - }, - }, 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.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"), - // Properties: &armeventgrid.EventSubscriptionProperties{ - // Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - // EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - // Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - // EndpointBaseURL: to.Ptr("https://requestb.in/15ksip71"), - // }, - // }, - // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // RetryPolicy: &armeventgrid.RetryPolicy{ - // 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"), - // }, - // } -} - -// 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 -func ExampleTopicEventSubscriptionsClient_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.NewTopicEventSubscriptionsClient().BeginDelete(ctx, "examplerg", "exampleTopic1", "examplesubscription1", 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/TopicEventSubscriptions_Update.json -func ExampleTopicEventSubscriptionsClient_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.NewTopicEventSubscriptionsClient().BeginUpdate(ctx, "examplerg", "exampleTopic1", "exampleEventSubscriptionName1", armeventgrid.EventSubscriptionUpdateParameters{ - Destination: &armeventgrid.WebHookEventSubscriptionDestination{ - EndpointType: to.Ptr(armeventgrid.EndpointTypeWebHook), - Properties: &armeventgrid.WebHookEventSubscriptionDestinationProperties{ - EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - }, - }, - Filter: &armeventgrid.EventSubscriptionFilter{ - IsSubjectCaseSensitive: to.Ptr(true), - SubjectBeginsWith: to.Ptr("existingPrefix"), - SubjectEndsWith: to.Ptr("newSuffix"), - }, - Labels: []*string{ - to.Ptr("label1"), - to.Ptr("label2")}, - }, 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/TopicEventSubscriptions_GetFullUrl.json -func ExampleTopicEventSubscriptionsClient_GetFullURL() { - 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.NewTopicEventSubscriptionsClient().GetFullURL(ctx, "examplerg", "exampleTopic1", "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.EventSubscriptionFullURL = armeventgrid.EventSubscriptionFullURL{ - // EndpointURL: to.Ptr("https://requestb.in/15ksip71"), - // } -} - -// 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 -func ExampleTopicEventSubscriptionsClient_NewListPager() { - 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.NewTopicEventSubscriptionsClient().NewListPager("examplerg", "exampleTopic1", &armeventgrid.TopicEventSubscriptionsClientListOptions{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.EventSubscriptionsListResult = armeventgrid.EventSubscriptionsListResult{ - // Value: []*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"), - // 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"), - // }, - // }, - // EventDeliverySchema: to.Ptr(armeventgrid.EventDeliverySchemaEventGridSchema), - // Filter: &armeventgrid.EventSubscriptionFilter{ - // IncludedEventTypes: []*string{ - // to.Ptr("Microsoft.Storage.BlobCreated"), - // to.Ptr("Microsoft.Storage.BlobDeleted")}, - // IsSubjectCaseSensitive: to.Ptr(false), - // SubjectBeginsWith: to.Ptr("ExamplePrefix"), - // SubjectEndsWith: to.Ptr("ExampleSuffix"), - // }, - // Labels: []*string{ - // to.Ptr("label1"), - // to.Ptr("label2")}, - // ProvisioningState: to.Ptr(armeventgrid.EventSubscriptionProvisioningStateSucceeded), - // RetryPolicy: &armeventgrid.RetryPolicy{ - // 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"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/topics_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/topics_client.go index bde420a07cb9..c783361be63d 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 @@ -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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - topicName - Name of the topic. // - topicInfo - Topic information. @@ -61,7 +60,8 @@ 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[TopicsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[TopicsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *TopicsClient) BeginCreateOrUpdate(ctx context.Context, resourceGro // 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 2023-12-15-preview func (client *TopicsClient) createOrUpdate(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic, options *TopicsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error 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 +108,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", "2023-12-15-preview") 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 2023-12-15-preview // - 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,7 +130,8 @@ 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[TopicsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[TopicsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -134,20 +140,22 @@ func (client *TopicsClient) BeginDelete(ctx context.Context, resourceGroupName s // 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 2023-12-15-preview func (client *TopicsClient) deleteOperation(ctx context.Context, resourceGroupName string, topicName string, options *TopicsClientBeginDeleteOptions) (*http.Response, error) { + var err error 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 +178,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -178,23 +186,26 @@ 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 2023-12-15-preview // - 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 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 +228,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -234,7 +245,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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - options - TopicsClientListByResourceGroupOptions contains the optional parameters for the TopicsClient.NewListByResourceGroupPager // method. @@ -282,7 +293,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -305,7 +316,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 2023-12-15-preview // - options - TopicsClientListBySubscriptionOptions contains the optional parameters for the TopicsClient.NewListBySubscriptionPager // method. func (client *TopicsClient) NewListBySubscriptionPager(options *TopicsClientListBySubscriptionOptions) *runtime.Pager[TopicsClientListBySubscriptionResponse] { @@ -348,7 +359,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", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -371,7 +382,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 2023-12-15-preview // - 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. @@ -428,7 +439,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -446,24 +457,27 @@ 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 2023-12-15-preview // - 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 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 +500,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -504,7 +518,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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - topicName - Name of the topic. // - regenerateKeyRequest - Request body to regenerate key. @@ -516,7 +530,8 @@ 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[TopicsClientRegenerateKeyResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[TopicsClientRegenerateKeyResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -525,20 +540,22 @@ func (client *TopicsClient) BeginRegenerateKey(ctx context.Context, resourceGrou // 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 2023-12-15-preview func (client *TopicsClient) regenerateKey(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest, options *TopicsClientBeginRegenerateKeyOptions) (*http.Response, error) { + var err error 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 +578,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", "2023-12-15-preview") 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 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - topicName - Name of the topic. // - topicUpdateParameters - Topic update information. @@ -581,7 +601,8 @@ 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[TopicsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[TopicsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -590,20 +611,22 @@ func (client *TopicsClient) BeginUpdate(ctx context.Context, resourceGroupName s // 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 2023-12-15-preview func (client *TopicsClient) update(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters TopicUpdateParameters, options *TopicsClientBeginUpdateOptions) (*http.Response, error) { + var err error 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 +649,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", "2023-12-15-preview") 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 deleted file mode 100644 index 60ab52999bdc..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/topics_client_example_test.go +++ /dev/null @@ -1,404 +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/Topics_Get.json -func ExampleTopicsClient_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.NewTopicsClient().Get(ctx, "examplerg", "exampletopic2", 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.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"), - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armeventgrid.TopicProperties{ - // Endpoint: to.Ptr("https://exampletopic2.westcentralus-1.eventgrid.azure.net/api/events"), - // ProvisioningState: to.Ptr(armeventgrid.TopicProvisioningStateSucceeded), - // }, - // } -} - -// 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() { - 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"), - }, - Properties: &armeventgrid.TopicProperties{ - InboundIPRules: []*armeventgrid.InboundIPRule{ - { - Action: to.Ptr(armeventgrid.IPActionTypeAllow), - IPMask: to.Ptr("12.18.30.15"), - }, - { - Action: to.Ptr(armeventgrid.IPActionTypeAllow), - IPMask: to.Ptr("12.18.176.1"), - }}, - PublicNetworkAccess: to.Ptr(armeventgrid.PublicNetworkAccessEnabled), - }, - }, 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_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 -func ExampleTopicsClient_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.NewTopicsClient().BeginDelete(ctx, "examplerg1", "exampletopic1", 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_Update.json -func ExampleTopicsClient_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.NewTopicsClient().BeginUpdate(ctx, "examplerg", "exampletopic1", armeventgrid.TopicUpdateParameters{ - Properties: &armeventgrid.TopicUpdateParameterProperties{ - InboundIPRules: []*armeventgrid.InboundIPRule{ - { - Action: to.Ptr(armeventgrid.IPActionTypeAllow), - IPMask: to.Ptr("12.18.30.15"), - }, - { - Action: to.Ptr(armeventgrid.IPActionTypeAllow), - IPMask: to.Ptr("12.18.176.1"), - }}, - PublicNetworkAccess: to.Ptr(armeventgrid.PublicNetworkAccessEnabled), - }, - 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) - } - _, 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_ListBySubscription.json -func ExampleTopicsClient_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.NewTopicsClient().NewListBySubscriptionPager(&armeventgrid.TopicsClientListBySubscriptionOptions{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.TopicsListResult = armeventgrid.TopicsListResult{ - // Value: []*armeventgrid.Topic{ - // { - // 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"), - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armeventgrid.TopicProperties{ - // Endpoint: to.Ptr("https://exampletopic1.westus2-1.eventgrid.azure.net/api/events"), - // ProvisioningState: to.Ptr(armeventgrid.TopicProvisioningStateSucceeded), - // }, - // }, - // { - // 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"), - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armeventgrid.TopicProperties{ - // Endpoint: to.Ptr("https://exampletopic2.westcentralus-1.eventgrid.azure.net/api/events"), - // ProvisioningState: to.Ptr(armeventgrid.TopicProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// 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 -func ExampleTopicsClient_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.NewTopicsClient().NewListByResourceGroupPager("examplerg", &armeventgrid.TopicsClientListByResourceGroupOptions{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.TopicsListResult = armeventgrid.TopicsListResult{ - // Value: []*armeventgrid.Topic{ - // { - // 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"), - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armeventgrid.TopicProperties{ - // Endpoint: to.Ptr("https://exampletopic1.westus2-1.eventgrid.azure.net/api/events"), - // ProvisioningState: to.Ptr(armeventgrid.TopicProvisioningStateSucceeded), - // }, - // }, - // { - // 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"), - // Location: to.Ptr("westcentralus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armeventgrid.TopicProperties{ - // Endpoint: to.Ptr("https://exampletopic2.westcentralus-1.eventgrid.azure.net/api/events"), - // ProvisioningState: to.Ptr(armeventgrid.TopicProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// 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 -func ExampleTopicsClient_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.NewTopicsClient().ListSharedAccessKeys(ctx, "examplerg", "exampletopic2", 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/Topics_RegenerateKey.json -func ExampleTopicsClient_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.NewTopicsClient().BeginRegenerateKey(ctx, "examplerg", "exampletopic2", 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"), - // } -} - -// 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 -func ExampleTopicsClient_NewListEventTypesPager() { - 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.NewTopicsClient().NewListEventTypesPager("examplerg", "Microsoft.Storage", "storageAccounts", "ExampleStorageAccount", 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.EventTypesListResult = armeventgrid.EventTypesListResult{ - // Value: []*armeventgrid.EventType{ - // { - // Name: to.Ptr("Microsoft.Storage.BlobCreated"), - // Type: to.Ptr("Microsoft.EventGrid/topicTypes/eventTypes"), - // ID: to.Ptr("providers/Microsoft.EventGrid/topicTypes/Microsoft.Storage.StorageAccounts/eventTypes/Microsoft.Storage.BlobCreated"), - // Properties: &armeventgrid.EventTypeProperties{ - // Description: to.Ptr("Raised when a blob is created."), - // DisplayName: to.Ptr("Blob Created"), - // SchemaURL: to.Ptr("tbd"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Storage.BlobDeleted"), - // Type: to.Ptr("Microsoft.EventGrid/topicTypes/eventTypes"), - // ID: to.Ptr("providers/Microsoft.EventGrid/topicTypes/Microsoft.Storage.StorageAccounts/eventTypes/Microsoft.Storage.BlobDeleted"), - // Properties: &armeventgrid.EventTypeProperties{ - // Description: to.Ptr("Raised when a blob is deleted."), - // DisplayName: to.Ptr("Blob Deleted"), - // SchemaURL: to.Ptr("tbd"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/topicspaces_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/topicspaces_client.go index 9d2ce58dfc85..743287e77b06 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/topicspaces_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/topicspaces_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 @@ -49,7 +48,7 @@ func NewTopicSpacesClient(subscriptionID string, credential azcore.TokenCredenti // 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 +// Generated from API version 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - namespaceName - Name of the namespace. // - topicSpaceName - The topic space name. @@ -62,9 +61,10 @@ func (client *TopicSpacesClient) BeginCreateOrUpdate(ctx context.Context, resour if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TopicSpacesClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TopicSpacesClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[TopicSpacesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -73,20 +73,22 @@ func (client *TopicSpacesClient) BeginCreateOrUpdate(ctx context.Context, resour // 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 +// Generated from API version 2023-12-15-preview func (client *TopicSpacesClient) createOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, topicSpaceName string, topicSpaceInfo TopicSpace, options *TopicSpacesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, namespaceName, topicSpaceName, topicSpaceInfo, 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. @@ -113,16 +115,19 @@ func (client *TopicSpacesClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, topicSpaceInfo) + if err := runtime.MarshalAsJSON(req, topicSpaceInfo); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete an existing topic space. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-preview // - resourceGroupName - The name of the resource group within the user's subscription. // - namespaceName - Name of the namespace. // - topicSpaceName - Name of the Topic space. @@ -133,9 +138,10 @@ func (client *TopicSpacesClient) BeginDelete(ctx context.Context, resourceGroupN if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TopicSpacesClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TopicSpacesClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[TopicSpacesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -144,20 +150,22 @@ func (client *TopicSpacesClient) BeginDelete(ctx context.Context, resourceGroupN // Delete - Delete an existing topic space. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-preview func (client *TopicSpacesClient) deleteOperation(ctx context.Context, resourceGroupName string, namespaceName string, topicSpaceName string, options *TopicSpacesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, namespaceName, topicSpaceName, 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. @@ -184,7 +192,7 @@ func (client *TopicSpacesClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -193,24 +201,27 @@ func (client *TopicSpacesClient) deleteCreateRequest(ctx context.Context, resour // 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 +// Generated from API version 2023-12-15-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) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, namespaceName, topicSpaceName, options) if err != nil { return TopicSpacesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TopicSpacesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TopicSpacesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TopicSpacesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -237,7 +248,7 @@ func (client *TopicSpacesClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -254,7 +265,7 @@ func (client *TopicSpacesClient) getHandleResponse(resp *http.Response) (TopicSp // NewListByNamespacePager - Get all the topic spaces under a namespace. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-12-15-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 @@ -307,7 +318,7 @@ func (client *TopicSpacesClient) listByNamespaceCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-12-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } 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..a835306c757e 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 @@ -44,22 +43,25 @@ 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 2023-12-15-preview // - 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 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 +76,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -91,7 +93,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 2023-12-15-preview // - 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]{ @@ -123,7 +125,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -140,7 +142,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 2023-12-15-preview // - topicTypeName - Name of the topic type. // - options - TopicTypesClientListEventTypesOptions contains the optional parameters for the TopicTypesClient.NewListEventTypesPager // method. @@ -178,7 +180,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", "2023-12-15-preview") 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 deleted file mode 100644 index a6063c860021..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/topictypes_client_example_test.go +++ /dev/null @@ -1,150 +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/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/TopicTypes_List.json -func ExampleTopicTypesClient_NewListPager() { - 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.NewTopicTypesClient().NewListPager(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.TopicTypesListResult = armeventgrid.TopicTypesListResult{ - // Value: []*armeventgrid.TopicTypeInfo{ - // { - // Name: to.Ptr("Microsoft.Eventhub.Namespaces"), - // Type: to.Ptr("Microsoft.EventGrid/topicTypes"), - // ID: to.Ptr("providers/Microsoft.EventGrid/topicTypes/Microsoft.Eventhub.Namespaces"), - // Properties: &armeventgrid.TopicTypeProperties{ - // Description: to.Ptr("Microsoft EventHubs service events."), - // DisplayName: to.Ptr("EventHubs Namespace"), - // Provider: to.Ptr("Microsoft.Eventhub"), - // ProvisioningState: to.Ptr(armeventgrid.TopicTypeProvisioningStateSucceeded), - // ResourceRegionType: to.Ptr(armeventgrid.ResourceRegionTypeRegionalResource), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Storage.StorageAccounts"), - // Type: to.Ptr("Microsoft.EventGrid/topicTypes"), - // ID: to.Ptr("providers/Microsoft.EventGrid/topicTypes/Microsoft.Storage.StorageAccounts"), - // Properties: &armeventgrid.TopicTypeProperties{ - // Description: to.Ptr("Microsoft Storage service events."), - // DisplayName: to.Ptr("Storage Accounts"), - // Provider: to.Ptr("Microsoft.Storage"), - // ProvisioningState: to.Ptr(armeventgrid.TopicTypeProvisioningStateSucceeded), - // ResourceRegionType: to.Ptr(armeventgrid.ResourceRegionTypeRegionalResource), - // }, - // }}, - // } - } -} - -// 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 -func ExampleTopicTypesClient_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.NewTopicTypesClient().Get(ctx, "Microsoft.Storage.StorageAccounts", 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.TopicTypeInfo = armeventgrid.TopicTypeInfo{ - // Name: to.Ptr("Microsoft.Storage.StorageAccounts"), - // Type: to.Ptr("Microsoft.EventGrid/topicTypes"), - // ID: to.Ptr("providers/Microsoft.EventGrid/topicTypes/Microsoft.Storage.StorageAccounts"), - // Properties: &armeventgrid.TopicTypeProperties{ - // Description: to.Ptr("Microsoft Storage service events."), - // DisplayName: to.Ptr("Storage Accounts"), - // Provider: to.Ptr("Microsoft.Storage"), - // ProvisioningState: to.Ptr(armeventgrid.TopicTypeProvisioningStateSucceeded), - // ResourceRegionType: to.Ptr(armeventgrid.ResourceRegionTypeRegionalResource), - // }, - // } -} - -// 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 -func ExampleTopicTypesClient_NewListEventTypesPager() { - 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.NewTopicTypesClient().NewListEventTypesPager("Microsoft.Storage.StorageAccounts", 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.EventTypesListResult = armeventgrid.EventTypesListResult{ - // Value: []*armeventgrid.EventType{ - // { - // Name: to.Ptr("Microsoft.Storage.BlobCreated"), - // Type: to.Ptr("Microsoft.EventGrid/topicTypes/eventTypes"), - // ID: to.Ptr("providers/Microsoft.EventGrid/topicTypes/Microsoft.Storage.StorageAccounts/eventTypes/Microsoft.Storage.BlobCreated"), - // Properties: &armeventgrid.EventTypeProperties{ - // Description: to.Ptr("Raised when a blob is created."), - // DisplayName: to.Ptr("Blob Created"), - // SchemaURL: to.Ptr("tbd"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Storage.BlobDeleted"), - // Type: to.Ptr("Microsoft.EventGrid/topicTypes/eventTypes"), - // ID: to.Ptr("providers/Microsoft.EventGrid/topicTypes/Microsoft.Storage.StorageAccounts/eventTypes/Microsoft.Storage.BlobDeleted"), - // Properties: &armeventgrid.EventTypeProperties{ - // Description: to.Ptr("Raised when a blob is deleted."), - // DisplayName: to.Ptr("Blob Deleted"), - // SchemaURL: to.Ptr("tbd"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/verifiedpartners_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/verifiedpartners_client.go index efbadc205c6a..39fc98f59e1c 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 @@ -45,22 +44,25 @@ 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 2023-12-15-preview // - 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 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 +77,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", "2023-12-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -92,7 +94,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 2023-12-15-preview // - options - VerifiedPartnersClientListOptions contains the optional parameters for the VerifiedPartnersClient.NewListPager // method. func (client *VerifiedPartnersClient) NewListPager(options *VerifiedPartnersClientListOptions) *runtime.Pager[VerifiedPartnersClientListResponse] { @@ -131,7 +133,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", "2023-12-15-preview") 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 deleted file mode 100644 index 0ee6ec4ddbb8..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/verifiedpartners_client_example_test.go +++ /dev/null @@ -1,108 +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/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/VerifiedPartners_Get.json -func ExampleVerifiedPartnersClient_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.NewVerifiedPartnersClient().Get(ctx, "Contoso.Finance", 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.VerifiedPartner = armeventgrid.VerifiedPartner{ - // Name: to.Ptr("Contoso.Finance"), - // Type: to.Ptr("Microsoft.EventGrid/verifiedPartners"), - // 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{ - // Description: to.Ptr("This is short description"), - // LongDescription: to.Ptr("This is really long long... long description"), - // SetupURI: to.Ptr("https://www.example.com/"), - // }, - // }, - // } -} - -// 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 -func ExampleVerifiedPartnersClient_NewListPager() { - 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.NewVerifiedPartnersClient().NewListPager(&armeventgrid.VerifiedPartnersClientListOptions{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.VerifiedPartnersListResult = armeventgrid.VerifiedPartnersListResult{ - // Value: []*armeventgrid.VerifiedPartner{ - // { - // Name: to.Ptr("Contoso.Finance"), - // Type: to.Ptr("Microsoft.EventGrid/verifiedPartners"), - // 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{ - // Description: to.Ptr("This is short description"), - // LongDescription: to.Ptr("This is really long long... long description"), - // SetupURI: to.Ptr("https://www.example.com/"), - // }, - // }, - // }}, - // } - } -}