diff --git a/sdk/resourcemanager/eventhub/armeventhub/CHANGELOG.md b/sdk/resourcemanager/eventhub/armeventhub/CHANGELOG.md index 10795a2cd9c7..3c3c9a331265 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/CHANGELOG.md +++ b/sdk/resourcemanager/eventhub/armeventhub/CHANGELOG.md @@ -1,5 +1,35 @@ # Release History +## 1.3.0-beta.2 (2024-04-11) +### Breaking Changes + +- `CleanupPolicyRetentionDescriptionCompaction` from enum `CleanupPolicyRetentionDescription` has been removed + +### Features Added + +- New value `CleanupPolicyRetentionDescriptionCompact`, `CleanupPolicyRetentionDescriptionDeleteCompact` added to enum type `CleanupPolicyRetentionDescription` +- New value `SchemaTypeJSON`, `SchemaTypeProtoBuf` added to enum type `SchemaType` +- New enum type `CaptureIdentityType` with values `CaptureIdentityTypeSystemAssigned`, `CaptureIdentityTypeUserAssigned` +- New enum type `GeoDRRoleType` with values `GeoDRRoleTypePrimary`, `GeoDRRoleTypeSecondary` +- New enum type `ProvisioningState` with values `ProvisioningStateActive`, `ProvisioningStateCanceled`, `ProvisioningStateCreating`, `ProvisioningStateDeleting`, `ProvisioningStateFailed`, `ProvisioningStateScaling`, `ProvisioningStateSucceeded`, `ProvisioningStateUnknown` +- New enum type `TimestampType` with values `TimestampTypeAppendTime`, `TimestampTypeCreateTime` +- New function `*NamespacesClient.BeginFailover(context.Context, string, string, FailOver, *NamespacesClientBeginFailoverOptions) (*runtime.Poller[NamespacesClientFailoverResponse], error)` +- New struct `CaptureIdentity` +- New struct `ErrorDetailAutoGenerated` +- New struct `ErrorResponseAutoGenerated` +- New struct `FailOver` +- New struct `FailOverProperties` +- New struct `GeoDataReplicationProperties` +- New struct `NamespaceReplicaLocation` +- New field `ProvisioningState` in struct `ClusterProperties` +- New field `Identity` in struct `Destination` +- New field `GeoDataReplication` in struct `EHNamespaceProperties` +- New field `Location` in struct `NetworkSecurityPerimeterConfiguration` +- New field `ApplicableFeatures`, `IsBackingResource`, `ParentAssociationName`, `SourceResourceID` in struct `NetworkSecurityPerimeterConfigurationProperties` +- New field `Identifier`, `MessageTimestampType`, `UserMetadata` in struct `Properties` +- New field `MinCompactionLagInMins` in struct `RetentionDescription` + + ## 1.3.0-beta.1 (2023-11-30) ### Features Added diff --git a/sdk/resourcemanager/eventhub/armeventhub/README.md b/sdk/resourcemanager/eventhub/armeventhub/README.md index 1ec4cf180095..19bdf772dd3e 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/README.md +++ b/sdk/resourcemanager/eventhub/armeventhub/README.md @@ -57,7 +57,7 @@ clientFactory, err := armeventhub.NewClientFactory(, cred, &opt A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. ```go -client := clientFactory.NewNamespacesClient() +client := clientFactory.NewApplicationGroupClient() ``` ## Fakes diff --git a/sdk/resourcemanager/eventhub/armeventhub/applicationgroup_client.go b/sdk/resourcemanager/eventhub/armeventhub/applicationgroup_client.go index d933cc72bf41..6cd6b4ed09a8 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/applicationgroup_client.go +++ b/sdk/resourcemanager/eventhub/armeventhub/applicationgroup_client.go @@ -47,7 +47,7 @@ func NewApplicationGroupClient(subscriptionID string, credential azcore.TokenCre // CreateOrUpdateApplicationGroup - Creates or updates an ApplicationGroup for a Namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - applicationGroupName - The Application Group name @@ -100,7 +100,7 @@ func (client *ApplicationGroupClient) createOrUpdateApplicationGroupCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -121,7 +121,7 @@ func (client *ApplicationGroupClient) createOrUpdateApplicationGroupHandleRespon // Delete - Deletes an ApplicationGroup for a Namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - applicationGroupName - The Application Group name @@ -171,7 +171,7 @@ func (client *ApplicationGroupClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -180,7 +180,7 @@ func (client *ApplicationGroupClient) deleteCreateRequest(ctx context.Context, r // Get - Gets an ApplicationGroup for a Namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - applicationGroupName - The Application Group name @@ -231,7 +231,7 @@ func (client *ApplicationGroupClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -248,7 +248,7 @@ func (client *ApplicationGroupClient) getHandleResponse(resp *http.Response) (Ap // NewListByNamespacePager - Gets a list of application groups for a Namespace. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - options - ApplicationGroupClientListByNamespaceOptions contains the optional parameters for the ApplicationGroupClient.NewListByNamespacePager @@ -296,7 +296,7 @@ func (client *ApplicationGroupClient) listByNamespaceCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/eventhub/armeventhub/applicationgroup_client_example_test.go b/sdk/resourcemanager/eventhub/armeventhub/applicationgroup_client_example_test.go deleted file mode 100644 index cf72844f3e0a..000000000000 --- a/sdk/resourcemanager/eventhub/armeventhub/applicationgroup_client_example_test.go +++ /dev/null @@ -1,244 +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 armeventhub_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/eventhub/armeventhub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/ApplicationGroup/ApplicationGroupListByNamespace.json -func ExampleApplicationGroupClient_NewListByNamespacePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewApplicationGroupClient().NewListByNamespacePager("contosotest", "contoso-ua-test-eh-system-1", 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.ApplicationGroupListResult = armeventhub.ApplicationGroupListResult{ - // Value: []*armeventhub.ApplicationGroup{ - // { - // Name: to.Ptr("appGroup1"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/ApplicationGroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosotest/providers/Microsoft.EventHub/namespaces/contoso-ua-test-eh-system-1/applicationgroups/appGroup1"), - // Location: to.Ptr("EAST US 2 EUAP"), - // Properties: &armeventhub.ApplicationGroupProperties{ - // ClientAppGroupIdentifier: to.Ptr("SASKeyName=KeyName"), - // IsEnabled: to.Ptr(true), - // Policies: []armeventhub.ApplicationGroupPolicyClassification{ - // &armeventhub.ThrottlingPolicy{ - // Name: to.Ptr("ThrottlingPolicy1"), - // Type: to.Ptr(armeventhub.ApplicationGroupPolicyTypeThrottlingPolicy), - // MetricID: to.Ptr(armeventhub.MetricIDIncomingMessages), - // RateLimitThreshold: to.Ptr[int64](7912), - // }, - // &armeventhub.ThrottlingPolicy{ - // Name: to.Ptr("ThrottlingPolicy2"), - // Type: to.Ptr(armeventhub.ApplicationGroupPolicyTypeThrottlingPolicy), - // MetricID: to.Ptr(armeventhub.MetricIDIncomingBytes), - // RateLimitThreshold: to.Ptr[int64](3951729), - // }, - // &armeventhub.ThrottlingPolicy{ - // Name: to.Ptr("ThrottlingPolicy3"), - // Type: to.Ptr(armeventhub.ApplicationGroupPolicyTypeThrottlingPolicy), - // MetricID: to.Ptr(armeventhub.MetricIDOutgoingBytes), - // RateLimitThreshold: to.Ptr[int64](245175), - // }}, - // }, - // }, - // { - // Name: to.Ptr("appGroup2"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/ApplicationGroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosotest/providers/Microsoft.EventHub/namespaces/contoso-ua-test-eh-system-1/applicationgroups/appGroup2"), - // Location: to.Ptr("EAST US 2 EUAP"), - // Properties: &armeventhub.ApplicationGroupProperties{ - // ClientAppGroupIdentifier: to.Ptr("AADAppID=Guid"), - // IsEnabled: to.Ptr(false), - // Policies: []armeventhub.ApplicationGroupPolicyClassification{ - // &armeventhub.ThrottlingPolicy{ - // Name: to.Ptr("ThrottlingPolicy1"), - // Type: to.Ptr(armeventhub.ApplicationGroupPolicyTypeThrottlingPolicy), - // MetricID: to.Ptr(armeventhub.MetricIDIncomingMessages), - // RateLimitThreshold: to.Ptr[int64](9984), - // }, - // &armeventhub.ThrottlingPolicy{ - // Name: to.Ptr("ThrottlingPolicy2"), - // Type: to.Ptr(armeventhub.ApplicationGroupPolicyTypeThrottlingPolicy), - // MetricID: to.Ptr(armeventhub.MetricIDIncomingBytes), - // RateLimitThreshold: to.Ptr[int64](7823412), - // }, - // &armeventhub.ThrottlingPolicy{ - // Name: to.Ptr("ThrottlingPolicy3"), - // Type: to.Ptr(armeventhub.ApplicationGroupPolicyTypeThrottlingPolicy), - // MetricID: to.Ptr(armeventhub.MetricIDOutgoingBytes), - // RateLimitThreshold: to.Ptr[int64](331665), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/ApplicationGroup/ApplicationGroupCreate.json -func ExampleApplicationGroupClient_CreateOrUpdateApplicationGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationGroupClient().CreateOrUpdateApplicationGroup(ctx, "contosotest", "contoso-ua-test-eh-system-1", "appGroup1", armeventhub.ApplicationGroup{ - Properties: &armeventhub.ApplicationGroupProperties{ - ClientAppGroupIdentifier: to.Ptr("SASKeyName=KeyName"), - IsEnabled: to.Ptr(true), - Policies: []armeventhub.ApplicationGroupPolicyClassification{ - &armeventhub.ThrottlingPolicy{ - Name: to.Ptr("ThrottlingPolicy1"), - Type: to.Ptr(armeventhub.ApplicationGroupPolicyTypeThrottlingPolicy), - MetricID: to.Ptr(armeventhub.MetricIDIncomingMessages), - RateLimitThreshold: to.Ptr[int64](7912), - }, - &armeventhub.ThrottlingPolicy{ - Name: to.Ptr("ThrottlingPolicy2"), - Type: to.Ptr(armeventhub.ApplicationGroupPolicyTypeThrottlingPolicy), - MetricID: to.Ptr(armeventhub.MetricIDIncomingBytes), - RateLimitThreshold: to.Ptr[int64](3951729), - }, - &armeventhub.ThrottlingPolicy{ - Name: to.Ptr("ThrottlingPolicy3"), - Type: to.Ptr(armeventhub.ApplicationGroupPolicyTypeThrottlingPolicy), - MetricID: to.Ptr(armeventhub.MetricIDOutgoingBytes), - RateLimitThreshold: to.Ptr[int64](245175), - }}, - }, - }, 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.ApplicationGroup = armeventhub.ApplicationGroup{ - // Name: to.Ptr("appGroup1"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/ApplicationGroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosotest/providers/Microsoft.EventHub/namespaces/contoso-ua-test-eh-system-1/applicationgroups/appGroup1"), - // Location: to.Ptr("EAST US 2 EUAP"), - // Properties: &armeventhub.ApplicationGroupProperties{ - // ClientAppGroupIdentifier: to.Ptr("SASKeyName=KeyName"), - // IsEnabled: to.Ptr(true), - // Policies: []armeventhub.ApplicationGroupPolicyClassification{ - // &armeventhub.ThrottlingPolicy{ - // Name: to.Ptr("ThrottlingPolicy1"), - // Type: to.Ptr(armeventhub.ApplicationGroupPolicyTypeThrottlingPolicy), - // MetricID: to.Ptr(armeventhub.MetricIDIncomingMessages), - // RateLimitThreshold: to.Ptr[int64](7912), - // }, - // &armeventhub.ThrottlingPolicy{ - // Name: to.Ptr("ThrottlingPolicy2"), - // Type: to.Ptr(armeventhub.ApplicationGroupPolicyTypeThrottlingPolicy), - // MetricID: to.Ptr(armeventhub.MetricIDIncomingBytes), - // RateLimitThreshold: to.Ptr[int64](3951729), - // }, - // &armeventhub.ThrottlingPolicy{ - // Name: to.Ptr("ThrottlingPolicy3"), - // Type: to.Ptr(armeventhub.ApplicationGroupPolicyTypeThrottlingPolicy), - // MetricID: to.Ptr(armeventhub.MetricIDOutgoingBytes), - // RateLimitThreshold: to.Ptr[int64](245175), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/ApplicationGroup/ApplicationGroupDelete.json -func ExampleApplicationGroupClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewApplicationGroupClient().Delete(ctx, "contosotest", "contoso-ua-test-eh-system-1", "appGroup1", 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/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/ApplicationGroup/ApplicationGroupGet.json -func ExampleApplicationGroupClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationGroupClient().Get(ctx, "contosotest", "contoso-ua-test-eh-system-1", "appGroup1", 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.ApplicationGroup = armeventhub.ApplicationGroup{ - // Name: to.Ptr("appGroup1"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/ApplicationGroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosotest/providers/Microsoft.EventHub/namespaces/contoso-ua-test-eh-system-1/applicationgroups/appGroup1"), - // Location: to.Ptr("EAST US 2 EUAP"), - // Properties: &armeventhub.ApplicationGroupProperties{ - // ClientAppGroupIdentifier: to.Ptr("SASKeyName=KeyName"), - // IsEnabled: to.Ptr(true), - // Policies: []armeventhub.ApplicationGroupPolicyClassification{ - // &armeventhub.ThrottlingPolicy{ - // Name: to.Ptr("ThrottlingPolicy1"), - // Type: to.Ptr(armeventhub.ApplicationGroupPolicyTypeThrottlingPolicy), - // MetricID: to.Ptr(armeventhub.MetricIDIncomingMessages), - // RateLimitThreshold: to.Ptr[int64](7912), - // }, - // &armeventhub.ThrottlingPolicy{ - // Name: to.Ptr("ThrottlingPolicy2"), - // Type: to.Ptr(armeventhub.ApplicationGroupPolicyTypeThrottlingPolicy), - // MetricID: to.Ptr(armeventhub.MetricIDIncomingBytes), - // RateLimitThreshold: to.Ptr[int64](3951729), - // }, - // &armeventhub.ThrottlingPolicy{ - // Name: to.Ptr("ThrottlingPolicy3"), - // Type: to.Ptr(armeventhub.ApplicationGroupPolicyTypeThrottlingPolicy), - // MetricID: to.Ptr(armeventhub.MetricIDOutgoingBytes), - // RateLimitThreshold: to.Ptr[int64](245175), - // }}, - // }, - // } -} diff --git a/sdk/resourcemanager/eventhub/armeventhub/autorest.md b/sdk/resourcemanager/eventhub/armeventhub/autorest.md index e1a113934487..422829e734df 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/autorest.md +++ b/sdk/resourcemanager/eventhub/armeventhub/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/eventhub/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/eventhub/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.3.0-beta.1 -tag: package-2022-10-preview +module-version: 1.3.0-beta.2 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/eventhub/armeventhub/client_factory.go b/sdk/resourcemanager/eventhub/armeventhub/client_factory.go index 92797cefadc6..c17000d2d2d4 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/client_factory.go +++ b/sdk/resourcemanager/eventhub/armeventhub/client_factory.go @@ -17,8 +17,7 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { subscriptionID string - credential azcore.TokenCredential - options *arm.ClientOptions + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. @@ -28,90 +27,115 @@ type ClientFactory struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - subscriptionID: subscriptionID, credential: credential, - options: options.Clone(), + subscriptionID: subscriptionID, + internal: internal, }, nil } // NewApplicationGroupClient creates a new instance of ApplicationGroupClient. func (c *ClientFactory) NewApplicationGroupClient() *ApplicationGroupClient { - subClient, _ := NewApplicationGroupClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ApplicationGroupClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewClustersClient creates a new instance of ClustersClient. func (c *ClientFactory) NewClustersClient() *ClustersClient { - subClient, _ := NewClustersClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ClustersClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewConfigurationClient creates a new instance of ConfigurationClient. func (c *ClientFactory) NewConfigurationClient() *ConfigurationClient { - subClient, _ := NewConfigurationClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ConfigurationClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewConsumerGroupsClient creates a new instance of ConsumerGroupsClient. func (c *ClientFactory) NewConsumerGroupsClient() *ConsumerGroupsClient { - subClient, _ := NewConsumerGroupsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ConsumerGroupsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewDisasterRecoveryConfigsClient creates a new instance of DisasterRecoveryConfigsClient. func (c *ClientFactory) NewDisasterRecoveryConfigsClient() *DisasterRecoveryConfigsClient { - subClient, _ := NewDisasterRecoveryConfigsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &DisasterRecoveryConfigsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewEventHubsClient creates a new instance of EventHubsClient. func (c *ClientFactory) NewEventHubsClient() *EventHubsClient { - subClient, _ := NewEventHubsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &EventHubsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewNamespacesClient creates a new instance of NamespacesClient. func (c *ClientFactory) NewNamespacesClient() *NamespacesClient { - subClient, _ := NewNamespacesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &NamespacesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewNetworkSecurityPerimeterConfigurationClient creates a new instance of NetworkSecurityPerimeterConfigurationClient. func (c *ClientFactory) NewNetworkSecurityPerimeterConfigurationClient() *NetworkSecurityPerimeterConfigurationClient { - subClient, _ := NewNetworkSecurityPerimeterConfigurationClient(c.subscriptionID, c.credential, c.options) - return subClient + return &NetworkSecurityPerimeterConfigurationClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewNetworkSecurityPerimeterConfigurationsClient creates a new instance of NetworkSecurityPerimeterConfigurationsClient. func (c *ClientFactory) NewNetworkSecurityPerimeterConfigurationsClient() *NetworkSecurityPerimeterConfigurationsClient { - subClient, _ := NewNetworkSecurityPerimeterConfigurationsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &NetworkSecurityPerimeterConfigurationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient + return &OperationsClient{ + internal: c.internal, + } } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient. func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { - subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateEndpointConnectionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient. func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { - subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateLinkResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewSchemaRegistryClient creates a new instance of SchemaRegistryClient. func (c *ClientFactory) NewSchemaRegistryClient() *SchemaRegistryClient { - subClient, _ := NewSchemaRegistryClient(c.subscriptionID, c.credential, c.options) - return subClient + return &SchemaRegistryClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } diff --git a/sdk/resourcemanager/eventhub/armeventhub/clusters_client.go b/sdk/resourcemanager/eventhub/armeventhub/clusters_client.go index 0f256e4ed6f3..fe1bb72caad1 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/clusters_client.go +++ b/sdk/resourcemanager/eventhub/armeventhub/clusters_client.go @@ -47,7 +47,7 @@ func NewClustersClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreateOrUpdate - Creates or updates an instance of an Event Hubs Cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - clusterName - The name of the Event Hubs Cluster. // - parameters - Parameters for creating a eventhub cluster resource. @@ -73,7 +73,7 @@ func (client *ClustersClient) BeginCreateOrUpdate(ctx context.Context, resourceG // CreateOrUpdate - Creates or updates an instance of an Event Hubs Cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview func (client *ClustersClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster, options *ClustersClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginCreateOrUpdate" @@ -115,7 +115,7 @@ func (client *ClustersClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -127,7 +127,7 @@ func (client *ClustersClient) createOrUpdateCreateRequest(ctx context.Context, r // BeginDelete - Deletes an existing Event Hubs Cluster. This operation is idempotent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - clusterName - The name of the Event Hubs Cluster. // - options - ClustersClientBeginDeleteOptions contains the optional parameters for the ClustersClient.BeginDelete method. @@ -151,7 +151,7 @@ func (client *ClustersClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes an existing Event Hubs Cluster. This operation is idempotent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview func (client *ClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginDelete" @@ -193,7 +193,7 @@ func (client *ClustersClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -202,7 +202,7 @@ func (client *ClustersClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Gets the resource description of the specified Event Hubs Cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - clusterName - The name of the Event Hubs Cluster. // - options - ClustersClientGetOptions contains the optional parameters for the ClustersClient.Get method. @@ -248,7 +248,7 @@ func (client *ClustersClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -266,7 +266,7 @@ func (client *ClustersClient) getHandleResponse(resp *http.Response) (ClustersCl // ListAvailableClusterRegion - List the quantity of available pre-provisioned Event Hubs Clusters, indexed by Azure region. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - options - ClustersClientListAvailableClusterRegionOptions contains the optional parameters for the ClustersClient.ListAvailableClusterRegion // method. func (client *ClustersClient) ListAvailableClusterRegion(ctx context.Context, options *ClustersClientListAvailableClusterRegionOptions) (ClustersClientListAvailableClusterRegionResponse, error) { @@ -303,7 +303,7 @@ func (client *ClustersClient) listAvailableClusterRegionCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -320,7 +320,7 @@ func (client *ClustersClient) listAvailableClusterRegionHandleResponse(resp *htt // NewListByResourceGroupPager - Lists the available Event Hubs Clusters within an ARM resource group // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - options - ClustersClientListByResourceGroupOptions contains the optional parameters for the ClustersClient.NewListByResourceGroupPager // method. @@ -363,7 +363,7 @@ func (client *ClustersClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -380,7 +380,7 @@ func (client *ClustersClient) listByResourceGroupHandleResponse(resp *http.Respo // NewListBySubscriptionPager - Lists the available Event Hubs Clusters within an ARM resource group // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - options - ClustersClientListBySubscriptionOptions contains the optional parameters for the ClustersClient.NewListBySubscriptionPager // method. func (client *ClustersClient) NewListBySubscriptionPager(options *ClustersClientListBySubscriptionOptions) *runtime.Pager[ClustersClientListBySubscriptionResponse] { @@ -418,7 +418,7 @@ func (client *ClustersClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -436,7 +436,7 @@ func (client *ClustersClient) listBySubscriptionHandleResponse(resp *http.Respon // ListNamespaces - List all Event Hubs Namespace IDs in an Event Hubs Dedicated Cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - clusterName - The name of the Event Hubs Cluster. // - options - ClustersClientListNamespacesOptions contains the optional parameters for the ClustersClient.ListNamespaces method. @@ -482,7 +482,7 @@ func (client *ClustersClient) listNamespacesCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -500,7 +500,7 @@ func (client *ClustersClient) listNamespacesHandleResponse(resp *http.Response) // BeginUpdate - Modifies mutable properties on the Event Hubs Cluster. This operation is idempotent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - clusterName - The name of the Event Hubs Cluster. // - parameters - The properties of the Event Hubs Cluster which should be updated. @@ -525,7 +525,7 @@ func (client *ClustersClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Modifies mutable properties on the Event Hubs Cluster. This operation is idempotent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview func (client *ClustersClient) update(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster, options *ClustersClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginUpdate" @@ -567,7 +567,7 @@ func (client *ClustersClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/eventhub/armeventhub/clusters_client_example_test.go b/sdk/resourcemanager/eventhub/armeventhub/clusters_client_example_test.go deleted file mode 100644 index c0cd62208a48..000000000000 --- a/sdk/resourcemanager/eventhub/armeventhub/clusters_client_example_test.go +++ /dev/null @@ -1,332 +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 armeventhub_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/eventhub/armeventhub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/Clusters/ListAvailableClustersGet.json -func ExampleClustersClient_ListAvailableClusterRegion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClustersClient().ListAvailableClusterRegion(ctx, 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.AvailableClustersList = armeventhub.AvailableClustersList{ - // Value: []*armeventhub.AvailableCluster{ - // { - // Location: to.Ptr("westus"), - // }, - // { - // Location: to.Ptr("eastus"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/Clusters/ClustersListBySubscription.json -func ExampleClustersClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClustersClient().NewListBySubscriptionPager(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.ClusterListResult = armeventhub.ClusterListResult{ - // Value: []*armeventhub.Cluster{ - // { - // Name: to.Ptr("testCluster"), - // Type: to.Ptr("Microsoft.EventHub/Clusters"), - // ID: to.Ptr("/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/Default-EventHub-SouthCentralUS/providers/Microsoft.EventHub/clusters/testCluster"), - // Location: to.Ptr("South Central US"), - // Tags: map[string]*string{ - // }, - // Properties: &armeventhub.ClusterProperties{ - // CreatedAt: to.Ptr("2016-09-13T23:17:25.24Z"), - // MetricID: to.Ptr("SN6-008"), - // UpdatedAt: to.Ptr("2016-09-13T23:17:28.223Z"), - // }, - // SKU: &armeventhub.ClusterSKU{ - // Name: to.Ptr(armeventhub.ClusterSKUNameDedicated), - // Capacity: to.Ptr[int32](4), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/Clusters/ClustersListByResourceGroup.json -func ExampleClustersClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClustersClient().NewListByResourceGroupPager("myResourceGroup", 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.ClusterListResult = armeventhub.ClusterListResult{ - // Value: []*armeventhub.Cluster{ - // { - // Name: to.Ptr("testCluster"), - // Type: to.Ptr("Microsoft.EventHub/Clusters"), - // ID: to.Ptr("/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/Default-EventHub-SouthCentralUS/providers/Microsoft.EventHub/clusters/testCluster"), - // Location: to.Ptr("South Central US"), - // Tags: map[string]*string{ - // }, - // Properties: &armeventhub.ClusterProperties{ - // CreatedAt: to.Ptr("2016-09-13T23:17:25.24Z"), - // MetricID: to.Ptr("SN6-008"), - // UpdatedAt: to.Ptr("2016-09-13T23:17:28.223Z"), - // }, - // SKU: &armeventhub.ClusterSKU{ - // Name: to.Ptr(armeventhub.ClusterSKUNameDedicated), - // Capacity: to.Ptr[int32](4), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/Clusters/ClusterGet.json -func ExampleClustersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClustersClient().Get(ctx, "myResourceGroup", "testCluster", 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.Cluster = armeventhub.Cluster{ - // Name: to.Ptr("testCluster"), - // Type: to.Ptr("Microsoft.EventHub/Clusters"), - // ID: to.Ptr("/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/myResourceGroup/providers/Microsoft.EventHub/clusters/testCluster"), - // Location: to.Ptr("South Central US"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armeventhub.ClusterProperties{ - // CreatedAt: to.Ptr("2017-05-24T23:23:27.877Z"), - // MetricID: to.Ptr("SN6-008"), - // UpdatedAt: to.Ptr("2017-05-24T23:23:27.877Z"), - // }, - // SKU: &armeventhub.ClusterSKU{ - // Name: to.Ptr(armeventhub.ClusterSKUNameDedicated), - // Capacity: to.Ptr[int32](4), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/Clusters/ClusterPut.json -func ExampleClustersClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "testCluster", armeventhub.Cluster{ - Location: to.Ptr("South Central US"), - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - SKU: &armeventhub.ClusterSKU{ - Name: to.Ptr(armeventhub.ClusterSKUNameDedicated), - Capacity: 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.Cluster = armeventhub.Cluster{ - // Name: to.Ptr("testCluster"), - // Type: to.Ptr("Microsoft.EventHub/Clusters"), - // ID: to.Ptr("/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/myResourceGroup/providers/Microsoft.EventHub/clusters/testCluster"), - // Location: to.Ptr("South Central US"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // "tag2": to.Ptr("value2"), - // }, - // Properties: &armeventhub.ClusterProperties{ - // CreatedAt: to.Ptr("2017-05-24T23:23:27.877Z"), - // MetricID: to.Ptr("SN6-008"), - // UpdatedAt: to.Ptr("2017-05-24T23:23:27.877Z"), - // }, - // SKU: &armeventhub.ClusterSKU{ - // Name: to.Ptr(armeventhub.ClusterSKUNameDedicated), - // Capacity: to.Ptr[int32](1), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/Clusters/ClusterPatch.json -func ExampleClustersClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginUpdate(ctx, "myResourceGroup", "testCluster", armeventhub.Cluster{ - Location: to.Ptr("South Central US"), - Tags: map[string]*string{ - "tag3": to.Ptr("value3"), - "tag4": to.Ptr("value4"), - }, - }, 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.Cluster = armeventhub.Cluster{ - // Name: to.Ptr("testCluster"), - // Type: to.Ptr("Microsoft.EventHub/Clusters"), - // ID: to.Ptr("/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/myResourceGroup/providers/Microsoft.EventHub/clusters/testCluster"), - // Location: to.Ptr("South Central US"), - // Tags: map[string]*string{ - // "tag3": to.Ptr("value3"), - // "tag4": to.Ptr("value4"), - // }, - // Properties: &armeventhub.ClusterProperties{ - // CreatedAt: to.Ptr("2017-06-01T21:37:04.46Z"), - // MetricID: to.Ptr("SN6-008"), - // UpdatedAt: to.Ptr("2017-06-01T21:37:53.413Z"), - // }, - // SKU: &armeventhub.ClusterSKU{ - // Name: to.Ptr(armeventhub.ClusterSKUNameDedicated), - // Capacity: to.Ptr[int32](4), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/Clusters/ClusterDelete.json -func ExampleClustersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginDelete(ctx, "myResourceGroup", "testCluster", 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/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/Clusters/ListNamespacesInClusterGet.json -func ExampleClustersClient_ListNamespaces() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClustersClient().ListNamespaces(ctx, "myResourceGroup", "testCluster", 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.EHNamespaceIDListResult = armeventhub.EHNamespaceIDListResult{ - // Value: []*armeventhub.EHNamespaceIDContainer{ - // { - // ID: to.Ptr("/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/Default-EventHub-SouthCentralUS/providers/Microsoft.EventHub/namespaces/rrama-int7-ns1"), - // }, - // { - // ID: to.Ptr("/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/Default-EventHub-SouthCentralUS/providers/Microsoft.EventHub/namespaces/rrama-ehns2-int7"), - // }, - // { - // ID: to.Ptr("/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/Default-ServiceBus-SouthCentralUS/providers/Microsoft.EventHub/namespaces/db3-rrama-foo1"), - // }}, - // } -} diff --git a/sdk/resourcemanager/eventhub/armeventhub/configuration_client.go b/sdk/resourcemanager/eventhub/armeventhub/configuration_client.go index 7cd8c566621d..ef8782cc7c8d 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/configuration_client.go +++ b/sdk/resourcemanager/eventhub/armeventhub/configuration_client.go @@ -48,7 +48,7 @@ func NewConfigurationClient(subscriptionID string, credential azcore.TokenCreden // on the cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - clusterName - The name of the Event Hubs Cluster. // - options - ConfigurationClientGetOptions contains the optional parameters for the ConfigurationClient.Get method. @@ -94,7 +94,7 @@ func (client *ConfigurationClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -113,7 +113,7 @@ func (client *ConfigurationClient) getHandleResponse(resp *http.Response) (Confi // not specified in the request body unmodified. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - clusterName - The name of the Event Hubs Cluster. // - parameters - Parameters for creating an Event Hubs Cluster resource. @@ -160,7 +160,7 @@ func (client *ConfigurationClient) patchCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/eventhub/armeventhub/configuration_client_example_test.go b/sdk/resourcemanager/eventhub/armeventhub/configuration_client_example_test.go deleted file mode 100644 index f4943532104d..000000000000 --- a/sdk/resourcemanager/eventhub/armeventhub/configuration_client_example_test.go +++ /dev/null @@ -1,76 +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 armeventhub_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/eventhub/armeventhub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/Clusters/ClusterQuotaConfigurationPatch.json -func ExampleConfigurationClient_Patch() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewConfigurationClient().Patch(ctx, "ArunMonocle", "testCluster", armeventhub.ClusterQuotaConfigurationProperties{ - Settings: map[string]*string{ - "eventhub-per-namespace-quota": to.Ptr("20"), - "namespaces-per-cluster-quota": to.Ptr("200"), - }, - }, 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.ClusterQuotaConfigurationProperties = armeventhub.ClusterQuotaConfigurationProperties{ - // Settings: map[string]*string{ - // "eventhub-per-namespace-quota": to.Ptr("20"), - // "namespaces-per-cluster-quota": to.Ptr("200"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/Clusters/ClusterQuotaConfigurationGet.json -func ExampleConfigurationClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewConfigurationClient().Get(ctx, "myResourceGroup", "testCluster", 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.ClusterQuotaConfigurationProperties = armeventhub.ClusterQuotaConfigurationProperties{ - // Settings: map[string]*string{ - // "eventhub-per-namespace-quota": to.Ptr("20"), - // "namespaces-per-cluster-quota": to.Ptr("200"), - // }, - // } -} diff --git a/sdk/resourcemanager/eventhub/armeventhub/constants.go b/sdk/resourcemanager/eventhub/armeventhub/constants.go index e5ae576046fc..ec29e8c1128b 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/constants.go +++ b/sdk/resourcemanager/eventhub/armeventhub/constants.go @@ -10,7 +10,7 @@ package armeventhub const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventhub/armeventhub" - moduleVersion = "v1.3.0-beta.1" + moduleVersion = "v1.3.0-beta.2" ) type AccessRights string @@ -44,19 +44,37 @@ func PossibleApplicationGroupPolicyTypeValues() []ApplicationGroupPolicyType { } } +// CaptureIdentityType - Type of Azure Active Directory Managed Identity. +type CaptureIdentityType string + +const ( + CaptureIdentityTypeSystemAssigned CaptureIdentityType = "SystemAssigned" + CaptureIdentityTypeUserAssigned CaptureIdentityType = "UserAssigned" +) + +// PossibleCaptureIdentityTypeValues returns the possible values for the CaptureIdentityType const type. +func PossibleCaptureIdentityTypeValues() []CaptureIdentityType { + return []CaptureIdentityType{ + CaptureIdentityTypeSystemAssigned, + CaptureIdentityTypeUserAssigned, + } +} + // CleanupPolicyRetentionDescription - Enumerates the possible values for cleanup policy type CleanupPolicyRetentionDescription string const ( - CleanupPolicyRetentionDescriptionCompaction CleanupPolicyRetentionDescription = "Compaction" - CleanupPolicyRetentionDescriptionDelete CleanupPolicyRetentionDescription = "Delete" + CleanupPolicyRetentionDescriptionCompact CleanupPolicyRetentionDescription = "Compact" + CleanupPolicyRetentionDescriptionDelete CleanupPolicyRetentionDescription = "Delete" + CleanupPolicyRetentionDescriptionDeleteCompact CleanupPolicyRetentionDescription = "Delete,Compact" ) // PossibleCleanupPolicyRetentionDescriptionValues returns the possible values for the CleanupPolicyRetentionDescription const type. func PossibleCleanupPolicyRetentionDescriptionValues() []CleanupPolicyRetentionDescription { return []CleanupPolicyRetentionDescription{ - CleanupPolicyRetentionDescriptionCompaction, + CleanupPolicyRetentionDescriptionCompact, CleanupPolicyRetentionDescriptionDelete, + CleanupPolicyRetentionDescriptionDeleteCompact, } } @@ -181,6 +199,22 @@ func PossibleEntityStatusValues() []EntityStatus { } } +// GeoDRRoleType - GeoDR Role Types +type GeoDRRoleType string + +const ( + GeoDRRoleTypePrimary GeoDRRoleType = "Primary" + GeoDRRoleTypeSecondary GeoDRRoleType = "Secondary" +) + +// PossibleGeoDRRoleTypeValues returns the possible values for the GeoDRRoleType const type. +func PossibleGeoDRRoleTypeValues() []GeoDRRoleType { + return []GeoDRRoleType{ + GeoDRRoleTypePrimary, + GeoDRRoleTypeSecondary, + } +} + // KeyType - The access key to regenerate. type KeyType string @@ -322,6 +356,34 @@ func PossiblePrivateLinkConnectionStatusValues() []PrivateLinkConnectionStatus { } } +// ProvisioningState - Provisioning state of the Cluster. +type ProvisioningState string + +const ( + ProvisioningStateActive ProvisioningState = "Active" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateScaling ProvisioningState = "Scaling" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUnknown ProvisioningState = "Unknown" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateActive, + ProvisioningStateCanceled, + ProvisioningStateCreating, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateScaling, + ProvisioningStateSucceeded, + ProvisioningStateUnknown, + } +} + // ProvisioningStateDR - Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' or // 'Succeeded' or 'Failed' type ProvisioningStateDR string @@ -475,14 +537,18 @@ func PossibleSchemaCompatibilityValues() []SchemaCompatibility { type SchemaType string const ( - SchemaTypeAvro SchemaType = "Avro" - SchemaTypeUnknown SchemaType = "Unknown" + SchemaTypeAvro SchemaType = "Avro" + SchemaTypeJSON SchemaType = "Json" + SchemaTypeProtoBuf SchemaType = "ProtoBuf" + SchemaTypeUnknown SchemaType = "Unknown" ) // PossibleSchemaTypeValues returns the possible values for the SchemaType const type. func PossibleSchemaTypeValues() []SchemaType { return []SchemaType{ SchemaTypeAvro, + SchemaTypeJSON, + SchemaTypeProtoBuf, SchemaTypeUnknown, } } @@ -505,6 +571,26 @@ func PossibleTLSVersionValues() []TLSVersion { } } +// TimestampType - Denotes the type of timestamp the message will hold. Two types of timestamp types AppendTime, CreateTime. +// AppendTime refers the time in which message got appended inside broker log. CreateTime refers +// to the time in which the message was generated on source side and producers can set this timestamp while sending the message. +// Default value is AppendTime. If you are using AMQP protocol, CreateTime +// equals AppendTime for now and will full have runtime support later. +type TimestampType string + +const ( + TimestampTypeAppendTime TimestampType = "AppendTime" + TimestampTypeCreateTime TimestampType = "CreateTime" +) + +// PossibleTimestampTypeValues returns the possible values for the TimestampType const type. +func PossibleTimestampTypeValues() []TimestampType { + return []TimestampType{ + TimestampTypeAppendTime, + TimestampTypeCreateTime, + } +} + // UnavailableReason - Specifies the reason for the unavailability of the service. type UnavailableReason string diff --git a/sdk/resourcemanager/eventhub/armeventhub/consumergroups_client.go b/sdk/resourcemanager/eventhub/armeventhub/consumergroups_client.go index f9d47e9997f5..1a05a6a98567 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/consumergroups_client.go +++ b/sdk/resourcemanager/eventhub/armeventhub/consumergroups_client.go @@ -48,7 +48,7 @@ func NewConsumerGroupsClient(subscriptionID string, credential azcore.TokenCrede // CreateOrUpdate - Creates or updates an Event Hubs consumer group as a nested resource within a Namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - eventHubName - The Event Hub name @@ -106,7 +106,7 @@ func (client *ConsumerGroupsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -127,7 +127,7 @@ func (client *ConsumerGroupsClient) createOrUpdateHandleResponse(resp *http.Resp // Delete - Deletes a consumer group from the specified Event Hub and resource group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - eventHubName - The Event Hub name @@ -182,7 +182,7 @@ func (client *ConsumerGroupsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -191,7 +191,7 @@ func (client *ConsumerGroupsClient) deleteCreateRequest(ctx context.Context, res // Get - Gets a description for the specified consumer group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - eventHubName - The Event Hub name @@ -247,7 +247,7 @@ func (client *ConsumerGroupsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -265,7 +265,7 @@ func (client *ConsumerGroupsClient) getHandleResponse(resp *http.Response) (Cons // NewListByEventHubPager - Gets all the consumer groups in a Namespace. An empty feed is returned if no consumer group exists // in the Namespace. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - eventHubName - The Event Hub name @@ -318,13 +318,13 @@ func (client *ConsumerGroupsClient) listByEventHubCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/eventhub/armeventhub/consumergroups_client_example_test.go b/sdk/resourcemanager/eventhub/armeventhub/consumergroups_client_example_test.go deleted file mode 100644 index 4edf48d4f4c8..000000000000 --- a/sdk/resourcemanager/eventhub/armeventhub/consumergroups_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 armeventhub_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/eventhub/armeventhub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/ConsumerGroup/EHConsumerGroupCreate.json -func ExampleConsumerGroupsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewConsumerGroupsClient().CreateOrUpdate(ctx, "ArunMonocle", "sdk-Namespace-2661", "sdk-EventHub-6681", "sdk-ConsumerGroup-5563", armeventhub.ConsumerGroup{ - Properties: &armeventhub.ConsumerGroupProperties{ - UserMetadata: to.Ptr("New consumergroup"), - }, - }, 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.ConsumerGroup = armeventhub.ConsumerGroup{ - // Name: to.Ptr("sdk-ConsumerGroup-5563"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/EventHubs/ConsumerGroups"), - // ID: to.Ptr("/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.EventHub/namespaces/sdk-Namespace-2661/eventhubs/sdk-EventHub-6681/consumergroups/sdk-ConsumerGroup-5563"), - // Properties: &armeventhub.ConsumerGroupProperties{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-25T03:43:09.453Z"); return t}()), - // UpdatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-25T03:43:09.453Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/ConsumerGroup/EHConsumerGroupDelete.json -func ExampleConsumerGroupsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewConsumerGroupsClient().Delete(ctx, "ArunMonocle", "sdk-Namespace-2661", "sdk-EventHub-6681", "sdk-ConsumerGroup-5563", 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/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/ConsumerGroup/EHConsumerGroupGet.json -func ExampleConsumerGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewConsumerGroupsClient().Get(ctx, "ArunMonocle", "sdk-Namespace-2661", "sdk-EventHub-6681", "sdk-ConsumerGroup-5563", 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.ConsumerGroup = armeventhub.ConsumerGroup{ - // Name: to.Ptr("sdk-ConsumerGroup-5563"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/EventHubs/ConsumerGroups"), - // ID: to.Ptr("/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.EventHub/namespaces/sdk-Namespace-2661/eventhubs/sdk-EventHub-6681/consumergroups/sdk-ConsumerGroup-5563"), - // Properties: &armeventhub.ConsumerGroupProperties{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-25T03:43:08.715Z"); return t}()), - // UpdatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-25T03:43:08.715Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/ConsumerGroup/EHConsumerGroupListByEventHub.json -func ExampleConsumerGroupsClient_NewListByEventHubPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewConsumerGroupsClient().NewListByEventHubPager("ArunMonocle", "sdk-Namespace-2661", "sdk-EventHub-6681", &armeventhub.ConsumerGroupsClientListByEventHubOptions{Skip: 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.ConsumerGroupListResult = armeventhub.ConsumerGroupListResult{ - // Value: []*armeventhub.ConsumerGroup{ - // { - // Name: to.Ptr("$Default"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/EventHubs/ConsumerGroups"), - // ID: to.Ptr("/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.EventHub/namespaces/sdk-Namespace-2661/eventhubs/sdk-EventHub-6681/consumergroups/$Default"), - // Properties: &armeventhub.ConsumerGroupProperties{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-25T03:42:52.287Z"); return t}()), - // UpdatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-25T03:42:52.287Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("sdk-consumergroup-5563"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/EventHubs/ConsumerGroups"), - // ID: to.Ptr("/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.EventHub/namespaces/sdk-Namespace-2661/eventhubs/sdk-EventHub-6681/consumergroups/sdk-consumergroup-5563"), - // Properties: &armeventhub.ConsumerGroupProperties{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-25T03:43:09.314Z"); return t}()), - // UpdatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-25T03:43:09.314Z"); return t}()), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/eventhub/armeventhub/disasterrecoveryconfigs_client.go b/sdk/resourcemanager/eventhub/armeventhub/disasterrecoveryconfigs_client.go index 4c4a63bd5c8d..bda9e6c3ecc8 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/disasterrecoveryconfigs_client.go +++ b/sdk/resourcemanager/eventhub/armeventhub/disasterrecoveryconfigs_client.go @@ -47,7 +47,7 @@ func NewDisasterRecoveryConfigsClient(subscriptionID string, credential azcore.T // BreakPairing - This operation disables the Disaster Recovery and stops replicating changes from primary to secondary namespaces // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - alias - The Disaster Recovery configuration name @@ -98,7 +98,7 @@ func (client *DisasterRecoveryConfigsClient) breakPairingCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -107,7 +107,7 @@ func (client *DisasterRecoveryConfigsClient) breakPairingCreateRequest(ctx conte // CheckNameAvailability - Check the give Namespace name availability. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - parameters - Parameters to check availability of the given Alias name @@ -155,7 +155,7 @@ func (client *DisasterRecoveryConfigsClient) checkNameAvailabilityCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -176,7 +176,7 @@ func (client *DisasterRecoveryConfigsClient) checkNameAvailabilityHandleResponse // CreateOrUpdate - Creates or updates a new Alias(Disaster Recovery configuration) // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - alias - The Disaster Recovery configuration name @@ -229,7 +229,7 @@ func (client *DisasterRecoveryConfigsClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -250,7 +250,7 @@ func (client *DisasterRecoveryConfigsClient) createOrUpdateHandleResponse(resp * // Delete - Deletes an Alias(Disaster Recovery configuration) // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - alias - The Disaster Recovery configuration name @@ -301,7 +301,7 @@ func (client *DisasterRecoveryConfigsClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -310,7 +310,7 @@ func (client *DisasterRecoveryConfigsClient) deleteCreateRequest(ctx context.Con // FailOver - Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - alias - The Disaster Recovery configuration name @@ -361,7 +361,7 @@ func (client *DisasterRecoveryConfigsClient) failOverCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -370,7 +370,7 @@ func (client *DisasterRecoveryConfigsClient) failOverCreateRequest(ctx context.C // Get - Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - alias - The Disaster Recovery configuration name @@ -422,7 +422,7 @@ func (client *DisasterRecoveryConfigsClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -440,7 +440,7 @@ func (client *DisasterRecoveryConfigsClient) getHandleResponse(resp *http.Respon // GetAuthorizationRule - Gets an AuthorizationRule for a Namespace by rule name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - alias - The Disaster Recovery configuration name @@ -497,7 +497,7 @@ func (client *DisasterRecoveryConfigsClient) getAuthorizationRuleCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -514,7 +514,7 @@ func (client *DisasterRecoveryConfigsClient) getAuthorizationRuleHandleResponse( // NewListPager - Gets all Alias(Disaster Recovery configurations) // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - options - DisasterRecoveryConfigsClientListOptions contains the optional parameters for the DisasterRecoveryConfigsClient.NewListPager @@ -562,7 +562,7 @@ func (client *DisasterRecoveryConfigsClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -579,7 +579,7 @@ func (client *DisasterRecoveryConfigsClient) listHandleResponse(resp *http.Respo // NewListAuthorizationRulesPager - Gets a list of authorization rules for a Namespace. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - alias - The Disaster Recovery configuration name @@ -632,7 +632,7 @@ func (client *DisasterRecoveryConfigsClient) listAuthorizationRulesCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -650,7 +650,7 @@ func (client *DisasterRecoveryConfigsClient) listAuthorizationRulesHandleRespons // ListKeys - Gets the primary and secondary connection strings for the Namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - alias - The Disaster Recovery configuration name @@ -707,7 +707,7 @@ func (client *DisasterRecoveryConfigsClient) listKeysCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/eventhub/armeventhub/disasterrecoveryconfigs_client_example_test.go b/sdk/resourcemanager/eventhub/armeventhub/disasterrecoveryconfigs_client_example_test.go deleted file mode 100644 index 6b9971222d1d..000000000000 --- a/sdk/resourcemanager/eventhub/armeventhub/disasterrecoveryconfigs_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 armeventhub_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/eventhub/armeventhub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/disasterRecoveryConfigs/EHAliasAuthorizationRuleListAll.json -func ExampleDisasterRecoveryConfigsClient_NewListAuthorizationRulesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDisasterRecoveryConfigsClient().NewListAuthorizationRulesPager("exampleResourceGroup", "sdk-Namespace-9080", "sdk-DisasterRecovery-4047", 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.AuthorizationRuleListResult = armeventhub.AuthorizationRuleListResult{ - // Value: []*armeventhub.AuthorizationRule{ - // { - // Name: to.Ptr("RootManageSharedAccessKey"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/AuthorizationRules"), - // ID: to.Ptr("/subscriptions/exampleSubscriptionId/resourceGroups/exampleResourceGroup/providers/Microsoft.EventHub/namespaces/sdk-Namespace-9080/disasterRecoveryConfigs/sdk-DisasterRecovery-4047/AuthorizationRules/RootManageSharedAccessKey"), - // Properties: &armeventhub.AuthorizationRuleProperties{ - // Rights: []*armeventhub.AccessRights{ - // to.Ptr(armeventhub.AccessRightsListen), - // to.Ptr(armeventhub.AccessRightsManage), - // to.Ptr(armeventhub.AccessRightsSend)}, - // }, - // }, - // { - // Name: to.Ptr("sdk-Authrules-1067"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/AuthorizationRules"), - // ID: to.Ptr("/subscriptions/exampleSubscriptionId/resourceGroups/exampleResourceGroup/providers/Microsoft.EventHub/namespaces/sdk-Namespace-9080/disasterRecoveryConfigs/sdk-DisasterRecovery-4047/AuthorizationRules/sdk-Authrules-1067"), - // Properties: &armeventhub.AuthorizationRuleProperties{ - // Rights: []*armeventhub.AccessRights{ - // to.Ptr(armeventhub.AccessRightsListen), - // to.Ptr(armeventhub.AccessRightsSend)}, - // }, - // }, - // { - // Name: to.Ptr("sdk-Authrules-1684"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/AuthorizationRules"), - // ID: to.Ptr("/subscriptions/exampleSubscriptionId/resourceGroups/exampleResourceGroup/providers/Microsoft.EventHub/namespaces/sdk-Namespace-9080/disasterRecoveryConfigs/sdk-DisasterRecovery-4047/AuthorizationRules/sdk-Authrules-1684"), - // Properties: &armeventhub.AuthorizationRuleProperties{ - // Rights: []*armeventhub.AccessRights{ - // to.Ptr(armeventhub.AccessRightsListen), - // to.Ptr(armeventhub.AccessRightsSend)}, - // }, - // }, - // { - // Name: to.Ptr("sdk-Authrules-4879"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/AuthorizationRules"), - // ID: to.Ptr("/subscriptions/exampleSubscriptionId/resourceGroups/exampleResourceGroup/providers/Microsoft.EventHub/namespaces/sdk-Namespace-9080/disasterRecoveryConfigs/sdk-DisasterRecovery-4047/AuthorizationRules/sdk-Authrules-4879"), - // Properties: &armeventhub.AuthorizationRuleProperties{ - // Rights: []*armeventhub.AccessRights{ - // to.Ptr(armeventhub.AccessRightsListen), - // to.Ptr(armeventhub.AccessRightsSend)}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/disasterRecoveryConfigs/EHAliasAuthorizationRuleGet.json -func ExampleDisasterRecoveryConfigsClient_GetAuthorizationRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDisasterRecoveryConfigsClient().GetAuthorizationRule(ctx, "exampleResourceGroup", "sdk-Namespace-9080", "sdk-DisasterRecovery-4879", "sdk-Authrules-4879", 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.AuthorizationRule = armeventhub.AuthorizationRule{ - // Name: to.Ptr("sdk-Authrules-4879"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/AuthorizationRules"), - // ID: to.Ptr("/subscriptions/exampleSubscriptionId/resourceGroups/exampleResourceGroup/providers/Microsoft.EventHub/namespaces/sdk-Namespace-9080/disasterRecoveryConfigs/sdk-DisasterRecovery-4047/AuthorizationRules/sdk-Authrules-4879"), - // Properties: &armeventhub.AuthorizationRuleProperties{ - // Rights: []*armeventhub.AccessRights{ - // to.Ptr(armeventhub.AccessRightsListen), - // to.Ptr(armeventhub.AccessRightsSend)}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/disasterRecoveryConfigs/EHAliasAuthorizationRuleListKey.json -func ExampleDisasterRecoveryConfigsClient_ListKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDisasterRecoveryConfigsClient().ListKeys(ctx, "exampleResourceGroup", "sdk-Namespace-2702", "sdk-DisasterRecovery-4047", "sdk-Authrules-1746", 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.AccessKeys = armeventhub.AccessKeys{ - // AliasPrimaryConnectionString: to.Ptr("Endpoint=sb://sdk-disasterrecovery-4047.servicebus.windows-int.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=############################################"), - // AliasSecondaryConnectionString: to.Ptr("Endpoint=sb://sdk-disasterrecovery-4047.servicebus.windows-int.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=############################################"), - // KeyName: to.Ptr("sdk-Authrules-1746"), - // PrimaryKey: to.Ptr("############################################"), - // SecondaryKey: to.Ptr("############################################"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/disasterRecoveryConfigs/EHAliasCheckNameAvailability.json -func ExampleDisasterRecoveryConfigsClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDisasterRecoveryConfigsClient().CheckNameAvailability(ctx, "exampleResourceGroup", "sdk-Namespace-9080", armeventhub.CheckNameAvailabilityParameter{ - Name: to.Ptr("sdk-DisasterRecovery-9474"), - }, 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.CheckNameAvailabilityResult = armeventhub.CheckNameAvailabilityResult{ - // Message: to.Ptr(""), - // NameAvailable: to.Ptr(true), - // Reason: to.Ptr(armeventhub.UnavailableReasonNone), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/disasterRecoveryConfigs/EHAliasList.json -func ExampleDisasterRecoveryConfigsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDisasterRecoveryConfigsClient().NewListPager("exampleResourceGroup", "sdk-Namespace-8859", 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.ArmDisasterRecoveryListResult = armeventhub.ArmDisasterRecoveryListResult{ - // Value: []*armeventhub.ArmDisasterRecovery{ - // { - // Name: to.Ptr("sdk-DisasterRecovery-3814"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/DisasterRecoveryConfig"), - // ID: to.Ptr("/subscriptions/exampleSubscriptionId/resourceGroups/exampleResourceGroup/providers/Microsoft.EventHub/namespaces/sdk-Namespace-8859/disasterRecoveryConfig/sdk-DisasterRecovery-3814"), - // Properties: &armeventhub.ArmDisasterRecoveryProperties{ - // PartnerNamespace: to.Ptr("sdk-Namespace-37"), - // ProvisioningState: to.Ptr(armeventhub.ProvisioningStateDRSucceeded), - // Role: to.Ptr(armeventhub.RoleDisasterRecoveryPrimary), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/disasterRecoveryConfigs/EHAliasCreate.json -func ExampleDisasterRecoveryConfigsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDisasterRecoveryConfigsClient().CreateOrUpdate(ctx, "exampleResourceGroup", "sdk-Namespace-8859", "sdk-DisasterRecovery-3814", armeventhub.ArmDisasterRecovery{ - Properties: &armeventhub.ArmDisasterRecoveryProperties{ - PartnerNamespace: to.Ptr("sdk-Namespace-37"), - }, - }, 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.ArmDisasterRecovery = armeventhub.ArmDisasterRecovery{ - // Name: to.Ptr("sdk-DisasterRecovery-3814"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/DisasterRecoveryConfig"), - // ID: to.Ptr("/subscriptions/exampleResourceGroup/resourceGroups/exampleResourceGroup/providers/Microsoft.EventHub/namespaces/sdk-Namespace-8859/disasterRecoveryConfig/sdk-DisasterRecovery-3814"), - // Properties: &armeventhub.ArmDisasterRecoveryProperties{ - // PartnerNamespace: to.Ptr("sdk-Namespace-37"), - // ProvisioningState: to.Ptr(armeventhub.ProvisioningStateDRSucceeded), - // Role: to.Ptr(armeventhub.RoleDisasterRecoveryPrimary), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/disasterRecoveryConfigs/EHAliasDelete.json -func ExampleDisasterRecoveryConfigsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDisasterRecoveryConfigsClient().Delete(ctx, "exampleResourceGroup", "sdk-Namespace-5849", "sdk-DisasterRecovery-3814", 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/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/disasterRecoveryConfigs/EHAliasGet.json -func ExampleDisasterRecoveryConfigsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDisasterRecoveryConfigsClient().Get(ctx, "exampleResourceGroup", "sdk-Namespace-8859", "sdk-DisasterRecovery-3814", 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.ArmDisasterRecovery = armeventhub.ArmDisasterRecovery{ - // Name: to.Ptr("sdk-DisasterRecovery-3814"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/DisasterRecoveryConfig"), - // ID: to.Ptr("/subscriptions/exampleSubscriptionId/resourceGroups/exampleResourceGroup/providers/Microsoft.EventHub/namespaces/sdk-Namespace-37/disasterRecoveryConfig/sdk-DisasterRecovery-3814"), - // Properties: &armeventhub.ArmDisasterRecoveryProperties{ - // PartnerNamespace: to.Ptr("sdk-Namespace-8859"), - // PendingReplicationOperationsCount: to.Ptr[int64](0), - // ProvisioningState: to.Ptr(armeventhub.ProvisioningStateDRSucceeded), - // Role: to.Ptr(armeventhub.RoleDisasterRecoverySecondary), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/disasterRecoveryConfigs/EHAliasBreakPairing.json -func ExampleDisasterRecoveryConfigsClient_BreakPairing() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDisasterRecoveryConfigsClient().BreakPairing(ctx, "exampleResourceGroup", "sdk-Namespace-8859", "sdk-DisasterRecovery-3814", 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/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/disasterRecoveryConfigs/EHAliasFailOver.json -func ExampleDisasterRecoveryConfigsClient_FailOver() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDisasterRecoveryConfigsClient().FailOver(ctx, "exampleResourceGroup", "sdk-Namespace-8859", "sdk-DisasterRecovery-3814", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/eventhub/armeventhub/eventhubs_client.go b/sdk/resourcemanager/eventhub/armeventhub/eventhubs_client.go index f2a39557ea59..1de7cf50740d 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/eventhubs_client.go +++ b/sdk/resourcemanager/eventhub/armeventhub/eventhubs_client.go @@ -48,7 +48,7 @@ func NewEventHubsClient(subscriptionID string, credential azcore.TokenCredential // CreateOrUpdate - Creates or updates a new Event Hub as a nested resource within a Namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - eventHubName - The Event Hub name @@ -101,7 +101,7 @@ func (client *EventHubsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -123,7 +123,7 @@ func (client *EventHubsClient) createOrUpdateHandleResponse(resp *http.Response) // of the AuthorizationRule will take a few seconds to take effect. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - eventHubName - The Event Hub name @@ -181,7 +181,7 @@ func (client *EventHubsClient) createOrUpdateAuthorizationRuleCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -202,7 +202,7 @@ func (client *EventHubsClient) createOrUpdateAuthorizationRuleHandleResponse(res // Delete - Deletes an Event Hub from the specified Namespace and resource group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - eventHubName - The Event Hub name @@ -252,7 +252,7 @@ func (client *EventHubsClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -261,7 +261,7 @@ func (client *EventHubsClient) deleteCreateRequest(ctx context.Context, resource // DeleteAuthorizationRule - Deletes an Event Hub AuthorizationRule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - eventHubName - The Event Hub name @@ -317,7 +317,7 @@ func (client *EventHubsClient) deleteAuthorizationRuleCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -326,7 +326,7 @@ func (client *EventHubsClient) deleteAuthorizationRuleCreateRequest(ctx context. // Get - Gets an Event Hubs description for the specified Event Hub. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - eventHubName - The Event Hub name @@ -377,7 +377,7 @@ func (client *EventHubsClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -395,7 +395,7 @@ func (client *EventHubsClient) getHandleResponse(resp *http.Response) (EventHubs // GetAuthorizationRule - Gets an AuthorizationRule for an Event Hub by rule name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - eventHubName - The Event Hub name @@ -452,7 +452,7 @@ func (client *EventHubsClient) getAuthorizationRuleCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -469,7 +469,7 @@ func (client *EventHubsClient) getAuthorizationRuleHandleResponse(resp *http.Res // NewListAuthorizationRulesPager - Gets the authorization rules for an Event Hub. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - eventHubName - The Event Hub name @@ -522,7 +522,7 @@ func (client *EventHubsClient) listAuthorizationRulesCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -539,7 +539,7 @@ func (client *EventHubsClient) listAuthorizationRulesHandleResponse(resp *http.R // NewListByNamespacePager - Gets all the Event Hubs in a Namespace. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - options - EventHubsClientListByNamespaceOptions contains the optional parameters for the EventHubsClient.NewListByNamespacePager @@ -587,13 +587,13 @@ func (client *EventHubsClient) listByNamespaceCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -611,7 +611,7 @@ func (client *EventHubsClient) listByNamespaceHandleResponse(resp *http.Response // ListKeys - Gets the ACS and SAS connection strings for the Event Hub. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - eventHubName - The Event Hub name @@ -667,7 +667,7 @@ func (client *EventHubsClient) listKeysCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -685,7 +685,7 @@ func (client *EventHubsClient) listKeysHandleResponse(resp *http.Response) (Even // RegenerateKeys - Regenerates the ACS and SAS connection strings for the Event Hub. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - eventHubName - The Event Hub name @@ -743,7 +743,7 @@ func (client *EventHubsClient) regenerateKeysCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/eventhub/armeventhub/eventhubs_client_example_test.go b/sdk/resourcemanager/eventhub/armeventhub/eventhubs_client_example_test.go deleted file mode 100644 index 08e7e73a257f..000000000000 --- a/sdk/resourcemanager/eventhub/armeventhub/eventhubs_client_example_test.go +++ /dev/null @@ -1,416 +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 armeventhub_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/eventhub/armeventhub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/EventHubs/EHEventHubAuthorizationRuleListAll.json -func ExampleEventHubsClient_NewListAuthorizationRulesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEventHubsClient().NewListAuthorizationRulesPager("ArunMonocle", "sdk-Namespace-960", "sdk-EventHub-532", 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.AuthorizationRuleListResult = armeventhub.AuthorizationRuleListResult{ - // Value: []*armeventhub.AuthorizationRule{ - // { - // Name: to.Ptr("sdk-Authrules-2513"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/EventHubs/AuthorizationRules"), - // ID: to.Ptr("/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.EventHub/namespaces/sdk-Namespace-960/eventhubs/sdk-EventHub-532/authorizationRules/sdk-Authrules-2513"), - // Properties: &armeventhub.AuthorizationRuleProperties{ - // Rights: []*armeventhub.AccessRights{ - // to.Ptr(armeventhub.AccessRightsListen), - // to.Ptr(armeventhub.AccessRightsSend)}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/EventHubs/EHEventHubAuthorizationRuleCreate.json -func ExampleEventHubsClient_CreateOrUpdateAuthorizationRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEventHubsClient().CreateOrUpdateAuthorizationRule(ctx, "ArunMonocle", "sdk-Namespace-960", "sdk-EventHub-532", "sdk-Authrules-2513", armeventhub.AuthorizationRule{ - Properties: &armeventhub.AuthorizationRuleProperties{ - Rights: []*armeventhub.AccessRights{ - to.Ptr(armeventhub.AccessRightsListen), - to.Ptr(armeventhub.AccessRightsSend)}, - }, - }, 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.AuthorizationRule = armeventhub.AuthorizationRule{ - // Name: to.Ptr("sdk-Authrules-2513"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/EventHubs/AuthorizationRules"), - // ID: to.Ptr("/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.EventHub/namespaces/sdk-Namespace-960/eventhubs/sdk-EventHub-532/authorizationRules/sdk-Authrules-2513"), - // Properties: &armeventhub.AuthorizationRuleProperties{ - // Rights: []*armeventhub.AccessRights{ - // to.Ptr(armeventhub.AccessRightsListen), - // to.Ptr(armeventhub.AccessRightsSend)}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/EventHubs/EHEventHubAuthorizationRuleGet.json -func ExampleEventHubsClient_GetAuthorizationRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEventHubsClient().GetAuthorizationRule(ctx, "ArunMonocle", "sdk-Namespace-960", "sdk-EventHub-532", "sdk-Authrules-2513", 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.AuthorizationRule = armeventhub.AuthorizationRule{ - // Name: to.Ptr("sdk-Authrules-2513"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/EventHubs/AuthorizationRules"), - // ID: to.Ptr("/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.EventHub/namespaces/sdk-Namespace-960/eventhubs/sdk-EventHub-532/authorizationRules/sdk-Authrules-2513"), - // Properties: &armeventhub.AuthorizationRuleProperties{ - // Rights: []*armeventhub.AccessRights{ - // to.Ptr(armeventhub.AccessRightsListen), - // to.Ptr(armeventhub.AccessRightsSend)}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/EventHubs/EHEventHubAuthorizationRuleDelete.json -func ExampleEventHubsClient_DeleteAuthorizationRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewEventHubsClient().DeleteAuthorizationRule(ctx, "ArunMonocle", "sdk-Namespace-960", "sdk-EventHub-532", "sdk-Authrules-2513", 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/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/EventHubs/EHEventHubAuthorizationRuleListKey.json -func ExampleEventHubsClient_ListKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEventHubsClient().ListKeys(ctx, "ArunMonocle", "sdk-namespace-960", "sdk-EventHub-532", "sdk-Authrules-2513", 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.AccessKeys = armeventhub.AccessKeys{ - // KeyName: to.Ptr("sdk-Authrules-2513"), - // PrimaryConnectionString: to.Ptr("Endpoint=sb://sdk-namespace-960.servicebus.windows-int.net/;SharedAccessKeyName=sdk-Authrules-2513;SharedAccessKey=############################################;EntityPath=sdk-EventHub-532"), - // PrimaryKey: to.Ptr("############################################"), - // SecondaryConnectionString: to.Ptr("Endpoint=sb://sdk-namespace-960.servicebus.windows-int.net/;SharedAccessKeyName=sdk-Authrules-2513;SharedAccessKey=############################################;EntityPath=sdk-EventHub-532"), - // SecondaryKey: to.Ptr("############################################"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/EventHubs/EHEventHubAuthorizationRuleRegenerateKey.json -func ExampleEventHubsClient_RegenerateKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEventHubsClient().RegenerateKeys(ctx, "ArunMonocle", "sdk-namespace-960", "sdk-EventHub-532", "sdk-Authrules-1534", armeventhub.RegenerateAccessKeyParameters{ - KeyType: to.Ptr(armeventhub.KeyTypePrimaryKey), - }, 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.AccessKeys = armeventhub.AccessKeys{ - // KeyName: to.Ptr("sdk-Authrules-1534"), - // PrimaryConnectionString: to.Ptr("Endpoint=sb://sdk-namespace-9027.servicebus.windows-int.net/;SharedAccessKeyName=sdk-Authrules-1534;SharedAccessKey=#############################################;EntityPath=sdk-EventHub-1647"), - // PrimaryKey: to.Ptr("#############################################"), - // SecondaryConnectionString: to.Ptr("Endpoint=sb://sdk-namespace-9027.servicebus.windows-int.net/;SharedAccessKeyName=sdk-Authrules-1534;SharedAccessKey=#############################################;EntityPath=sdk-EventHub-1647"), - // SecondaryKey: to.Ptr("#############################################"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/EventHubs/EHEventHubListByNameSpace.json -func ExampleEventHubsClient_NewListByNamespacePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEventHubsClient().NewListByNamespacePager("Default-NotificationHubs-AustraliaEast", "sdk-Namespace-5357", &armeventhub.EventHubsClientListByNamespaceOptions{Skip: 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.ListResult = armeventhub.ListResult{ - // Value: []*armeventhub.Eventhub{ - // { - // Name: to.Ptr("sdk-eventhub-10"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/EventHubs"), - // ID: to.Ptr("/subscriptions/e2f361f0-3b27-4503-a9cc-21cfba380093/resourceGroups/Default-NotificationHubs-AustraliaEast/providers/Microsoft.EventHub/namespaces/sdk-Namespace-716/eventhubs/sdk-eventhub-10"), - // Properties: &armeventhub.Properties{ - // CaptureDescription: &armeventhub.CaptureDescription{ - // Destination: &armeventhub.Destination{ - // Name: to.Ptr("EventHubArchive.AzureBlockBlob"), - // Properties: &armeventhub.DestinationProperties{ - // ArchiveNameFormat: to.Ptr("{Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}"), - // BlobContainer: to.Ptr("container"), - // StorageAccountResourceID: to.Ptr("/subscriptions/e2f361f0-3b27-4503-a9cc-21cfba380093/resourceGroups/Default-Storage-SouthCentralUS/providers/Microsoft.ClassicStorage/storageAccounts/arjunteststorage"), - // }, - // }, - // Enabled: to.Ptr(true), - // Encoding: to.Ptr(armeventhub.EncodingCaptureDescriptionAvro), - // IntervalInSeconds: to.Ptr[int32](120), - // SizeLimitInBytes: to.Ptr[int32](10485763), - // }, - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-28T02:45:55.877Z"); return t}()), - // MessageRetentionInDays: to.Ptr[int64](4), - // PartitionCount: to.Ptr[int64](4), - // PartitionIDs: []*string{ - // to.Ptr("0"), - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // RetentionDescription: &armeventhub.RetentionDescription{ - // CleanupPolicy: to.Ptr(armeventhub.CleanupPolicyRetentionDescriptionDelete), - // RetentionTimeInHours: to.Ptr[int64](96), - // TombstoneRetentionTimeInHours: to.Ptr[int32](1), - // }, - // Status: to.Ptr(armeventhub.EntityStatusActive), - // UpdatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-28T02:46:05.877Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/EventHubs/EHEventHubCreate.json -func ExampleEventHubsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEventHubsClient().CreateOrUpdate(ctx, "Default-NotificationHubs-AustraliaEast", "sdk-Namespace-5357", "sdk-EventHub-6547", armeventhub.Eventhub{ - Properties: &armeventhub.Properties{ - CaptureDescription: &armeventhub.CaptureDescription{ - Destination: &armeventhub.Destination{ - Name: to.Ptr("EventHubArchive.AzureBlockBlob"), - Properties: &armeventhub.DestinationProperties{ - ArchiveNameFormat: to.Ptr("{Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}"), - BlobContainer: to.Ptr("container"), - StorageAccountResourceID: to.Ptr("/subscriptions/e2f361f0-3b27-4503-a9cc-21cfba380093/resourceGroups/Default-Storage-SouthCentralUS/providers/Microsoft.ClassicStorage/storageAccounts/arjunteststorage"), - }, - }, - Enabled: to.Ptr(true), - Encoding: to.Ptr(armeventhub.EncodingCaptureDescriptionAvro), - IntervalInSeconds: to.Ptr[int32](120), - SizeLimitInBytes: to.Ptr[int32](10485763), - }, - MessageRetentionInDays: to.Ptr[int64](4), - PartitionCount: to.Ptr[int64](4), - RetentionDescription: &armeventhub.RetentionDescription{ - CleanupPolicy: to.Ptr(armeventhub.CleanupPolicyRetentionDescriptionCompaction), - RetentionTimeInHours: to.Ptr[int64](96), - TombstoneRetentionTimeInHours: to.Ptr[int32](1), - }, - Status: to.Ptr(armeventhub.EntityStatusActive), - }, - }, 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.Eventhub = armeventhub.Eventhub{ - // Name: to.Ptr("sdk-EventHub-10"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/EventHubs"), - // ID: to.Ptr("/subscriptions/e2f361f0-3b27-4503-a9cc-21cfba380093/resourceGroups/Default-NotificationHubs-AustraliaEast/providers/Microsoft.EventHub/namespaces/sdk-Namespace-716/eventhubs/sdk-EventHub-10"), - // Properties: &armeventhub.Properties{ - // CaptureDescription: &armeventhub.CaptureDescription{ - // Destination: &armeventhub.Destination{ - // Name: to.Ptr("EventHubArchive.AzureBlockBlob"), - // Properties: &armeventhub.DestinationProperties{ - // ArchiveNameFormat: to.Ptr("{Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}"), - // BlobContainer: to.Ptr("container"), - // StorageAccountResourceID: to.Ptr("/subscriptions/e2f361f0-3b27-4503-a9cc-21cfba380093/resourceGroups/Default-Storage-SouthCentralUS/providers/Microsoft.ClassicStorage/storageAccounts/arjunteststorage"), - // }, - // }, - // Enabled: to.Ptr(true), - // Encoding: to.Ptr(armeventhub.EncodingCaptureDescriptionAvro), - // IntervalInSeconds: to.Ptr[int32](120), - // SizeLimitInBytes: to.Ptr[int32](10485763), - // }, - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-28T02:45:55.877Z"); return t}()), - // MessageRetentionInDays: to.Ptr[int64](4), - // PartitionCount: to.Ptr[int64](4), - // PartitionIDs: []*string{ - // to.Ptr("0"), - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // RetentionDescription: &armeventhub.RetentionDescription{ - // CleanupPolicy: to.Ptr(armeventhub.CleanupPolicyRetentionDescriptionCompaction), - // RetentionTimeInHours: to.Ptr[int64](96), - // TombstoneRetentionTimeInHours: to.Ptr[int32](1), - // }, - // Status: to.Ptr(armeventhub.EntityStatusActive), - // UpdatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-28T02:46:05.877Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/EventHubs/EHEventHubDelete.json -func ExampleEventHubsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewEventHubsClient().Delete(ctx, "ArunMonocle", "sdk-Namespace-5357", "sdk-EventHub-6547", 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/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/EventHubs/EHEventHubGet.json -func ExampleEventHubsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEventHubsClient().Get(ctx, "Default-NotificationHubs-AustraliaEast", "sdk-Namespace-716", "sdk-EventHub-10", 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.Eventhub = armeventhub.Eventhub{ - // Name: to.Ptr("sdk-EventHub-10"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/EventHubs"), - // ID: to.Ptr("/subscriptions/e2f361f0-3b27-4503-a9cc-21cfba380093/resourceGroups/Default-NotificationHubs-AustraliaEast/providers/Microsoft.EventHub/namespaces/sdk-Namespace-716/eventhubs/sdk-EventHub-10"), - // Properties: &armeventhub.Properties{ - // CaptureDescription: &armeventhub.CaptureDescription{ - // Destination: &armeventhub.Destination{ - // Name: to.Ptr("EventHubArchive.AzureBlockBlob"), - // Properties: &armeventhub.DestinationProperties{ - // ArchiveNameFormat: to.Ptr("{Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}"), - // BlobContainer: to.Ptr("container"), - // StorageAccountResourceID: to.Ptr("/subscriptions/e2f361f0-3b27-4503-a9cc-21cfba380093/resourceGroups/Default-Storage-SouthCentralUS/providers/Microsoft.ClassicStorage/storageAccounts/arjunteststorage"), - // }, - // }, - // Enabled: to.Ptr(true), - // Encoding: to.Ptr(armeventhub.EncodingCaptureDescriptionAvro), - // IntervalInSeconds: to.Ptr[int32](120), - // SizeLimitInBytes: to.Ptr[int32](10485763), - // }, - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-28T02:45:55.877Z"); return t}()), - // MessageRetentionInDays: to.Ptr[int64](4), - // PartitionCount: to.Ptr[int64](4), - // PartitionIDs: []*string{ - // to.Ptr("0"), - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // RetentionDescription: &armeventhub.RetentionDescription{ - // CleanupPolicy: to.Ptr(armeventhub.CleanupPolicyRetentionDescriptionCompaction), - // RetentionTimeInHours: to.Ptr[int64](96), - // TombstoneRetentionTimeInHours: to.Ptr[int32](1), - // }, - // Status: to.Ptr(armeventhub.EntityStatusActive), - // UpdatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-28T02:46:05.877Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/eventhub/armeventhub/fake/namespaces_server.go b/sdk/resourcemanager/eventhub/armeventhub/fake/namespaces_server.go index 1caae14cfb72..788d004e7754 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/fake/namespaces_server.go +++ b/sdk/resourcemanager/eventhub/armeventhub/fake/namespaces_server.go @@ -48,6 +48,10 @@ type NamespacesServer struct { // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent DeleteAuthorizationRule func(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, options *armeventhub.NamespacesClientDeleteAuthorizationRuleOptions) (resp azfake.Responder[armeventhub.NamespacesClientDeleteAuthorizationRuleResponse], errResp azfake.ErrorResponder) + // BeginFailover is the fake for method NamespacesClient.BeginFailover + // HTTP status codes to indicate success: http.StatusAccepted + BeginFailover func(ctx context.Context, resourceGroupName string, namespaceName string, parameters armeventhub.FailOver, options *armeventhub.NamespacesClientBeginFailoverOptions) (resp azfake.PollerResponder[armeventhub.NamespacesClientFailoverResponse], errResp azfake.ErrorResponder) + // Get is the fake for method NamespacesClient.Get // HTTP status codes to indicate success: http.StatusOK Get func(ctx context.Context, resourceGroupName string, namespaceName string, options *armeventhub.NamespacesClientGetOptions) (resp azfake.Responder[armeventhub.NamespacesClientGetResponse], errResp azfake.ErrorResponder) @@ -97,6 +101,7 @@ func NewNamespacesServerTransport(srv *NamespacesServer) *NamespacesServerTransp srv: srv, beginCreateOrUpdate: newTracker[azfake.PollerResponder[armeventhub.NamespacesClientCreateOrUpdateResponse]](), beginDelete: newTracker[azfake.PollerResponder[armeventhub.NamespacesClientDeleteResponse]](), + beginFailover: newTracker[azfake.PollerResponder[armeventhub.NamespacesClientFailoverResponse]](), newListPager: newTracker[azfake.PagerResponder[armeventhub.NamespacesClientListResponse]](), newListAuthorizationRulesPager: newTracker[azfake.PagerResponder[armeventhub.NamespacesClientListAuthorizationRulesResponse]](), newListByResourceGroupPager: newTracker[azfake.PagerResponder[armeventhub.NamespacesClientListByResourceGroupResponse]](), @@ -109,6 +114,7 @@ type NamespacesServerTransport struct { srv *NamespacesServer beginCreateOrUpdate *tracker[azfake.PollerResponder[armeventhub.NamespacesClientCreateOrUpdateResponse]] beginDelete *tracker[azfake.PollerResponder[armeventhub.NamespacesClientDeleteResponse]] + beginFailover *tracker[azfake.PollerResponder[armeventhub.NamespacesClientFailoverResponse]] newListPager *tracker[azfake.PagerResponder[armeventhub.NamespacesClientListResponse]] newListAuthorizationRulesPager *tracker[azfake.PagerResponder[armeventhub.NamespacesClientListAuthorizationRulesResponse]] newListByResourceGroupPager *tracker[azfake.PagerResponder[armeventhub.NamespacesClientListByResourceGroupResponse]] @@ -138,6 +144,8 @@ func (n *NamespacesServerTransport) Do(req *http.Request) (*http.Response, error resp, err = n.dispatchBeginDelete(req) case "NamespacesClient.DeleteAuthorizationRule": resp, err = n.dispatchDeleteAuthorizationRule(req) + case "NamespacesClient.BeginFailover": + resp, err = n.dispatchBeginFailover(req) case "NamespacesClient.Get": resp, err = n.dispatchGet(req) case "NamespacesClient.GetAuthorizationRule": @@ -405,6 +413,54 @@ func (n *NamespacesServerTransport) dispatchDeleteAuthorizationRule(req *http.Re return resp, nil } +func (n *NamespacesServerTransport) dispatchBeginFailover(req *http.Request) (*http.Response, error) { + if n.srv.BeginFailover == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginFailover not implemented")} + } + beginFailover := n.beginFailover.get(req) + if beginFailover == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EventHub/namespaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/failover` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armeventhub.FailOver](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + namespaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("namespaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := n.srv.BeginFailover(req.Context(), resourceGroupNameParam, namespaceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginFailover = &respr + n.beginFailover.add(req, beginFailover) + } + + resp, err := server.PollerResponderNext(beginFailover, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + n.beginFailover.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginFailover) { + n.beginFailover.remove(req) + } + + return resp, nil +} + func (n *NamespacesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { if n.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} diff --git a/sdk/resourcemanager/eventhub/armeventhub/fake/time_rfc3339.go b/sdk/resourcemanager/eventhub/armeventhub/fake/time_rfc3339.go index b0535a7b63e6..81f308b0d343 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/fake/time_rfc3339.go +++ b/sdk/resourcemanager/eventhub/armeventhub/fake/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/eventhub/armeventhub/go.mod b/sdk/resourcemanager/eventhub/armeventhub/go.mod index 6265fdf05765..008d6a64b444 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/go.mod +++ b/sdk/resourcemanager/eventhub/armeventhub/go.mod @@ -4,7 +4,6 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1 @@ -12,6 +11,7 @@ require ( ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dnaeon/go-vcr v1.2.0 // indirect diff --git a/sdk/resourcemanager/eventhub/armeventhub/models.go b/sdk/resourcemanager/eventhub/armeventhub/models.go index 8787c6569f8c..08c70862a875 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/models.go +++ b/sdk/resourcemanager/eventhub/armeventhub/models.go @@ -210,6 +210,16 @@ type CaptureDescription struct { SkipEmptyArchives *bool } +// CaptureIdentity - A value that indicates whether capture description is enabled. +type CaptureIdentity struct { + // Type of Azure Active Directory Managed Identity. + Type *CaptureIdentityType + + // ARM ID of Managed User Identity. This property is required is the type is UserAssignedIdentity. If type is SystemAssigned, + // then the System Assigned Identity Associated with the namespace will be used. + UserAssignedIdentity *string +} + // CheckNameAvailabilityParameter - Parameter supplied to check Namespace name availability operation type CheckNameAvailabilityParameter struct { // REQUIRED; Name to check the namespace name availability @@ -275,6 +285,9 @@ type ClusterProperties struct { // READ-ONLY; The metric ID of the cluster resource. Provided by the service and not modifiable by the user. MetricID *string + // READ-ONLY; Provisioning state of the Cluster. + ProvisioningState *ProvisioningState + // READ-ONLY; Status of the Cluster resource Status *string @@ -353,6 +366,9 @@ type ConsumerGroupProperties struct { // Destination - Capture storage details for capture description type Destination struct { + // A value that indicates whether capture description is enabled. + Identity *CaptureIdentity + // Name for capture destination Name *string @@ -448,6 +464,9 @@ type EHNamespaceProperties struct { // Properties of BYOK Encryption description Encryption *Encryption + // Geo Data Replication settings for the namespace + GeoDataReplication *GeoDataReplicationProperties + // Value that indicates whether AutoInflate is enabled for eventhub namespace. IsAutoInflateEnabled *bool @@ -528,6 +547,24 @@ type ErrorDetail struct { Target *string } +// ErrorDetailAutoGenerated - The error detail. +type ErrorDetailAutoGenerated struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo + + // READ-ONLY; The error code. + Code *string + + // READ-ONLY; The error details. + Details []*ErrorDetailAutoGenerated + + // READ-ONLY; The error message. + Message *string + + // READ-ONLY; The error target. + Target *string +} + // ErrorResponse - Error response indicates Event Hub service is not able to process the incoming request. The reason is provided // in the error message. type ErrorResponse struct { @@ -535,6 +572,13 @@ type ErrorResponse struct { Error *ErrorDetail } +// ErrorResponseAutoGenerated - Common error response for all Azure Resource Manager APIs to return error details for failed +// operations. (This also follows the OData error response format.). +type ErrorResponseAutoGenerated struct { + // The error object. + Error *ErrorDetailAutoGenerated +} + // Eventhub - Single item in List or Get Event Hub operation type Eventhub struct { // Properties supplied to the Create Or Update Event Hub operation. @@ -556,6 +600,34 @@ type Eventhub struct { Type *string } +type FailOver struct { + Properties *FailOverProperties +} + +type FailOverProperties struct { + // Maximum time duration allowed complete data replication from primary to secondary. Use maximumGracePeriodInMins = 0: For + // Unplanned Geo-Failover, which switches the role between primary and secondary + // immediately. The data that is not being replicated yet will be discarded. Use maximumGracePeriodInMins > 0: For Planned + // Geo-Failover/DR Drill, continue replicating data until grace period expires. Any + // data that is not replicated during the grace period will be discarded. During the replication the namespace stops accepting + // any new publishing requests + MaximumGracePeriodInMins *int32 + + // Query parameter for the new primary location after failover. + PrimaryLocation *string +} + +// GeoDataReplicationProperties - GeoDR Replication properties +type GeoDataReplicationProperties struct { + // A list of regions where replicas of the namespace are maintained. + Locations []*NamespaceReplicaLocation + + // The maximum acceptable lag for data replication operations from the primary replica to a quorum of secondary replicas. + // When the lag exceeds the configured amount, operations on the primary replica + // will be failed. The allowed values are 0 and 5 minutes to 1 day. + MaxReplicationLagDurationInSeconds *int32 +} + // Identity - Properties to configure Identity for Bring your Own Keys type Identity struct { // Type of managed service identity. @@ -612,6 +684,22 @@ type NWRuleSetVirtualNetworkRules struct { Subnet *Subnet } +// NamespaceReplicaLocation - Namespace replication properties +type NamespaceReplicaLocation struct { + // Optional property that denotes the ARM ID of the Cluster. This is required, if a namespace replica should be placed in + // a Dedicated Event Hub Cluster + ClusterArmID *string + + // Azure regions where a replica of the namespace is maintained + LocationName *string + + // GeoDR Role Types + RoleType *GeoDRRoleType + + // READ-ONLY; state of Namespace replica. + ReplicaState *string +} + // NetworkRuleSet - Description of topic resource. type NetworkRuleSet struct { // NetworkRuleSet properties @@ -679,13 +767,16 @@ type NetworkSecurityPerimeterConfiguration struct { // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string + // READ-ONLY; The geo-location where the resource lives + Location *string + // READ-ONLY; The name of the resource Name *string // READ-ONLY; Properties of the Network Security Perimeter Configuration Properties *NetworkSecurityPerimeterConfigurationProperties - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + // READ-ONLY; The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or "Microsoft.EventHub/Namespaces/EventHubs" Type *string } @@ -703,14 +794,27 @@ type NetworkSecurityPerimeterConfigurationProperties struct { // Provisioning state of NetworkSecurityPerimeter configuration propagation ProvisioningState *NetworkSecurityPerimeterConfigurationProvisioningState + // READ-ONLY; Indicates that the NSP controls related to backing association are only applicable to a specific feature in + // backing resource's data plane. + ApplicableFeatures []*string + + // READ-ONLY; True if the EventHub namespace is backed by another Azure resource and not visible to end users. + IsBackingResource *bool + // READ-ONLY; NetworkSecurityPerimeter related information NetworkSecurityPerimeter *NetworkSecurityPerimeter + // READ-ONLY; Source Resource Association name + ParentAssociationName *string + // READ-ONLY; Information about current network profile Profile *NetworkSecurityPerimeterConfigurationPropertiesProfile // READ-ONLY; Information about resource association ResourceAssociation *NetworkSecurityPerimeterConfigurationPropertiesResourceAssociation + + // READ-ONLY; ARM Id of source resource + SourceResourceID *string } // NetworkSecurityPerimeterConfigurationPropertiesProfile - Information about current network profile @@ -908,6 +1012,13 @@ type Properties struct { // Number of days to retain the events for this Event Hub, value should be 1 to 7 days MessageRetentionInDays *int64 + // Denotes the type of timestamp the message will hold. Two types of timestamp types AppendTime, CreateTime. AppendTime refers + // the time in which message got appended inside broker log. CreateTime refers + // to the time in which the message was generated on source side and producers can set this timestamp while sending the message. + // Default value is AppendTime. If you are using AMQP protocol, CreateTime + // equals AppendTime for now and will full have runtime support later. + MessageTimestampType *TimestampType + // Number of partitions created for the Event Hub, allowed values are from 1 to 32 partitions. PartitionCount *int64 @@ -917,9 +1028,17 @@ type Properties struct { // Enumerates the possible values for the status of the Event Hub. Status *EntityStatus + // Gets and Sets Metadata of User. + UserMetadata *string + // READ-ONLY; Exact time the Event Hub was created. CreatedAt *time.Time + // READ-ONLY; Denotes the unique identifier for event hub and is generated by service while creating topic. This identifier + // can be used in kafka runtime apis wherever a UUID is required e.g Fetch & Delete Topic. + // This identifier is not supported in AMQP runtime operations yet. + Identifier *string + // READ-ONLY; Current number of shards on the Event Hub. PartitionIDs []*string @@ -987,12 +1106,15 @@ type RetentionDescription struct { // Enumerates the possible values for cleanup policy CleanupPolicy *CleanupPolicyRetentionDescription - // Number of hours to retain the events for this Event Hub. This value is only used when cleanupPolicy is Delete. If cleanupPolicy - // is Compaction the returned value of this property is Long.MaxValue + // The minimum time a message will remain ineligible for compaction in the log. Only applicable for logs that are being compacted. + MinCompactionLagInMins *int64 + + // Number of hours to retain the events for this Event Hub. If cleanupPolicy is Compact the returned value of this property + // is Long.MaxValue RetentionTimeInHours *int64 // Number of hours to retain the tombstone markers of a compacted Event Hub. This value is only used when cleanupPolicy is - // Compaction. Consumer must complete reading the tombstone marker within this + // Compact. Consumer must complete reading the tombstone marker within this // specified amount of time if consumer begins from starting offset to ensure they get a valid snapshot for the specific key // described by the tombstone marker within the compacted Event Hub TombstoneRetentionTimeInHours *int32 diff --git a/sdk/resourcemanager/eventhub/armeventhub/models_serde.go b/sdk/resourcemanager/eventhub/armeventhub/models_serde.go index dcf44ad0417f..20df190e87bb 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/models_serde.go +++ b/sdk/resourcemanager/eventhub/armeventhub/models_serde.go @@ -537,6 +537,37 @@ func (c *CaptureDescription) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type CaptureIdentity. +func (c CaptureIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "type", c.Type) + populate(objectMap, "userAssignedIdentity", c.UserAssignedIdentity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CaptureIdentity. +func (c *CaptureIdentity) 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 "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + case "userAssignedIdentity": + err = unpopulate(val, "UserAssignedIdentity", &c.UserAssignedIdentity) + 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 CheckNameAvailabilityParameter. func (c CheckNameAvailabilityParameter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -690,6 +721,7 @@ func (c ClusterProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "createdAt", c.CreatedAt) populate(objectMap, "metricId", c.MetricID) + populate(objectMap, "provisioningState", c.ProvisioningState) populate(objectMap, "status", c.Status) populate(objectMap, "supportsScaling", c.SupportsScaling) populate(objectMap, "updatedAt", c.UpdatedAt) @@ -711,6 +743,9 @@ func (c *ClusterProperties) UnmarshalJSON(data []byte) error { case "metricId": err = unpopulate(val, "MetricID", &c.MetricID) delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &c.Status) delete(rawMsg, key) @@ -933,6 +968,7 @@ func (c *ConsumerGroupProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Destination. func (d Destination) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "identity", d.Identity) populate(objectMap, "name", d.Name) populate(objectMap, "properties", d.Properties) return json.Marshal(objectMap) @@ -947,6 +983,9 @@ func (d *Destination) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "identity": + err = unpopulate(val, "Identity", &d.Identity) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) @@ -1160,6 +1199,7 @@ func (e EHNamespaceProperties) MarshalJSON() ([]byte, error) { populateDateTimeRFC3339(objectMap, "createdAt", e.CreatedAt) populate(objectMap, "disableLocalAuth", e.DisableLocalAuth) populate(objectMap, "encryption", e.Encryption) + populate(objectMap, "geoDataReplication", e.GeoDataReplication) populate(objectMap, "isAutoInflateEnabled", e.IsAutoInflateEnabled) populate(objectMap, "kafkaEnabled", e.KafkaEnabled) populate(objectMap, "maximumThroughputUnits", e.MaximumThroughputUnits) @@ -1199,6 +1239,9 @@ func (e *EHNamespaceProperties) UnmarshalJSON(data []byte) error { case "encryption": err = unpopulate(val, "Encryption", &e.Encryption) delete(rawMsg, key) + case "geoDataReplication": + err = unpopulate(val, "GeoDataReplication", &e.GeoDataReplication) + delete(rawMsg, key) case "isAutoInflateEnabled": err = unpopulate(val, "IsAutoInflateEnabled", &e.IsAutoInflateEnabled) delete(rawMsg, key) @@ -1352,6 +1395,49 @@ func (e *ErrorDetail) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ErrorDetailAutoGenerated. +func (e ErrorDetailAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetailAutoGenerated. +func (e *ErrorDetailAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ErrorResponse. func (e ErrorResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1379,6 +1465,33 @@ func (e *ErrorResponse) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated. +func (e ErrorResponseAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated. +func (e *ErrorResponseAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Eventhub. func (e Eventhub) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1426,6 +1539,95 @@ func (e *Eventhub) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type FailOver. +func (f FailOver) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", f.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FailOver. +func (f *FailOver) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FailOverProperties. +func (f FailOverProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "maximumGracePeriodInMins", f.MaximumGracePeriodInMins) + populate(objectMap, "primaryLocation", f.PrimaryLocation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FailOverProperties. +func (f *FailOverProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "maximumGracePeriodInMins": + err = unpopulate(val, "MaximumGracePeriodInMins", &f.MaximumGracePeriodInMins) + delete(rawMsg, key) + case "primaryLocation": + err = unpopulate(val, "PrimaryLocation", &f.PrimaryLocation) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GeoDataReplicationProperties. +func (g GeoDataReplicationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "locations", g.Locations) + populate(objectMap, "maxReplicationLagDurationInSeconds", g.MaxReplicationLagDurationInSeconds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GeoDataReplicationProperties. +func (g *GeoDataReplicationProperties) 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "locations": + err = unpopulate(val, "Locations", &g.Locations) + delete(rawMsg, key) + case "maxReplicationLagDurationInSeconds": + err = unpopulate(val, "MaxReplicationLagDurationInSeconds", &g.MaxReplicationLagDurationInSeconds) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Identity. func (i Identity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1597,6 +1799,45 @@ func (n *NWRuleSetVirtualNetworkRules) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type NamespaceReplicaLocation. +func (n NamespaceReplicaLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clusterArmId", n.ClusterArmID) + populate(objectMap, "locationName", n.LocationName) + populate(objectMap, "replicaState", n.ReplicaState) + populate(objectMap, "roleType", n.RoleType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NamespaceReplicaLocation. +func (n *NamespaceReplicaLocation) 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 "clusterArmId": + err = unpopulate(val, "ClusterArmID", &n.ClusterArmID) + delete(rawMsg, key) + case "locationName": + err = unpopulate(val, "LocationName", &n.LocationName) + delete(rawMsg, key) + case "replicaState": + err = unpopulate(val, "ReplicaState", &n.ReplicaState) + delete(rawMsg, key) + case "roleType": + err = unpopulate(val, "RoleType", &n.RoleType) + 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 NetworkRuleSet. func (n NetworkRuleSet) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1757,6 +1998,7 @@ func (n *NetworkSecurityPerimeter) UnmarshalJSON(data []byte) error { func (n NetworkSecurityPerimeterConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", n.ID) + populate(objectMap, "location", n.Location) populate(objectMap, "name", n.Name) populate(objectMap, "properties", n.Properties) populate(objectMap, "type", n.Type) @@ -1775,6 +2017,9 @@ func (n *NetworkSecurityPerimeterConfiguration) UnmarshalJSON(data []byte) error case "id": err = unpopulate(val, "ID", &n.ID) delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &n.Location) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &n.Name) delete(rawMsg, key) @@ -1822,11 +2067,15 @@ func (n *NetworkSecurityPerimeterConfigurationList) UnmarshalJSON(data []byte) e // MarshalJSON implements the json.Marshaller interface for type NetworkSecurityPerimeterConfigurationProperties. func (n NetworkSecurityPerimeterConfigurationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "applicableFeatures", n.ApplicableFeatures) + populate(objectMap, "isBackingResource", n.IsBackingResource) populate(objectMap, "networkSecurityPerimeter", n.NetworkSecurityPerimeter) + populate(objectMap, "parentAssociationName", n.ParentAssociationName) populate(objectMap, "profile", n.Profile) populate(objectMap, "provisioningIssues", n.ProvisioningIssues) populate(objectMap, "provisioningState", n.ProvisioningState) populate(objectMap, "resourceAssociation", n.ResourceAssociation) + populate(objectMap, "sourceResourceId", n.SourceResourceID) return json.Marshal(objectMap) } @@ -1839,9 +2088,18 @@ func (n *NetworkSecurityPerimeterConfigurationProperties) UnmarshalJSON(data []b for key, val := range rawMsg { var err error switch key { + case "applicableFeatures": + err = unpopulate(val, "ApplicableFeatures", &n.ApplicableFeatures) + delete(rawMsg, key) + case "isBackingResource": + err = unpopulate(val, "IsBackingResource", &n.IsBackingResource) + delete(rawMsg, key) case "networkSecurityPerimeter": err = unpopulate(val, "NetworkSecurityPerimeter", &n.NetworkSecurityPerimeter) delete(rawMsg, key) + case "parentAssociationName": + err = unpopulate(val, "ParentAssociationName", &n.ParentAssociationName) + delete(rawMsg, key) case "profile": err = unpopulate(val, "Profile", &n.Profile) delete(rawMsg, key) @@ -1854,6 +2112,9 @@ func (n *NetworkSecurityPerimeterConfigurationProperties) UnmarshalJSON(data []b case "resourceAssociation": err = unpopulate(val, "ResourceAssociation", &n.ResourceAssociation) delete(rawMsg, key) + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &n.SourceResourceID) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) @@ -2400,12 +2661,15 @@ func (p Properties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "captureDescription", p.CaptureDescription) populateDateTimeRFC3339(objectMap, "createdAt", p.CreatedAt) + populate(objectMap, "identifier", p.Identifier) populate(objectMap, "messageRetentionInDays", p.MessageRetentionInDays) + populate(objectMap, "messageTimestampType", p.MessageTimestampType) populate(objectMap, "partitionCount", p.PartitionCount) populate(objectMap, "partitionIds", p.PartitionIDs) populate(objectMap, "retentionDescription", p.RetentionDescription) populate(objectMap, "status", p.Status) populateDateTimeRFC3339(objectMap, "updatedAt", p.UpdatedAt) + populate(objectMap, "userMetadata", p.UserMetadata) return json.Marshal(objectMap) } @@ -2424,9 +2688,15 @@ func (p *Properties) UnmarshalJSON(data []byte) error { case "createdAt": err = unpopulateDateTimeRFC3339(val, "CreatedAt", &p.CreatedAt) delete(rawMsg, key) + case "identifier": + err = unpopulate(val, "Identifier", &p.Identifier) + delete(rawMsg, key) case "messageRetentionInDays": err = unpopulate(val, "MessageRetentionInDays", &p.MessageRetentionInDays) delete(rawMsg, key) + case "messageTimestampType": + err = unpopulate(val, "MessageTimestampType", &p.MessageTimestampType) + delete(rawMsg, key) case "partitionCount": err = unpopulate(val, "PartitionCount", &p.PartitionCount) delete(rawMsg, key) @@ -2442,6 +2712,9 @@ func (p *Properties) UnmarshalJSON(data []byte) error { case "updatedAt": err = unpopulateDateTimeRFC3339(val, "UpdatedAt", &p.UpdatedAt) delete(rawMsg, key) + case "userMetadata": + err = unpopulate(val, "UserMetadata", &p.UserMetadata) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -2621,6 +2894,7 @@ func (r *Resource) UnmarshalJSON(data []byte) error { func (r RetentionDescription) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "cleanupPolicy", r.CleanupPolicy) + populate(objectMap, "minCompactionLagInMins", r.MinCompactionLagInMins) populate(objectMap, "retentionTimeInHours", r.RetentionTimeInHours) populate(objectMap, "tombstoneRetentionTimeInHours", r.TombstoneRetentionTimeInHours) return json.Marshal(objectMap) @@ -2638,6 +2912,9 @@ func (r *RetentionDescription) UnmarshalJSON(data []byte) error { case "cleanupPolicy": err = unpopulate(val, "CleanupPolicy", &r.CleanupPolicy) delete(rawMsg, key) + case "minCompactionLagInMins": + err = unpopulate(val, "MinCompactionLagInMins", &r.MinCompactionLagInMins) + delete(rawMsg, key) case "retentionTimeInHours": err = unpopulate(val, "RetentionTimeInHours", &r.RetentionTimeInHours) delete(rawMsg, key) @@ -3047,7 +3324,7 @@ func populateAny(m map[string]any, k string, v any) { } func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/sdk/resourcemanager/eventhub/armeventhub/namespaces_client.go b/sdk/resourcemanager/eventhub/armeventhub/namespaces_client.go index 95833774d6ac..e7a1e9326857 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/namespaces_client.go +++ b/sdk/resourcemanager/eventhub/armeventhub/namespaces_client.go @@ -47,7 +47,7 @@ func NewNamespacesClient(subscriptionID string, credential azcore.TokenCredentia // CheckNameAvailability - Check the give Namespace name availability. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - parameters - Parameters to check availability of the given Namespace name // - options - NamespacesClientCheckNameAvailabilityOptions contains the optional parameters for the NamespacesClient.CheckNameAvailability // method. @@ -85,7 +85,7 @@ func (client *NamespacesClient) checkNameAvailabilityCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -107,7 +107,7 @@ func (client *NamespacesClient) checkNameAvailabilityHandleResponse(resp *http.R // operation is idempotent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - parameters - Parameters for creating a namespace resource. @@ -120,7 +120,8 @@ func (client *NamespacesClient) BeginCreateOrUpdate(ctx context.Context, resourc return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespacesClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -134,7 +135,7 @@ func (client *NamespacesClient) BeginCreateOrUpdate(ctx context.Context, resourc // is idempotent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview func (client *NamespacesClient) createOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, parameters EHNamespace, options *NamespacesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "NamespacesClient.BeginCreateOrUpdate" @@ -176,7 +177,7 @@ func (client *NamespacesClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -188,7 +189,7 @@ func (client *NamespacesClient) createOrUpdateCreateRequest(ctx context.Context, // CreateOrUpdateAuthorizationRule - Creates or updates an AuthorizationRule for a Namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - authorizationRuleName - The authorization rule name. @@ -241,7 +242,7 @@ func (client *NamespacesClient) createOrUpdateAuthorizationRuleCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -262,7 +263,7 @@ func (client *NamespacesClient) createOrUpdateAuthorizationRuleHandleResponse(re // CreateOrUpdateNetworkRuleSet - Create or update NetworkRuleSet for a Namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - parameters - The Namespace IpFilterRule. @@ -310,7 +311,7 @@ func (client *NamespacesClient) createOrUpdateNetworkRuleSetCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -331,7 +332,7 @@ func (client *NamespacesClient) createOrUpdateNetworkRuleSetHandleResponse(resp // BeginDelete - Deletes an existing namespace. This operation also removes all associated resources under the namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - options - NamespacesClientBeginDeleteOptions contains the optional parameters for the NamespacesClient.BeginDelete method. @@ -342,7 +343,8 @@ func (client *NamespacesClient) BeginDelete(ctx context.Context, resourceGroupNa return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespacesClientDeleteResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -355,7 +357,7 @@ func (client *NamespacesClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Deletes an existing namespace. This operation also removes all associated resources under the namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview func (client *NamespacesClient) deleteOperation(ctx context.Context, resourceGroupName string, namespaceName string, options *NamespacesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "NamespacesClient.BeginDelete" @@ -397,7 +399,7 @@ func (client *NamespacesClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -406,7 +408,7 @@ func (client *NamespacesClient) deleteCreateRequest(ctx context.Context, resourc // DeleteAuthorizationRule - Deletes an AuthorizationRule for a Namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - authorizationRuleName - The authorization rule name. @@ -457,16 +459,97 @@ func (client *NamespacesClient) deleteAuthorizationRuleCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginFailover - GeoDR Failover +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-05-01-preview +// - resourceGroupName - Name of the resource group within the azure subscription. +// - namespaceName - The Namespace name +// - parameters - Parameters for updating a namespace resource. +// - options - NamespacesClientBeginFailoverOptions contains the optional parameters for the NamespacesClient.BeginFailover +// method. +func (client *NamespacesClient) BeginFailover(ctx context.Context, resourceGroupName string, namespaceName string, parameters FailOver, options *NamespacesClientBeginFailoverOptions) (*runtime.Poller[NamespacesClientFailoverResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.failover(ctx, resourceGroupName, namespaceName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NamespacesClientFailoverResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[NamespacesClientFailoverResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Failover - GeoDR Failover +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-05-01-preview +func (client *NamespacesClient) failover(ctx context.Context, resourceGroupName string, namespaceName string, parameters FailOver, options *NamespacesClientBeginFailoverOptions) (*http.Response, error) { + var err error + const operationName = "NamespacesClient.BeginFailover" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.failoverCreateRequest(ctx, resourceGroupName, namespaceName, parameters, 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.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// failoverCreateRequest creates the Failover request. +func (client *NamespacesClient) failoverCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, parameters FailOver, options *NamespacesClientBeginFailoverOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/failover" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } return req, nil } // Get - Gets the description of the specified namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - options - NamespacesClientGetOptions contains the optional parameters for the NamespacesClient.Get method. @@ -512,7 +595,7 @@ func (client *NamespacesClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -530,7 +613,7 @@ func (client *NamespacesClient) getHandleResponse(resp *http.Response) (Namespac // GetAuthorizationRule - Gets an AuthorizationRule for a Namespace by rule name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - authorizationRuleName - The authorization rule name. @@ -582,7 +665,7 @@ func (client *NamespacesClient) getAuthorizationRuleCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -600,7 +683,7 @@ func (client *NamespacesClient) getAuthorizationRuleHandleResponse(resp *http.Re // GetNetworkRuleSet - Gets NetworkRuleSet for a Namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - options - NamespacesClientGetNetworkRuleSetOptions contains the optional parameters for the NamespacesClient.GetNetworkRuleSet @@ -647,7 +730,7 @@ func (client *NamespacesClient) getNetworkRuleSetCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -664,7 +747,7 @@ func (client *NamespacesClient) getNetworkRuleSetHandleResponse(resp *http.Respo // NewListPager - Lists all the available Namespaces within a subscription, irrespective of the resource groups. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - options - NamespacesClientListOptions contains the optional parameters for the NamespacesClient.NewListPager method. func (client *NamespacesClient) NewListPager(options *NamespacesClientListOptions) *runtime.Pager[NamespacesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[NamespacesClientListResponse]{ @@ -701,7 +784,7 @@ func (client *NamespacesClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -718,7 +801,7 @@ func (client *NamespacesClient) listHandleResponse(resp *http.Response) (Namespa // NewListAuthorizationRulesPager - Gets a list of authorization rules for a Namespace. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - options - NamespacesClientListAuthorizationRulesOptions contains the optional parameters for the NamespacesClient.NewListAuthorizationRulesPager @@ -766,7 +849,7 @@ func (client *NamespacesClient) listAuthorizationRulesCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -783,7 +866,7 @@ func (client *NamespacesClient) listAuthorizationRulesHandleResponse(resp *http. // NewListByResourceGroupPager - Lists the available Namespaces within a resource group. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - options - NamespacesClientListByResourceGroupOptions contains the optional parameters for the NamespacesClient.NewListByResourceGroupPager // method. @@ -826,7 +909,7 @@ func (client *NamespacesClient) listByResourceGroupCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -844,7 +927,7 @@ func (client *NamespacesClient) listByResourceGroupHandleResponse(resp *http.Res // ListKeys - Gets the primary and secondary connection strings for the Namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - authorizationRuleName - The authorization rule name. @@ -895,7 +978,7 @@ func (client *NamespacesClient) listKeysCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -913,7 +996,7 @@ func (client *NamespacesClient) listKeysHandleResponse(resp *http.Response) (Nam // ListNetworkRuleSet - Gets NetworkRuleSet for a Namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - options - NamespacesClientListNetworkRuleSetOptions contains the optional parameters for the NamespacesClient.ListNetworkRuleSet @@ -960,7 +1043,7 @@ func (client *NamespacesClient) listNetworkRuleSetCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -978,7 +1061,7 @@ func (client *NamespacesClient) listNetworkRuleSetHandleResponse(resp *http.Resp // RegenerateKeys - Regenerates the primary or secondary connection strings for the specified Namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - authorizationRuleName - The authorization rule name. @@ -1031,7 +1114,7 @@ func (client *NamespacesClient) regenerateKeysCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -1053,7 +1136,7 @@ func (client *NamespacesClient) regenerateKeysHandleResponse(resp *http.Response // is idempotent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - parameters - Parameters for updating a namespace resource. @@ -1100,7 +1183,7 @@ func (client *NamespacesClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/eventhub/armeventhub/namespaces_client_example_test.go b/sdk/resourcemanager/eventhub/armeventhub/namespaces_client_example_test.go deleted file mode 100644 index f0b33097ff47..000000000000 --- a/sdk/resourcemanager/eventhub/armeventhub/namespaces_client_example_test.go +++ /dev/null @@ -1,938 +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 armeventhub_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/eventhub/armeventhub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/EHNameSpaceList.json -func ExampleNamespacesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewNamespacesClient().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.EHNamespaceListResult = armeventhub.EHNamespaceListResult{ - // Value: []*armeventhub.EHNamespace{ - // { - // Name: to.Ptr("NamespaceSample"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces"), - // ID: to.Ptr("/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.EventHub/namespaces/NamespaceSample"), - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // }, - // Identity: &armeventhub.Identity{ - // Type: to.Ptr(armeventhub.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("PrincipalIdGUID"), - // TenantID: to.Ptr("TenantIdGUID"), - // UserAssignedIdentities: map[string]*armeventhub.UserAssignedIdentity{ - // "/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud1": &armeventhub.UserAssignedIdentity{ - // ClientID: to.Ptr("ClientIdGUID"), - // PrincipalID: to.Ptr("PrincipalIdGUID"), - // }, - // "/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud2": &armeventhub.UserAssignedIdentity{ - // ClientID: to.Ptr("6a35400f-6ccb-4817-8f1a-ce19ea4523bc"), - // PrincipalID: to.Ptr("ce2d5953-5c15-40ca-9d51-cc3f4a63b0f5"), - // }, - // }, - // }, - // Properties: &armeventhub.EHNamespaceProperties{ - // ClusterArmID: to.Ptr("/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.EventHub/clusters/enc-test"), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-30T00:28:38.963Z"); return t}()), - // DisableLocalAuth: to.Ptr(false), - // Encryption: &armeventhub.Encryption{ - // KeySource: to.Ptr("Microsoft.KeyVault"), - // KeyVaultProperties: []*armeventhub.KeyVaultProperties{ - // { - // Identity: &armeventhub.UserAssignedIdentityProperties{ - // UserAssignedIdentity: to.Ptr("/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud1"), - // }, - // KeyName: to.Ptr("Samplekey"), - // KeyVaultURI: to.Ptr("https://sample-keyvault-user.vault-int.azure-int.net"), - // KeyVersion: to.Ptr(""), - // }}, - // RequireInfrastructureEncryption: to.Ptr(false), - // }, - // IsAutoInflateEnabled: to.Ptr(false), - // MaximumThroughputUnits: to.Ptr[int32](0), - // MetricID: to.Ptr("MetricGUID:NamespaceSample"), - // MinimumTLSVersion: to.Ptr(armeventhub.TLSVersionOne2), - // ProvisioningState: to.Ptr("Succeeded"), - // ServiceBusEndpoint: to.Ptr("https://NamespaceSample.servicebus.windows-int.net:443/"), - // UpdatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-30T00:30:55.143Z"); return t}()), - // ZoneRedundant: to.Ptr(false), - // }, - // SKU: &armeventhub.SKU{ - // Name: to.Ptr(armeventhub.SKUNameStandard), - // Capacity: to.Ptr[int32](0), - // Tier: to.Ptr(armeventhub.SKUTierStandard), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/EHNameSpaceListByResourceGroup.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 := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewNamespacesClient().NewListByResourceGroupPager("ResurceGroupSample", 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.EHNamespaceListResult = armeventhub.EHNamespaceListResult{ - // Value: []*armeventhub.EHNamespace{ - // { - // Name: to.Ptr("NamespaceSample"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces"), - // ID: to.Ptr("/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.EventHub/namespaces/NamespaceSample"), - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // }, - // Identity: &armeventhub.Identity{ - // Type: to.Ptr(armeventhub.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("PrincipalIdGUID"), - // TenantID: to.Ptr("TenantIdGUID"), - // UserAssignedIdentities: map[string]*armeventhub.UserAssignedIdentity{ - // "/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud1": &armeventhub.UserAssignedIdentity{ - // ClientID: to.Ptr("ClientIdGUID"), - // PrincipalID: to.Ptr("PrincipalIdGUID"), - // }, - // "/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud2": &armeventhub.UserAssignedIdentity{ - // ClientID: to.Ptr("6a35400f-6ccb-4817-8f1a-ce19ea4523bc"), - // PrincipalID: to.Ptr("ce2d5953-5c15-40ca-9d51-cc3f4a63b0f5"), - // }, - // }, - // }, - // Properties: &armeventhub.EHNamespaceProperties{ - // ClusterArmID: to.Ptr("/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.EventHub/clusters/enc-test"), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-30T00:28:38.963Z"); return t}()), - // DisableLocalAuth: to.Ptr(false), - // Encryption: &armeventhub.Encryption{ - // KeySource: to.Ptr("Microsoft.KeyVault"), - // KeyVaultProperties: []*armeventhub.KeyVaultProperties{ - // { - // Identity: &armeventhub.UserAssignedIdentityProperties{ - // UserAssignedIdentity: to.Ptr("/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud1"), - // }, - // KeyName: to.Ptr("Samplekey"), - // KeyVaultURI: to.Ptr("https://sample-keyvault-user.vault-int.azure-int.net"), - // KeyVersion: to.Ptr(""), - // }}, - // RequireInfrastructureEncryption: to.Ptr(false), - // }, - // IsAutoInflateEnabled: to.Ptr(false), - // MaximumThroughputUnits: to.Ptr[int32](0), - // MetricID: to.Ptr("MetricGUID:NamespaceSample"), - // ProvisioningState: to.Ptr("Succeeded"), - // ServiceBusEndpoint: to.Ptr("https://NamespaceSample.servicebus.windows-int.net:443/"), - // UpdatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-30T00:30:55.143Z"); return t}()), - // ZoneRedundant: to.Ptr(false), - // }, - // SKU: &armeventhub.SKU{ - // Name: to.Ptr(armeventhub.SKUNameStandard), - // Capacity: to.Ptr[int32](1), - // Tier: to.Ptr(armeventhub.SKUTierStandard), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/EHNameSpaceCreate.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 := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNamespacesClient().BeginCreateOrUpdate(ctx, "ResurceGroupSample", "NamespaceSample", armeventhub.EHNamespace{ - Location: to.Ptr("East US"), - Identity: &armeventhub.Identity{ - Type: to.Ptr(armeventhub.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - UserAssignedIdentities: map[string]*armeventhub.UserAssignedIdentity{ - "/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud1": {}, - "/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud2": {}, - }, - }, - Properties: &armeventhub.EHNamespaceProperties{ - ClusterArmID: to.Ptr("/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.EventHub/clusters/enc-test"), - Encryption: &armeventhub.Encryption{ - KeySource: to.Ptr("Microsoft.KeyVault"), - KeyVaultProperties: []*armeventhub.KeyVaultProperties{ - { - Identity: &armeventhub.UserAssignedIdentityProperties{ - UserAssignedIdentity: to.Ptr("/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud1"), - }, - KeyName: to.Ptr("Samplekey"), - KeyVaultURI: to.Ptr("https://aprao-keyvault-user.vault-int.azure-int.net/"), - }}, - }, - }, - }, 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.EHNamespace = armeventhub.EHNamespace{ - // Name: to.Ptr("NamespaceSample"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces"), - // ID: to.Ptr("/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.EventHub/namespaces/NamespaceSample"), - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // }, - // Identity: &armeventhub.Identity{ - // Type: to.Ptr(armeventhub.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("PrincipalIdGUID"), - // TenantID: to.Ptr("TenantIdGUID"), - // UserAssignedIdentities: map[string]*armeventhub.UserAssignedIdentity{ - // "/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud1": &armeventhub.UserAssignedIdentity{ - // ClientID: to.Ptr("ClientIdGUID"), - // PrincipalID: to.Ptr("PrincipalIdGUID"), - // }, - // "/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud2": &armeventhub.UserAssignedIdentity{ - // ClientID: to.Ptr("6a35400f-6ccb-4817-8f1a-ce19ea4523bc"), - // PrincipalID: to.Ptr("ce2d5953-5c15-40ca-9d51-cc3f4a63b0f5"), - // }, - // }, - // }, - // Properties: &armeventhub.EHNamespaceProperties{ - // ClusterArmID: to.Ptr("/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.EventHub/clusters/enc-test"), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-02-16T22:36:06.107Z"); return t}()), - // DisableLocalAuth: to.Ptr(false), - // Encryption: &armeventhub.Encryption{ - // KeySource: to.Ptr("Microsoft.KeyVault"), - // KeyVaultProperties: []*armeventhub.KeyVaultProperties{ - // { - // Identity: &armeventhub.UserAssignedIdentityProperties{ - // UserAssignedIdentity: to.Ptr("/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud1"), - // }, - // KeyName: to.Ptr("Samplekey"), - // KeyVaultURI: to.Ptr("https://sample-keyvault-user.vault-int.azure-int.net"), - // KeyVersion: to.Ptr(""), - // }}, - // RequireInfrastructureEncryption: to.Ptr(false), - // }, - // IsAutoInflateEnabled: to.Ptr(false), - // KafkaEnabled: to.Ptr(false), - // MaximumThroughputUnits: to.Ptr[int32](0), - // MetricID: to.Ptr("MetricGUID:NamespaceSample"), - // MinimumTLSVersion: to.Ptr(armeventhub.TLSVersionOne2), - // ProvisioningState: to.Ptr("Succeeded"), - // ServiceBusEndpoint: to.Ptr("https://NamespaceSample.servicebus.windows-int.net:443/"), - // UpdatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-02-16T22:37:42.290Z"); return t}()), - // ZoneRedundant: to.Ptr(false), - // }, - // SKU: &armeventhub.SKU{ - // Name: to.Ptr(armeventhub.SKUNameStandard), - // Capacity: to.Ptr[int32](1), - // Tier: to.Ptr(armeventhub.SKUTierStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/EHNameSpaceDelete.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 := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNamespacesClient().BeginDelete(ctx, "ResurceGroupSample", "NamespaceSample", 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/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/EHNameSpaceGet.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 := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNamespacesClient().Get(ctx, "ResurceGroupSample", "NamespaceSample", 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.EHNamespace = armeventhub.EHNamespace{ - // Name: to.Ptr("NamespaceSample"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces"), - // ID: to.Ptr("/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.EventHub/namespaces/NamespaceSample"), - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // }, - // Identity: &armeventhub.Identity{ - // Type: to.Ptr(armeventhub.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("PrincipalIdGUID"), - // TenantID: to.Ptr("TenantIdGUID"), - // UserAssignedIdentities: map[string]*armeventhub.UserAssignedIdentity{ - // "/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud1": &armeventhub.UserAssignedIdentity{ - // ClientID: to.Ptr("ClientIdGUID"), - // PrincipalID: to.Ptr("PrincipalIdGUID"), - // }, - // "/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud2": &armeventhub.UserAssignedIdentity{ - // ClientID: to.Ptr("6a35400f-6ccb-4817-8f1a-ce19ea4523bc"), - // PrincipalID: to.Ptr("ce2d5953-5c15-40ca-9d51-cc3f4a63b0f5"), - // }, - // }, - // }, - // Properties: &armeventhub.EHNamespaceProperties{ - // ClusterArmID: to.Ptr("/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.EventHub/clusters/enc-test"), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-30T00:28:38.963Z"); return t}()), - // DisableLocalAuth: to.Ptr(false), - // Encryption: &armeventhub.Encryption{ - // KeySource: to.Ptr("Microsoft.KeyVault"), - // KeyVaultProperties: []*armeventhub.KeyVaultProperties{ - // { - // Identity: &armeventhub.UserAssignedIdentityProperties{ - // UserAssignedIdentity: to.Ptr("/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud1"), - // }, - // KeyName: to.Ptr("Samplekey"), - // KeyVaultURI: to.Ptr("https://sample-keyvault-user.vault-int.azure-int.net"), - // KeyVersion: to.Ptr(""), - // }}, - // RequireInfrastructureEncryption: to.Ptr(false), - // }, - // IsAutoInflateEnabled: to.Ptr(false), - // MaximumThroughputUnits: to.Ptr[int32](0), - // MetricID: to.Ptr("MetricGUID:NamespaceSample"), - // MinimumTLSVersion: to.Ptr(armeventhub.TLSVersionOne2), - // PrivateEndpointConnections: []*armeventhub.PrivateEndpointConnection{ - // { - // Name: to.Ptr("privateEndpointConnectionName"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.EventHub/namespaces/NamespaceSample/privateEndpointConnections/privateEndpointConnectionName"), - // Properties: &armeventhub.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armeventhub.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.Network/privateEndpoints/NamespaceSample"), - // }, - // PrivateLinkServiceConnectionState: &armeventhub.ConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // Status: to.Ptr(armeventhub.PrivateLinkConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armeventhub.EndPointProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // ServiceBusEndpoint: to.Ptr("https://NamespaceSample.servicebus.windows-int.net:443"), - // UpdatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-30T00:30:55.143Z"); return t}()), - // ZoneRedundant: to.Ptr(false), - // }, - // SKU: &armeventhub.SKU{ - // Name: to.Ptr(armeventhub.SKUNameStandard), - // Capacity: to.Ptr[int32](1), - // Tier: to.Ptr(armeventhub.SKUTierStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/EHNameSpaceUpdate.json -func ExampleNamespacesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNamespacesClient().Update(ctx, "ResurceGroupSample", "NamespaceSample", armeventhub.EHNamespace{ - Location: to.Ptr("East US"), - Identity: &armeventhub.Identity{ - Type: to.Ptr(armeventhub.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - UserAssignedIdentities: map[string]*armeventhub.UserAssignedIdentity{ - "/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud2": nil, - }, - }, - }, 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.EHNamespace = armeventhub.EHNamespace{ - // Name: to.Ptr("NamespaceSample"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces"), - // ID: to.Ptr("/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.EventHub/namespaces/NamespaceSample"), - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // }, - // Identity: &armeventhub.Identity{ - // Type: to.Ptr(armeventhub.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("PrincipalIdGUID"), - // TenantID: to.Ptr("TenantIdGUID"), - // UserAssignedIdentities: map[string]*armeventhub.UserAssignedIdentity{ - // "/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud1": &armeventhub.UserAssignedIdentity{ - // ClientID: to.Ptr("ClientIdGUID"), - // PrincipalID: to.Ptr("PrincipalIdGUID"), - // }, - // }, - // }, - // Properties: &armeventhub.EHNamespaceProperties{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-30T00:28:38.963Z"); return t}()), - // DisableLocalAuth: to.Ptr(false), - // Encryption: &armeventhub.Encryption{ - // KeySource: to.Ptr("Microsoft.KeyVault"), - // KeyVaultProperties: []*armeventhub.KeyVaultProperties{ - // { - // Identity: &armeventhub.UserAssignedIdentityProperties{ - // UserAssignedIdentity: to.Ptr("/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud1"), - // }, - // KeyName: to.Ptr("Samplekey"), - // KeyVaultURI: to.Ptr("https://sample-keyvault-user.vault-int.azure-int.net"), - // KeyVersion: to.Ptr(""), - // }}, - // RequireInfrastructureEncryption: to.Ptr(false), - // }, - // IsAutoInflateEnabled: to.Ptr(false), - // MaximumThroughputUnits: to.Ptr[int32](0), - // MetricID: to.Ptr("MetricGUID:NamespaceSample"), - // MinimumTLSVersion: to.Ptr(armeventhub.TLSVersionOne1), - // ProvisioningState: to.Ptr("Succeeded"), - // ServiceBusEndpoint: to.Ptr("https://NamespaceSample.servicebus.windows-int.net:443/"), - // UpdatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-30T00:31:13.657Z"); return t}()), - // ZoneRedundant: to.Ptr(false), - // }, - // SKU: &armeventhub.SKU{ - // Name: to.Ptr(armeventhub.SKUNameStandard), - // Capacity: to.Ptr[int32](1), - // Tier: to.Ptr(armeventhub.SKUTierStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/VirtualNetworkRule/EHNetworkRuleSetCreate.json -func ExampleNamespacesClient_CreateOrUpdateNetworkRuleSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNamespacesClient().CreateOrUpdateNetworkRuleSet(ctx, "ResourceGroup", "sdk-Namespace-6019", armeventhub.NetworkRuleSet{ - Properties: &armeventhub.NetworkRuleSetProperties{ - DefaultAction: to.Ptr(armeventhub.DefaultActionDeny), - IPRules: []*armeventhub.NWRuleSetIPRules{ - { - Action: to.Ptr(armeventhub.NetworkRuleIPActionAllow), - IPMask: to.Ptr("1.1.1.1"), - }, - { - Action: to.Ptr(armeventhub.NetworkRuleIPActionAllow), - IPMask: to.Ptr("1.1.1.2"), - }, - { - Action: to.Ptr(armeventhub.NetworkRuleIPActionAllow), - IPMask: to.Ptr("1.1.1.3"), - }, - { - Action: to.Ptr(armeventhub.NetworkRuleIPActionAllow), - IPMask: to.Ptr("1.1.1.4"), - }, - { - Action: to.Ptr(armeventhub.NetworkRuleIPActionAllow), - IPMask: to.Ptr("1.1.1.5"), - }}, - VirtualNetworkRules: []*armeventhub.NWRuleSetVirtualNetworkRules{ - { - IgnoreMissingVnetServiceEndpoint: to.Ptr(true), - Subnet: &armeventhub.Subnet{ - ID: to.Ptr("/subscriptions/subscriptionid/resourcegroups/resourcegroupid/providers/Microsoft.Network/virtualNetworks/myvn/subnets/subnet2"), - }, - }, - { - IgnoreMissingVnetServiceEndpoint: to.Ptr(false), - Subnet: &armeventhub.Subnet{ - ID: to.Ptr("/subscriptions/subscriptionid/resourcegroups/resourcegroupid/providers/Microsoft.Network/virtualNetworks/myvn/subnets/subnet3"), - }, - }, - { - IgnoreMissingVnetServiceEndpoint: to.Ptr(false), - Subnet: &armeventhub.Subnet{ - ID: to.Ptr("/subscriptions/subscriptionid/resourcegroups/resourcegroupid/providers/Microsoft.Network/virtualNetworks/myvn/subnets/subnet6"), - }, - }}, - }, - }, 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.NetworkRuleSet = armeventhub.NetworkRuleSet{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/NetworkRuleSet"), - // ID: to.Ptr("/subscriptions/854d368f-1828-428f-8f3c-f2affa9b2f7d/resourceGroups/resourcegroupid/providers/Microsoft.EventHub/namespaces/sdk-Namespace-9659/networkruleset/default"), - // Properties: &armeventhub.NetworkRuleSetProperties{ - // DefaultAction: to.Ptr(armeventhub.DefaultActionDeny), - // IPRules: []*armeventhub.NWRuleSetIPRules{ - // { - // Action: to.Ptr(armeventhub.NetworkRuleIPActionAllow), - // IPMask: to.Ptr("1.1.1.1"), - // }, - // { - // Action: to.Ptr(armeventhub.NetworkRuleIPActionAllow), - // IPMask: to.Ptr("1.1.1.2"), - // }, - // { - // Action: to.Ptr(armeventhub.NetworkRuleIPActionAllow), - // IPMask: to.Ptr("1.1.1.3"), - // }, - // { - // Action: to.Ptr(armeventhub.NetworkRuleIPActionAllow), - // IPMask: to.Ptr("1.1.1.4"), - // }, - // { - // Action: to.Ptr(armeventhub.NetworkRuleIPActionAllow), - // IPMask: to.Ptr("1.1.1.5"), - // }}, - // VirtualNetworkRules: []*armeventhub.NWRuleSetVirtualNetworkRules{ - // { - // IgnoreMissingVnetServiceEndpoint: to.Ptr(true), - // Subnet: &armeventhub.Subnet{ - // ID: to.Ptr("/subscriptions/subscriptionid/resourcegroups/resourcegroupid/providers/Microsoft.Network/virtualNetworks/myvn/subnets/subnet2"), - // }, - // }, - // { - // IgnoreMissingVnetServiceEndpoint: to.Ptr(false), - // Subnet: &armeventhub.Subnet{ - // ID: to.Ptr("/subscriptions/subscriptionid/resourcegroups/resourcegroupid/providers/Microsoft.Network/virtualNetworks/myvn/subnets/subnet3"), - // }, - // }, - // { - // IgnoreMissingVnetServiceEndpoint: to.Ptr(false), - // Subnet: &armeventhub.Subnet{ - // ID: to.Ptr("/subscriptions/subscriptionid/resourcegroups/resourcegroupid/providers/Microsoft.Network/virtualNetworks/myvn/subnets/subnet6"), - // }, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/VirtualNetworkRule/EHNetworkRuleSetGet.json -func ExampleNamespacesClient_GetNetworkRuleSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNamespacesClient().GetNetworkRuleSet(ctx, "ResourceGroup", "sdk-Namespace-6019", 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.NetworkRuleSet = armeventhub.NetworkRuleSet{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/NetworkRuleSet"), - // ID: to.Ptr("/subscriptions/subscriptionid/resourceGroups/resourcegroupid/providers/Microsoft.EventHub/namespaces/sdk-Namespace-9659/networkruleset/default"), - // Properties: &armeventhub.NetworkRuleSetProperties{ - // DefaultAction: to.Ptr(armeventhub.DefaultActionDeny), - // IPRules: []*armeventhub.NWRuleSetIPRules{ - // { - // Action: to.Ptr(armeventhub.NetworkRuleIPActionAllow), - // IPMask: to.Ptr("1.1.1.1"), - // }, - // { - // Action: to.Ptr(armeventhub.NetworkRuleIPActionAllow), - // IPMask: to.Ptr("1.1.1.2"), - // }, - // { - // Action: to.Ptr(armeventhub.NetworkRuleIPActionAllow), - // IPMask: to.Ptr("1.1.1.3"), - // }, - // { - // Action: to.Ptr(armeventhub.NetworkRuleIPActionAllow), - // IPMask: to.Ptr("1.1.1.4"), - // }, - // { - // Action: to.Ptr(armeventhub.NetworkRuleIPActionAllow), - // IPMask: to.Ptr("1.1.1.5"), - // }}, - // VirtualNetworkRules: []*armeventhub.NWRuleSetVirtualNetworkRules{ - // { - // IgnoreMissingVnetServiceEndpoint: to.Ptr(true), - // Subnet: &armeventhub.Subnet{ - // ID: to.Ptr("/subscriptions/subscriptionid/resourcegroups/resourcegroupid/providers/Microsoft.Network/virtualNetworks/myvn/subnets/subnet2"), - // }, - // }, - // { - // IgnoreMissingVnetServiceEndpoint: to.Ptr(false), - // Subnet: &armeventhub.Subnet{ - // ID: to.Ptr("/subscriptions/subscriptionid/resourcegroups/resourcegroupid/providers/Microsoft.Network/virtualNetworks/myvn/subnets/subnet3"), - // }, - // }, - // { - // IgnoreMissingVnetServiceEndpoint: to.Ptr(false), - // Subnet: &armeventhub.Subnet{ - // ID: to.Ptr("/subscriptions/subscriptionid/resourcegroups/resourcegroupid/providers/Microsoft.Network/virtualNetworks/myvn/subnets/subnet6"), - // }, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/VirtualNetworkRule/EHNetworkRuleSetList.json -func ExampleNamespacesClient_ListNetworkRuleSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNamespacesClient().ListNetworkRuleSet(ctx, "ResourceGroup", "sdk-Namespace-6019", 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.NetworkRuleSetListResult = armeventhub.NetworkRuleSetListResult{ - // Value: []*armeventhub.NetworkRuleSet{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/NetworkRuleSet"), - // ID: to.Ptr("/subscriptions/subscriptionid/resourceGroups/resourcegroupid/providers/Microsoft.EventHub/namespaces/sdk-Namespace-9659/networkruleset/default"), - // Properties: &armeventhub.NetworkRuleSetProperties{ - // DefaultAction: to.Ptr(armeventhub.DefaultActionDeny), - // IPRules: []*armeventhub.NWRuleSetIPRules{ - // { - // Action: to.Ptr(armeventhub.NetworkRuleIPActionAllow), - // IPMask: to.Ptr("1.1.1.1"), - // }, - // { - // Action: to.Ptr(armeventhub.NetworkRuleIPActionAllow), - // IPMask: to.Ptr("1.1.1.2"), - // }, - // { - // Action: to.Ptr(armeventhub.NetworkRuleIPActionAllow), - // IPMask: to.Ptr("1.1.1.3"), - // }, - // { - // Action: to.Ptr(armeventhub.NetworkRuleIPActionAllow), - // IPMask: to.Ptr("1.1.1.4"), - // }, - // { - // Action: to.Ptr(armeventhub.NetworkRuleIPActionAllow), - // IPMask: to.Ptr("1.1.1.5"), - // }}, - // VirtualNetworkRules: []*armeventhub.NWRuleSetVirtualNetworkRules{ - // { - // IgnoreMissingVnetServiceEndpoint: to.Ptr(true), - // Subnet: &armeventhub.Subnet{ - // ID: to.Ptr("/subscriptions/subscriptionid/resourcegroups/resourcegroupid/providers/Microsoft.Network/virtualNetworks/myvn/subnets/subnet2"), - // }, - // }, - // { - // IgnoreMissingVnetServiceEndpoint: to.Ptr(false), - // Subnet: &armeventhub.Subnet{ - // ID: to.Ptr("/subscriptions/subscriptionid/resourcegroups/resourcegroupid/providers/Microsoft.Network/virtualNetworks/myvn/subnets/subnet3"), - // }, - // }, - // { - // IgnoreMissingVnetServiceEndpoint: to.Ptr(false), - // Subnet: &armeventhub.Subnet{ - // ID: to.Ptr("/subscriptions/subscriptionid/resourcegroups/resourcegroupid/providers/Microsoft.Network/virtualNetworks/myvn/subnets/subnet6"), - // }, - // }}, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/EHNameSpaceAuthorizationRuleListAll.json -func ExampleNamespacesClient_NewListAuthorizationRulesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewNamespacesClient().NewListAuthorizationRulesPager("ArunMonocle", "sdk-Namespace-2702", 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.AuthorizationRuleListResult = armeventhub.AuthorizationRuleListResult{ - // Value: []*armeventhub.AuthorizationRule{ - // { - // Name: to.Ptr("RootManageSharedAccessKey"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/AuthorizationRules"), - // ID: to.Ptr("/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.EventHub/namespaces/sdk-Namespace-2702/AuthorizationRules?api-version=2017-04-01/RootManageSharedAccessKey"), - // Properties: &armeventhub.AuthorizationRuleProperties{ - // Rights: []*armeventhub.AccessRights{ - // to.Ptr(armeventhub.AccessRightsListen), - // to.Ptr(armeventhub.AccessRightsManage), - // to.Ptr(armeventhub.AccessRightsSend)}, - // }, - // }, - // { - // Name: to.Ptr("sdk-Authrules-1746"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/AuthorizationRules"), - // ID: to.Ptr("/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.EventHub/namespaces/sdk-Namespace-2702/AuthorizationRules?api-version=2017-04-01/sdk-Authrules-1746"), - // Properties: &armeventhub.AuthorizationRuleProperties{ - // Rights: []*armeventhub.AccessRights{ - // to.Ptr(armeventhub.AccessRightsListen), - // to.Ptr(armeventhub.AccessRightsSend)}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/EHNameSpaceAuthorizationRuleCreate.json -func ExampleNamespacesClient_CreateOrUpdateAuthorizationRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNamespacesClient().CreateOrUpdateAuthorizationRule(ctx, "ArunMonocle", "sdk-Namespace-2702", "sdk-Authrules-1746", armeventhub.AuthorizationRule{ - Properties: &armeventhub.AuthorizationRuleProperties{ - Rights: []*armeventhub.AccessRights{ - to.Ptr(armeventhub.AccessRightsListen), - to.Ptr(armeventhub.AccessRightsSend)}, - }, - }, 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.AuthorizationRule = armeventhub.AuthorizationRule{ - // Name: to.Ptr("sdk-Authrules-1746"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/AuthorizationRules"), - // ID: to.Ptr("/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.EventHub/namespaces/sdk-Namespace-2702/AuthorizationRules/sdk-Authrules-1746"), - // Properties: &armeventhub.AuthorizationRuleProperties{ - // Rights: []*armeventhub.AccessRights{ - // to.Ptr(armeventhub.AccessRightsListen), - // to.Ptr(armeventhub.AccessRightsSend)}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/EHNameSpaceAuthorizationRuleDelete.json -func ExampleNamespacesClient_DeleteAuthorizationRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewNamespacesClient().DeleteAuthorizationRule(ctx, "ArunMonocle", "sdk-Namespace-8980", "sdk-Authrules-8929", 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/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/EHNameSpaceAuthorizationRuleGet.json -func ExampleNamespacesClient_GetAuthorizationRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNamespacesClient().GetAuthorizationRule(ctx, "ArunMonocle", "sdk-Namespace-2702", "sdk-Authrules-1746", 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.AuthorizationRule = armeventhub.AuthorizationRule{ - // Name: to.Ptr("sdk-Authrules-1746"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/AuthorizationRules"), - // ID: to.Ptr("/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/ArunMonocle/providers/Microsoft.EventHub/namespaces/sdk-Namespace-2702/AuthorizationRules/sdk-Authrules-1746"), - // Properties: &armeventhub.AuthorizationRuleProperties{ - // Rights: []*armeventhub.AccessRights{ - // to.Ptr(armeventhub.AccessRightsListen), - // to.Ptr(armeventhub.AccessRightsSend)}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/EHNameSpaceAuthorizationRuleListKey.json -func ExampleNamespacesClient_ListKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNamespacesClient().ListKeys(ctx, "ArunMonocle", "sdk-Namespace-2702", "sdk-Authrules-1746", 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.AccessKeys = armeventhub.AccessKeys{ - // KeyName: to.Ptr("sdk-Authrules-1746"), - // PrimaryConnectionString: to.Ptr("Endpoint=sb://sdk-namespace-2702.servicebus.windows-int.net/;SharedAccessKeyName=sdk-Authrules-1746;SharedAccessKey=############################################"), - // PrimaryKey: to.Ptr("############################################"), - // SecondaryConnectionString: to.Ptr("Endpoint=sb://sdk-namespace-2702.servicebus.windows-int.net/;SharedAccessKeyName=sdk-Authrules-1746;SharedAccessKey=############################################"), - // SecondaryKey: to.Ptr("############################################"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/EHNameSpaceAuthorizationRuleRegenerateKey.json -func ExampleNamespacesClient_RegenerateKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNamespacesClient().RegenerateKeys(ctx, "ArunMonocle", "sdk-Namespace-8980", "sdk-Authrules-8929", armeventhub.RegenerateAccessKeyParameters{ - KeyType: to.Ptr(armeventhub.KeyTypePrimaryKey), - }, 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.AccessKeys = armeventhub.AccessKeys{ - // KeyName: to.Ptr("sdk-Authrules-8929"), - // PrimaryConnectionString: to.Ptr("Endpoint=sb://sdk-namespace-8980.servicebus.windows-int.net/;SharedAccessKeyName=sdk-Authrules-8929;SharedAccessKey=############################################"), - // PrimaryKey: to.Ptr("############################################"), - // SecondaryConnectionString: to.Ptr("Endpoint=sb://sdk-namespace-8980.servicebus.windows-int.net/;SharedAccessKeyName=sdk-Authrules-8929;SharedAccessKey=############################################"), - // SecondaryKey: to.Ptr("############################################"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/EHNameSpaceCheckNameAvailability.json -func ExampleNamespacesClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNamespacesClient().CheckNameAvailability(ctx, armeventhub.CheckNameAvailabilityParameter{ - Name: to.Ptr("sdk-Namespace-8458"), - }, 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.CheckNameAvailabilityResult = armeventhub.CheckNameAvailabilityResult{ - // Message: to.Ptr(""), - // NameAvailable: to.Ptr(true), - // Reason: to.Ptr(armeventhub.UnavailableReasonNone), - // } -} diff --git a/sdk/resourcemanager/eventhub/armeventhub/networksecurityperimeterconfiguration_client.go b/sdk/resourcemanager/eventhub/armeventhub/networksecurityperimeterconfiguration_client.go index 44ac62756fb4..b7c9d00f7a35 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/networksecurityperimeterconfiguration_client.go +++ b/sdk/resourcemanager/eventhub/armeventhub/networksecurityperimeterconfiguration_client.go @@ -47,7 +47,7 @@ func NewNetworkSecurityPerimeterConfigurationClient(subscriptionID string, crede // List - Gets list of current NetworkSecurityPerimeterConfiguration for Namespace // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - options - NetworkSecurityPerimeterConfigurationClientListOptions contains the optional parameters for the NetworkSecurityPerimeterConfigurationClient.List @@ -94,7 +94,7 @@ func (client *NetworkSecurityPerimeterConfigurationClient) listCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/eventhub/armeventhub/networksecurityperimeterconfiguration_client_example_test.go b/sdk/resourcemanager/eventhub/armeventhub/networksecurityperimeterconfiguration_client_example_test.go deleted file mode 100644 index afe141803fe4..000000000000 --- a/sdk/resourcemanager/eventhub/armeventhub/networksecurityperimeterconfiguration_client_example_test.go +++ /dev/null @@ -1,71 +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 armeventhub_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventhub/armeventhub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/NetworkSecurityPerimeterConfigurationList.json -func ExampleNetworkSecurityPerimeterConfigurationClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNetworkSecurityPerimeterConfigurationClient().List(ctx, "SDK-EventHub-4794", "sdk-Namespace-5828", 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.NetworkSecurityPerimeterConfigurationList = armeventhub.NetworkSecurityPerimeterConfigurationList{ - // Value: []*armeventhub.NetworkSecurityPerimeterConfiguration{ - // { - // Name: to.Ptr("resourceAssociation1"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/networkSecurityPerimeterConfigurations"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SDK-EventHub-4794/providers/Microsoft.EventHub/namespaces/sdk-Namespace-5705-new/networkSecurityPerimeterConfigurations/resourceAssociation1"), - // Properties: &armeventhub.NetworkSecurityPerimeterConfigurationProperties{ - // NetworkSecurityPerimeter: &armeventhub.NetworkSecurityPerimeter{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SDK-EventHub-4794/providers/Microsoft.Network/networkSecurityPerimeters/nsp1"), - // Location: to.Ptr("East US"), - // PerimeterGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Profile: &armeventhub.NetworkSecurityPerimeterConfigurationPropertiesProfile{ - // Name: to.Ptr("devProfile"), - // AccessRules: []*armeventhub.NspAccessRule{ - // { - // Name: to.Ptr("inVpnRule"), - // Properties: &armeventhub.NspAccessRuleProperties{ - // AddressPrefixes: []*string{ - // to.Ptr("148.0.0.0/8"), - // to.Ptr("152.4.6.0/24")}, - // Direction: to.Ptr(armeventhub.NspAccessRuleDirectionInbound), - // }, - // }}, - // AccessRulesVersion: to.Ptr("10"), - // }, - // ProvisioningState: to.Ptr(armeventhub.NetworkSecurityPerimeterConfigurationProvisioningStateSucceeded), - // ResourceAssociation: &armeventhub.NetworkSecurityPerimeterConfigurationPropertiesResourceAssociation{ - // Name: to.Ptr("association1"), - // }, - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/eventhub/armeventhub/networksecurityperimeterconfigurations_client.go b/sdk/resourcemanager/eventhub/armeventhub/networksecurityperimeterconfigurations_client.go index ec24fc3e6d7a..f188e91a1c76 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/networksecurityperimeterconfigurations_client.go +++ b/sdk/resourcemanager/eventhub/armeventhub/networksecurityperimeterconfigurations_client.go @@ -47,7 +47,7 @@ func NewNetworkSecurityPerimeterConfigurationsClient(subscriptionID string, cred // BeginCreateOrUpdate - Refreshes any information about the association. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - resourceAssociationName - The ResourceAssociation Name @@ -60,7 +60,8 @@ func (client *NetworkSecurityPerimeterConfigurationsClient) BeginCreateOrUpdate( return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NetworkSecurityPerimeterConfigurationsClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -73,7 +74,7 @@ func (client *NetworkSecurityPerimeterConfigurationsClient) BeginCreateOrUpdate( // CreateOrUpdate - Refreshes any information about the association. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview func (client *NetworkSecurityPerimeterConfigurationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, resourceAssociationName string, options *NetworkSecurityPerimeterConfigurationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "NetworkSecurityPerimeterConfigurationsClient.BeginCreateOrUpdate" @@ -119,7 +120,7 @@ func (client *NetworkSecurityPerimeterConfigurationsClient) createOrUpdateCreate return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/eventhub/armeventhub/networksecurityperimeterconfigurations_client_example_test.go b/sdk/resourcemanager/eventhub/armeventhub/networksecurityperimeterconfigurations_client_example_test.go deleted file mode 100644 index a032bf473390..000000000000 --- a/sdk/resourcemanager/eventhub/armeventhub/networksecurityperimeterconfigurations_client_example_test.go +++ /dev/null @@ -1,39 +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 armeventhub_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventhub/armeventhub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/NetworkSecurityPerimeterConfigurationReconcile.json -func ExampleNetworkSecurityPerimeterConfigurationsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNetworkSecurityPerimeterConfigurationsClient().BeginCreateOrUpdate(ctx, "SDK-EventHub-4794", "sdk-Namespace-5828", "resourceAssociation1", 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) - } -} diff --git a/sdk/resourcemanager/eventhub/armeventhub/operations_client.go b/sdk/resourcemanager/eventhub/armeventhub/operations_client.go index dea8216b230f..c8d845a8b2c0 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/operations_client.go +++ b/sdk/resourcemanager/eventhub/armeventhub/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available Event Hub REST API operations. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-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 +72,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/eventhub/armeventhub/operations_client_example_test.go b/sdk/resourcemanager/eventhub/armeventhub/operations_client_example_test.go deleted file mode 100644 index 065152b5d20c..000000000000 --- a/sdk/resourcemanager/eventhub/armeventhub/operations_client_example_test.go +++ /dev/null @@ -1,246 +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 armeventhub_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventhub/armeventhub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/EHOperations_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 := armeventhub.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.OperationListResult = armeventhub.OperationListResult{ - // Value: []*armeventhub.Operation{ - // { - // Name: to.Ptr("Microsoft.EventHub/checkNameAvailability/action"), - // Display: &armeventhub.OperationDisplay{ - // Operation: to.Ptr("Get namespace availability."), - // Provider: to.Ptr("Microsoft Azure EventHub"), - // Resource: to.Ptr("Non Resource Operation"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.EventHub/register/action"), - // Display: &armeventhub.OperationDisplay{ - // Operation: to.Ptr("Registers the EventHub Resource Provider"), - // Provider: to.Ptr("Microsoft Azure EventHub"), - // Resource: to.Ptr("EventHub Resource Provider"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.EventHub/namespaces/write"), - // Display: &armeventhub.OperationDisplay{ - // Operation: to.Ptr("Create Or Update Namespace "), - // Provider: to.Ptr("Microsoft Azure EventHub"), - // Resource: to.Ptr("Namespace"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.EventHub/namespaces/read"), - // Display: &armeventhub.OperationDisplay{ - // Operation: to.Ptr("Get Namespace Resource"), - // Provider: to.Ptr("Microsoft Azure EventHub"), - // Resource: to.Ptr("Namespace"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.EventHub/namespaces/Delete"), - // Display: &armeventhub.OperationDisplay{ - // Operation: to.Ptr("Delete Namespace"), - // Provider: to.Ptr("Microsoft Azure EventHub"), - // Resource: to.Ptr("Namespace"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.EventHub/namespaces/authorizationRules/read"), - // Display: &armeventhub.OperationDisplay{ - // Operation: to.Ptr("Get Namespace Authorization Rules"), - // Provider: to.Ptr("Microsoft Azure EventHub"), - // Resource: to.Ptr("AuthorizationRules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.EventHub/namespaces/authorizationRules/write"), - // Display: &armeventhub.OperationDisplay{ - // Operation: to.Ptr("Create or Update Namespace Authorization Rules"), - // Provider: to.Ptr("Microsoft Azure EventHub"), - // Resource: to.Ptr("AuthorizationRules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.EventHub/namespaces/authorizationRules/delete"), - // Display: &armeventhub.OperationDisplay{ - // Operation: to.Ptr("Delete Namespace Authorization Rule"), - // Provider: to.Ptr("Microsoft Azure EventHub"), - // Resource: to.Ptr("AuthorizationRules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.EventHub/namespaces/authorizationRules/listkeys/action"), - // Display: &armeventhub.OperationDisplay{ - // Operation: to.Ptr("Get Namespace Listkeys"), - // Provider: to.Ptr("Microsoft Azure EventHub"), - // Resource: to.Ptr("AuthorizationRules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.EventHub/namespaces/authorizationRules/regenerateKeys/action"), - // Display: &armeventhub.OperationDisplay{ - // Operation: to.Ptr("Resource Regeneratekeys"), - // Provider: to.Ptr("Microsoft Azure EventHub"), - // Resource: to.Ptr("AuthorizationRules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.EventHub/namespaces/eventhubs/write"), - // Display: &armeventhub.OperationDisplay{ - // Operation: to.Ptr("Create or Update EventHub"), - // Provider: to.Ptr("Microsoft Azure EventHub"), - // Resource: to.Ptr("EventHub"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.EventHub/namespaces/eventhubs/read"), - // Display: &armeventhub.OperationDisplay{ - // Operation: to.Ptr("Get EventHub"), - // Provider: to.Ptr("Microsoft Azure EventHub"), - // Resource: to.Ptr("EventHub"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.EventHub/namespaces/eventhubs/Delete"), - // Display: &armeventhub.OperationDisplay{ - // Operation: to.Ptr("Delete EventHub"), - // Provider: to.Ptr("Microsoft Azure EventHub"), - // Resource: to.Ptr("EventHub"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.EventHub/namespaces/eventhubs/authorizationRules/read"), - // Display: &armeventhub.OperationDisplay{ - // Operation: to.Ptr(" Get EventHub Authorization Rules"), - // Provider: to.Ptr("Microsoft Azure EventHub"), - // Resource: to.Ptr("EventHub AuthorizationRules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.EventHub/namespaces/eventhubs/authorizationRules/write"), - // Display: &armeventhub.OperationDisplay{ - // Operation: to.Ptr("Create or Update EventHub Authorization Rule"), - // Provider: to.Ptr("Microsoft Azure EventHub"), - // Resource: to.Ptr("EventHub AuthorizationRules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.EventHub/namespaces/eventhubs/authorizationRules/delete"), - // Display: &armeventhub.OperationDisplay{ - // Operation: to.Ptr("Delete EventHub Authorization Rules"), - // Provider: to.Ptr("Microsoft Azure EventHub"), - // Resource: to.Ptr("EventHub AuthorizationRules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.EventHub/namespaces/eventhubs/authorizationRules/listkeys/action"), - // Display: &armeventhub.OperationDisplay{ - // Operation: to.Ptr("List EventHub keys"), - // Provider: to.Ptr("Microsoft Azure EventHub"), - // Resource: to.Ptr("EventHub AuthorizationRules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.EventHub/namespaces/eventhubs/authorizationRules/regenerateKeys/action"), - // Display: &armeventhub.OperationDisplay{ - // Operation: to.Ptr("Resource Regeneratekeys"), - // Provider: to.Ptr("Microsoft Azure EventHub"), - // Resource: to.Ptr("EventHub AuthorizationRules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.EventHub/namespaces/eventHubs/consumergroups/write"), - // Display: &armeventhub.OperationDisplay{ - // Operation: to.Ptr("Create or Update ConsumerGroup"), - // Provider: to.Ptr("Microsoft Azure EventHub"), - // Resource: to.Ptr("ConsumerGroup"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.EventHub/namespaces/eventHubs/consumergroups/read"), - // Display: &armeventhub.OperationDisplay{ - // Operation: to.Ptr("Get ConsumerGroup"), - // Provider: to.Ptr("Microsoft Azure EventHub"), - // Resource: to.Ptr("ConsumerGroup"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.EventHub/namespaces/eventHubs/consumergroups/Delete"), - // Display: &armeventhub.OperationDisplay{ - // Operation: to.Ptr("Delete ConsumerGroup"), - // Provider: to.Ptr("Microsoft Azure EventHub"), - // Resource: to.Ptr("ConsumerGroup"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.EventHub/namespaces/metricDefinitions/read"), - // Display: &armeventhub.OperationDisplay{ - // Operation: to.Ptr("Get Namespace metrics"), - // Provider: to.Ptr("Microsoft Azure EventHub"), - // Resource: to.Ptr("Namespace metrics"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.EventHub/namespaces/diagnosticSettings/read"), - // Display: &armeventhub.OperationDisplay{ - // Operation: to.Ptr("Get Namespace diagnostic settings"), - // Provider: to.Ptr("Microsoft Azure EventHub"), - // Resource: to.Ptr("Namespace diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.EventHub/namespaces/diagnosticSettings/write"), - // Display: &armeventhub.OperationDisplay{ - // Operation: to.Ptr("Create or Update Namespace diagnostic settings"), - // Provider: to.Ptr("Microsoft Azure EventHub"), - // Resource: to.Ptr("Namespace diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.EventHub/namespaces/logDefinitions/read"), - // Display: &armeventhub.OperationDisplay{ - // Operation: to.Ptr("Get Namespace logs"), - // Provider: to.Ptr("Microsoft Azure EventHub"), - // Resource: to.Ptr("Namespace logs"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/eventhub/armeventhub/options.go b/sdk/resourcemanager/eventhub/armeventhub/options.go index 84e25bb72342..7fa33c35548a 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/options.go +++ b/sdk/resourcemanager/eventhub/armeventhub/options.go @@ -247,6 +247,12 @@ type NamespacesClientBeginDeleteOptions struct { ResumeToken string } +// NamespacesClientBeginFailoverOptions contains the optional parameters for the NamespacesClient.BeginFailover method. +type NamespacesClientBeginFailoverOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // NamespacesClientCheckNameAvailabilityOptions contains the optional parameters for the NamespacesClient.CheckNameAvailability // method. type NamespacesClientCheckNameAvailabilityOptions struct { diff --git a/sdk/resourcemanager/eventhub/armeventhub/polymorphic_helpers.go b/sdk/resourcemanager/eventhub/armeventhub/polymorphic_helpers.go index 70eeffed1406..a6716720672f 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/polymorphic_helpers.go +++ b/sdk/resourcemanager/eventhub/armeventhub/polymorphic_helpers.go @@ -11,7 +11,7 @@ package armeventhub import "encoding/json" func unmarshalApplicationGroupPolicyClassification(rawMsg json.RawMessage) (ApplicationGroupPolicyClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -32,7 +32,7 @@ func unmarshalApplicationGroupPolicyClassification(rawMsg json.RawMessage) (Appl } func unmarshalApplicationGroupPolicyClassificationArray(rawMsg json.RawMessage) ([]ApplicationGroupPolicyClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var rawMessages []json.RawMessage diff --git a/sdk/resourcemanager/eventhub/armeventhub/privateendpointconnections_client.go b/sdk/resourcemanager/eventhub/armeventhub/privateendpointconnections_client.go index b6005802e28e..58b73003ecc8 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/privateendpointconnections_client.go +++ b/sdk/resourcemanager/eventhub/armeventhub/privateendpointconnections_client.go @@ -47,7 +47,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // CreateOrUpdate - Creates or updates PrivateEndpointConnections of service namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - privateEndpointConnectionName - The PrivateEndpointConnection name @@ -100,7 +100,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -121,7 +121,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateHandleResponse(res // BeginDelete - Deletes an existing namespace. This operation also removes all associated resources under the namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - privateEndpointConnectionName - The PrivateEndpointConnection name @@ -134,7 +134,8 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -147,7 +148,7 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Deletes an existing namespace. This operation also removes all associated resources under the namespace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, namespaceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginDelete" @@ -193,7 +194,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -202,7 +203,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Gets a description for the specified Private Endpoint Connection name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - privateEndpointConnectionName - The PrivateEndpointConnection name @@ -254,7 +255,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -271,7 +272,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListPager - Gets the available PrivateEndpointConnections within a namespace. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager @@ -319,7 +320,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/eventhub/armeventhub/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/eventhub/armeventhub/privateendpointconnections_client_example_test.go deleted file mode 100644 index e89576c0cbd9..000000000000 --- a/sdk/resourcemanager/eventhub/armeventhub/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,164 +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 armeventhub_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/eventhub/armeventhub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/PrivateEndPointConnectionList.json -func ExamplePrivateEndpointConnectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateEndpointConnectionsClient().NewListPager("SDK-EventHub-4794", "sdk-Namespace-5828", 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 = armeventhub.PrivateEndpointConnectionListResult{ - // Value: []*armeventhub.PrivateEndpointConnection{ - // { - // Name: to.Ptr("5dc668b3-70e4-437f-b61c-a3c1e594be7a"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/dbedb4e0-40e6-4145-81f3-f1314c150774/resourceGroups/SDK-EventHub-7182/providers/Microsoft.EventHub/namespaces/sdk-Namespace-5705-new/privateEndpointConnections/5dc668b3-70e4-437f-b61c-a3c1e594be7a"), - // Properties: &armeventhub.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armeventhub.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/dbedb4e0-40e6-4145-81f3-f1314c150774/resourceGroups/SDK-EventHub-7182/providers/Microsoft.Network/privateEndpoints/sdk-Namespace-5705-new"), - // }, - // PrivateLinkServiceConnectionState: &armeventhub.ConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // Status: to.Ptr(armeventhub.PrivateLinkConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armeventhub.EndPointProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/PrivateEndPointConnectionCreate.json -func ExamplePrivateEndpointConnectionsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().CreateOrUpdate(ctx, "ArunMonocle", "sdk-Namespace-2924", "privateEndpointConnectionName", armeventhub.PrivateEndpointConnection{ - Properties: &armeventhub.PrivateEndpointConnectionProperties{ - PrivateEndpoint: &armeventhub.PrivateEndpoint{ - ID: to.Ptr("/subscriptions/dbedb4e0-40e6-4145-81f3-f1314c150774/resourceGroups/SDK-EventHub-8396/providers/Microsoft.Network/privateEndpoints/sdk-Namespace-2847"), - }, - PrivateLinkServiceConnectionState: &armeventhub.ConnectionState{ - Description: to.Ptr("testing"), - Status: to.Ptr(armeventhub.PrivateLinkConnectionStatusRejected), - }, - ProvisioningState: to.Ptr(armeventhub.EndPointProvisioningStateSucceeded), - }, - }, 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 = armeventhub.PrivateEndpointConnection{ - // Name: to.Ptr("928c44d5-b7c6-423b-b6fa-811e0c27b3e0"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/dbedb4e0-40e6-4145-81f3-f1314c150774/resourceGroups/SDK-EventHub-4794/providers/Microsoft.EventHub/namespaces/sdk-Namespace-5828/privateEndpointConnections/928c44d5-b7c6-423b-b6fa-811e0c27b3e0"), - // Properties: &armeventhub.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armeventhub.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/dbedb4e0-40e6-4145-81f3-f1314c150774/resourceGroups/SDK-EventHub-4794/providers/Microsoft.Network/privateEndpoints/sdk-Namespace-5828"), - // }, - // PrivateLinkServiceConnectionState: &armeventhub.ConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // Status: to.Ptr(armeventhub.PrivateLinkConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armeventhub.EndPointProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/PrivateEndPointConnectionDelete.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 := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "ArunMonocle", "sdk-Namespace-3285", "928c44d5-b7c6-423b-b6fa-811e0c27b3e0", 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/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/PrivateEndPointConnectionGet.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 := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "SDK-EventHub-4794", "sdk-Namespace-5828", "privateEndpointConnectionName", 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 = armeventhub.PrivateEndpointConnection{ - // Name: to.Ptr("privateEndpointConnectionName"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/dbedb4e0-40e6-4145-81f3-f1314c150774/resourceGroups/SDK-EventHub-4794/providers/Microsoft.EventHub/namespaces/sdk-Namespace-5828/privateEndpointConnections/privateEndpointConnectionName"), - // Properties: &armeventhub.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armeventhub.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/dbedb4e0-40e6-4145-81f3-f1314c150774/resourceGroups/SDK-EventHub-4794/providers/Microsoft.Network/privateEndpoints/sdk-Namespace-5828"), - // }, - // PrivateLinkServiceConnectionState: &armeventhub.ConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // Status: to.Ptr(armeventhub.PrivateLinkConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armeventhub.EndPointProvisioningStateSucceeded), - // }, - // } -} diff --git a/sdk/resourcemanager/eventhub/armeventhub/privatelinkresources_client.go b/sdk/resourcemanager/eventhub/armeventhub/privatelinkresources_client.go index b953fcb8259f..88dfa15cc436 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/privatelinkresources_client.go +++ b/sdk/resourcemanager/eventhub/armeventhub/privatelinkresources_client.go @@ -47,7 +47,7 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // Get - Gets lists of resources that supports Privatelinks. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - options - PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get @@ -94,7 +94,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/eventhub/armeventhub/privatelinkresources_client_example_test.go b/sdk/resourcemanager/eventhub/armeventhub/privatelinkresources_client_example_test.go deleted file mode 100644 index 7f5d0493596d..000000000000 --- a/sdk/resourcemanager/eventhub/armeventhub/privatelinkresources_client_example_test.go +++ /dev/null @@ -1,53 +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 armeventhub_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventhub/armeventhub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/NameSpaces/PrivateLinkResourcesGet.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 := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourcesClient().Get(ctx, "ArunMonocle", "sdk-Namespace-2924", 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.PrivateLinkResourcesListResult = armeventhub.PrivateLinkResourcesListResult{ - // Value: []*armeventhub.PrivateLinkResource{ - // { - // Name: to.Ptr("namespace"), - // Type: to.Ptr("Microsoft.EventHub/namespaces/privateLinkResources"), - // ID: to.Ptr("subscriptions/subID/resourceGroups/SDK-EventHub-4794/providers/Microsoft.EventHub/namespaces/sdk-Namespace-5828/privateLinkResources/namespace"), - // Properties: &armeventhub.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("namespace"), - // RequiredMembers: []*string{ - // to.Ptr("namespace")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.EventHub.windows.net")}, - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/eventhub/armeventhub/response_types.go b/sdk/resourcemanager/eventhub/armeventhub/responses.go similarity index 98% rename from sdk/resourcemanager/eventhub/armeventhub/response_types.go rename to sdk/resourcemanager/eventhub/armeventhub/responses.go index 5f2597b52eae..0e0a86f5b302 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/response_types.go +++ b/sdk/resourcemanager/eventhub/armeventhub/responses.go @@ -262,6 +262,11 @@ type NamespacesClientDeleteResponse struct { // placeholder for future response values } +// NamespacesClientFailoverResponse contains the response from method NamespacesClient.BeginFailover. +type NamespacesClientFailoverResponse struct { + // placeholder for future response values +} + // NamespacesClientGetAuthorizationRuleResponse contains the response from method NamespacesClient.GetAuthorizationRule. type NamespacesClientGetAuthorizationRuleResponse struct { // Single item in a List or Get AuthorizationRule operation diff --git a/sdk/resourcemanager/eventhub/armeventhub/schemaregistry_client.go b/sdk/resourcemanager/eventhub/armeventhub/schemaregistry_client.go index 509d00e8d2e0..19cc4dad3bb1 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/schemaregistry_client.go +++ b/sdk/resourcemanager/eventhub/armeventhub/schemaregistry_client.go @@ -45,10 +45,10 @@ func NewSchemaRegistryClient(subscriptionID string, credential azcore.TokenCrede return client, nil } -// CreateOrUpdate - +// CreateOrUpdate - Creates or Updates an EventHub schema group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - schemaGroupName - The Schema Group name @@ -101,7 +101,7 @@ func (client *SchemaRegistryClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -119,10 +119,10 @@ func (client *SchemaRegistryClient) createOrUpdateHandleResponse(resp *http.Resp return result, nil } -// Delete - +// Delete - Deletes an EventHub schema group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - schemaGroupName - The Schema Group name @@ -172,16 +172,16 @@ func (client *SchemaRegistryClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// Get - +// Get - Gets the details of an EventHub schema group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - schemaGroupName - The Schema Group name @@ -232,7 +232,7 @@ func (client *SchemaRegistryClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -249,7 +249,7 @@ func (client *SchemaRegistryClient) getHandleResponse(resp *http.Response) (Sche // NewListByNamespacePager - Gets all the Schema Groups in a Namespace. // -// Generated from API version 2022-10-01-preview +// Generated from API version 2024-05-01-preview // - resourceGroupName - Name of the resource group within the azure subscription. // - namespaceName - The Namespace name // - options - SchemaRegistryClientListByNamespaceOptions contains the optional parameters for the SchemaRegistryClient.NewListByNamespacePager @@ -297,13 +297,13 @@ func (client *SchemaRegistryClient) listByNamespaceCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01-preview") if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } + reqQP.Set("api-version", "2024-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/eventhub/armeventhub/schemaregistry_client_example_test.go b/sdk/resourcemanager/eventhub/armeventhub/schemaregistry_client_example_test.go deleted file mode 100644 index d39f719234fa..000000000000 --- a/sdk/resourcemanager/eventhub/armeventhub/schemaregistry_client_example_test.go +++ /dev/null @@ -1,187 +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 armeventhub_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/eventhub/armeventhub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/SchemaRegistry/SchemaRegistryListByNamespace.json -func ExampleSchemaRegistryClient_NewListByNamespacePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSchemaRegistryClient().NewListByNamespacePager("alitest", "ali-ua-test-eh-system-1", &armeventhub.SchemaRegistryClientListByNamespaceOptions{Skip: 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.SchemaGroupListResult = armeventhub.SchemaGroupListResult{ - // Value: []*armeventhub.SchemaGroup{ - // { - // Name: to.Ptr("testSchemaGroup1"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/SchemaGroups"), - // ID: to.Ptr("/subscriptions/e8baea74-64ce-459b-bee3-5aa4c47b3ae3/resourceGroups/alitest/providers/Microsoft.EventHub/namespaces/ali-ua-test-eh-system-1/schemagroups/testSchemaGroup1"), - // Location: to.Ptr("EAST US 2 EUAP"), - // Properties: &armeventhub.SchemaGroupProperties{ - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-13T03:08:11.167Z"); return t}()), - // ETag: to.Ptr("51ddcff4-a287-423c-b194-7a8ebbfd8366"), - // GroupProperties: map[string]*string{ - // }, - // SchemaCompatibility: to.Ptr(armeventhub.SchemaCompatibilityForward), - // SchemaType: to.Ptr(armeventhub.SchemaTypeAvro), - // UpdatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-13T03:08:11.167Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("testSchemaGroup2"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/SchemaGroups"), - // ID: to.Ptr("/subscriptions/e8baea74-64ce-459b-bee3-5aa4c47b3ae3/resourceGroups/alitest/providers/Microsoft.EventHub/namespaces/ali-ua-test-eh-system-1/schemagroups/testSchemaGroup2"), - // Location: to.Ptr("EAST US 2 EUAP"), - // Properties: &armeventhub.SchemaGroupProperties{ - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-13T03:10:33.697Z"); return t}()), - // ETag: to.Ptr("d01173a4-08c5-43c9-b30f-d9666196a907"), - // GroupProperties: map[string]*string{ - // }, - // SchemaCompatibility: to.Ptr(armeventhub.SchemaCompatibilityNone), - // SchemaType: to.Ptr(armeventhub.SchemaTypeAvro), - // UpdatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-13T03:10:33.697Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("testSchemaGroup3"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/SchemaGroups"), - // ID: to.Ptr("/subscriptions/e8baea74-64ce-459b-bee3-5aa4c47b3ae3/resourceGroups/alitest/providers/Microsoft.EventHub/namespaces/ali-ua-test-eh-system-1/schemagroups/testSchemaGroup3"), - // Location: to.Ptr("EAST US 2 EUAP"), - // Properties: &armeventhub.SchemaGroupProperties{ - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-13T03:13:30.893Z"); return t}()), - // ETag: to.Ptr("2c1c3d08-2fb8-4a4e-91f4-6e8b940c1b7c"), - // GroupProperties: map[string]*string{ - // }, - // SchemaCompatibility: to.Ptr(armeventhub.SchemaCompatibilityBackward), - // SchemaType: to.Ptr(armeventhub.SchemaTypeAvro), - // UpdatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-13T03:13:30.893Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/SchemaRegistry/SchemaRegistryCreate.json -func ExampleSchemaRegistryClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSchemaRegistryClient().CreateOrUpdate(ctx, "alitest", "ali-ua-test-eh-system-1", "testSchemaGroup1", armeventhub.SchemaGroup{ - Properties: &armeventhub.SchemaGroupProperties{ - GroupProperties: map[string]*string{}, - SchemaCompatibility: to.Ptr(armeventhub.SchemaCompatibilityForward), - SchemaType: to.Ptr(armeventhub.SchemaTypeAvro), - }, - }, 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.SchemaGroup = armeventhub.SchemaGroup{ - // Name: to.Ptr("testSchemaGroup1"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/SchemaGroups"), - // ID: to.Ptr("/subscriptions/e8baea74-64ce-459b-bee3-5aa4c47b3ae3/resourceGroups/alitest/providers/Microsoft.EventHub/namespaces/ali-ua-test-eh-system-1/schemagroups/testSchemaGroup1"), - // Location: to.Ptr("EAST US 2 EUAP"), - // Properties: &armeventhub.SchemaGroupProperties{ - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-13T03:08:11.167Z"); return t}()), - // ETag: to.Ptr("51ddcff4-a287-423c-b194-7a8ebbfd8366"), - // GroupProperties: map[string]*string{ - // }, - // SchemaCompatibility: to.Ptr(armeventhub.SchemaCompatibilityForward), - // SchemaType: to.Ptr(armeventhub.SchemaTypeAvro), - // UpdatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-13T03:08:11.167Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/SchemaRegistry/SchemaRegistryDelete.json -func ExampleSchemaRegistryClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSchemaRegistryClient().Delete(ctx, "alitest", "ali-ua-test-eh-system-1", "testSchemaGroup1", 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/1f22d4dbd99b0fe347ad79e79d4eb1ed44a87291/specification/eventhub/resource-manager/Microsoft.EventHub/preview/2022-10-01-preview/examples/SchemaRegistry/SchemaRegistryGet.json -func ExampleSchemaRegistryClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armeventhub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSchemaRegistryClient().Get(ctx, "alitest", "ali-ua-test-eh-system-1", "testSchemaGroup1", 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.SchemaGroup = armeventhub.SchemaGroup{ - // Name: to.Ptr("testSchemaGroup1"), - // Type: to.Ptr("Microsoft.EventHub/Namespaces/SchemaGroups"), - // ID: to.Ptr("/subscriptions/e8baea74-64ce-459b-bee3-5aa4c47b3ae3/resourceGroups/alitest/providers/Microsoft.EventHub/namespaces/ali-ua-test-eh-system-1/schemagroups/testSchemaGroup1"), - // Location: to.Ptr("EAST US 2 EUAP"), - // Properties: &armeventhub.SchemaGroupProperties{ - // CreatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-13T03:08:11.167Z"); return t}()), - // ETag: to.Ptr("51ddcff4-a287-423c-b194-7a8ebbfd8366"), - // GroupProperties: map[string]*string{ - // }, - // SchemaCompatibility: to.Ptr(armeventhub.SchemaCompatibilityForward), - // SchemaType: to.Ptr(armeventhub.SchemaTypeAvro), - // UpdatedAtUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-13T03:08:11.167Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/eventhub/armeventhub/time_rfc3339.go b/sdk/resourcemanager/eventhub/armeventhub/time_rfc3339.go index d9611dac386a..e59ea92f1220 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/time_rfc3339.go +++ b/sdk/resourcemanager/eventhub/armeventhub/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339