diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/CHANGELOG.md b/sdk/resourcemanager/hdinsight/armhdinsight/CHANGELOG.md index 21b1b8c6e273..7bfb8a67c2f9 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/CHANGELOG.md +++ b/sdk/resourcemanager/hdinsight/armhdinsight/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 1.3.0-beta.1 (2023-11-30) +### Features Added + +- New field `EnableSecureChannel` in struct `StorageAccount` + + ## 1.2.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/applications_client.go b/sdk/resourcemanager/hdinsight/armhdinsight/applications_client.go index 0f5e18a33d30..674acc429e69 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/applications_client.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/applications_client.go @@ -47,7 +47,7 @@ func NewApplicationsClient(subscriptionID string, credential azcore.TokenCredent // BeginCreate - Creates applications for the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - applicationName - The constant value for the application name. @@ -75,7 +75,7 @@ func (client *ApplicationsClient) BeginCreate(ctx context.Context, resourceGroup // Create - Creates applications for the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview func (client *ApplicationsClient) create(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, parameters Application, options *ApplicationsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "ApplicationsClient.BeginCreate" @@ -121,7 +121,7 @@ func (client *ApplicationsClient) createCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -133,7 +133,7 @@ func (client *ApplicationsClient) createCreateRequest(ctx context.Context, resou // BeginDelete - Deletes the specified application on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - applicationName - The constant value for the application name. @@ -160,7 +160,7 @@ func (client *ApplicationsClient) BeginDelete(ctx context.Context, resourceGroup // Delete - Deletes the specified application on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview func (client *ApplicationsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, options *ApplicationsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ApplicationsClient.BeginDelete" @@ -206,7 +206,7 @@ func (client *ApplicationsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -215,7 +215,7 @@ func (client *ApplicationsClient) deleteCreateRequest(ctx context.Context, resou // Get - Gets properties of the specified application. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - applicationName - The constant value for the application name. @@ -266,7 +266,7 @@ func (client *ApplicationsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -284,7 +284,7 @@ func (client *ApplicationsClient) getHandleResponse(resp *http.Response) (Applic // GetAzureAsyncOperationStatus - Gets the async operation status. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - applicationName - The constant value for the application name. @@ -341,7 +341,7 @@ func (client *ApplicationsClient) getAzureAsyncOperationStatusCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -358,7 +358,7 @@ func (client *ApplicationsClient) getAzureAsyncOperationStatusHandleResponse(res // NewListByClusterPager - Lists all of the applications for the HDInsight cluster. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - ApplicationsClientListByClusterOptions contains the optional parameters for the ApplicationsClient.NewListByClusterPager @@ -406,7 +406,7 @@ func (client *ApplicationsClient) listByClusterCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/applications_client_example_test.go b/sdk/resourcemanager/hdinsight/armhdinsight/applications_client_example_test.go index 9414d5cf7260..2bfe895c7272 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/applications_client_example_test.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/applications_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/GetAllApplications.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetAllApplications.json func ExampleApplicationsClient_NewListByClusterPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -140,7 +140,7 @@ func ExampleApplicationsClient_NewListByClusterPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/GetApplicationInProgress.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetApplicationInProgress.json func ExampleApplicationsClient_Get_getApplicationOnHdInsightClusterCreationInProgress() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -205,7 +205,7 @@ func ExampleApplicationsClient_Get_getApplicationOnHdInsightClusterCreationInPro // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/GetApplicationCreated.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetApplicationCreated.json func ExampleApplicationsClient_Get_getApplicationOnHdInsightClusterSuccessfullyCreated() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -274,7 +274,7 @@ func ExampleApplicationsClient_Get_getApplicationOnHdInsightClusterSuccessfullyC // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateApplication.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateApplication.json func ExampleApplicationsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -372,7 +372,7 @@ func ExampleApplicationsClient_BeginCreate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/DeleteApplication.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/DeleteApplication.json func ExampleApplicationsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -393,7 +393,7 @@ func ExampleApplicationsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/GetApplicationCreationAsyncOperationStatus.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetApplicationCreationAsyncOperationStatus.json func ExampleApplicationsClient_GetAzureAsyncOperationStatus() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/autorest.md b/sdk/resourcemanager/hdinsight/armhdinsight/autorest.md index 9e7dbdf42922..f765d2db24fa 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/autorest.md +++ b/sdk/resourcemanager/hdinsight/armhdinsight/autorest.md @@ -5,13 +5,14 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.2.0 +module-version: 1.3.0-beta.1 directive: - from: cluster.json where: $.definitions.Resource transform: > $["title"] = "Resource" +tag: package-2023-04-preview ``` \ No newline at end of file diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/clusters_client.go b/sdk/resourcemanager/hdinsight/armhdinsight/clusters_client.go index 04560c1343ab..aa8f5aa6045d 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/clusters_client.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/clusters_client.go @@ -47,7 +47,7 @@ func NewClustersClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreate - Creates a new HDInsight cluster with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - parameters - The cluster create request. @@ -73,7 +73,7 @@ func (client *ClustersClient) BeginCreate(ctx context.Context, resourceGroupName // Create - Creates a new HDInsight cluster with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview func (client *ClustersClient) create(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterCreateParametersExtended, options *ClustersClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginCreate" @@ -115,7 +115,7 @@ func (client *ClustersClient) createCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-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) createCreateRequest(ctx context.Context, resourceG // BeginDelete - Deletes the specified HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - ClustersClientBeginDeleteOptions contains the optional parameters for the ClustersClient.BeginDelete method. @@ -152,7 +152,7 @@ func (client *ClustersClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes the specified HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview func (client *ClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginDelete" @@ -194,7 +194,7 @@ func (client *ClustersClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -203,7 +203,7 @@ func (client *ClustersClient) deleteCreateRequest(ctx context.Context, resourceG // BeginExecuteScriptActions - Executes script actions on the specified HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - parameters - The parameters for executing script actions. @@ -230,7 +230,7 @@ func (client *ClustersClient) BeginExecuteScriptActions(ctx context.Context, res // ExecuteScriptActions - Executes script actions on the specified HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview func (client *ClustersClient) executeScriptActions(ctx context.Context, resourceGroupName string, clusterName string, parameters ExecuteScriptActionParameters, options *ClustersClientBeginExecuteScriptActionsOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginExecuteScriptActions" @@ -272,7 +272,7 @@ func (client *ClustersClient) executeScriptActionsCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -284,7 +284,7 @@ func (client *ClustersClient) executeScriptActionsCreateRequest(ctx context.Cont // Get - Gets the specified cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - ClustersClientGetOptions contains the optional parameters for the ClustersClient.Get method. @@ -330,7 +330,7 @@ func (client *ClustersClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -348,7 +348,7 @@ func (client *ClustersClient) getHandleResponse(resp *http.Response) (ClustersCl // GetAzureAsyncOperationStatus - The the async operation status. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - operationID - The long running operation id. @@ -400,7 +400,7 @@ func (client *ClustersClient) getAzureAsyncOperationStatusCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -418,7 +418,7 @@ func (client *ClustersClient) getAzureAsyncOperationStatusHandleResponse(resp *h // GetGatewaySettings - Gets the gateway settings for the specified cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - ClustersClientGetGatewaySettingsOptions contains the optional parameters for the ClustersClient.GetGatewaySettings @@ -465,7 +465,7 @@ func (client *ClustersClient) getGatewaySettingsCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -482,7 +482,7 @@ func (client *ClustersClient) getGatewaySettingsHandleResponse(resp *http.Respon // NewListPager - Lists all the HDInsight clusters under the subscription. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - options - ClustersClientListOptions contains the optional parameters for the ClustersClient.NewListPager method. func (client *ClustersClient) NewListPager(options *ClustersClientListOptions) *runtime.Pager[ClustersClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ClustersClientListResponse]{ @@ -519,7 +519,7 @@ func (client *ClustersClient) listCreateRequest(ctx context.Context, options *Cl return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -536,7 +536,7 @@ func (client *ClustersClient) listHandleResponse(resp *http.Response) (ClustersC // NewListByResourceGroupPager - Lists the HDInsight clusters in a resource group. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - options - ClustersClientListByResourceGroupOptions contains the optional parameters for the ClustersClient.NewListByResourceGroupPager // method. @@ -579,7 +579,7 @@ func (client *ClustersClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -597,7 +597,7 @@ func (client *ClustersClient) listByResourceGroupHandleResponse(resp *http.Respo // BeginResize - Resizes the specified HDInsight cluster to the specified size. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - roleName - The constant value for the roleName @@ -624,7 +624,7 @@ func (client *ClustersClient) BeginResize(ctx context.Context, resourceGroupName // Resize - Resizes the specified HDInsight cluster to the specified size. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview func (client *ClustersClient) resize(ctx context.Context, resourceGroupName string, clusterName string, roleName RoleName, parameters ClusterResizeParameters, options *ClustersClientBeginResizeOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginResize" @@ -670,7 +670,7 @@ func (client *ClustersClient) resizeCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -682,7 +682,7 @@ func (client *ClustersClient) resizeCreateRequest(ctx context.Context, resourceG // BeginRotateDiskEncryptionKey - Rotate disk encryption key of the specified HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - parameters - The parameters for the disk encryption operation. @@ -709,7 +709,7 @@ func (client *ClustersClient) BeginRotateDiskEncryptionKey(ctx context.Context, // RotateDiskEncryptionKey - Rotate disk encryption key of the specified HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview func (client *ClustersClient) rotateDiskEncryptionKey(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterDiskEncryptionParameters, options *ClustersClientBeginRotateDiskEncryptionKeyOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginRotateDiskEncryptionKey" @@ -751,7 +751,7 @@ func (client *ClustersClient) rotateDiskEncryptionKeyCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -763,7 +763,7 @@ func (client *ClustersClient) rotateDiskEncryptionKeyCreateRequest(ctx context.C // Update - Patch HDInsight cluster with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - parameters - The cluster patch request. @@ -810,7 +810,7 @@ func (client *ClustersClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -831,7 +831,7 @@ func (client *ClustersClient) updateHandleResponse(resp *http.Response) (Cluster // BeginUpdateAutoScaleConfiguration - Updates the Autoscale Configuration for HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - roleName - The constant value for the roleName @@ -859,7 +859,7 @@ func (client *ClustersClient) BeginUpdateAutoScaleConfiguration(ctx context.Cont // UpdateAutoScaleConfiguration - Updates the Autoscale Configuration for HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview func (client *ClustersClient) updateAutoScaleConfiguration(ctx context.Context, resourceGroupName string, clusterName string, roleName RoleName, parameters AutoscaleConfigurationUpdateParameter, options *ClustersClientBeginUpdateAutoScaleConfigurationOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginUpdateAutoScaleConfiguration" @@ -905,7 +905,7 @@ func (client *ClustersClient) updateAutoScaleConfigurationCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -917,7 +917,7 @@ func (client *ClustersClient) updateAutoScaleConfigurationCreateRequest(ctx cont // BeginUpdateGatewaySettings - Configures the gateway settings on the specified cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - parameters - The cluster configurations. @@ -944,7 +944,7 @@ func (client *ClustersClient) BeginUpdateGatewaySettings(ctx context.Context, re // UpdateGatewaySettings - Configures the gateway settings on the specified cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview func (client *ClustersClient) updateGatewaySettings(ctx context.Context, resourceGroupName string, clusterName string, parameters UpdateGatewaySettingsParameters, options *ClustersClientBeginUpdateGatewaySettingsOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginUpdateGatewaySettings" @@ -986,7 +986,7 @@ func (client *ClustersClient) updateGatewaySettingsCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -998,7 +998,7 @@ func (client *ClustersClient) updateGatewaySettingsCreateRequest(ctx context.Con // BeginUpdateIdentityCertificate - Updates the cluster identity certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - parameters - The cluster configurations. @@ -1025,7 +1025,7 @@ func (client *ClustersClient) BeginUpdateIdentityCertificate(ctx context.Context // UpdateIdentityCertificate - Updates the cluster identity certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview func (client *ClustersClient) updateIdentityCertificate(ctx context.Context, resourceGroupName string, clusterName string, parameters UpdateClusterIdentityCertificateParameters, options *ClustersClientBeginUpdateIdentityCertificateOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginUpdateIdentityCertificate" @@ -1067,7 +1067,7 @@ func (client *ClustersClient) updateIdentityCertificateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-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/hdinsight/armhdinsight/clusters_client_example_test.go b/sdk/resourcemanager/hdinsight/armhdinsight/clusters_client_example_test.go index 0fe117311760..1718e845eede 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/clusters_client_example_test.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/clusters_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithAutoscaleConfig.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateHDInsightClusterWithAutoscaleConfig.json func ExampleClustersClient_BeginCreate_createHdInsightClusterWithAutoscaleConfiguration() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -118,10 +118,11 @@ func ExampleClustersClient_BeginCreate_createHdInsightClusterWithAutoscaleConfig StorageProfile: &armhdinsight.StorageProfile{ Storageaccounts: []*armhdinsight.StorageAccount{ { - Name: to.Ptr("mystorage.blob.core.windows.net"), - Container: to.Ptr("hdinsight-autoscale-tes-2019-06-18t05-49-16-591z"), - IsDefault: to.Ptr(true), - Key: to.Ptr("storagekey"), + Name: to.Ptr("mystorage.blob.core.windows.net"), + Container: to.Ptr("hdinsight-autoscale-tes-2019-06-18t05-49-16-591z"), + EnableSecureChannel: to.Ptr(true), + IsDefault: to.Ptr(true), + Key: to.Ptr("storagekey"), }}, }, Tier: to.Ptr(armhdinsight.TierStandard), @@ -216,7 +217,7 @@ func ExampleClustersClient_BeginCreate_createHdInsightClusterWithAutoscaleConfig // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxHadoopAdlsGen2.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateLinuxHadoopAdlsGen2.json func ExampleClustersClient_BeginCreate_createHadoopClusterWithAzureDataLakeStorageGen2() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -289,10 +290,11 @@ func ExampleClustersClient_BeginCreate_createHadoopClusterWithAzureDataLakeStora StorageProfile: &armhdinsight.StorageProfile{ Storageaccounts: []*armhdinsight.StorageAccount{ { - Name: to.Ptr("mystorage.dfs.core.windows.net"), - FileSystem: to.Ptr("default"), - IsDefault: to.Ptr(true), - Key: to.Ptr("storagekey"), + Name: to.Ptr("mystorage.dfs.core.windows.net"), + EnableSecureChannel: to.Ptr(true), + FileSystem: to.Ptr("default"), + IsDefault: to.Ptr(true), + Key: to.Ptr("storagekey"), }}, }, Tier: to.Ptr(armhdinsight.TierStandard), @@ -390,7 +392,7 @@ func ExampleClustersClient_BeginCreate_createHadoopClusterWithAzureDataLakeStora // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxHadoopSshPassword.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateLinuxHadoopSshPassword.json func ExampleClustersClient_BeginCreate_createHadoopOnLinuxClusterWithSshPassword() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -463,10 +465,11 @@ func ExampleClustersClient_BeginCreate_createHadoopOnLinuxClusterWithSshPassword StorageProfile: &armhdinsight.StorageProfile{ Storageaccounts: []*armhdinsight.StorageAccount{ { - Name: to.Ptr("mystorage.blob.core.windows.net"), - Container: to.Ptr("containername"), - IsDefault: to.Ptr(true), - Key: to.Ptr("storagekey"), + Name: to.Ptr("mystorage.blob.core.windows.net"), + Container: to.Ptr("containername"), + EnableSecureChannel: to.Ptr(true), + IsDefault: to.Ptr(true), + Key: to.Ptr("storagekey"), }}, }, Tier: to.Ptr(armhdinsight.TierStandard), @@ -564,7 +567,7 @@ func ExampleClustersClient_BeginCreate_createHadoopOnLinuxClusterWithSshPassword // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxHadoopSshPublicKey.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateLinuxHadoopSshPublicKey.json func ExampleClustersClient_BeginCreate_createHadoopOnLinuxClusterWithSshPublicKey() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -642,10 +645,11 @@ func ExampleClustersClient_BeginCreate_createHadoopOnLinuxClusterWithSshPublicKe StorageProfile: &armhdinsight.StorageProfile{ Storageaccounts: []*armhdinsight.StorageAccount{ { - Name: to.Ptr("mystorage.blob.core.windows.net"), - Container: to.Ptr("containername"), - IsDefault: to.Ptr(true), - Key: to.Ptr("storagekey"), + Name: to.Ptr("mystorage.blob.core.windows.net"), + Container: to.Ptr("containername"), + EnableSecureChannel: to.Ptr(true), + IsDefault: to.Ptr(true), + Key: to.Ptr("storagekey"), }}, }, Tier: to.Ptr(armhdinsight.TierStandard), @@ -743,7 +747,7 @@ func ExampleClustersClient_BeginCreate_createHadoopOnLinuxClusterWithSshPublicKe // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateKafkaClusterWithKafkaRestProxy.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateKafkaClusterWithKafkaRestProxy.json func ExampleClustersClient_BeginCreate_createKafkaClusterWithKafkaRestProxy() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -839,10 +843,11 @@ func ExampleClustersClient_BeginCreate_createKafkaClusterWithKafkaRestProxy() { StorageProfile: &armhdinsight.StorageProfile{ Storageaccounts: []*armhdinsight.StorageAccount{ { - Name: to.Ptr("mystorage.blob.core.windows.net"), - Container: to.Ptr("containername"), - IsDefault: to.Ptr(true), - Key: to.Ptr("storagekey"), + Name: to.Ptr("mystorage.blob.core.windows.net"), + Container: to.Ptr("containername"), + EnableSecureChannel: to.Ptr(true), + IsDefault: to.Ptr(true), + Key: to.Ptr("storagekey"), }}, }, Tier: to.Ptr(armhdinsight.TierStandard), @@ -967,7 +972,7 @@ func ExampleClustersClient_BeginCreate_createKafkaClusterWithKafkaRestProxy() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxHadoopSecureHadoop.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateLinuxHadoopSecureHadoop.json func ExampleClustersClient_BeginCreate_createSecureHadoopCluster() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1084,10 +1089,11 @@ func ExampleClustersClient_BeginCreate_createSecureHadoopCluster() { StorageProfile: &armhdinsight.StorageProfile{ Storageaccounts: []*armhdinsight.StorageAccount{ { - Name: to.Ptr("mystorage.blob.core.windows.net"), - Container: to.Ptr("containername"), - IsDefault: to.Ptr(true), - Key: to.Ptr("storage account key"), + Name: to.Ptr("mystorage.blob.core.windows.net"), + Container: to.Ptr("containername"), + EnableSecureChannel: to.Ptr(true), + IsDefault: to.Ptr(true), + Key: to.Ptr("storage account key"), }}, }, Tier: to.Ptr(armhdinsight.TierPremium), @@ -1185,7 +1191,7 @@ func ExampleClustersClient_BeginCreate_createSecureHadoopCluster() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxSparkSshPassword.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateLinuxSparkSshPassword.json func ExampleClustersClient_BeginCreate_createSparkOnLinuxClusterWithSshPassword() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1247,10 +1253,11 @@ func ExampleClustersClient_BeginCreate_createSparkOnLinuxClusterWithSshPassword( StorageProfile: &armhdinsight.StorageProfile{ Storageaccounts: []*armhdinsight.StorageAccount{ { - Name: to.Ptr("mystorage.blob.core.windows.net"), - Container: to.Ptr("containername"), - IsDefault: to.Ptr(true), - Key: to.Ptr("storageapikey*"), + Name: to.Ptr("mystorage.blob.core.windows.net"), + Container: to.Ptr("containername"), + EnableSecureChannel: to.Ptr(true), + IsDefault: to.Ptr(true), + Key: to.Ptr("storageapikey*"), }}, }, Tier: to.Ptr(armhdinsight.TierStandard), @@ -1348,7 +1355,7 @@ func ExampleClustersClient_BeginCreate_createSparkOnLinuxClusterWithSshPassword( // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithTLS12.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateHDInsightClusterWithTLS12.json func ExampleClustersClient_BeginCreate_createClusterWithTls12() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1419,10 +1426,11 @@ func ExampleClustersClient_BeginCreate_createClusterWithTls12() { StorageProfile: &armhdinsight.StorageProfile{ Storageaccounts: []*armhdinsight.StorageAccount{ { - Name: to.Ptr("mystorage.blob.core.windows.net"), - Container: to.Ptr("default8525"), - IsDefault: to.Ptr(true), - Key: to.Ptr("storagekey"), + Name: to.Ptr("mystorage.blob.core.windows.net"), + Container: to.Ptr("default8525"), + EnableSecureChannel: to.Ptr(true), + IsDefault: to.Ptr(true), + Key: to.Ptr("storagekey"), }}, }, Tier: to.Ptr(armhdinsight.TierStandard), @@ -1518,7 +1526,7 @@ func ExampleClustersClient_BeginCreate_createClusterWithTls12() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithAvailabilityZones.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateHDInsightClusterWithAvailabilityZones.json func ExampleClustersClient_BeginCreate_createClusterWithAvailabilityZones() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1630,10 +1638,11 @@ func ExampleClustersClient_BeginCreate_createClusterWithAvailabilityZones() { StorageProfile: &armhdinsight.StorageProfile{ Storageaccounts: []*armhdinsight.StorageAccount{ { - Name: to.Ptr("mystorage"), - Container: to.Ptr("containername"), - IsDefault: to.Ptr(true), - Key: to.Ptr("storage account key"), + Name: to.Ptr("mystorage"), + Container: to.Ptr("containername"), + EnableSecureChannel: to.Ptr(true), + IsDefault: to.Ptr(true), + Key: to.Ptr("storage account key"), }}, }, }, @@ -1712,7 +1721,7 @@ func ExampleClustersClient_BeginCreate_createClusterWithAvailabilityZones() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithComputeIsolationProperties.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateHDInsightClusterWithComputeIsolationProperties.json func ExampleClustersClient_BeginCreate_createClusterWithComputeIsolationProperties() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1784,10 +1793,11 @@ func ExampleClustersClient_BeginCreate_createClusterWithComputeIsolationProperti StorageProfile: &armhdinsight.StorageProfile{ Storageaccounts: []*armhdinsight.StorageAccount{ { - Name: to.Ptr("mystorage"), - Container: to.Ptr("containername"), - IsDefault: to.Ptr(true), - Key: to.Ptr("storage account key"), + Name: to.Ptr("mystorage"), + Container: to.Ptr("containername"), + EnableSecureChannel: to.Ptr(true), + IsDefault: to.Ptr(true), + Key: to.Ptr("storage account key"), }}, }, }, @@ -1861,7 +1871,7 @@ func ExampleClustersClient_BeginCreate_createClusterWithComputeIsolationProperti // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithEncryptionAtHost.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateHDInsightClusterWithEncryptionAtHost.json func ExampleClustersClient_BeginCreate_createClusterWithEncryptionAtHost() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1934,10 +1944,11 @@ func ExampleClustersClient_BeginCreate_createClusterWithEncryptionAtHost() { StorageProfile: &armhdinsight.StorageProfile{ Storageaccounts: []*armhdinsight.StorageAccount{ { - Name: to.Ptr("mystorage.blob.core.windows.net"), - Container: to.Ptr("default8525"), - IsDefault: to.Ptr(true), - Key: to.Ptr("storagekey"), + Name: to.Ptr("mystorage.blob.core.windows.net"), + Container: to.Ptr("default8525"), + EnableSecureChannel: to.Ptr(true), + IsDefault: to.Ptr(true), + Key: to.Ptr("storagekey"), }}, }, Tier: to.Ptr(armhdinsight.TierStandard), @@ -2035,7 +2046,7 @@ func ExampleClustersClient_BeginCreate_createClusterWithEncryptionAtHost() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithEncryptionInTransit.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateHDInsightClusterWithEncryptionInTransit.json func ExampleClustersClient_BeginCreate_createClusterWithEncryptionInTransit() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2108,10 +2119,11 @@ func ExampleClustersClient_BeginCreate_createClusterWithEncryptionInTransit() { StorageProfile: &armhdinsight.StorageProfile{ Storageaccounts: []*armhdinsight.StorageAccount{ { - Name: to.Ptr("mystorage.blob.core.windows.net"), - Container: to.Ptr("default8525"), - IsDefault: to.Ptr(true), - Key: to.Ptr("storagekey"), + Name: to.Ptr("mystorage.blob.core.windows.net"), + Container: to.Ptr("default8525"), + EnableSecureChannel: to.Ptr(true), + IsDefault: to.Ptr(true), + Key: to.Ptr("storagekey"), }}, }, Tier: to.Ptr(armhdinsight.TierStandard), @@ -2209,7 +2221,7 @@ func ExampleClustersClient_BeginCreate_createClusterWithEncryptionInTransit() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithCustomNetworkProperties.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateHDInsightClusterWithCustomNetworkProperties.json func ExampleClustersClient_BeginCreate_createClusterWithNetworkProperties() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2290,10 +2302,11 @@ func ExampleClustersClient_BeginCreate_createClusterWithNetworkProperties() { StorageProfile: &armhdinsight.StorageProfile{ Storageaccounts: []*armhdinsight.StorageAccount{ { - Name: to.Ptr("mystorage"), - Container: to.Ptr("containername"), - IsDefault: to.Ptr(true), - Key: to.Ptr("storage account key"), + Name: to.Ptr("mystorage"), + Container: to.Ptr("containername"), + EnableSecureChannel: to.Ptr(true), + IsDefault: to.Ptr(true), + Key: to.Ptr("storage account key"), }}, }, }, @@ -2372,7 +2385,7 @@ func ExampleClustersClient_BeginCreate_createClusterWithNetworkProperties() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/PatchLinuxHadoopCluster.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/PatchLinuxHadoopCluster.json func ExampleClustersClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2475,7 +2488,7 @@ func ExampleClustersClient_Update() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/DeleteLinuxHadoopCluster.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/DeleteLinuxHadoopCluster.json func ExampleClustersClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2496,7 +2509,7 @@ func ExampleClustersClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/GetLinuxHadoopCluster.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetLinuxHadoopCluster.json func ExampleClustersClient_Get_getHadoopOnLinuxCluster() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2593,7 +2606,7 @@ func ExampleClustersClient_Get_getHadoopOnLinuxCluster() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/GetLinuxSparkCluster.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetLinuxSparkCluster.json func ExampleClustersClient_Get_getSparkOnLinuxCluster() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2693,7 +2706,7 @@ func ExampleClustersClient_Get_getSparkOnLinuxCluster() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/GetLinuxHadoopAllClustersInResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetLinuxHadoopAllClustersInResourceGroup.json func ExampleClustersClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2875,7 +2888,7 @@ func ExampleClustersClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/ResizeLinuxHadoopCluster.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/ResizeLinuxHadoopCluster.json func ExampleClustersClient_BeginResize() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2898,7 +2911,7 @@ func ExampleClustersClient_BeginResize() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/DisableClusterAutoScale.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/DisableClusterAutoScale.json func ExampleClustersClient_BeginUpdateAutoScaleConfiguration_disableAutoscaleForTheHdInsightCluster() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2919,7 +2932,7 @@ func ExampleClustersClient_BeginUpdateAutoScaleConfiguration_disableAutoscaleFor } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/EnableOrUpdateAutoScaleWithLoadBasedConfiguration.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/EnableOrUpdateAutoScaleWithLoadBasedConfiguration.json func ExampleClustersClient_BeginUpdateAutoScaleConfiguration_enableOrUpdateAutoscaleWithTheLoadBasedConfigurationForHdInsightCluster() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2947,7 +2960,7 @@ func ExampleClustersClient_BeginUpdateAutoScaleConfiguration_enableOrUpdateAutos } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/EnableOrUpdateAutoScaleWithScheduleBasedConfiguration.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/EnableOrUpdateAutoScaleWithScheduleBasedConfiguration.json func ExampleClustersClient_BeginUpdateAutoScaleConfiguration_enableOrUpdateAutoscaleWithTheScheduleBasedConfigurationForHdInsightCluster() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2984,7 +2997,7 @@ func ExampleClustersClient_BeginUpdateAutoScaleConfiguration_enableOrUpdateAutos } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/GetLinuxHadoopAllClusters.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetLinuxHadoopAllClusters.json func ExampleClustersClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -3166,7 +3179,7 @@ func ExampleClustersClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/RotateLinuxHadoopClusterDiskEncryptionKey.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/RotateLinuxHadoopClusterDiskEncryptionKey.json func ExampleClustersClient_BeginRotateDiskEncryptionKey() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -3191,7 +3204,7 @@ func ExampleClustersClient_BeginRotateDiskEncryptionKey() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/HDI_Clusters_GetGatewaySettings.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/HDI_Clusters_GetGatewaySettings.json func ExampleClustersClient_GetGatewaySettings() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -3216,7 +3229,7 @@ func ExampleClustersClient_GetGatewaySettings() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/HDI_Clusters_UpdateGatewaySettings_Enable.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/HDI_Clusters_UpdateGatewaySettings_Enable.json func ExampleClustersClient_BeginUpdateGatewaySettings() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -3241,7 +3254,7 @@ func ExampleClustersClient_BeginUpdateGatewaySettings() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/GetClusterCreatingAsyncOperationStatus.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetClusterCreatingAsyncOperationStatus.json func ExampleClustersClient_GetAzureAsyncOperationStatus() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -3264,7 +3277,7 @@ func ExampleClustersClient_GetAzureAsyncOperationStatus() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/HDI_Clusters_UpdateClusterIdentityCertificate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/HDI_Clusters_UpdateClusterIdentityCertificate.json func ExampleClustersClient_BeginUpdateIdentityCertificate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -3289,7 +3302,7 @@ func ExampleClustersClient_BeginUpdateIdentityCertificate() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/PostExecuteScriptAction.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/PostExecuteScriptAction.json func ExampleClustersClient_BeginExecuteScriptActions() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/configurations_client.go b/sdk/resourcemanager/hdinsight/armhdinsight/configurations_client.go index ccb31973c3b2..0d88faba17dd 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/configurations_client.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/configurations_client.go @@ -48,7 +48,7 @@ func NewConfigurationsClient(subscriptionID string, credential azcore.TokenCrede // Please consider using List configurations API instead. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - configurationName - The name of the cluster configuration. @@ -99,7 +99,7 @@ func (client *ConfigurationsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -117,7 +117,7 @@ func (client *ConfigurationsClient) getHandleResponse(resp *http.Response) (Conf // List - Gets all configuration information for an HDI cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - ConfigurationsClientListOptions contains the optional parameters for the ConfigurationsClient.List method. @@ -163,7 +163,7 @@ func (client *ConfigurationsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,7 +182,7 @@ func (client *ConfigurationsClient) listHandleResponse(resp *http.Response) (Con // in cluster endpoint instead. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - configurationName - The name of the cluster configuration. @@ -211,7 +211,7 @@ func (client *ConfigurationsClient) BeginUpdate(ctx context.Context, resourceGro // in cluster endpoint instead. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview func (client *ConfigurationsClient) update(ctx context.Context, resourceGroupName string, clusterName string, configurationName string, parameters map[string]*string, options *ConfigurationsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "ConfigurationsClient.BeginUpdate" @@ -257,7 +257,7 @@ func (client *ConfigurationsClient) updateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-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/hdinsight/armhdinsight/configurations_client_example_test.go b/sdk/resourcemanager/hdinsight/armhdinsight/configurations_client_example_test.go index 6e1d61fa71af..2c99efb3c244 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/configurations_client_example_test.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/configurations_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/HDI_Configurations_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/HDI_Configurations_List.json func ExampleConfigurationsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -51,7 +51,7 @@ func ExampleConfigurationsClient_List() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/ChangeHttpConnectivityDisable.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/ChangeHttpConnectivityDisable.json func ExampleConfigurationsClient_BeginUpdate_disableHttpConnectivity() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -74,7 +74,7 @@ func ExampleConfigurationsClient_BeginUpdate_disableHttpConnectivity() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/ChangeHttpConnectivityEnable.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/ChangeHttpConnectivityEnable.json func ExampleConfigurationsClient_BeginUpdate_enableHttpConnectivity() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -99,7 +99,7 @@ func ExampleConfigurationsClient_BeginUpdate_enableHttpConnectivity() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/HDI_Configurations_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/HDI_Configurations_Get.json func ExampleConfigurationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/constants.go b/sdk/resourcemanager/hdinsight/armhdinsight/constants.go index 0f522e4d10ab..0c54cd74191c 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/constants.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/constants.go @@ -10,7 +10,7 @@ package armhdinsight const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight" - moduleVersion = "v1.2.0" + moduleVersion = "v1.3.0-beta.1" ) // AsyncOperationState - The async operation state. diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/extensions_client.go b/sdk/resourcemanager/hdinsight/armhdinsight/extensions_client.go index 252a787ef1b3..cf266238a577 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/extensions_client.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/extensions_client.go @@ -47,7 +47,7 @@ func NewExtensionsClient(subscriptionID string, credential azcore.TokenCredentia // BeginCreate - Creates an HDInsight cluster extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - extensionName - The name of the cluster extension. @@ -74,7 +74,7 @@ func (client *ExtensionsClient) BeginCreate(ctx context.Context, resourceGroupNa // Create - Creates an HDInsight cluster extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview func (client *ExtensionsClient) create(ctx context.Context, resourceGroupName string, clusterName string, extensionName string, parameters Extension, options *ExtensionsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "ExtensionsClient.BeginCreate" @@ -120,7 +120,7 @@ func (client *ExtensionsClient) createCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -132,7 +132,7 @@ func (client *ExtensionsClient) createCreateRequest(ctx context.Context, resourc // BeginDelete - Deletes the specified extension for HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - extensionName - The name of the cluster extension. @@ -158,7 +158,7 @@ func (client *ExtensionsClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Deletes the specified extension for HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview func (client *ExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, extensionName string, options *ExtensionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ExtensionsClient.BeginDelete" @@ -204,7 +204,7 @@ func (client *ExtensionsClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -213,7 +213,7 @@ func (client *ExtensionsClient) deleteCreateRequest(ctx context.Context, resourc // BeginDisableAzureMonitor - Disables the Azure Monitor on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - ExtensionsClientBeginDisableAzureMonitorOptions contains the optional parameters for the ExtensionsClient.BeginDisableAzureMonitor @@ -239,7 +239,7 @@ func (client *ExtensionsClient) BeginDisableAzureMonitor(ctx context.Context, re // DisableAzureMonitor - Disables the Azure Monitor on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview func (client *ExtensionsClient) disableAzureMonitor(ctx context.Context, resourceGroupName string, clusterName string, options *ExtensionsClientBeginDisableAzureMonitorOptions) (*http.Response, error) { var err error const operationName = "ExtensionsClient.BeginDisableAzureMonitor" @@ -281,7 +281,7 @@ func (client *ExtensionsClient) disableAzureMonitorCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -290,7 +290,7 @@ func (client *ExtensionsClient) disableAzureMonitorCreateRequest(ctx context.Con // BeginDisableMonitoring - Disables the Operations Management Suite (OMS) on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - ExtensionsClientBeginDisableMonitoringOptions contains the optional parameters for the ExtensionsClient.BeginDisableMonitoring @@ -316,7 +316,7 @@ func (client *ExtensionsClient) BeginDisableMonitoring(ctx context.Context, reso // DisableMonitoring - Disables the Operations Management Suite (OMS) on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview func (client *ExtensionsClient) disableMonitoring(ctx context.Context, resourceGroupName string, clusterName string, options *ExtensionsClientBeginDisableMonitoringOptions) (*http.Response, error) { var err error const operationName = "ExtensionsClient.BeginDisableMonitoring" @@ -358,7 +358,7 @@ func (client *ExtensionsClient) disableMonitoringCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -367,7 +367,7 @@ func (client *ExtensionsClient) disableMonitoringCreateRequest(ctx context.Conte // BeginEnableAzureMonitor - Enables the Azure Monitor on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - parameters - The Log Analytics workspace parameters. @@ -394,7 +394,7 @@ func (client *ExtensionsClient) BeginEnableAzureMonitor(ctx context.Context, res // EnableAzureMonitor - Enables the Azure Monitor on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview func (client *ExtensionsClient) enableAzureMonitor(ctx context.Context, resourceGroupName string, clusterName string, parameters AzureMonitorRequest, options *ExtensionsClientBeginEnableAzureMonitorOptions) (*http.Response, error) { var err error const operationName = "ExtensionsClient.BeginEnableAzureMonitor" @@ -436,7 +436,7 @@ func (client *ExtensionsClient) enableAzureMonitorCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -448,7 +448,7 @@ func (client *ExtensionsClient) enableAzureMonitorCreateRequest(ctx context.Cont // BeginEnableMonitoring - Enables the Operations Management Suite (OMS) on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - parameters - The Operations Management Suite (OMS) workspace parameters. @@ -475,7 +475,7 @@ func (client *ExtensionsClient) BeginEnableMonitoring(ctx context.Context, resou // EnableMonitoring - Enables the Operations Management Suite (OMS) on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview func (client *ExtensionsClient) enableMonitoring(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterMonitoringRequest, options *ExtensionsClientBeginEnableMonitoringOptions) (*http.Response, error) { var err error const operationName = "ExtensionsClient.BeginEnableMonitoring" @@ -517,7 +517,7 @@ func (client *ExtensionsClient) enableMonitoringCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -529,7 +529,7 @@ func (client *ExtensionsClient) enableMonitoringCreateRequest(ctx context.Contex // Get - Gets the extension properties for the specified HDInsight cluster extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - extensionName - The name of the cluster extension. @@ -580,7 +580,7 @@ func (client *ExtensionsClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -598,7 +598,7 @@ func (client *ExtensionsClient) getHandleResponse(resp *http.Response) (Extensio // GetAzureAsyncOperationStatus - Gets the async operation status. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - extensionName - The name of the cluster extension. @@ -655,7 +655,7 @@ func (client *ExtensionsClient) getAzureAsyncOperationStatusCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -673,7 +673,7 @@ func (client *ExtensionsClient) getAzureAsyncOperationStatusHandleResponse(resp // GetAzureMonitorStatus - Gets the status of Azure Monitor on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - ExtensionsClientGetAzureMonitorStatusOptions contains the optional parameters for the ExtensionsClient.GetAzureMonitorStatus @@ -720,7 +720,7 @@ func (client *ExtensionsClient) getAzureMonitorStatusCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -738,7 +738,7 @@ func (client *ExtensionsClient) getAzureMonitorStatusHandleResponse(resp *http.R // GetMonitoringStatus - Gets the status of Operations Management Suite (OMS) on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - ExtensionsClientGetMonitoringStatusOptions contains the optional parameters for the ExtensionsClient.GetMonitoringStatus @@ -785,7 +785,7 @@ func (client *ExtensionsClient) getMonitoringStatusCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/extensions_client_example_test.go b/sdk/resourcemanager/hdinsight/armhdinsight/extensions_client_example_test.go index eccfc0efa0b8..b05ebf827839 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/extensions_client_example_test.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/extensions_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/EnableLinuxClusterMonitoring.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/EnableLinuxClusterMonitoring.json func ExampleExtensionsClient_BeginEnableMonitoring() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -42,7 +42,7 @@ func ExampleExtensionsClient_BeginEnableMonitoring() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/GetLinuxClusterMonitoringStatus.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetLinuxClusterMonitoringStatus.json func ExampleExtensionsClient_GetMonitoringStatus() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -66,7 +66,7 @@ func ExampleExtensionsClient_GetMonitoringStatus() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/DisableLinuxClusterMonitoring.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/DisableLinuxClusterMonitoring.json func ExampleExtensionsClient_BeginDisableMonitoring() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -87,7 +87,7 @@ func ExampleExtensionsClient_BeginDisableMonitoring() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/EnableLinuxClusterAzureMonitor.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/EnableLinuxClusterAzureMonitor.json func ExampleExtensionsClient_BeginEnableAzureMonitor() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -111,7 +111,7 @@ func ExampleExtensionsClient_BeginEnableAzureMonitor() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/GetLinuxClusterAzureMonitorStatus.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetLinuxClusterAzureMonitorStatus.json func ExampleExtensionsClient_GetAzureMonitorStatus() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -135,7 +135,7 @@ func ExampleExtensionsClient_GetAzureMonitorStatus() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/DisableLinuxClusterAzureMonitor.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/DisableLinuxClusterAzureMonitor.json func ExampleExtensionsClient_BeginDisableAzureMonitor() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -156,7 +156,7 @@ func ExampleExtensionsClient_BeginDisableAzureMonitor() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateExtension.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/CreateExtension.json func ExampleExtensionsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -180,7 +180,7 @@ func ExampleExtensionsClient_BeginCreate() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/GetExtension.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetExtension.json func ExampleExtensionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -204,7 +204,7 @@ func ExampleExtensionsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/DeleteExtension.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/DeleteExtension.json func ExampleExtensionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -225,7 +225,7 @@ func ExampleExtensionsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/GetExtensionCreationAsyncOperationStatus.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetExtensionCreationAsyncOperationStatus.json func ExampleExtensionsClient_GetAzureAsyncOperationStatus() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/locations_client.go b/sdk/resourcemanager/hdinsight/armhdinsight/locations_client.go index cc078ff95ada..00598b3e6df0 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/locations_client.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/locations_client.go @@ -47,7 +47,7 @@ func NewLocationsClient(subscriptionID string, credential azcore.TokenCredential // CheckNameAvailability - Check the cluster name is available or not. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - location - The Azure location (region) for which to make the request. // - options - LocationsClientCheckNameAvailabilityOptions contains the optional parameters for the LocationsClient.CheckNameAvailability // method. @@ -89,7 +89,7 @@ func (client *LocationsClient) checkNameAvailabilityCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -110,7 +110,7 @@ func (client *LocationsClient) checkNameAvailabilityHandleResponse(resp *http.Re // GetAzureAsyncOperationStatus - Get the async operation status. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - location - The Azure location (region) for which to make the request. // - operationID - The long running operation id. // - options - LocationsClientGetAzureAsyncOperationStatusOptions contains the optional parameters for the LocationsClient.GetAzureAsyncOperationStatus @@ -157,7 +157,7 @@ func (client *LocationsClient) getAzureAsyncOperationStatusCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -175,7 +175,7 @@ func (client *LocationsClient) getAzureAsyncOperationStatusHandleResponse(resp * // GetCapabilities - Gets the capabilities for the specified location. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - location - The Azure location (region) for which to make the request. // - options - LocationsClientGetCapabilitiesOptions contains the optional parameters for the LocationsClient.GetCapabilities // method. @@ -217,7 +217,7 @@ func (client *LocationsClient) getCapabilitiesCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -235,7 +235,7 @@ func (client *LocationsClient) getCapabilitiesHandleResponse(resp *http.Response // ListBillingSpecs - Lists the billingSpecs for the specified subscription and location. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - location - The Azure location (region) for which to make the request. // - options - LocationsClientListBillingSpecsOptions contains the optional parameters for the LocationsClient.ListBillingSpecs // method. @@ -277,7 +277,7 @@ func (client *LocationsClient) listBillingSpecsCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -295,7 +295,7 @@ func (client *LocationsClient) listBillingSpecsHandleResponse(resp *http.Respons // ListUsages - Lists the usages for the specified location. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - location - The Azure location (region) for which to make the request. // - options - LocationsClientListUsagesOptions contains the optional parameters for the LocationsClient.ListUsages method. func (client *LocationsClient) ListUsages(ctx context.Context, location string, options *LocationsClientListUsagesOptions) (LocationsClientListUsagesResponse, error) { @@ -336,7 +336,7 @@ func (client *LocationsClient) listUsagesCreateRequest(ctx context.Context, loca return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -354,7 +354,7 @@ func (client *LocationsClient) listUsagesHandleResponse(resp *http.Response) (Lo // ValidateClusterCreateRequest - Validate the cluster create request spec is valid or not. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - location - The Azure location (region) for which to make the request. // - options - LocationsClientValidateClusterCreateRequestOptions contains the optional parameters for the LocationsClient.ValidateClusterCreateRequest // method. @@ -396,7 +396,7 @@ func (client *LocationsClient) validateClusterCreateRequestCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-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/hdinsight/armhdinsight/locations_client_example_test.go b/sdk/resourcemanager/hdinsight/armhdinsight/locations_client_example_test.go index 539bab38f38d..7250f4e92252 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/locations_client_example_test.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/locations_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/GetHDInsightCapabilities.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetHDInsightCapabilities.json func ExampleLocationsClient_GetCapabilities() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -405,7 +405,7 @@ func ExampleLocationsClient_GetCapabilities() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/GetHDInsightUsages.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetHDInsightUsages.json func ExampleLocationsClient_ListUsages() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -437,7 +437,7 @@ func ExampleLocationsClient_ListUsages() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/HDI_Locations_ListBillingSpecs.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/HDI_Locations_ListBillingSpecs.json func ExampleLocationsClient_ListBillingSpecs() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -500,7 +500,7 @@ func ExampleLocationsClient_ListBillingSpecs() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/HDI_Locations_GetAsyncOperationStatus.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/HDI_Locations_GetAsyncOperationStatus.json func ExampleLocationsClient_GetAzureAsyncOperationStatus() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -523,7 +523,7 @@ func ExampleLocationsClient_GetAzureAsyncOperationStatus() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/HDI_Locations_CheckClusterNameAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/HDI_Locations_CheckClusterNameAvailability.json func ExampleLocationsClient_CheckNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -551,7 +551,7 @@ func ExampleLocationsClient_CheckNameAvailability() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/HDI_Locations_ValidateClusterCreateRequest.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/HDI_Locations_ValidateClusterCreateRequest.json func ExampleLocationsClient_ValidateClusterCreateRequest() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -631,11 +631,12 @@ func ExampleLocationsClient_ValidateClusterCreateRequest() { StorageProfile: &armhdinsight.StorageProfile{ Storageaccounts: []*armhdinsight.StorageAccount{ { - Name: to.Ptr("storagename.blob.core.windows.net"), - Container: to.Ptr("contianername"), - IsDefault: to.Ptr(true), - Key: to.Ptr("*******"), - ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/storagename"), + Name: to.Ptr("storagename.blob.core.windows.net"), + Container: to.Ptr("contianername"), + EnableSecureChannel: to.Ptr(true), + IsDefault: to.Ptr(true), + Key: to.Ptr("*******"), + ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/storagename"), }}, }, Tier: to.Ptr(armhdinsight.TierStandard), @@ -653,7 +654,7 @@ func ExampleLocationsClient_ValidateClusterCreateRequest() { _ = 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.ClusterCreateValidationResult = armhdinsight.ClusterCreateValidationResult{ - // EstimatedCreationDuration: to.Ptr("00:20:00"), + // EstimatedCreationDuration: to.Ptr("PT20M"), // ValidationErrors: []*armhdinsight.ValidationErrorInfo{ // }, // } diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/models.go b/sdk/resourcemanager/hdinsight/armhdinsight/models.go index f687c529d02e..44a46c1c7329 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/models.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/models.go @@ -1397,6 +1397,10 @@ type StorageAccount struct { // The container in the storage account, only to be specified for WASB storage accounts. Container *string + // Enable secure channel or not, it's an optional field. Default value is false when cluster version < 5.1 and true when cluster + // version >= 5.1 , + EnableSecureChannel *bool + // The filesystem, only to be specified for Azure Data Lake Storage Gen 2. FileSystem *string diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/models_serde.go b/sdk/resourcemanager/hdinsight/armhdinsight/models_serde.go index 827f2ba9e21a..b25f0751a493 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/models_serde.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/models_serde.go @@ -3694,6 +3694,7 @@ func (s *ServiceSpecification) UnmarshalJSON(data []byte) error { func (s StorageAccount) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "container", s.Container) + populate(objectMap, "enableSecureChannel", s.EnableSecureChannel) populate(objectMap, "fileSystem", s.FileSystem) populate(objectMap, "fileshare", s.Fileshare) populate(objectMap, "isDefault", s.IsDefault) @@ -3717,6 +3718,9 @@ func (s *StorageAccount) UnmarshalJSON(data []byte) error { case "container": err = unpopulate(val, "Container", &s.Container) delete(rawMsg, key) + case "enableSecureChannel": + err = unpopulate(val, "EnableSecureChannel", &s.EnableSecureChannel) + delete(rawMsg, key) case "fileSystem": err = unpopulate(val, "FileSystem", &s.FileSystem) delete(rawMsg, key) diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/operations_client.go b/sdk/resourcemanager/hdinsight/armhdinsight/operations_client.go index 7a5f328884f0..f28e500b170f 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/operations_client.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available HDInsight REST API operations. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -72,7 +72,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/operations_client_example_test.go b/sdk/resourcemanager/hdinsight/armhdinsight/operations_client_example_test.go new file mode 100644 index 000000000000..05364b1d9c2b --- /dev/null +++ b/sdk/resourcemanager/hdinsight/armhdinsight/operations_client_example_test.go @@ -0,0 +1,62 @@ +//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 armhdinsight_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/ListHDInsightOperations.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 := armhdinsight.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 = armhdinsight.OperationListResult{ + // Value: []*armhdinsight.Operation{ + // { + // Name: to.Ptr("Microsoft.HDInsight/register/action"), + // Display: &armhdinsight.OperationDisplay{ + // Description: to.Ptr("Register HDInsight resource provider for the subscription"), + // Operation: to.Ptr("Register HDInsight resource provider"), + // Provider: to.Ptr("Microsoft.HDInsight"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.HDInsight/unregister/action"), + // Display: &armhdinsight.OperationDisplay{ + // Description: to.Ptr("Unregister HDInsight resource provider for the subscription"), + // Operation: to.Ptr("Unregister HDInsight resource provider"), + // Provider: to.Ptr("Microsoft.HDInsight"), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/privateendpointconnections_client.go b/sdk/resourcemanager/hdinsight/armhdinsight/privateendpointconnections_client.go index 856498bc5f76..58e833780c08 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/privateendpointconnections_client.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/privateendpointconnections_client.go @@ -47,7 +47,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Approve or reject a private endpoint connection manually. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -75,7 +75,7 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Approve or reject a private endpoint connection manually. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginCreateOrUpdate" @@ -121,7 +121,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -133,7 +133,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx // BeginDelete - Deletes the specific private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -160,7 +160,7 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Deletes the specific private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginDelete" @@ -206,7 +206,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -215,7 +215,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Gets the specific private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -267,7 +267,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -284,7 +284,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListByClusterPager - Lists the private endpoint connections for a HDInsight cluster. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - PrivateEndpointConnectionsClientListByClusterOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByClusterPager @@ -332,7 +332,7 @@ func (client *PrivateEndpointConnectionsClient) listByClusterCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/hdinsight/armhdinsight/privateendpointconnections_client_example_test.go index 0a06558b457b..9bc8754e6d3b 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/privateendpointconnections_client_example_test.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/privateendpointconnections_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/GetAllPrivateEndpointConnectionsInCluster.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetAllPrivateEndpointConnectionsInCluster.json func ExamplePrivateEndpointConnectionsClient_NewListByClusterPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -63,7 +63,7 @@ func ExamplePrivateEndpointConnectionsClient_NewListByClusterPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/ApprovePrivateEndpointConnection.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/ApprovePrivateEndpointConnection.json func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -112,7 +112,7 @@ func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/GetPrivateEndpointConnection.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetPrivateEndpointConnection.json func ExamplePrivateEndpointConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -149,7 +149,7 @@ func ExamplePrivateEndpointConnectionsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/DeletePrivateEndpointConnection.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/DeletePrivateEndpointConnection.json func ExamplePrivateEndpointConnectionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/privatelinkresources_client.go b/sdk/resourcemanager/hdinsight/armhdinsight/privatelinkresources_client.go index c4d37d1370a9..a93963a3d1de 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/privatelinkresources_client.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/privatelinkresources_client.go @@ -47,7 +47,7 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // Get - Gets the specific private link resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - privateLinkResourceName - The name of the private link resource. @@ -99,7 +99,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -117,7 +117,7 @@ func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) // ListByCluster - Lists the private link resources in a HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - PrivateLinkResourcesClientListByClusterOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByCluster @@ -164,7 +164,7 @@ func (client *PrivateLinkResourcesClient) listByClusterCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/privatelinkresources_client_example_test.go b/sdk/resourcemanager/hdinsight/armhdinsight/privatelinkresources_client_example_test.go index 494690c9aac3..0e6bc4089828 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/privatelinkresources_client_example_test.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/privatelinkresources_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/GetAllPrivateLinkResourcesInCluster.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetAllPrivateLinkResourcesInCluster.json func ExamplePrivateLinkResourcesClient_ListByCluster() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -64,7 +64,7 @@ func ExamplePrivateLinkResourcesClient_ListByCluster() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/GetPrivateLinkResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetPrivateLinkResource.json func ExamplePrivateLinkResourcesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/scriptactions_client.go b/sdk/resourcemanager/hdinsight/armhdinsight/scriptactions_client.go index 48fefb1e1f93..393acc6fb18c 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/scriptactions_client.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/scriptactions_client.go @@ -47,7 +47,7 @@ func NewScriptActionsClient(subscriptionID string, credential azcore.TokenCreden // Delete - Deletes a specified persisted script action of the cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - scriptName - The name of the script. @@ -97,7 +97,7 @@ func (client *ScriptActionsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -106,7 +106,7 @@ func (client *ScriptActionsClient) deleteCreateRequest(ctx context.Context, reso // GetExecutionAsyncOperationStatus - Gets the async operation status of execution operation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - operationID - The long running operation id. @@ -158,7 +158,7 @@ func (client *ScriptActionsClient) getExecutionAsyncOperationStatusCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -176,7 +176,7 @@ func (client *ScriptActionsClient) getExecutionAsyncOperationStatusHandleRespons // GetExecutionDetail - Gets the script execution detail for the given script execution ID. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - scriptExecutionID - The script execution Id @@ -228,7 +228,7 @@ func (client *ScriptActionsClient) getExecutionDetailCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -245,7 +245,7 @@ func (client *ScriptActionsClient) getExecutionDetailHandleResponse(resp *http.R // NewListByClusterPager - Lists all the persisted script actions for the specified cluster. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - ScriptActionsClientListByClusterOptions contains the optional parameters for the ScriptActionsClient.NewListByClusterPager @@ -293,7 +293,7 @@ func (client *ScriptActionsClient) listByClusterCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/scriptactions_client_example_test.go b/sdk/resourcemanager/hdinsight/armhdinsight/scriptactions_client_example_test.go index df049e285204..c44497a4b218 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/scriptactions_client_example_test.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/scriptactions_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/DeleteScriptAction.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/DeleteScriptAction.json func ExampleScriptActionsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -34,7 +34,7 @@ func ExampleScriptActionsClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/GetLinuxHadoopScriptAction.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetLinuxHadoopScriptAction.json func ExampleScriptActionsClient_NewListByClusterPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -69,7 +69,7 @@ func ExampleScriptActionsClient_NewListByClusterPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/GetScriptActionById.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetScriptActionById.json func ExampleScriptActionsClient_GetExecutionDetail() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -105,7 +105,7 @@ func ExampleScriptActionsClient_GetExecutionDetail() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/GetScriptExecutionAsyncOperationStatus.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetScriptExecutionAsyncOperationStatus.json func ExampleScriptActionsClient_GetExecutionAsyncOperationStatus() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/scriptexecutionhistory_client.go b/sdk/resourcemanager/hdinsight/armhdinsight/scriptexecutionhistory_client.go index 996a2442bdd3..29c811ebf3ac 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/scriptexecutionhistory_client.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/scriptexecutionhistory_client.go @@ -46,7 +46,7 @@ func NewScriptExecutionHistoryClient(subscriptionID string, credential azcore.To // NewListByClusterPager - Lists all scripts' execution history for the specified cluster. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - ScriptExecutionHistoryClientListByClusterOptions contains the optional parameters for the ScriptExecutionHistoryClient.NewListByClusterPager @@ -94,7 +94,7 @@ func (client *ScriptExecutionHistoryClient) listByClusterCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -112,7 +112,7 @@ func (client *ScriptExecutionHistoryClient) listByClusterHandleResponse(resp *ht // Promote - Promotes the specified ad-hoc script execution to a persisted script. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - scriptExecutionID - The script execution Id @@ -163,7 +163,7 @@ func (client *ScriptExecutionHistoryClient) promoteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/scriptexecutionhistory_client_example_test.go b/sdk/resourcemanager/hdinsight/armhdinsight/scriptexecutionhistory_client_example_test.go index 963f184bcc38..641af1d3f295 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/scriptexecutionhistory_client_example_test.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/scriptexecutionhistory_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/GetScriptExecutionHistory.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetScriptExecutionHistory.json func ExampleScriptExecutionHistoryClient_NewListByClusterPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -75,7 +75,7 @@ func ExampleScriptExecutionHistoryClient_NewListByClusterPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/PromoteLinuxHadoopScriptAction.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/PromoteLinuxHadoopScriptAction.json func ExampleScriptExecutionHistoryClient_Promote() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/virtualmachines_client.go b/sdk/resourcemanager/hdinsight/armhdinsight/virtualmachines_client.go index 5e3edf1f3bfa..3783221a5053 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/virtualmachines_client.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/virtualmachines_client.go @@ -47,7 +47,7 @@ func NewVirtualMachinesClient(subscriptionID string, credential azcore.TokenCred // GetAsyncOperationStatus - Gets the async operation status. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - operationID - The long running operation id. @@ -99,7 +99,7 @@ func (client *VirtualMachinesClient) getAsyncOperationStatusCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -117,7 +117,7 @@ func (client *VirtualMachinesClient) getAsyncOperationStatusHandleResponse(resp // ListHosts - Lists the HDInsight clusters hosts // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - VirtualMachinesClientListHostsOptions contains the optional parameters for the VirtualMachinesClient.ListHosts @@ -164,7 +164,7 @@ func (client *VirtualMachinesClient) listHostsCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,7 +182,7 @@ func (client *VirtualMachinesClient) listHostsHandleResponse(resp *http.Response // BeginRestartHosts - Restarts the specified HDInsight cluster hosts. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - hosts - The list of hosts to restart @@ -209,7 +209,7 @@ func (client *VirtualMachinesClient) BeginRestartHosts(ctx context.Context, reso // RestartHosts - Restarts the specified HDInsight cluster hosts. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2023-04-15-preview func (client *VirtualMachinesClient) restartHosts(ctx context.Context, resourceGroupName string, clusterName string, hosts []*string, options *VirtualMachinesClientBeginRestartHostsOptions) (*http.Response, error) { var err error const operationName = "VirtualMachinesClient.BeginRestartHosts" @@ -251,7 +251,7 @@ func (client *VirtualMachinesClient) restartHostsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2023-04-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, hosts); err != nil { diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/virtualmachines_client_example_test.go b/sdk/resourcemanager/hdinsight/armhdinsight/virtualmachines_client_example_test.go index c3123a08a177..9188f9cce718 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/virtualmachines_client_example_test.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/virtualmachines_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/GetClusterVirtualMachines.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetClusterVirtualMachines.json func ExampleVirtualMachinesClient_ListHosts() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -66,7 +66,7 @@ func ExampleVirtualMachinesClient_ListHosts() { // }} } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/RestartVirtualMachinesOperation.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/RestartVirtualMachinesOperation.json func ExampleVirtualMachinesClient_BeginRestartHosts() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -89,7 +89,7 @@ func ExampleVirtualMachinesClient_BeginRestartHosts() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/GetRestartHostsAsyncOperationStatus.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2023-04-15-preview/examples/GetRestartHostsAsyncOperationStatus.json func ExampleVirtualMachinesClient_GetAsyncOperationStatus() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/CHANGELOG.md b/sdk/resourcemanager/mysql/armmysqlflexibleservers/CHANGELOG.md index 3a425d895781..0ba3cdb7d07f 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/CHANGELOG.md +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 2.0.0-beta.2 (2023-11-30) +### Features Added + +- Support for test fakes and OpenTelemetry trace spans. + + ## 1.2.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/autorest.md b/sdk/resourcemanager/mysql/armmysqlflexibleservers/autorest.md index 8f4ad38fa03f..7fcfb595d469 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/autorest.md +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/autorest.md @@ -5,9 +5,10 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.2.0 +module-version: 2.0.0-beta.2 package-flexibleservers: true +tag: package-flexibleserver-2022-09-30-preview ``` \ No newline at end of file diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/azureadadministrators_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/azureadadministrators_client.go new file mode 100644 index 000000000000..f7c7c47b8060 --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/azureadadministrators_client.go @@ -0,0 +1,346 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmysqlflexibleservers + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AzureADAdministratorsClient contains the methods for the AzureADAdministrators group. +// Don't use this type directly, use NewAzureADAdministratorsClient() instead. +type AzureADAdministratorsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAzureADAdministratorsClient creates a new instance of AzureADAdministratorsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAzureADAdministratorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureADAdministratorsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AzureADAdministratorsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates an existing Azure Active Directory administrator. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serverName - The name of the server. +// - administratorName - The name of the Azure AD Administrator. +// - parameters - The required parameters for creating or updating an aad administrator. +// - options - AzureADAdministratorsClientBeginCreateOrUpdateOptions contains the optional parameters for the AzureADAdministratorsClient.BeginCreateOrUpdate +// method. +func (client *AzureADAdministratorsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, administratorName AdministratorName, parameters AzureADAdministrator, options *AzureADAdministratorsClientBeginCreateOrUpdateOptions) (*runtime.Poller[AzureADAdministratorsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, serverName, administratorName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureADAdministratorsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AzureADAdministratorsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates an existing Azure Active Directory administrator. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +func (client *AzureADAdministratorsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, administratorName AdministratorName, parameters AzureADAdministrator, options *AzureADAdministratorsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "AzureADAdministratorsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, administratorName, 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.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *AzureADAdministratorsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, administratorName AdministratorName, parameters AzureADAdministrator, options *AzureADAdministratorsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/administrators/{administratorName}" + 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 serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if administratorName == "" { + return nil, errors.New("parameter administratorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{administratorName}", url.PathEscape(string(administratorName))) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-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 +} + +// BeginDelete - Deletes an Azure AD Administrator. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serverName - The name of the server. +// - administratorName - The name of the Azure AD Administrator. +// - options - AzureADAdministratorsClientBeginDeleteOptions contains the optional parameters for the AzureADAdministratorsClient.BeginDelete +// method. +func (client *AzureADAdministratorsClient) BeginDelete(ctx context.Context, resourceGroupName string, serverName string, administratorName AdministratorName, options *AzureADAdministratorsClientBeginDeleteOptions) (*runtime.Poller[AzureADAdministratorsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, serverName, administratorName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureADAdministratorsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AzureADAdministratorsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes an Azure AD Administrator. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +func (client *AzureADAdministratorsClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, administratorName AdministratorName, options *AzureADAdministratorsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "AzureADAdministratorsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, administratorName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AzureADAdministratorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serverName string, administratorName AdministratorName, options *AzureADAdministratorsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/administrators/{administratorName}" + 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 serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if administratorName == "" { + return nil, errors.New("parameter administratorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{administratorName}", url.PathEscape(string(administratorName))) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets information about an azure ad administrator. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serverName - The name of the server. +// - administratorName - The name of the Azure AD Administrator. +// - options - AzureADAdministratorsClientGetOptions contains the optional parameters for the AzureADAdministratorsClient.Get +// method. +func (client *AzureADAdministratorsClient) Get(ctx context.Context, resourceGroupName string, serverName string, administratorName AdministratorName, options *AzureADAdministratorsClientGetOptions) (AzureADAdministratorsClientGetResponse, error) { + var err error + const operationName = "AzureADAdministratorsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, administratorName, options) + if err != nil { + return AzureADAdministratorsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AzureADAdministratorsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AzureADAdministratorsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AzureADAdministratorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, administratorName AdministratorName, options *AzureADAdministratorsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/administrators/{administratorName}" + 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 serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if administratorName == "" { + return nil, errors.New("parameter administratorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{administratorName}", url.PathEscape(string(administratorName))) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AzureADAdministratorsClient) getHandleResponse(resp *http.Response) (AzureADAdministratorsClientGetResponse, error) { + result := AzureADAdministratorsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureADAdministrator); err != nil { + return AzureADAdministratorsClientGetResponse{}, err + } + return result, nil +} + +// NewListByServerPager - List all the AAD administrators in a given server. +// +// Generated from API version 2021-12-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serverName - The name of the server. +// - options - AzureADAdministratorsClientListByServerOptions contains the optional parameters for the AzureADAdministratorsClient.NewListByServerPager +// method. +func (client *AzureADAdministratorsClient) NewListByServerPager(resourceGroupName string, serverName string, options *AzureADAdministratorsClientListByServerOptions) *runtime.Pager[AzureADAdministratorsClientListByServerResponse] { + return runtime.NewPager(runtime.PagingHandler[AzureADAdministratorsClientListByServerResponse]{ + More: func(page AzureADAdministratorsClientListByServerResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AzureADAdministratorsClientListByServerResponse) (AzureADAdministratorsClientListByServerResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AzureADAdministratorsClient.NewListByServerPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) + }, nil) + if err != nil { + return AzureADAdministratorsClientListByServerResponse{}, err + } + return client.listByServerHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByServerCreateRequest creates the ListByServer request. +func (client *AzureADAdministratorsClient) listByServerCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *AzureADAdministratorsClientListByServerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/administrators" + 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 serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServerHandleResponse handles the ListByServer response. +func (client *AzureADAdministratorsClient) listByServerHandleResponse(resp *http.Response) (AzureADAdministratorsClientListByServerResponse, error) { + result := AzureADAdministratorsClientListByServerResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AdministratorListResult); err != nil { + return AzureADAdministratorsClientListByServerResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/azureadadministrators_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/azureadadministrators_client_example_test.go new file mode 100644 index 000000000000..1d4259771715 --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/azureadadministrators_client_example_test.go @@ -0,0 +1,156 @@ +//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 armmysqlflexibleservers_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/mysql/armmysqlflexibleservers/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2021-12-01-preview/examples/AzureADAdministratorCreate.json +func ExampleAzureADAdministratorsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewAzureADAdministratorsClient().BeginCreateOrUpdate(ctx, "testrg", "mysqltestsvc4", armmysqlflexibleservers.AdministratorNameActiveDirectory, armmysqlflexibleservers.AzureADAdministrator{ + Properties: &armmysqlflexibleservers.AdministratorProperties{ + AdministratorType: to.Ptr(armmysqlflexibleservers.AdministratorTypeActiveDirectory), + IdentityResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/test-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-umi"), + Login: to.Ptr("bob@contoso.com"), + Sid: to.Ptr("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"), + TenantID: to.Ptr("c12b7025-bfe2-46c1-b463-993b5e4cd467"), + }, + }, 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.AzureADAdministrator = armmysqlflexibleservers.AzureADAdministrator{ + // Name: to.Ptr("ActiveDirectory"), + // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/administrators"), + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestsvc4/administrators/ActiveDirectory"), + // Properties: &armmysqlflexibleservers.AdministratorProperties{ + // AdministratorType: to.Ptr(armmysqlflexibleservers.AdministratorTypeActiveDirectory), + // IdentityResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/test-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-umi"), + // Login: to.Ptr("bob@contoso.com"), + // Sid: to.Ptr("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"), + // TenantID: to.Ptr("c12b7025-bfe2-46c1-b463-993b5e4cd467"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2021-12-01-preview/examples/AzureADAdministratorDelete.json +func ExampleAzureADAdministratorsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewAzureADAdministratorsClient().BeginDelete(ctx, "testrg", "mysqltestsvc4", armmysqlflexibleservers.AdministratorNameActiveDirectory, 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/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2021-12-01-preview/examples/AzureADAdministratorGet.json +func ExampleAzureADAdministratorsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAzureADAdministratorsClient().Get(ctx, "testrg", "mysqltestsvc4", armmysqlflexibleservers.AdministratorNameActiveDirectory, 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.AzureADAdministrator = armmysqlflexibleservers.AzureADAdministrator{ + // Name: to.Ptr("ActiveDirectory"), + // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/administrators"), + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestsvc4/administrators/ActiveDirectory"), + // Properties: &armmysqlflexibleservers.AdministratorProperties{ + // AdministratorType: to.Ptr(armmysqlflexibleservers.AdministratorTypeActiveDirectory), + // IdentityResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/test-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-umi"), + // Login: to.Ptr("bob@contoso.com"), + // Sid: to.Ptr("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"), + // TenantID: to.Ptr("c12b7025-bfe2-46c1-b463-993b5e4cd467"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2021-12-01-preview/examples/AzureADAdministratorsListByServer.json +func ExampleAzureADAdministratorsClient_NewListByServerPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewAzureADAdministratorsClient().NewListByServerPager("testrg", "mysqltestsvc4", 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.AdministratorListResult = armmysqlflexibleservers.AdministratorListResult{ + // Value: []*armmysqlflexibleservers.AzureADAdministrator{ + // { + // Name: to.Ptr("ActiveDirectory"), + // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/administrators"), + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestsvc4/administrators/ActiveDirectory"), + // Properties: &armmysqlflexibleservers.AdministratorProperties{ + // AdministratorType: to.Ptr(armmysqlflexibleservers.AdministratorTypeActiveDirectory), + // IdentityResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/test-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-umi"), + // Login: to.Ptr("bob@contoso.com"), + // Sid: to.Ptr("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"), + // TenantID: to.Ptr("c12b7025-bfe2-46c1-b463-993b5e4cd467"), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/backupandexport_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/backupandexport_client.go new file mode 100644 index 000000000000..fe2bb7623000 --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/backupandexport_client.go @@ -0,0 +1,190 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmysqlflexibleservers + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// BackupAndExportClient contains the methods for the BackupAndExport group. +// Don't use this type directly, use NewBackupAndExportClient() instead. +type BackupAndExportClient struct { + internal *arm.Client + subscriptionID string +} + +// NewBackupAndExportClient creates a new instance of BackupAndExportClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewBackupAndExportClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupAndExportClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BackupAndExportClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Exports the backup of the given server by creating a backup if not existing. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-30-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serverName - The name of the server. +// - parameters - The required parameters for creating and exporting backup of the given server. +// - options - BackupAndExportClientBeginCreateOptions contains the optional parameters for the BackupAndExportClient.BeginCreate +// method. +func (client *BackupAndExportClient) BeginCreate(ctx context.Context, resourceGroupName string, serverName string, parameters BackupAndExportRequest, options *BackupAndExportClientBeginCreateOptions) (*runtime.Poller[BackupAndExportClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, serverName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BackupAndExportClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BackupAndExportClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Exports the backup of the given server by creating a backup if not existing. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-30-preview +func (client *BackupAndExportClient) create(ctx context.Context, resourceGroupName string, serverName string, parameters BackupAndExportRequest, options *BackupAndExportClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "BackupAndExportClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, serverName, 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.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *BackupAndExportClient) createCreateRequest(ctx context.Context, resourceGroupName string, serverName string, parameters BackupAndExportRequest, options *BackupAndExportClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/backupAndExport" + 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 serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + 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", "2022-09-30-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 +} + +// ValidateBackup - Validates if backup can be performed for given server. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-30-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serverName - The name of the server. +// - options - BackupAndExportClientValidateBackupOptions contains the optional parameters for the BackupAndExportClient.ValidateBackup +// method. +func (client *BackupAndExportClient) ValidateBackup(ctx context.Context, resourceGroupName string, serverName string, options *BackupAndExportClientValidateBackupOptions) (BackupAndExportClientValidateBackupResponse, error) { + var err error + const operationName = "BackupAndExportClient.ValidateBackup" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.validateBackupCreateRequest(ctx, resourceGroupName, serverName, options) + if err != nil { + return BackupAndExportClientValidateBackupResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BackupAndExportClientValidateBackupResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BackupAndExportClientValidateBackupResponse{}, err + } + resp, err := client.validateBackupHandleResponse(httpResp) + return resp, err +} + +// validateBackupCreateRequest creates the ValidateBackup request. +func (client *BackupAndExportClient) validateBackupCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *BackupAndExportClientValidateBackupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/validateBackup" + 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 serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + 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", "2022-09-30-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// validateBackupHandleResponse handles the ValidateBackup response. +func (client *BackupAndExportClient) validateBackupHandleResponse(resp *http.Response) (BackupAndExportClientValidateBackupResponse, error) { + result := BackupAndExportClientValidateBackupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ValidateBackupResponse); err != nil { + return BackupAndExportClientValidateBackupResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/backupandexport_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/backupandexport_client_example_test.go new file mode 100644 index 000000000000..c14ef7bcba87 --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/backupandexport_client_example_test.go @@ -0,0 +1,96 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armmysqlflexibleservers_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/mysql/armmysqlflexibleservers/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2022-09-30-preview/examples/BackupAndExport.json +func ExampleBackupAndExportClient_BeginCreate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewBackupAndExportClient().BeginCreate(ctx, "TestGroup", "mysqltestserver", armmysqlflexibleservers.BackupAndExportRequest{ + BackupSettings: &armmysqlflexibleservers.BackupSettings{ + BackupName: to.Ptr("customer-backup-name"), + }, + TargetDetails: &armmysqlflexibleservers.FullBackupStoreDetails{ + ObjectType: to.Ptr("FullBackupStoreDetails"), + SasURIList: []*string{ + to.Ptr("sasuri1"), + to.Ptr("sasuri2")}, + }, + }, 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.BackupAndExportResponse = armmysqlflexibleservers.BackupAndExportResponse{ + // Name: to.Ptr("custom-backup101"), + // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/backupAndExport"), + // ID: to.Ptr("/subscriptions/cb9d743d-2140-4e73-b871-cd31abab1d2f/resourceGroups/mrgsumitkumatest1/providers/Microsoft.DBforMySQL/flexibleServers/servermysql-01/backupAndExport/custom-backup101"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-29T07:37:05.640Z"); return t}()), + // Error: &armmysqlflexibleservers.ErrorResponse{ + // Code: to.Ptr("AggregateException"), + // Message: to.Ptr("System.AggregateException: One or more errors occurred. (Mismatch in count of number of Commited-Blocks from service.)"), + // }, + // PercentComplete: to.Ptr[float64](100), + // Properties: &armmysqlflexibleservers.BackupAndExportResponseProperties{ + // BackupMetadata: to.Ptr("{\"key1\":\"value1\",\"key2\":\"value2\"}"), + // DataTransferredInBytes: to.Ptr[int64](1024), + // DatasourceSizeInBytes: to.Ptr[int64](1024), + // }, + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-29T07:34:02.328Z"); return t}()), + // Status: to.Ptr(armmysqlflexibleservers.OperationStatusFailed), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2022-09-30-preview/examples/ValidateBackup.json +func ExampleBackupAndExportClient_ValidateBackup() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewBackupAndExportClient().ValidateBackup(ctx, "TestGroup", "mysqltestserver", 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.ValidateBackupResponse = armmysqlflexibleservers.ValidateBackupResponse{ + // Properties: &armmysqlflexibleservers.ValidateBackupResponseProperties{ + // NumberOfContainers: to.Ptr[int32](1), + // }, + // } +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/backups_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/backups_client.go index 0649f3ef0e0b..b03a8e793be5 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/backups_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/backups_client.go @@ -46,7 +46,7 @@ func NewBackupsClient(subscriptionID string, credential azcore.TokenCredential, // Get - List all the backups for a given server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - backupName - The name of the backup. @@ -97,7 +97,7 @@ func (client *BackupsClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -114,7 +114,7 @@ func (client *BackupsClient) getHandleResponse(resp *http.Response) (BackupsClie // NewListByServerPager - List all the backups for a given server. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - options - BackupsClientListByServerOptions contains the optional parameters for the BackupsClient.NewListByServerPager @@ -162,7 +162,7 @@ func (client *BackupsClient) listByServerCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -176,3 +176,72 @@ func (client *BackupsClient) listByServerHandleResponse(resp *http.Response) (Ba } return result, nil } + +// Put - Create backup for a given server with specified backup name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-30-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serverName - The name of the server. +// - backupName - The name of the backup. +// - options - BackupsClientPutOptions contains the optional parameters for the BackupsClient.Put method. +func (client *BackupsClient) Put(ctx context.Context, resourceGroupName string, serverName string, backupName string, options *BackupsClientPutOptions) (BackupsClientPutResponse, error) { + var err error + const operationName = "BackupsClient.Put" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.putCreateRequest(ctx, resourceGroupName, serverName, backupName, options) + if err != nil { + return BackupsClientPutResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BackupsClientPutResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BackupsClientPutResponse{}, err + } + resp, err := client.putHandleResponse(httpResp) + return resp, err +} + +// putCreateRequest creates the Put request. +func (client *BackupsClient) putCreateRequest(ctx context.Context, resourceGroupName string, serverName string, backupName string, options *BackupsClientPutOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/backups/{backupName}" + 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 serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if backupName == "" { + return nil, errors.New("parameter backupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupName}", url.PathEscape(backupName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-30-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// putHandleResponse handles the Put response. +func (client *BackupsClient) putHandleResponse(resp *http.Response) (BackupsClientPutResponse, error) { + result := BackupsClientPutResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServerBackup); err != nil { + return BackupsClientPutResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/backups_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/backups_client_example_test.go index 492dc0da1d79..8199e883ef1b 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/backups_client_example_test.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/backups_client_example_test.go @@ -14,10 +14,40 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/BackupGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2022-09-30-preview/examples/BackupPut.json +func ExampleBackupsClient_Put() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewBackupsClient().Put(ctx, "TestGroup", "mysqltestserver", "mybackup", 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.ServerBackup = armmysqlflexibleservers.ServerBackup{ + // Name: to.Ptr("customer_20220507t073755_bb392c3b-17c6-4d3f-9742-8479ca87b3ac_mybackup"), + // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/backups"), + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/backups/customer_20220507t073755_bb392c3b-17c6-4d3f-9742-8479ca87b3ac_mybackup"), + // Properties: &armmysqlflexibleservers.ServerBackupProperties{ + // BackupType: to.Ptr("FULL"), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-07T07:38:01.149Z"); return t}()), + // Source: to.Ptr("Automatic"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2022-09-30-preview/examples/BackupGet.json func ExampleBackupsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -47,7 +77,7 @@ func ExampleBackupsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/BackupsListByServer.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2022-09-30-preview/examples/BackupsListByServer.json func ExampleBackupsClient_NewListByServerPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailability_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailability_client.go index e21f02ed733d..e43aab2ae4eb 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailability_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailability_client.go @@ -46,7 +46,7 @@ func NewCheckNameAvailabilityClient(subscriptionID string, credential azcore.Tok // Execute - Check the availability of name for server // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-01-preview // - locationName - The name of the location. // - nameAvailabilityRequest - The required parameters for checking if server name is available. // - options - CheckNameAvailabilityClientExecuteOptions contains the optional parameters for the CheckNameAvailabilityClient.Execute @@ -89,7 +89,7 @@ func (client *CheckNameAvailabilityClient) executeCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, nameAvailabilityRequest); err != nil { diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailability_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailability_client_example_test.go index e6e26026ffa5..daa51d2550f1 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailability_client_example_test.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailability_client_example_test.go @@ -15,10 +15,10 @@ import ( "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/mysql/armmysqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/CheckNameAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2021-12-01-preview/examples/CheckNameAvailability.json func ExampleCheckNameAvailabilityClient_Execute() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailabilitywithoutlocation_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailabilitywithoutlocation_client.go new file mode 100644 index 000000000000..9b443d41a110 --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailabilitywithoutlocation_client.go @@ -0,0 +1,103 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmysqlflexibleservers + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CheckNameAvailabilityWithoutLocationClient contains the methods for the CheckNameAvailabilityWithoutLocation group. +// Don't use this type directly, use NewCheckNameAvailabilityWithoutLocationClient() instead. +type CheckNameAvailabilityWithoutLocationClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCheckNameAvailabilityWithoutLocationClient creates a new instance of CheckNameAvailabilityWithoutLocationClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewCheckNameAvailabilityWithoutLocationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CheckNameAvailabilityWithoutLocationClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CheckNameAvailabilityWithoutLocationClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Execute - Check the availability of name for server +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - nameAvailabilityRequest - The required parameters for checking if server name is available. +// - options - CheckNameAvailabilityWithoutLocationClientExecuteOptions contains the optional parameters for the CheckNameAvailabilityWithoutLocationClient.Execute +// method. +func (client *CheckNameAvailabilityWithoutLocationClient) Execute(ctx context.Context, nameAvailabilityRequest NameAvailabilityRequest, options *CheckNameAvailabilityWithoutLocationClientExecuteOptions) (CheckNameAvailabilityWithoutLocationClientExecuteResponse, error) { + var err error + const operationName = "CheckNameAvailabilityWithoutLocationClient.Execute" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.executeCreateRequest(ctx, nameAvailabilityRequest, options) + if err != nil { + return CheckNameAvailabilityWithoutLocationClientExecuteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CheckNameAvailabilityWithoutLocationClientExecuteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CheckNameAvailabilityWithoutLocationClientExecuteResponse{}, err + } + resp, err := client.executeHandleResponse(httpResp) + return resp, err +} + +// executeCreateRequest creates the Execute request. +func (client *CheckNameAvailabilityWithoutLocationClient) executeCreateRequest(ctx context.Context, nameAvailabilityRequest NameAvailabilityRequest, options *CheckNameAvailabilityWithoutLocationClientExecuteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/checkNameAvailability" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, nameAvailabilityRequest); err != nil { + return nil, err + } + return req, nil +} + +// executeHandleResponse handles the Execute response. +func (client *CheckNameAvailabilityWithoutLocationClient) executeHandleResponse(resp *http.Response) (CheckNameAvailabilityWithoutLocationClientExecuteResponse, error) { + result := CheckNameAvailabilityWithoutLocationClientExecuteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NameAvailability); err != nil { + return CheckNameAvailabilityWithoutLocationClientExecuteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailabilitywithoutlocation_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailabilitywithoutlocation_client_example_test.go new file mode 100644 index 000000000000..d90d25bc94e1 --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailabilitywithoutlocation_client_example_test.go @@ -0,0 +1,47 @@ +//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 armmysqlflexibleservers_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/mysql/armmysqlflexibleservers/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2021-12-01-preview/examples/CheckNameAvailability.json +func ExampleCheckNameAvailabilityWithoutLocationClient_Execute() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewCheckNameAvailabilityWithoutLocationClient().Execute(ctx, armmysqlflexibleservers.NameAvailabilityRequest{ + Name: to.Ptr("name1"), + Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers"), + }, 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.NameAvailability = armmysqlflexibleservers.NameAvailability{ + // Message: to.Ptr(""), + // NameAvailable: to.Ptr(true), + // Reason: to.Ptr(""), + // } +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checkvirtualnetworksubnetusage_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checkvirtualnetworksubnetusage_client.go index 7792a9573ead..6221089e3b39 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checkvirtualnetworksubnetusage_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checkvirtualnetworksubnetusage_client.go @@ -46,7 +46,7 @@ func NewCheckVirtualNetworkSubnetUsageClient(subscriptionID string, credential a // Execute - Get virtual network subnet usage for a given vNet resource id. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-01-preview // - locationName - The name of the location. // - parameters - The required parameters for creating or updating a server. // - options - CheckVirtualNetworkSubnetUsageClientExecuteOptions contains the optional parameters for the CheckVirtualNetworkSubnetUsageClient.Execute @@ -89,7 +89,7 @@ func (client *CheckVirtualNetworkSubnetUsageClient) executeCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-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/mysql/armmysqlflexibleservers/checkvirtualnetworksubnetusage_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checkvirtualnetworksubnetusage_client_example_test.go index 8d800a4f3e85..6cf3a994aea2 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checkvirtualnetworksubnetusage_client_example_test.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checkvirtualnetworksubnetusage_client_example_test.go @@ -15,10 +15,10 @@ import ( "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/mysql/armmysqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/CheckVirtualNetworkSubnetUsage.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2021-12-01-preview/examples/CheckVirtualNetworkSubnetUsage.json func ExampleCheckVirtualNetworkSubnetUsageClient_Execute() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -48,5 +48,7 @@ func ExampleCheckVirtualNetworkSubnetUsageClient_Execute() { // SubnetName: to.Ptr("test-subnet-2"), // Usage: to.Ptr[int64](3), // }}, + // Location: to.Ptr("WestUS"), + // SubscriptionID: to.Ptr("ffffffff-ffff-ffff-ffff-ffffffffffff"), // } } diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/client_factory.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/client_factory.go index 42e497c2ebd5..a9c2041dd6e2 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/client_factory.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/client_factory.go @@ -37,6 +37,18 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } +// NewAzureADAdministratorsClient creates a new instance of AzureADAdministratorsClient. +func (c *ClientFactory) NewAzureADAdministratorsClient() *AzureADAdministratorsClient { + subClient, _ := NewAzureADAdministratorsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewBackupAndExportClient creates a new instance of BackupAndExportClient. +func (c *ClientFactory) NewBackupAndExportClient() *BackupAndExportClient { + subClient, _ := NewBackupAndExportClient(c.subscriptionID, c.credential, c.options) + return subClient +} + // NewBackupsClient creates a new instance of BackupsClient. func (c *ClientFactory) NewBackupsClient() *BackupsClient { subClient, _ := NewBackupsClient(c.subscriptionID, c.credential, c.options) @@ -49,6 +61,12 @@ func (c *ClientFactory) NewCheckNameAvailabilityClient() *CheckNameAvailabilityC return subClient } +// NewCheckNameAvailabilityWithoutLocationClient creates a new instance of CheckNameAvailabilityWithoutLocationClient. +func (c *ClientFactory) NewCheckNameAvailabilityWithoutLocationClient() *CheckNameAvailabilityWithoutLocationClient { + subClient, _ := NewCheckNameAvailabilityWithoutLocationClient(c.subscriptionID, c.credential, c.options) + return subClient +} + // NewCheckVirtualNetworkSubnetUsageClient creates a new instance of CheckVirtualNetworkSubnetUsageClient. func (c *ClientFactory) NewCheckVirtualNetworkSubnetUsageClient() *CheckVirtualNetworkSubnetUsageClient { subClient, _ := NewCheckVirtualNetworkSubnetUsageClient(c.subscriptionID, c.credential, c.options) @@ -85,6 +103,12 @@ func (c *ClientFactory) NewLocationBasedCapabilitiesClient() *LocationBasedCapab return subClient } +// NewLogFilesClient creates a new instance of LogFilesClient. +func (c *ClientFactory) NewLogFilesClient() *LogFilesClient { + subClient, _ := NewLogFilesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + // NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { subClient, _ := NewOperationsClient(c.credential, c.options) diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/configurations_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/configurations_client.go index 418e67daee2f..05d4a1ef3747 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/configurations_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/configurations_client.go @@ -17,6 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" + "strconv" "strings" ) @@ -46,7 +47,7 @@ func NewConfigurationsClient(subscriptionID string, credential azcore.TokenCrede // BeginBatchUpdate - Update a list of configurations in a given server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - parameters - The parameters for updating a list of server configuration. @@ -73,7 +74,7 @@ func (client *ConfigurationsClient) BeginBatchUpdate(ctx context.Context, resour // BatchUpdate - Update a list of configurations in a given server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-01-preview func (client *ConfigurationsClient) batchUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters ConfigurationListForBatchUpdate, options *ConfigurationsClientBeginBatchUpdateOptions) (*http.Response, error) { var err error const operationName = "ConfigurationsClient.BeginBatchUpdate" @@ -115,7 +116,92 @@ func (client *ConfigurationsClient) batchUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-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 +} + +// BeginCreateOrUpdate - Updates a configuration of a server. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serverName - The name of the server. +// - configurationName - The name of the server configuration. +// - parameters - The required parameters for updating a server configuration. +// - options - ConfigurationsClientBeginCreateOrUpdateOptions contains the optional parameters for the ConfigurationsClient.BeginCreateOrUpdate +// method. +func (client *ConfigurationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration, options *ConfigurationsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ConfigurationsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, serverName, configurationName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConfigurationsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ConfigurationsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Updates a configuration of a server. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +func (client *ConfigurationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration, options *ConfigurationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ConfigurationsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, configurationName, 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.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ConfigurationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration, options *ConfigurationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/configurations/{configurationName}" + 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 serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if configurationName == "" { + return nil, errors.New("parameter configurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(configurationName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-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 +213,7 @@ func (client *ConfigurationsClient) batchUpdateCreateRequest(ctx context.Context // Get - Gets information about a configuration of server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - configurationName - The name of the server configuration. @@ -178,7 +264,7 @@ func (client *ConfigurationsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -195,7 +281,7 @@ func (client *ConfigurationsClient) getHandleResponse(resp *http.Response) (Conf // NewListByServerPager - List all the configurations in a given server. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - options - ConfigurationsClientListByServerOptions contains the optional parameters for the ConfigurationsClient.NewListByServerPager @@ -243,7 +329,19 @@ func (client *ConfigurationsClient) listByServerCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") + if options != nil && options.Tags != nil { + reqQP.Set("tags", *options.Tags) + } + if options != nil && options.Keyword != nil { + reqQP.Set("keyword", *options.Keyword) + } + if options != nil && options.Page != nil { + reqQP.Set("page", strconv.FormatInt(int64(*options.Page), 10)) + } + if options != nil && options.PageSize != nil { + reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -261,7 +359,7 @@ func (client *ConfigurationsClient) listByServerHandleResponse(resp *http.Respon // BeginUpdate - Updates a configuration of a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - configurationName - The name of the server configuration. @@ -288,7 +386,7 @@ func (client *ConfigurationsClient) BeginUpdate(ctx context.Context, resourceGro // Update - Updates a configuration of a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-01-preview func (client *ConfigurationsClient) update(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration, options *ConfigurationsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "ConfigurationsClient.BeginUpdate" @@ -334,7 +432,7 @@ func (client *ConfigurationsClient) updateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-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/mysql/armmysqlflexibleservers/configurations_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/configurations_client_example_test.go index f5470234e5bf..09800f288994 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/configurations_client_example_test.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/configurations_client_example_test.go @@ -15,10 +15,52 @@ import ( "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/mysql/armmysqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ConfigurationUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2021-12-01-preview/examples/ConfigurationCreateOrUpdate.json +func ExampleConfigurationsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewConfigurationsClient().BeginCreateOrUpdate(ctx, "TestGroup", "testserver", "event_scheduler", armmysqlflexibleservers.Configuration{ + Properties: &armmysqlflexibleservers.ConfigurationProperties{ + Source: to.Ptr(armmysqlflexibleservers.ConfigurationSourceUserOverride), + Value: to.Ptr("off"), + }, + }, 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.Configuration = armmysqlflexibleservers.Configuration{ + // Name: to.Ptr("event_scheduler"), + // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testserver/configurations/event_scheduler"), + // Properties: &armmysqlflexibleservers.ConfigurationProperties{ + // Description: to.Ptr("Indicates the status of the Event Scheduler."), + // AllowedValues: to.Ptr("ON,OFF,DISABLED"), + // DataType: to.Ptr("Enumeration"), + // DefaultValue: to.Ptr("OFF"), + // Source: to.Ptr(armmysqlflexibleservers.ConfigurationSourceUserOverride), + // Value: to.Ptr("ON"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2021-12-01-preview/examples/ConfigurationUpdate.json func ExampleConfigurationsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -63,7 +105,7 @@ func ExampleConfigurationsClient_BeginUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ConfigurationGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2021-12-01-preview/examples/ConfigurationGet.json func ExampleConfigurationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -99,7 +141,7 @@ func ExampleConfigurationsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ConfigurationsBatchUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2021-12-01-preview/examples/ConfigurationsBatchUpdate.json func ExampleConfigurationsClient_BeginBatchUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -111,6 +153,7 @@ func ExampleConfigurationsClient_BeginBatchUpdate() { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewConfigurationsClient().BeginBatchUpdate(ctx, "testrg", "mysqltestserver", armmysqlflexibleservers.ConfigurationListForBatchUpdate{ + ResetAllToDefault: to.Ptr(armmysqlflexibleservers.ResetAllToDefaultFalse), Value: []*armmysqlflexibleservers.ConfigurationForBatchUpdate{ { Name: to.Ptr("event_scheduler"), @@ -172,7 +215,7 @@ func ExampleConfigurationsClient_BeginBatchUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ConfigurationsListByServer.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2021-12-01-preview/examples/ConfigurationsListByServer.json func ExampleConfigurationsClient_NewListByServerPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -183,7 +226,11 @@ func ExampleConfigurationsClient_NewListByServerPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewConfigurationsClient().NewListByServerPager("testrg", "mysqltestserver", nil) + pager := clientFactory.NewConfigurationsClient().NewListByServerPager("testrg", "mysqltestserver", &armmysqlflexibleservers.ConfigurationsClientListByServerOptions{Tags: nil, + Keyword: nil, + Page: to.Ptr[int32](1), + PageSize: to.Ptr[int32](8), + }) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/constants.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/constants.go index 61902b82b197..af28f6e5246a 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/constants.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/constants.go @@ -10,9 +10,52 @@ package armmysqlflexibleservers const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers" - moduleVersion = "v1.2.0" + moduleVersion = "v2.0.0-beta.2" ) +type AdministratorName string + +const ( + AdministratorNameActiveDirectory AdministratorName = "ActiveDirectory" +) + +// PossibleAdministratorNameValues returns the possible values for the AdministratorName const type. +func PossibleAdministratorNameValues() []AdministratorName { + return []AdministratorName{ + AdministratorNameActiveDirectory, + } +} + +// AdministratorType - Type of the sever administrator. +type AdministratorType string + +const ( + AdministratorTypeActiveDirectory AdministratorType = "ActiveDirectory" +) + +// PossibleAdministratorTypeValues returns the possible values for the AdministratorType const type. +func PossibleAdministratorTypeValues() []AdministratorType { + return []AdministratorType{ + AdministratorTypeActiveDirectory, + } +} + +// BackupFormat - Backup Format for the current backup. (CollatedFormat is INTERNAL – DO NOT USE) +type BackupFormat string + +const ( + BackupFormatCollatedFormat BackupFormat = "CollatedFormat" + BackupFormatNone BackupFormat = "None" +) + +// PossibleBackupFormatValues returns the possible values for the BackupFormat const type. +func PossibleBackupFormatValues() []BackupFormat { + return []BackupFormat{ + BackupFormatCollatedFormat, + BackupFormatNone, + } +} + // ConfigurationSource - Source of the configuration. type ConfigurationSource string @@ -189,6 +232,50 @@ func PossibleIsReadOnlyValues() []IsReadOnly { } } +// ManagedServiceIdentityType - Type of managed service identity. +type ManagedServiceIdentityType string + +const ( + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" +) + +// PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. +func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { + return []ManagedServiceIdentityType{ + ManagedServiceIdentityTypeUserAssigned, + } +} + +// OperationStatus - The operation status +type OperationStatus string + +const ( + // OperationStatusCancelInProgress - The cancellation in progress + OperationStatusCancelInProgress OperationStatus = "CancelInProgress" + // OperationStatusCanceled - The operation has been Canceled + OperationStatusCanceled OperationStatus = "Canceled" + // OperationStatusFailed - The operation Failed + OperationStatusFailed OperationStatus = "Failed" + // OperationStatusInProgress - The operation is running + OperationStatusInProgress OperationStatus = "InProgress" + // OperationStatusPending - The operation has been accepted but hasn't started. + OperationStatusPending OperationStatus = "Pending" + // OperationStatusSucceeded - The operation Succeeded + OperationStatusSucceeded OperationStatus = "Succeeded" +) + +// PossibleOperationStatusValues returns the possible values for the OperationStatus const type. +func PossibleOperationStatusValues() []OperationStatus { + return []OperationStatus{ + OperationStatusCancelInProgress, + OperationStatusCanceled, + OperationStatusFailed, + OperationStatusInProgress, + OperationStatusPending, + OperationStatusSucceeded, + } +} + // ReplicationRole - The replication role. type ReplicationRole string @@ -207,6 +294,22 @@ func PossibleReplicationRoleValues() []ReplicationRole { } } +// ResetAllToDefault - Whether to reset all server parameters to default. +type ResetAllToDefault string + +const ( + ResetAllToDefaultFalse ResetAllToDefault = "False" + ResetAllToDefaultTrue ResetAllToDefault = "True" +) + +// PossibleResetAllToDefaultValues returns the possible values for the ResetAllToDefault const type. +func PossibleResetAllToDefaultValues() []ResetAllToDefault { + return []ResetAllToDefault{ + ResetAllToDefaultFalse, + ResetAllToDefaultTrue, + } +} + // SKUTier - The tier of the particular SKU, e.g. GeneralPurpose. type SKUTier string diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/databases_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/databases_client.go index e81d0d76a5b8..c8ac369d627b 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/databases_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/databases_client.go @@ -46,7 +46,7 @@ func NewDatabasesClient(subscriptionID string, credential azcore.TokenCredential // BeginCreateOrUpdate - Creates a new database or updates an existing database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - databaseName - The name of the database. @@ -73,7 +73,7 @@ func (client *DatabasesClient) BeginCreateOrUpdate(ctx context.Context, resource // CreateOrUpdate - Creates a new database or updates an existing database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-01-preview func (client *DatabasesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database, options *DatabasesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "DatabasesClient.BeginCreateOrUpdate" @@ -119,7 +119,7 @@ func (client *DatabasesClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -131,7 +131,7 @@ func (client *DatabasesClient) createOrUpdateCreateRequest(ctx context.Context, // BeginDelete - Deletes a database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - databaseName - The name of the database. @@ -156,7 +156,7 @@ func (client *DatabasesClient) BeginDelete(ctx context.Context, resourceGroupNam // Delete - Deletes a database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-01-preview func (client *DatabasesClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *DatabasesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "DatabasesClient.BeginDelete" @@ -202,7 +202,7 @@ func (client *DatabasesClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -211,7 +211,7 @@ func (client *DatabasesClient) deleteCreateRequest(ctx context.Context, resource // Get - Gets information about a database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - databaseName - The name of the database. @@ -262,7 +262,7 @@ func (client *DatabasesClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -279,7 +279,7 @@ func (client *DatabasesClient) getHandleResponse(resp *http.Response) (Databases // NewListByServerPager - List all the databases in a given server. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - options - DatabasesClientListByServerOptions contains the optional parameters for the DatabasesClient.NewListByServerPager @@ -327,7 +327,7 @@ func (client *DatabasesClient) listByServerCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/databases_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/databases_client_example_test.go index 2f67c5698430..ef77b6ef696f 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/databases_client_example_test.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/databases_client_example_test.go @@ -15,10 +15,10 @@ import ( "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/mysql/armmysqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/DatabaseCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2021-12-01-preview/examples/DatabaseCreate.json func ExampleDatabasesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -56,7 +56,7 @@ func ExampleDatabasesClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/DatabaseDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2021-12-01-preview/examples/DatabaseDelete.json func ExampleDatabasesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -77,7 +77,7 @@ func ExampleDatabasesClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/DatabaseGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2021-12-01-preview/examples/DatabaseGet.json func ExampleDatabasesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -106,7 +106,7 @@ func ExampleDatabasesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/DatabasesListByServer.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2021-12-01-preview/examples/DatabasesListByServer.json func ExampleDatabasesClient_NewListByServerPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/azureadadministrators_server.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/azureadadministrators_server.go new file mode 100644 index 000000000000..a1ad670b8afc --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/azureadadministrators_server.go @@ -0,0 +1,290 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" + "net/http" + "net/url" + "regexp" +) + +// AzureADAdministratorsServer is a fake server for instances of the armmysqlflexibleservers.AzureADAdministratorsClient type. +type AzureADAdministratorsServer struct { + // BeginCreateOrUpdate is the fake for method AzureADAdministratorsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated, http.StatusAccepted + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, serverName string, administratorName armmysqlflexibleservers.AdministratorName, parameters armmysqlflexibleservers.AzureADAdministrator, options *armmysqlflexibleservers.AzureADAdministratorsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armmysqlflexibleservers.AzureADAdministratorsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method AzureADAdministratorsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, serverName string, administratorName armmysqlflexibleservers.AdministratorName, options *armmysqlflexibleservers.AzureADAdministratorsClientBeginDeleteOptions) (resp azfake.PollerResponder[armmysqlflexibleservers.AzureADAdministratorsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method AzureADAdministratorsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, serverName string, administratorName armmysqlflexibleservers.AdministratorName, options *armmysqlflexibleservers.AzureADAdministratorsClientGetOptions) (resp azfake.Responder[armmysqlflexibleservers.AzureADAdministratorsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByServerPager is the fake for method AzureADAdministratorsClient.NewListByServerPager + // HTTP status codes to indicate success: http.StatusOK + NewListByServerPager func(resourceGroupName string, serverName string, options *armmysqlflexibleservers.AzureADAdministratorsClientListByServerOptions) (resp azfake.PagerResponder[armmysqlflexibleservers.AzureADAdministratorsClientListByServerResponse]) +} + +// NewAzureADAdministratorsServerTransport creates a new instance of AzureADAdministratorsServerTransport with the provided implementation. +// The returned AzureADAdministratorsServerTransport instance is connected to an instance of armmysqlflexibleservers.AzureADAdministratorsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAzureADAdministratorsServerTransport(srv *AzureADAdministratorsServer) *AzureADAdministratorsServerTransport { + return &AzureADAdministratorsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armmysqlflexibleservers.AzureADAdministratorsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armmysqlflexibleservers.AzureADAdministratorsClientDeleteResponse]](), + newListByServerPager: newTracker[azfake.PagerResponder[armmysqlflexibleservers.AzureADAdministratorsClientListByServerResponse]](), + } +} + +// AzureADAdministratorsServerTransport connects instances of armmysqlflexibleservers.AzureADAdministratorsClient to instances of AzureADAdministratorsServer. +// Don't use this type directly, use NewAzureADAdministratorsServerTransport instead. +type AzureADAdministratorsServerTransport struct { + srv *AzureADAdministratorsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armmysqlflexibleservers.AzureADAdministratorsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armmysqlflexibleservers.AzureADAdministratorsClientDeleteResponse]] + newListByServerPager *tracker[azfake.PagerResponder[armmysqlflexibleservers.AzureADAdministratorsClientListByServerResponse]] +} + +// Do implements the policy.Transporter interface for AzureADAdministratorsServerTransport. +func (a *AzureADAdministratorsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "AzureADAdministratorsClient.BeginCreateOrUpdate": + resp, err = a.dispatchBeginCreateOrUpdate(req) + case "AzureADAdministratorsClient.BeginDelete": + resp, err = a.dispatchBeginDelete(req) + case "AzureADAdministratorsClient.Get": + resp, err = a.dispatchGet(req) + case "AzureADAdministratorsClient.NewListByServerPager": + resp, err = a.dispatchNewListByServerPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (a *AzureADAdministratorsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if a.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := a.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DBforMySQL/flexibleServers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/administrators/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmysqlflexibleservers.AzureADAdministrator](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + serverNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serverName")]) + if err != nil { + return nil, err + } + administratorNameParam, err := parseWithCast(matches[regex.SubexpIndex("administratorName")], func(v string) (armmysqlflexibleservers.AdministratorName, error) { + p, unescapeErr := url.PathUnescape(v) + if unescapeErr != nil { + return "", unescapeErr + } + return armmysqlflexibleservers.AdministratorName(p), nil + }) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, serverNameParam, administratorNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + a.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { + a.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + a.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (a *AzureADAdministratorsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if a.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := a.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DBforMySQL/flexibleServers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/administrators/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + serverNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serverName")]) + if err != nil { + return nil, err + } + administratorNameParam, err := parseWithCast(matches[regex.SubexpIndex("administratorName")], func(v string) (armmysqlflexibleservers.AdministratorName, error) { + p, unescapeErr := url.PathUnescape(v) + if unescapeErr != nil { + return "", unescapeErr + } + return armmysqlflexibleservers.AdministratorName(p), nil + }) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginDelete(req.Context(), resourceGroupNameParam, serverNameParam, administratorNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + a.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + a.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + a.beginDelete.remove(req) + } + + return resp, nil +} + +func (a *AzureADAdministratorsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DBforMySQL/flexibleServers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/administrators/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + serverNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serverName")]) + if err != nil { + return nil, err + } + administratorNameParam, err := parseWithCast(matches[regex.SubexpIndex("administratorName")], func(v string) (armmysqlflexibleservers.AdministratorName, error) { + p, unescapeErr := url.PathUnescape(v) + if unescapeErr != nil { + return "", unescapeErr + } + return armmysqlflexibleservers.AdministratorName(p), nil + }) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, serverNameParam, administratorNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AzureADAdministrator, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AzureADAdministratorsServerTransport) dispatchNewListByServerPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListByServerPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByServerPager not implemented")} + } + newListByServerPager := a.newListByServerPager.get(req) + if newListByServerPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DBforMySQL/flexibleServers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/administrators` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + serverNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serverName")]) + if err != nil { + return nil, err + } + resp := a.srv.NewListByServerPager(resourceGroupNameParam, serverNameParam, nil) + newListByServerPager = &resp + a.newListByServerPager.add(req, newListByServerPager) + server.PagerResponderInjectNextLinks(newListByServerPager, req, func(page *armmysqlflexibleservers.AzureADAdministratorsClientListByServerResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByServerPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListByServerPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByServerPager) { + a.newListByServerPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/backupandexport_server.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/backupandexport_server.go new file mode 100644 index 000000000000..05339d0cbbba --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/backupandexport_server.go @@ -0,0 +1,158 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" + "net/http" + "net/url" + "regexp" +) + +// BackupAndExportServer is a fake server for instances of the armmysqlflexibleservers.BackupAndExportClient type. +type BackupAndExportServer struct { + // BeginCreate is the fake for method BackupAndExportClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginCreate func(ctx context.Context, resourceGroupName string, serverName string, parameters armmysqlflexibleservers.BackupAndExportRequest, options *armmysqlflexibleservers.BackupAndExportClientBeginCreateOptions) (resp azfake.PollerResponder[armmysqlflexibleservers.BackupAndExportClientCreateResponse], errResp azfake.ErrorResponder) + + // ValidateBackup is the fake for method BackupAndExportClient.ValidateBackup + // HTTP status codes to indicate success: http.StatusOK + ValidateBackup func(ctx context.Context, resourceGroupName string, serverName string, options *armmysqlflexibleservers.BackupAndExportClientValidateBackupOptions) (resp azfake.Responder[armmysqlflexibleservers.BackupAndExportClientValidateBackupResponse], errResp azfake.ErrorResponder) +} + +// NewBackupAndExportServerTransport creates a new instance of BackupAndExportServerTransport with the provided implementation. +// The returned BackupAndExportServerTransport instance is connected to an instance of armmysqlflexibleservers.BackupAndExportClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewBackupAndExportServerTransport(srv *BackupAndExportServer) *BackupAndExportServerTransport { + return &BackupAndExportServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armmysqlflexibleservers.BackupAndExportClientCreateResponse]](), + } +} + +// BackupAndExportServerTransport connects instances of armmysqlflexibleservers.BackupAndExportClient to instances of BackupAndExportServer. +// Don't use this type directly, use NewBackupAndExportServerTransport instead. +type BackupAndExportServerTransport struct { + srv *BackupAndExportServer + beginCreate *tracker[azfake.PollerResponder[armmysqlflexibleservers.BackupAndExportClientCreateResponse]] +} + +// Do implements the policy.Transporter interface for BackupAndExportServerTransport. +func (b *BackupAndExportServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "BackupAndExportClient.BeginCreate": + resp, err = b.dispatchBeginCreate(req) + case "BackupAndExportClient.ValidateBackup": + resp, err = b.dispatchValidateBackup(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (b *BackupAndExportServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if b.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := b.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DBforMySQL/flexibleServers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupAndExport` + 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[armmysqlflexibleservers.BackupAndExportRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + serverNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serverName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.BeginCreate(req.Context(), resourceGroupNameParam, serverNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + b.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + b.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + b.beginCreate.remove(req) + } + + return resp, nil +} + +func (b *BackupAndExportServerTransport) dispatchValidateBackup(req *http.Request) (*http.Response, error) { + if b.srv.ValidateBackup == nil { + return nil, &nonRetriableError{errors.New("fake for method ValidateBackup not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DBforMySQL/flexibleServers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/validateBackup` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + serverNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serverName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.ValidateBackup(req.Context(), resourceGroupNameParam, serverNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ValidateBackupResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/backups_server.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/backups_server.go index 031c955d5c52..f8fa45f5a890 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/backups_server.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/backups_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" "net/http" "net/url" "regexp" @@ -31,6 +31,10 @@ type BackupsServer struct { // NewListByServerPager is the fake for method BackupsClient.NewListByServerPager // HTTP status codes to indicate success: http.StatusOK NewListByServerPager func(resourceGroupName string, serverName string, options *armmysqlflexibleservers.BackupsClientListByServerOptions) (resp azfake.PagerResponder[armmysqlflexibleservers.BackupsClientListByServerResponse]) + + // Put is the fake for method BackupsClient.Put + // HTTP status codes to indicate success: http.StatusOK + Put func(ctx context.Context, resourceGroupName string, serverName string, backupName string, options *armmysqlflexibleservers.BackupsClientPutOptions) (resp azfake.Responder[armmysqlflexibleservers.BackupsClientPutResponse], errResp azfake.ErrorResponder) } // NewBackupsServerTransport creates a new instance of BackupsServerTransport with the provided implementation. @@ -66,6 +70,8 @@ func (b *BackupsServerTransport) Do(req *http.Request) (*http.Response, error) { resp, err = b.dispatchGet(req) case "BackupsClient.NewListByServerPager": resp, err = b.dispatchNewListByServerPager(req) + case "BackupsClient.Put": + resp, err = b.dispatchPut(req) default: err = fmt.Errorf("unhandled API %s", method) } @@ -154,3 +160,40 @@ func (b *BackupsServerTransport) dispatchNewListByServerPager(req *http.Request) } return resp, nil } + +func (b *BackupsServerTransport) dispatchPut(req *http.Request) (*http.Response, error) { + if b.srv.Put == nil { + return nil, &nonRetriableError{errors.New("fake for method Put not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DBforMySQL/flexibleServers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + serverNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serverName")]) + if err != nil { + return nil, err + } + backupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("backupName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.Put(req.Context(), resourceGroupNameParam, serverNameParam, backupNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ServerBackup, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/checknameavailability_server.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/checknameavailability_server.go index 15d3d139bb3f..e7326e6a662c 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/checknameavailability_server.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/checknameavailability_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/checknameavailabilitywithoutlocation_server.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/checknameavailabilitywithoutlocation_server.go new file mode 100644 index 000000000000..ac70af2fa780 --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/checknameavailabilitywithoutlocation_server.go @@ -0,0 +1,95 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" + "net/http" + "regexp" +) + +// CheckNameAvailabilityWithoutLocationServer is a fake server for instances of the armmysqlflexibleservers.CheckNameAvailabilityWithoutLocationClient type. +type CheckNameAvailabilityWithoutLocationServer struct { + // Execute is the fake for method CheckNameAvailabilityWithoutLocationClient.Execute + // HTTP status codes to indicate success: http.StatusOK + Execute func(ctx context.Context, nameAvailabilityRequest armmysqlflexibleservers.NameAvailabilityRequest, options *armmysqlflexibleservers.CheckNameAvailabilityWithoutLocationClientExecuteOptions) (resp azfake.Responder[armmysqlflexibleservers.CheckNameAvailabilityWithoutLocationClientExecuteResponse], errResp azfake.ErrorResponder) +} + +// NewCheckNameAvailabilityWithoutLocationServerTransport creates a new instance of CheckNameAvailabilityWithoutLocationServerTransport with the provided implementation. +// The returned CheckNameAvailabilityWithoutLocationServerTransport instance is connected to an instance of armmysqlflexibleservers.CheckNameAvailabilityWithoutLocationClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCheckNameAvailabilityWithoutLocationServerTransport(srv *CheckNameAvailabilityWithoutLocationServer) *CheckNameAvailabilityWithoutLocationServerTransport { + return &CheckNameAvailabilityWithoutLocationServerTransport{srv: srv} +} + +// CheckNameAvailabilityWithoutLocationServerTransport connects instances of armmysqlflexibleservers.CheckNameAvailabilityWithoutLocationClient to instances of CheckNameAvailabilityWithoutLocationServer. +// Don't use this type directly, use NewCheckNameAvailabilityWithoutLocationServerTransport instead. +type CheckNameAvailabilityWithoutLocationServerTransport struct { + srv *CheckNameAvailabilityWithoutLocationServer +} + +// Do implements the policy.Transporter interface for CheckNameAvailabilityWithoutLocationServerTransport. +func (c *CheckNameAvailabilityWithoutLocationServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "CheckNameAvailabilityWithoutLocationClient.Execute": + resp, err = c.dispatchExecute(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *CheckNameAvailabilityWithoutLocationServerTransport) dispatchExecute(req *http.Request) (*http.Response, error) { + if c.srv.Execute == nil { + return nil, &nonRetriableError{errors.New("fake for method Execute not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DBforMySQL/checkNameAvailability` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmysqlflexibleservers.NameAvailabilityRequest](req) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Execute(req.Context(), body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).NameAvailability, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/checkvirtualnetworksubnetusage_server.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/checkvirtualnetworksubnetusage_server.go index 18e843a1a814..fa78a6cc0f55 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/checkvirtualnetworksubnetusage_server.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/checkvirtualnetworksubnetusage_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/configurations_server.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/configurations_server.go index f9263d8033e2..4ea662096f1d 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/configurations_server.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/configurations_server.go @@ -16,10 +16,11 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" "net/http" "net/url" "regexp" + "strconv" ) // ConfigurationsServer is a fake server for instances of the armmysqlflexibleservers.ConfigurationsClient type. @@ -28,6 +29,10 @@ type ConfigurationsServer struct { // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginBatchUpdate func(ctx context.Context, resourceGroupName string, serverName string, parameters armmysqlflexibleservers.ConfigurationListForBatchUpdate, options *armmysqlflexibleservers.ConfigurationsClientBeginBatchUpdateOptions) (resp azfake.PollerResponder[armmysqlflexibleservers.ConfigurationsClientBatchUpdateResponse], errResp azfake.ErrorResponder) + // BeginCreateOrUpdate is the fake for method ConfigurationsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters armmysqlflexibleservers.Configuration, options *armmysqlflexibleservers.ConfigurationsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armmysqlflexibleservers.ConfigurationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + // Get is the fake for method ConfigurationsClient.Get // HTTP status codes to indicate success: http.StatusOK Get func(ctx context.Context, resourceGroupName string, serverName string, configurationName string, options *armmysqlflexibleservers.ConfigurationsClientGetOptions) (resp azfake.Responder[armmysqlflexibleservers.ConfigurationsClientGetResponse], errResp azfake.ErrorResponder) @@ -48,6 +53,7 @@ func NewConfigurationsServerTransport(srv *ConfigurationsServer) *Configurations return &ConfigurationsServerTransport{ srv: srv, beginBatchUpdate: newTracker[azfake.PollerResponder[armmysqlflexibleservers.ConfigurationsClientBatchUpdateResponse]](), + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armmysqlflexibleservers.ConfigurationsClientCreateOrUpdateResponse]](), newListByServerPager: newTracker[azfake.PagerResponder[armmysqlflexibleservers.ConfigurationsClientListByServerResponse]](), beginUpdate: newTracker[azfake.PollerResponder[armmysqlflexibleservers.ConfigurationsClientUpdateResponse]](), } @@ -58,6 +64,7 @@ func NewConfigurationsServerTransport(srv *ConfigurationsServer) *Configurations type ConfigurationsServerTransport struct { srv *ConfigurationsServer beginBatchUpdate *tracker[azfake.PollerResponder[armmysqlflexibleservers.ConfigurationsClientBatchUpdateResponse]] + beginCreateOrUpdate *tracker[azfake.PollerResponder[armmysqlflexibleservers.ConfigurationsClientCreateOrUpdateResponse]] newListByServerPager *tracker[azfake.PagerResponder[armmysqlflexibleservers.ConfigurationsClientListByServerResponse]] beginUpdate *tracker[azfake.PollerResponder[armmysqlflexibleservers.ConfigurationsClientUpdateResponse]] } @@ -76,6 +83,8 @@ func (c *ConfigurationsServerTransport) Do(req *http.Request) (*http.Response, e switch method { case "ConfigurationsClient.BeginBatchUpdate": resp, err = c.dispatchBeginBatchUpdate(req) + case "ConfigurationsClient.BeginCreateOrUpdate": + resp, err = c.dispatchBeginCreateOrUpdate(req) case "ConfigurationsClient.Get": resp, err = c.dispatchGet(req) case "ConfigurationsClient.NewListByServerPager": @@ -141,6 +150,58 @@ func (c *ConfigurationsServerTransport) dispatchBeginBatchUpdate(req *http.Reque return resp, nil } +func (c *ConfigurationsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := c.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DBforMySQL/flexibleServers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/configurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armmysqlflexibleservers.Configuration](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + serverNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serverName")]) + if err != nil { + return nil, err + } + configurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("configurationName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, serverNameParam, configurationNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + c.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + c.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + func (c *ConfigurationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { if c.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} @@ -190,6 +251,7 @@ func (c *ConfigurationsServerTransport) dispatchNewListByServerPager(req *http.R if matches == nil || len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } + qp := req.URL.Query() resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) if err != nil { return nil, err @@ -198,7 +260,54 @@ func (c *ConfigurationsServerTransport) dispatchNewListByServerPager(req *http.R if err != nil { return nil, err } - resp := c.srv.NewListByServerPager(resourceGroupNameParam, serverNameParam, nil) + tagsUnescaped, err := url.QueryUnescape(qp.Get("tags")) + if err != nil { + return nil, err + } + tagsParam := getOptional(tagsUnescaped) + keywordUnescaped, err := url.QueryUnescape(qp.Get("keyword")) + if err != nil { + return nil, err + } + keywordParam := getOptional(keywordUnescaped) + pageUnescaped, err := url.QueryUnescape(qp.Get("page")) + if err != nil { + return nil, err + } + pageParam, err := parseOptional(pageUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + pageSizeUnescaped, err := url.QueryUnescape(qp.Get("pageSize")) + if err != nil { + return nil, err + } + pageSizeParam, err := parseOptional(pageSizeUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armmysqlflexibleservers.ConfigurationsClientListByServerOptions + if tagsParam != nil || keywordParam != nil || pageParam != nil || pageSizeParam != nil { + options = &armmysqlflexibleservers.ConfigurationsClientListByServerOptions{ + Tags: tagsParam, + Keyword: keywordParam, + Page: pageParam, + PageSize: pageSizeParam, + } + } + resp := c.srv.NewListByServerPager(resourceGroupNameParam, serverNameParam, options) newListByServerPager = &resp c.newListByServerPager.add(req, newListByServerPager) server.PagerResponderInjectNextLinks(newListByServerPager, req, func(page *armmysqlflexibleservers.ConfigurationsClientListByServerResponse, createLink func() string) { diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/databases_server.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/databases_server.go index 2390ef58b1ed..ef9ac0c2b22d 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/databases_server.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/databases_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/firewallrules_server.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/firewallrules_server.go index 7d3d3df53012..303d5f8c4f38 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/firewallrules_server.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/firewallrules_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/getprivatednszonesuffix_server.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/getprivatednszonesuffix_server.go index 5795bfa5d466..6899657ea36d 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/getprivatednszonesuffix_server.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/getprivatednszonesuffix_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" "net/http" ) diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/internal.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/internal.go index 5f75802a569e..72f540f217a1 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/internal.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/internal.go @@ -11,6 +11,7 @@ package fake import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "net/http" + "reflect" "sync" ) @@ -31,6 +32,32 @@ func contains[T comparable](s []T, v T) bool { return false } +func getOptional[T any](v T) *T { + if reflect.ValueOf(v).IsZero() { + return nil + } + return &v +} + +func parseOptional[T any](v string, parse func(v string) (T, error)) (*T, error) { + if v == "" { + return nil, nil + } + t, err := parse(v) + if err != nil { + return nil, err + } + return &t, err +} + +func parseWithCast[T any](v string, parse func(v string) (T, error)) (T, error) { + t, err := parse(v) + if err != nil { + return *new(T), err + } + return t, err +} + func newTracker[T any]() *tracker[T] { return &tracker[T]{ items: map[string]*T{}, diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/locationbasedcapabilities_server.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/locationbasedcapabilities_server.go index a009e7c457be..01cf3dc93a93 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/locationbasedcapabilities_server.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/locationbasedcapabilities_server.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/logfiles_server.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/logfiles_server.go new file mode 100644 index 000000000000..497171a85c9d --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/logfiles_server.go @@ -0,0 +1,112 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" + "net/http" + "net/url" + "regexp" +) + +// LogFilesServer is a fake server for instances of the armmysqlflexibleservers.LogFilesClient type. +type LogFilesServer struct { + // NewListByServerPager is the fake for method LogFilesClient.NewListByServerPager + // HTTP status codes to indicate success: http.StatusOK + NewListByServerPager func(resourceGroupName string, serverName string, options *armmysqlflexibleservers.LogFilesClientListByServerOptions) (resp azfake.PagerResponder[armmysqlflexibleservers.LogFilesClientListByServerResponse]) +} + +// NewLogFilesServerTransport creates a new instance of LogFilesServerTransport with the provided implementation. +// The returned LogFilesServerTransport instance is connected to an instance of armmysqlflexibleservers.LogFilesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewLogFilesServerTransport(srv *LogFilesServer) *LogFilesServerTransport { + return &LogFilesServerTransport{ + srv: srv, + newListByServerPager: newTracker[azfake.PagerResponder[armmysqlflexibleservers.LogFilesClientListByServerResponse]](), + } +} + +// LogFilesServerTransport connects instances of armmysqlflexibleservers.LogFilesClient to instances of LogFilesServer. +// Don't use this type directly, use NewLogFilesServerTransport instead. +type LogFilesServerTransport struct { + srv *LogFilesServer + newListByServerPager *tracker[azfake.PagerResponder[armmysqlflexibleservers.LogFilesClientListByServerResponse]] +} + +// Do implements the policy.Transporter interface for LogFilesServerTransport. +func (l *LogFilesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "LogFilesClient.NewListByServerPager": + resp, err = l.dispatchNewListByServerPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (l *LogFilesServerTransport) dispatchNewListByServerPager(req *http.Request) (*http.Response, error) { + if l.srv.NewListByServerPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByServerPager not implemented")} + } + newListByServerPager := l.newListByServerPager.get(req) + if newListByServerPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DBforMySQL/flexibleServers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/logFiles` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + serverNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serverName")]) + if err != nil { + return nil, err + } + resp := l.srv.NewListByServerPager(resourceGroupNameParam, serverNameParam, nil) + newListByServerPager = &resp + l.newListByServerPager.add(req, newListByServerPager) + server.PagerResponderInjectNextLinks(newListByServerPager, req, func(page *armmysqlflexibleservers.LogFilesClientListByServerResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByServerPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + l.newListByServerPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByServerPager) { + l.newListByServerPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/operations_server.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/operations_server.go index 4d0dba7772fa..935b8227fa55 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/operations_server.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/operations_server.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" "net/http" ) diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/replicas_server.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/replicas_server.go index 2480bff82506..1f5e81af8ab5 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/replicas_server.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/replicas_server.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/server_factory.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/server_factory.go index 070f34c7070b..762214288fe1 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/server_factory.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/server_factory.go @@ -19,17 +19,21 @@ import ( // ServerFactory is a fake server for instances of the armmysqlflexibleservers.ClientFactory type. type ServerFactory struct { - BackupsServer BackupsServer - CheckNameAvailabilityServer CheckNameAvailabilityServer - CheckVirtualNetworkSubnetUsageServer CheckVirtualNetworkSubnetUsageServer - ConfigurationsServer ConfigurationsServer - DatabasesServer DatabasesServer - FirewallRulesServer FirewallRulesServer - GetPrivateDNSZoneSuffixServer GetPrivateDNSZoneSuffixServer - LocationBasedCapabilitiesServer LocationBasedCapabilitiesServer - OperationsServer OperationsServer - ReplicasServer ReplicasServer - ServersServer ServersServer + AzureADAdministratorsServer AzureADAdministratorsServer + BackupAndExportServer BackupAndExportServer + BackupsServer BackupsServer + CheckNameAvailabilityServer CheckNameAvailabilityServer + CheckNameAvailabilityWithoutLocationServer CheckNameAvailabilityWithoutLocationServer + CheckVirtualNetworkSubnetUsageServer CheckVirtualNetworkSubnetUsageServer + ConfigurationsServer ConfigurationsServer + DatabasesServer DatabasesServer + FirewallRulesServer FirewallRulesServer + GetPrivateDNSZoneSuffixServer GetPrivateDNSZoneSuffixServer + LocationBasedCapabilitiesServer LocationBasedCapabilitiesServer + LogFilesServer LogFilesServer + OperationsServer OperationsServer + ReplicasServer ReplicasServer + ServersServer ServersServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -44,19 +48,23 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armmysqlflexibleservers.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trBackupsServer *BackupsServerTransport - trCheckNameAvailabilityServer *CheckNameAvailabilityServerTransport - trCheckVirtualNetworkSubnetUsageServer *CheckVirtualNetworkSubnetUsageServerTransport - trConfigurationsServer *ConfigurationsServerTransport - trDatabasesServer *DatabasesServerTransport - trFirewallRulesServer *FirewallRulesServerTransport - trGetPrivateDNSZoneSuffixServer *GetPrivateDNSZoneSuffixServerTransport - trLocationBasedCapabilitiesServer *LocationBasedCapabilitiesServerTransport - trOperationsServer *OperationsServerTransport - trReplicasServer *ReplicasServerTransport - trServersServer *ServersServerTransport + srv *ServerFactory + trMu sync.Mutex + trAzureADAdministratorsServer *AzureADAdministratorsServerTransport + trBackupAndExportServer *BackupAndExportServerTransport + trBackupsServer *BackupsServerTransport + trCheckNameAvailabilityServer *CheckNameAvailabilityServerTransport + trCheckNameAvailabilityWithoutLocationServer *CheckNameAvailabilityWithoutLocationServerTransport + trCheckVirtualNetworkSubnetUsageServer *CheckVirtualNetworkSubnetUsageServerTransport + trConfigurationsServer *ConfigurationsServerTransport + trDatabasesServer *DatabasesServerTransport + trFirewallRulesServer *FirewallRulesServerTransport + trGetPrivateDNSZoneSuffixServer *GetPrivateDNSZoneSuffixServerTransport + trLocationBasedCapabilitiesServer *LocationBasedCapabilitiesServerTransport + trLogFilesServer *LogFilesServerTransport + trOperationsServer *OperationsServerTransport + trReplicasServer *ReplicasServerTransport + trServersServer *ServersServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -72,6 +80,16 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { + case "AzureADAdministratorsClient": + initServer(s, &s.trAzureADAdministratorsServer, func() *AzureADAdministratorsServerTransport { + return NewAzureADAdministratorsServerTransport(&s.srv.AzureADAdministratorsServer) + }) + resp, err = s.trAzureADAdministratorsServer.Do(req) + case "BackupAndExportClient": + initServer(s, &s.trBackupAndExportServer, func() *BackupAndExportServerTransport { + return NewBackupAndExportServerTransport(&s.srv.BackupAndExportServer) + }) + resp, err = s.trBackupAndExportServer.Do(req) case "BackupsClient": initServer(s, &s.trBackupsServer, func() *BackupsServerTransport { return NewBackupsServerTransport(&s.srv.BackupsServer) }) resp, err = s.trBackupsServer.Do(req) @@ -80,6 +98,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewCheckNameAvailabilityServerTransport(&s.srv.CheckNameAvailabilityServer) }) resp, err = s.trCheckNameAvailabilityServer.Do(req) + case "CheckNameAvailabilityWithoutLocationClient": + initServer(s, &s.trCheckNameAvailabilityWithoutLocationServer, func() *CheckNameAvailabilityWithoutLocationServerTransport { + return NewCheckNameAvailabilityWithoutLocationServerTransport(&s.srv.CheckNameAvailabilityWithoutLocationServer) + }) + resp, err = s.trCheckNameAvailabilityWithoutLocationServer.Do(req) case "CheckVirtualNetworkSubnetUsageClient": initServer(s, &s.trCheckVirtualNetworkSubnetUsageServer, func() *CheckVirtualNetworkSubnetUsageServerTransport { return NewCheckVirtualNetworkSubnetUsageServerTransport(&s.srv.CheckVirtualNetworkSubnetUsageServer) @@ -108,6 +131,9 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewLocationBasedCapabilitiesServerTransport(&s.srv.LocationBasedCapabilitiesServer) }) resp, err = s.trLocationBasedCapabilitiesServer.Do(req) + case "LogFilesClient": + initServer(s, &s.trLogFilesServer, func() *LogFilesServerTransport { return NewLogFilesServerTransport(&s.srv.LogFilesServer) }) + resp, err = s.trLogFilesServer.Do(req) case "OperationsClient": initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) resp, err = s.trOperationsServer.Do(req) diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/servers_server.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/servers_server.go index 56f2f4ab40e6..54c6a7948db8 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/servers_server.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/fake/servers_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" "net/http" "net/url" "regexp" @@ -48,6 +48,10 @@ type ServersServer struct { // HTTP status codes to indicate success: http.StatusOK NewListByResourceGroupPager func(resourceGroupName string, options *armmysqlflexibleservers.ServersClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmysqlflexibleservers.ServersClientListByResourceGroupResponse]) + // BeginResetGtid is the fake for method ServersClient.BeginResetGtid + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginResetGtid func(ctx context.Context, resourceGroupName string, serverName string, parameters armmysqlflexibleservers.ServerGtidSetParameter, options *armmysqlflexibleservers.ServersClientBeginResetGtidOptions) (resp azfake.PollerResponder[armmysqlflexibleservers.ServersClientResetGtidResponse], errResp azfake.ErrorResponder) + // BeginRestart is the fake for method ServersClient.BeginRestart // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginRestart func(ctx context.Context, resourceGroupName string, serverName string, parameters armmysqlflexibleservers.ServerRestartParameter, options *armmysqlflexibleservers.ServersClientBeginRestartOptions) (resp azfake.PollerResponder[armmysqlflexibleservers.ServersClientRestartResponse], errResp azfake.ErrorResponder) @@ -76,6 +80,7 @@ func NewServersServerTransport(srv *ServersServer) *ServersServerTransport { beginFailover: newTracker[azfake.PollerResponder[armmysqlflexibleservers.ServersClientFailoverResponse]](), newListPager: newTracker[azfake.PagerResponder[armmysqlflexibleservers.ServersClientListResponse]](), newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmysqlflexibleservers.ServersClientListByResourceGroupResponse]](), + beginResetGtid: newTracker[azfake.PollerResponder[armmysqlflexibleservers.ServersClientResetGtidResponse]](), beginRestart: newTracker[azfake.PollerResponder[armmysqlflexibleservers.ServersClientRestartResponse]](), beginStart: newTracker[azfake.PollerResponder[armmysqlflexibleservers.ServersClientStartResponse]](), beginStop: newTracker[azfake.PollerResponder[armmysqlflexibleservers.ServersClientStopResponse]](), @@ -92,6 +97,7 @@ type ServersServerTransport struct { beginFailover *tracker[azfake.PollerResponder[armmysqlflexibleservers.ServersClientFailoverResponse]] newListPager *tracker[azfake.PagerResponder[armmysqlflexibleservers.ServersClientListResponse]] newListByResourceGroupPager *tracker[azfake.PagerResponder[armmysqlflexibleservers.ServersClientListByResourceGroupResponse]] + beginResetGtid *tracker[azfake.PollerResponder[armmysqlflexibleservers.ServersClientResetGtidResponse]] beginRestart *tracker[azfake.PollerResponder[armmysqlflexibleservers.ServersClientRestartResponse]] beginStart *tracker[azfake.PollerResponder[armmysqlflexibleservers.ServersClientStartResponse]] beginStop *tracker[azfake.PollerResponder[armmysqlflexibleservers.ServersClientStopResponse]] @@ -122,6 +128,8 @@ func (s *ServersServerTransport) Do(req *http.Request) (*http.Response, error) { resp, err = s.dispatchNewListPager(req) case "ServersClient.NewListByResourceGroupPager": resp, err = s.dispatchNewListByResourceGroupPager(req) + case "ServersClient.BeginResetGtid": + resp, err = s.dispatchBeginResetGtid(req) case "ServersClient.BeginRestart": resp, err = s.dispatchBeginRestart(req) case "ServersClient.BeginStart": @@ -380,6 +388,54 @@ func (s *ServersServerTransport) dispatchNewListByResourceGroupPager(req *http.R return resp, nil } +func (s *ServersServerTransport) dispatchBeginResetGtid(req *http.Request) (*http.Response, error) { + if s.srv.BeginResetGtid == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginResetGtid not implemented")} + } + beginResetGtid := s.beginResetGtid.get(req) + if beginResetGtid == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DBforMySQL/flexibleServers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resetGtid` + 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[armmysqlflexibleservers.ServerGtidSetParameter](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + serverNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("serverName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginResetGtid(req.Context(), resourceGroupNameParam, serverNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginResetGtid = &respr + s.beginResetGtid.add(req, beginResetGtid) + } + + resp, err := server.PollerResponderNext(beginResetGtid, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginResetGtid.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginResetGtid) { + s.beginResetGtid.remove(req) + } + + return resp, nil +} + func (s *ServersServerTransport) dispatchBeginRestart(req *http.Request) (*http.Response, error) { if s.srv.BeginRestart == nil { return nil, &nonRetriableError{errors.New("fake for method BeginRestart not implemented")} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/firewallrules_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/firewallrules_client.go index 83bbc9fac55a..68cf58ea354a 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/firewallrules_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/firewallrules_client.go @@ -46,7 +46,7 @@ func NewFirewallRulesClient(subscriptionID string, credential azcore.TokenCreden // BeginCreateOrUpdate - Creates a new firewall rule or updates an existing firewall rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - firewallRuleName - The name of the server firewall rule. @@ -73,7 +73,7 @@ func (client *FirewallRulesClient) BeginCreateOrUpdate(ctx context.Context, reso // CreateOrUpdate - Creates a new firewall rule or updates an existing firewall rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-01-preview func (client *FirewallRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule, options *FirewallRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "FirewallRulesClient.BeginCreateOrUpdate" @@ -119,7 +119,7 @@ func (client *FirewallRulesClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -131,7 +131,7 @@ func (client *FirewallRulesClient) createOrUpdateCreateRequest(ctx context.Conte // BeginDelete - Deletes a firewall rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - firewallRuleName - The name of the server firewall rule. @@ -157,7 +157,7 @@ func (client *FirewallRulesClient) BeginDelete(ctx context.Context, resourceGrou // Delete - Deletes a firewall rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-01-preview func (client *FirewallRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, options *FirewallRulesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "FirewallRulesClient.BeginDelete" @@ -203,7 +203,7 @@ func (client *FirewallRulesClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -212,7 +212,7 @@ func (client *FirewallRulesClient) deleteCreateRequest(ctx context.Context, reso // Get - Gets information about a server firewall rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - firewallRuleName - The name of the server firewall rule. @@ -263,7 +263,7 @@ func (client *FirewallRulesClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -280,7 +280,7 @@ func (client *FirewallRulesClient) getHandleResponse(resp *http.Response) (Firew // NewListByServerPager - List all the firewall rules in a given server. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - options - FirewallRulesClientListByServerOptions contains the optional parameters for the FirewallRulesClient.NewListByServerPager @@ -328,7 +328,7 @@ func (client *FirewallRulesClient) listByServerCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/firewallrules_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/firewallrules_client_example_test.go index b638b2098f41..dd4eb2d03a4c 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/firewallrules_client_example_test.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/firewallrules_client_example_test.go @@ -15,10 +15,10 @@ import ( "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/mysql/armmysqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/FirewallRuleCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2021-12-01-preview/examples/FirewallRuleCreate.json func ExampleFirewallRulesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -56,7 +56,7 @@ func ExampleFirewallRulesClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/FirewallRuleDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2021-12-01-preview/examples/FirewallRuleDelete.json func ExampleFirewallRulesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -77,7 +77,7 @@ func ExampleFirewallRulesClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/FirewallRuleGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2021-12-01-preview/examples/FirewallRuleGet.json func ExampleFirewallRulesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -106,7 +106,7 @@ func ExampleFirewallRulesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/FirewallRulesListByServer.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2021-12-01-preview/examples/FirewallRulesListByServer.json func ExampleFirewallRulesClient_NewListByServerPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/getprivatednszonesuffix_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/getprivatednszonesuffix_client.go index e0938ca6dcff..cd269ea0616b 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/getprivatednszonesuffix_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/getprivatednszonesuffix_client.go @@ -40,7 +40,7 @@ func NewGetPrivateDNSZoneSuffixClient(credential azcore.TokenCredential, options // Execute - Get private DNS zone suffix in the cloud. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-01-preview // - options - GetPrivateDNSZoneSuffixClientExecuteOptions contains the optional parameters for the GetPrivateDNSZoneSuffixClient.Execute // method. func (client *GetPrivateDNSZoneSuffixClient) Execute(ctx context.Context, options *GetPrivateDNSZoneSuffixClientExecuteOptions) (GetPrivateDNSZoneSuffixClientExecuteResponse, error) { @@ -73,7 +73,7 @@ func (client *GetPrivateDNSZoneSuffixClient) executeCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/getprivatednszonesuffix_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/getprivatednszonesuffix_client_example_test.go index 07a0517be695..dfaa4386b012 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/getprivatednszonesuffix_client_example_test.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/getprivatednszonesuffix_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/GetPrivateDnsZoneSuffix.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2021-12-01-preview/examples/GetPrivateDnsZoneSuffix.json func ExampleGetPrivateDNSZoneSuffixClient_Execute() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/go.mod b/sdk/resourcemanager/mysql/armmysqlflexibleservers/go.mod index 290fffb5c338..19476d30d097 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/go.mod +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/go.mod @@ -1,4 +1,4 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2 go 1.18 diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/interfaces.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/interfaces.go new file mode 100644 index 000000000000..117de631ec56 --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/interfaces.go @@ -0,0 +1,18 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmysqlflexibleservers + +// BackupStoreDetailsClassification provides polymorphic access to related types. +// Call the interface's GetBackupStoreDetails() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *BackupStoreDetails, *FullBackupStoreDetails +type BackupStoreDetailsClassification interface { + // GetBackupStoreDetails returns the BackupStoreDetails content of the underlying type. + GetBackupStoreDetails() *BackupStoreDetails +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/locationbasedcapabilities_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/locationbasedcapabilities_client.go index 4c46fd970157..e513c1812d57 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/locationbasedcapabilities_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/locationbasedcapabilities_client.go @@ -45,7 +45,7 @@ func NewLocationBasedCapabilitiesClient(subscriptionID string, credential azcore // NewListPager - Get capabilities at specified location in a given subscription. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-01-preview // - locationName - The name of the location. // - options - LocationBasedCapabilitiesClientListOptions contains the optional parameters for the LocationBasedCapabilitiesClient.NewListPager // method. @@ -88,7 +88,7 @@ func (client *LocationBasedCapabilitiesClient) listCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/locationbasedcapabilities_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/locationbasedcapabilities_client_example_test.go index 0d3d408fe5f2..2d5295544e3c 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/locationbasedcapabilities_client_example_test.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/locationbasedcapabilities_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/CapabilitiesByLocationList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2021-12-01-preview/examples/CapabilitiesByLocationList.json func ExampleLocationBasedCapabilitiesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/logfiles_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/logfiles_client.go new file mode 100644 index 000000000000..137876761767 --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/logfiles_client.go @@ -0,0 +1,109 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmysqlflexibleservers + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// LogFilesClient contains the methods for the LogFiles group. +// Don't use this type directly, use NewLogFilesClient() instead. +type LogFilesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewLogFilesClient creates a new instance of LogFilesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewLogFilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LogFilesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &LogFilesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListByServerPager - List all the server log files in a given server. +// +// Generated from API version 2021-12-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serverName - The name of the server. +// - options - LogFilesClientListByServerOptions contains the optional parameters for the LogFilesClient.NewListByServerPager +// method. +func (client *LogFilesClient) NewListByServerPager(resourceGroupName string, serverName string, options *LogFilesClientListByServerOptions) *runtime.Pager[LogFilesClientListByServerResponse] { + return runtime.NewPager(runtime.PagingHandler[LogFilesClientListByServerResponse]{ + More: func(page LogFilesClientListByServerResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *LogFilesClientListByServerResponse) (LogFilesClientListByServerResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "LogFilesClient.NewListByServerPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) + }, nil) + if err != nil { + return LogFilesClientListByServerResponse{}, err + } + return client.listByServerHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByServerCreateRequest creates the ListByServer request. +func (client *LogFilesClient) listByServerCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *LogFilesClientListByServerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/logFiles" + 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 serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServerHandleResponse handles the ListByServer response. +func (client *LogFilesClient) listByServerHandleResponse(resp *http.Response) (LogFilesClientListByServerResponse, error) { + result := LogFilesClientListByServerResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LogFileListResult); err != nil { + return LogFilesClientListByServerResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/logfiles_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/logfiles_client_example_test.go new file mode 100644 index 000000000000..8a4addf323f0 --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/logfiles_client_example_test.go @@ -0,0 +1,58 @@ +//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 armmysqlflexibleservers_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/LogFiles/preview/2021-12-01-preview/examples/LogFilesListByServer.json +func ExampleLogFilesClient_NewListByServerPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewLogFilesClient().NewListByServerPager("testrg", "mysqltestsvc1", 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.LogFileListResult = armmysqlflexibleservers.LogFileListResult{ + // Value: []*armmysqlflexibleservers.LogFile{ + // { + // Name: to.Ptr("mysql-slow-mysqltestsvc1-2018022823.log"), + // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/logFiles"), + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestsvc1/logFiles/mysql-slow-mysqltestsvc1-2018022823.log"), + // Properties: &armmysqlflexibleservers.LogFileProperties{ + // Type: to.Ptr("slowlog"), + // CreatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), + // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-01T06:09:20.000Z"); return t}()), + // SizeInKB: to.Ptr[int64](1), + // URL: to.Ptr("https://wasd2prodwus1afse42.file.core.windows.net/833c99b2f36c47349e5554b903fe0440/serverlogs/mysql-slow-mysqltestsvc1-2018022823.log?sv=2015-04-05&sr=f&sig=D9Ga4N5Pa%2BPe5Bmjpvs7A0TPD%2FF7IZpk9e4KWR0jgpM%3D&se=2018-03-01T07%3A12%3A13Z&sp=r"), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/models.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/models.go index f4b28fc31a49..4dec561b6c04 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/models.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/models.go @@ -10,6 +10,51 @@ package armmysqlflexibleservers import "time" +// AdministratorListResult - A List of azure ad administrators. +type AdministratorListResult struct { + // The link used to get the next page of operations. + NextLink *string + + // The list of azure ad administrator of a server + Value []*AzureADAdministrator +} + +// AdministratorProperties - The properties of an administrator. +type AdministratorProperties struct { + // Type of the sever administrator. + AdministratorType *AdministratorType + + // The resource id of the identity used for AAD Authentication. + IdentityResourceID *string + + // Login name of the server administrator. + Login *string + + // SID (object ID) of the server administrator. + Sid *string + + // Tenant ID of the administrator. + TenantID *string +} + +// AzureADAdministrator - Represents a Administrator. +type AzureADAdministrator struct { + // The properties of an administrator. + Properties *AdministratorProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + // Backup - Storage Profile properties of a server type Backup struct { // Backup retention days for the server. @@ -22,6 +67,81 @@ type Backup struct { EarliestRestoreDate *time.Time } +// BackupAndExportRequest - BackupAndExport API Request +type BackupAndExportRequest struct { + // REQUIRED; Backup Settings + BackupSettings *BackupSettings + + // REQUIRED; Backup Target Store Details + TargetDetails BackupStoreDetailsClassification +} + +// BackupAndExportResponse - Represents BackupAndExport API Response +type BackupAndExportResponse struct { + // End time + EndTime *time.Time + + // The BackupAndExport operation error response. + Error *ErrorResponse + + // Operation progress (0-100). + PercentComplete *float64 + + // The response properties of a backup and export operation. + Properties *BackupAndExportResponseProperties + + // Start time + StartTime *time.Time + + // The operation status + Status *OperationStatus + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// BackupAndExportResponseProperties - BackupAndExport Response Properties +type BackupAndExportResponseProperties struct { + // Metadata related to backup to be stored for restoring resource in key-value pairs. + BackupMetadata *string + + // Data transferred in bytes + DataTransferredInBytes *int64 + + // Size of datasource in bytes + DatasourceSizeInBytes *int64 +} + +// BackupRequestBase is the base for all backup request. +type BackupRequestBase struct { + // REQUIRED; Backup Settings + BackupSettings *BackupSettings +} + +// BackupSettings - Backup Settings +type BackupSettings struct { + // REQUIRED; The name of the backup. + BackupName *string + + // Backup Format for the current backup. (CollatedFormat is INTERNAL – DO NOT USE) + BackupFormat *BackupFormat +} + +// BackupStoreDetails - Details about the target where the backup content will be stored. +type BackupStoreDetails struct { + // REQUIRED; Type of the specific object - used for deserializing + ObjectType *string +} + +// GetBackupStoreDetails implements the BackupStoreDetailsClassification interface for type BackupStoreDetails. +func (b *BackupStoreDetails) GetBackupStoreDetails() *BackupStoreDetails { return b } + // CapabilitiesListResult - location capability type CapabilitiesListResult struct { // READ-ONLY; Link to retrieve next page of results. @@ -84,6 +204,9 @@ type ConfigurationForBatchUpdateProperties struct { // ConfigurationListForBatchUpdate - A list of server configurations to update. type ConfigurationListForBatchUpdate struct { + // Whether to reset all server parameters to default. + ResetAllToDefault *ResetAllToDefault + // The list of server configurations. Value []*ConfigurationForBatchUpdate } @@ -99,6 +222,9 @@ type ConfigurationListResult struct { // ConfigurationProperties - The properties of a configuration. type ConfigurationProperties struct { + // Current value of the configuration. + CurrentValue *string + // Source of the configuration. Source *ConfigurationSource @@ -117,6 +243,9 @@ type ConfigurationProperties struct { // READ-ONLY; Description of the configuration. Description *string + // READ-ONLY; The link used to get the document from community or Azure site. + DocumentationLink *string + // READ-ONLY; If is the configuration pending restart or not. IsConfigPendingRestart *IsConfigPendingRestart @@ -254,6 +383,22 @@ type FirewallRuleProperties struct { StartIPAddress *string } +// FullBackupStoreDetails is used for scenarios where backup data is streamed/copied over to a storage destination. +type FullBackupStoreDetails struct { + // REQUIRED; Type of the specific object - used for deserializing + ObjectType *string + + // REQUIRED; SASUriList of storage containers where backup data is to be streamed/copied. + SasURIList []*string +} + +// GetBackupStoreDetails implements the BackupStoreDetailsClassification interface for type FullBackupStoreDetails. +func (f *FullBackupStoreDetails) GetBackupStoreDetails() *BackupStoreDetails { + return &BackupStoreDetails{ + ObjectType: f.ObjectType, + } +} + // GetPrivateDNSZoneSuffixResponse - The response of get private dns zone suffix. type GetPrivateDNSZoneSuffixResponse struct { // Represents the private DNS zone suffix. @@ -275,7 +420,7 @@ type HighAvailability struct { // Identity - Properties to configure Identity for Bring your Own Keys type Identity struct { // Type of managed service identity. - Type *string + Type *ManagedServiceIdentityType // Metadata of user assigned identity. UserAssignedIdentities map[string]any @@ -287,6 +432,51 @@ type Identity struct { TenantID *string } +// LogFile - Represents a logFile. +type LogFile struct { + // The properties of a logFile. + Properties *LogFileProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// LogFileListResult - A List of logFiles. +type LogFileListResult struct { + // The link used to get the next page of operations. + NextLink *string + + // The list of logFiles in a server + Value []*LogFile +} + +// LogFileProperties - The properties of a logFile. +type LogFileProperties struct { + // Creation timestamp of the log file. + CreatedTime *time.Time + + // Last modified timestamp of the log file. + LastModifiedTime *time.Time + + // The size in kb of the logFile. + SizeInKB *int64 + + // Type of the log file. + Type *string + + // The url to download the log file from. + URL *string +} + // MaintenanceWindow - Maintenance window of a server. type MaintenanceWindow struct { // indicates whether custom window is enabled or disabled @@ -331,7 +521,7 @@ type Network struct { // Private DNS zone resource id. PrivateDNSZoneResourceID *string - // READ-ONLY; Whether or not public network access is allowed for this server. Value is 'Disabled' when server has VNet integration. + // Whether or not public network access is allowed for this server. Value is 'Disabled' when server has VNet integration. PublicNetworkAccess *EnableStatusEnum } @@ -519,6 +709,12 @@ type ServerForUpdate struct { Tags map[string]*string } +// ServerGtidSetParameter - Server gtid set parameters. +type ServerGtidSetParameter struct { + // The gtid set of server. + GtidSet *string +} + // ServerListResult - A list of servers. type ServerListResult struct { // The link used to get the next page of operations. @@ -605,6 +801,9 @@ type ServerPropertiesForUpdate struct { // Storage related properties of a server. Storage *Storage + + // Server version. + Version *ServerVersion } // ServerRestartParameter - Server restart parameters. @@ -630,9 +829,15 @@ type Storage struct { // Enable Storage Auto Grow or not. AutoGrow *EnableStatusEnum + // Enable IO Auto Scaling or not. + AutoIoScaling *EnableStatusEnum + // Storage IOPS for a server. Iops *int32 + // Enable Log On Disk or not. + LogOnDisk *EnableStatusEnum + // Max storage size allowed for a server. StorageSizeGB *int32 @@ -707,6 +912,18 @@ type UserAssignedIdentity struct { PrincipalID *string } +// ValidateBackupResponse - Represents ValidateBackup API Response +type ValidateBackupResponse struct { + // The response properties of a pre backup operation. + Properties *ValidateBackupResponseProperties +} + +// ValidateBackupResponseProperties - ValidateBackup Response Properties +type ValidateBackupResponseProperties struct { + // Estimated no of storage containers required for resource data to be backed up. + NumberOfContainers *int32 +} + // VirtualNetworkSubnetUsageParameter - Virtual network subnet usage parameter type VirtualNetworkSubnetUsageParameter struct { // Virtual network resource id. @@ -717,4 +934,10 @@ type VirtualNetworkSubnetUsageParameter struct { type VirtualNetworkSubnetUsageResult struct { // READ-ONLY; A list of delegated subnet usage DelegatedSubnetsUsage []*DelegatedSubnetUsage + + // READ-ONLY; The location name. + Location *string + + // READ-ONLY; The subscription id. + SubscriptionID *string } diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/models_serde.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/models_serde.go index cf6c80049d2e..2f2428fb0d83 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/models_serde.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/models_serde.go @@ -15,6 +15,123 @@ import ( "reflect" ) +// MarshalJSON implements the json.Marshaller interface for type AdministratorListResult. +func (a AdministratorListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdministratorListResult. +func (a *AdministratorListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AdministratorProperties. +func (a AdministratorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "administratorType", a.AdministratorType) + populate(objectMap, "identityResourceId", a.IdentityResourceID) + populate(objectMap, "login", a.Login) + populate(objectMap, "sid", a.Sid) + populate(objectMap, "tenantId", a.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdministratorProperties. +func (a *AdministratorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "administratorType": + err = unpopulate(val, "AdministratorType", &a.AdministratorType) + delete(rawMsg, key) + case "identityResourceId": + err = unpopulate(val, "IdentityResourceID", &a.IdentityResourceID) + delete(rawMsg, key) + case "login": + err = unpopulate(val, "Login", &a.Login) + delete(rawMsg, key) + case "sid": + err = unpopulate(val, "Sid", &a.Sid) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &a.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureADAdministrator. +func (a AzureADAdministrator) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureADAdministrator. +func (a *AzureADAdministrator) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Backup. func (b Backup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -50,6 +167,216 @@ func (b *Backup) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type BackupAndExportRequest. +func (b BackupAndExportRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupSettings", b.BackupSettings) + populate(objectMap, "targetDetails", b.TargetDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupAndExportRequest. +func (b *BackupAndExportRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupSettings": + err = unpopulate(val, "BackupSettings", &b.BackupSettings) + delete(rawMsg, key) + case "targetDetails": + b.TargetDetails, err = unmarshalBackupStoreDetailsClassification(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupAndExportResponse. +func (b BackupAndExportResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "endTime", b.EndTime) + populate(objectMap, "error", b.Error) + populate(objectMap, "id", b.ID) + populate(objectMap, "name", b.Name) + populate(objectMap, "percentComplete", b.PercentComplete) + populate(objectMap, "properties", b.Properties) + populateDateTimeRFC3339(objectMap, "startTime", b.StartTime) + populate(objectMap, "status", b.Status) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupAndExportResponse. +func (b *BackupAndExportResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &b.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &b.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "percentComplete": + err = unpopulate(val, "PercentComplete", &b.PercentComplete) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &b.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &b.Status) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupAndExportResponseProperties. +func (b BackupAndExportResponseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupMetadata", b.BackupMetadata) + populate(objectMap, "dataTransferredInBytes", b.DataTransferredInBytes) + populate(objectMap, "datasourceSizeInBytes", b.DatasourceSizeInBytes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupAndExportResponseProperties. +func (b *BackupAndExportResponseProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupMetadata": + err = unpopulate(val, "BackupMetadata", &b.BackupMetadata) + delete(rawMsg, key) + case "dataTransferredInBytes": + err = unpopulate(val, "DataTransferredInBytes", &b.DataTransferredInBytes) + delete(rawMsg, key) + case "datasourceSizeInBytes": + err = unpopulate(val, "DatasourceSizeInBytes", &b.DatasourceSizeInBytes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupRequestBase. +func (b BackupRequestBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupSettings", b.BackupSettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupRequestBase. +func (b *BackupRequestBase) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupSettings": + err = unpopulate(val, "BackupSettings", &b.BackupSettings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupSettings. +func (b BackupSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupFormat", b.BackupFormat) + populate(objectMap, "backupName", b.BackupName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupSettings. +func (b *BackupSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupFormat": + err = unpopulate(val, "BackupFormat", &b.BackupFormat) + delete(rawMsg, key) + case "backupName": + err = unpopulate(val, "BackupName", &b.BackupName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupStoreDetails. +func (b BackupStoreDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["objectType"] = b.ObjectType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupStoreDetails. +func (b *BackupStoreDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, "ObjectType", &b.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type CapabilitiesListResult. func (c CapabilitiesListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -228,6 +555,7 @@ func (c *ConfigurationForBatchUpdateProperties) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type ConfigurationListForBatchUpdate. func (c ConfigurationListForBatchUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "resetAllToDefault", c.ResetAllToDefault) populate(objectMap, "value", c.Value) return json.Marshal(objectMap) } @@ -241,6 +569,9 @@ func (c *ConfigurationListForBatchUpdate) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "resetAllToDefault": + err = unpopulate(val, "ResetAllToDefault", &c.ResetAllToDefault) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &c.Value) delete(rawMsg, key) @@ -287,9 +618,11 @@ func (c *ConfigurationListResult) UnmarshalJSON(data []byte) error { func (c ConfigurationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "allowedValues", c.AllowedValues) + populate(objectMap, "currentValue", c.CurrentValue) populate(objectMap, "dataType", c.DataType) populate(objectMap, "defaultValue", c.DefaultValue) populate(objectMap, "description", c.Description) + populate(objectMap, "documentationLink", c.DocumentationLink) populate(objectMap, "isConfigPendingRestart", c.IsConfigPendingRestart) populate(objectMap, "isDynamicConfig", c.IsDynamicConfig) populate(objectMap, "isReadOnly", c.IsReadOnly) @@ -310,6 +643,9 @@ func (c *ConfigurationProperties) UnmarshalJSON(data []byte) error { case "allowedValues": err = unpopulate(val, "AllowedValues", &c.AllowedValues) delete(rawMsg, key) + case "currentValue": + err = unpopulate(val, "CurrentValue", &c.CurrentValue) + delete(rawMsg, key) case "dataType": err = unpopulate(val, "DataType", &c.DataType) delete(rawMsg, key) @@ -319,6 +655,9 @@ func (c *ConfigurationProperties) UnmarshalJSON(data []byte) error { case "description": err = unpopulate(val, "Description", &c.Description) delete(rawMsg, key) + case "documentationLink": + err = unpopulate(val, "DocumentationLink", &c.DocumentationLink) + delete(rawMsg, key) case "isConfigPendingRestart": err = unpopulate(val, "IsConfigPendingRestart", &c.IsConfigPendingRestart) delete(rawMsg, key) @@ -345,9 +684,9 @@ func (c *ConfigurationProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DataEncryption. func (d DataEncryption) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "geoBackupKeyUri", d.GeoBackupKeyURI) + populate(objectMap, "geoBackupKeyURI", d.GeoBackupKeyURI) populate(objectMap, "geoBackupUserAssignedIdentityId", d.GeoBackupUserAssignedIdentityID) - populate(objectMap, "primaryKeyUri", d.PrimaryKeyURI) + populate(objectMap, "primaryKeyURI", d.PrimaryKeyURI) populate(objectMap, "primaryUserAssignedIdentityId", d.PrimaryUserAssignedIdentityID) populate(objectMap, "type", d.Type) return json.Marshal(objectMap) @@ -362,13 +701,13 @@ func (d *DataEncryption) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "geoBackupKeyUri": + case "geoBackupKeyURI": err = unpopulate(val, "GeoBackupKeyURI", &d.GeoBackupKeyURI) delete(rawMsg, key) case "geoBackupUserAssignedIdentityId": err = unpopulate(val, "GeoBackupUserAssignedIdentityID", &d.GeoBackupUserAssignedIdentityID) delete(rawMsg, key) - case "primaryKeyUri": + case "primaryKeyURI": err = unpopulate(val, "PrimaryKeyURI", &d.PrimaryKeyURI) delete(rawMsg, key) case "primaryUserAssignedIdentityId": @@ -700,6 +1039,37 @@ func (f *FirewallRuleProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type FullBackupStoreDetails. +func (f FullBackupStoreDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["objectType"] = "FullBackupStoreDetails" + populate(objectMap, "sasUriList", f.SasURIList) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FullBackupStoreDetails. +func (f *FullBackupStoreDetails) 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 "objectType": + err = unpopulate(val, "ObjectType", &f.ObjectType) + delete(rawMsg, key) + case "sasUriList": + err = unpopulate(val, "SasURIList", &f.SasURIList) + 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 GetPrivateDNSZoneSuffixResponse. func (g GetPrivateDNSZoneSuffixResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -767,7 +1137,7 @@ func (i Identity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "principalId", i.PrincipalID) populate(objectMap, "tenantId", i.TenantID) - objectMap["type"] = "UserAssigned" + populate(objectMap, "type", i.Type) populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) return json.Marshal(objectMap) } @@ -801,6 +1171,123 @@ func (i *Identity) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type LogFile. +func (l LogFile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", l.ID) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "systemData", l.SystemData) + populate(objectMap, "type", l.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogFile. +func (l *LogFile) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &l.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &l.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &l.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogFileListResult. +func (l LogFileListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogFileListResult. +func (l *LogFileListResult) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogFileProperties. +func (l LogFileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createdTime", l.CreatedTime) + populateDateTimeRFC3339(objectMap, "lastModifiedTime", l.LastModifiedTime) + populate(objectMap, "sizeInKB", l.SizeInKB) + populate(objectMap, "type", l.Type) + populate(objectMap, "url", l.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogFileProperties. +func (l *LogFileProperties) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdTime": + err = unpopulateDateTimeRFC3339(val, "CreatedTime", &l.CreatedTime) + delete(rawMsg, key) + case "lastModifiedTime": + err = unpopulateDateTimeRFC3339(val, "LastModifiedTime", &l.LastModifiedTime) + delete(rawMsg, key) + case "sizeInKB": + err = unpopulate(val, "SizeInKB", &l.SizeInKB) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &l.Type) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &l.URL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type MaintenanceWindow. func (m MaintenanceWindow) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1432,6 +1919,33 @@ func (s *ServerForUpdate) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ServerGtidSetParameter. +func (s ServerGtidSetParameter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "gtidSet", s.GtidSet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerGtidSetParameter. +func (s *ServerGtidSetParameter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "gtidSet": + err = unpopulate(val, "GtidSet", &s.GtidSet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ServerListResult. func (s ServerListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1564,6 +2078,7 @@ func (s ServerPropertiesForUpdate) MarshalJSON() ([]byte, error) { populate(objectMap, "maintenanceWindow", s.MaintenanceWindow) populate(objectMap, "replicationRole", s.ReplicationRole) populate(objectMap, "storage", s.Storage) + populate(objectMap, "version", s.Version) return json.Marshal(objectMap) } @@ -1597,6 +2112,9 @@ func (s *ServerPropertiesForUpdate) UnmarshalJSON(data []byte) error { case "storage": err = unpopulate(val, "Storage", &s.Storage) delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &s.Version) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -1671,7 +2189,9 @@ func (s *ServerVersionCapability) UnmarshalJSON(data []byte) error { func (s Storage) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "autoGrow", s.AutoGrow) + populate(objectMap, "autoIoScaling", s.AutoIoScaling) populate(objectMap, "iops", s.Iops) + populate(objectMap, "logOnDisk", s.LogOnDisk) populate(objectMap, "storageSku", s.StorageSKU) populate(objectMap, "storageSizeGB", s.StorageSizeGB) return json.Marshal(objectMap) @@ -1689,9 +2209,15 @@ func (s *Storage) UnmarshalJSON(data []byte) error { case "autoGrow": err = unpopulate(val, "AutoGrow", &s.AutoGrow) delete(rawMsg, key) + case "autoIoScaling": + err = unpopulate(val, "AutoIoScaling", &s.AutoIoScaling) + delete(rawMsg, key) case "iops": err = unpopulate(val, "Iops", &s.Iops) delete(rawMsg, key) + case "logOnDisk": + err = unpopulate(val, "LogOnDisk", &s.LogOnDisk) + delete(rawMsg, key) case "storageSku": err = unpopulate(val, "StorageSKU", &s.StorageSKU) delete(rawMsg, key) @@ -1870,6 +2396,60 @@ func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ValidateBackupResponse. +func (v ValidateBackupResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", v.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateBackupResponse. +func (v *ValidateBackupResponse) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ValidateBackupResponseProperties. +func (v ValidateBackupResponseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "numberOfContainers", v.NumberOfContainers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateBackupResponseProperties. +func (v *ValidateBackupResponseProperties) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "numberOfContainers": + err = unpopulate(val, "NumberOfContainers", &v.NumberOfContainers) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type VirtualNetworkSubnetUsageParameter. func (v VirtualNetworkSubnetUsageParameter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1901,6 +2481,8 @@ func (v *VirtualNetworkSubnetUsageParameter) UnmarshalJSON(data []byte) error { func (v VirtualNetworkSubnetUsageResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "delegatedSubnetsUsage", v.DelegatedSubnetsUsage) + populate(objectMap, "location", v.Location) + populate(objectMap, "subscriptionId", v.SubscriptionID) return json.Marshal(objectMap) } @@ -1916,6 +2498,12 @@ func (v *VirtualNetworkSubnetUsageResult) UnmarshalJSON(data []byte) error { case "delegatedSubnetsUsage": err = unpopulate(val, "DelegatedSubnetsUsage", &v.DelegatedSubnetsUsage) delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &v.SubscriptionID) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/operations_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/operations_client.go index ba718ffac4c5..c623bae7d84c 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/operations_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available REST API operations. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-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", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/operations_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/operations_client_example_test.go index 3e71889096dc..0744ec661e32 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/operations_client_example_test.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/operations_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/OperationsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2021-12-01-preview/examples/OperationsList.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/options.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/options.go index 799ad625c866..f07f46a4522e 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/options.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/options.go @@ -8,6 +8,43 @@ package armmysqlflexibleservers +// AzureADAdministratorsClientBeginCreateOrUpdateOptions contains the optional parameters for the AzureADAdministratorsClient.BeginCreateOrUpdate +// method. +type AzureADAdministratorsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AzureADAdministratorsClientBeginDeleteOptions contains the optional parameters for the AzureADAdministratorsClient.BeginDelete +// method. +type AzureADAdministratorsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AzureADAdministratorsClientGetOptions contains the optional parameters for the AzureADAdministratorsClient.Get method. +type AzureADAdministratorsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AzureADAdministratorsClientListByServerOptions contains the optional parameters for the AzureADAdministratorsClient.NewListByServerPager +// method. +type AzureADAdministratorsClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// BackupAndExportClientBeginCreateOptions contains the optional parameters for the BackupAndExportClient.BeginCreate method. +type BackupAndExportClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupAndExportClientValidateBackupOptions contains the optional parameters for the BackupAndExportClient.ValidateBackup +// method. +type BackupAndExportClientValidateBackupOptions struct { + // placeholder for future optional parameters +} + // BackupsClientGetOptions contains the optional parameters for the BackupsClient.Get method. type BackupsClientGetOptions struct { // placeholder for future optional parameters @@ -18,12 +55,23 @@ type BackupsClientListByServerOptions struct { // placeholder for future optional parameters } +// BackupsClientPutOptions contains the optional parameters for the BackupsClient.Put method. +type BackupsClientPutOptions struct { + // placeholder for future optional parameters +} + // CheckNameAvailabilityClientExecuteOptions contains the optional parameters for the CheckNameAvailabilityClient.Execute // method. type CheckNameAvailabilityClientExecuteOptions struct { // placeholder for future optional parameters } +// CheckNameAvailabilityWithoutLocationClientExecuteOptions contains the optional parameters for the CheckNameAvailabilityWithoutLocationClient.Execute +// method. +type CheckNameAvailabilityWithoutLocationClientExecuteOptions struct { + // placeholder for future optional parameters +} + // CheckVirtualNetworkSubnetUsageClientExecuteOptions contains the optional parameters for the CheckVirtualNetworkSubnetUsageClient.Execute // method. type CheckVirtualNetworkSubnetUsageClientExecuteOptions struct { @@ -37,6 +85,13 @@ type ConfigurationsClientBeginBatchUpdateOptions struct { ResumeToken string } +// ConfigurationsClientBeginCreateOrUpdateOptions contains the optional parameters for the ConfigurationsClient.BeginCreateOrUpdate +// method. +type ConfigurationsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // ConfigurationsClientBeginUpdateOptions contains the optional parameters for the ConfigurationsClient.BeginUpdate method. type ConfigurationsClientBeginUpdateOptions struct { // Resumes the LRO from the provided token. @@ -51,7 +106,17 @@ type ConfigurationsClientGetOptions struct { // ConfigurationsClientListByServerOptions contains the optional parameters for the ConfigurationsClient.NewListByServerPager // method. type ConfigurationsClientListByServerOptions struct { - // placeholder for future optional parameters + // The keyword of the server configuration. + Keyword *string + + // The page of the server configuration. + Page *int32 + + // The pageSize of the server configuration. + PageSize *int32 + + // The tags of the server configuration. + Tags *string } // DatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the DatabasesClient.BeginCreateOrUpdate @@ -113,6 +178,11 @@ type LocationBasedCapabilitiesClientListOptions struct { // placeholder for future optional parameters } +// LogFilesClientListByServerOptions contains the optional parameters for the LogFilesClient.NewListByServerPager method. +type LogFilesClientListByServerOptions struct { + // placeholder for future optional parameters +} + // OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { // placeholder for future optional parameters @@ -141,6 +211,12 @@ type ServersClientBeginFailoverOptions struct { ResumeToken string } +// ServersClientBeginResetGtidOptions contains the optional parameters for the ServersClient.BeginResetGtid method. +type ServersClientBeginResetGtidOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // ServersClientBeginRestartOptions contains the optional parameters for the ServersClient.BeginRestart method. type ServersClientBeginRestartOptions struct { // Resumes the LRO from the provided token. diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/polymorphic_helpers.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/polymorphic_helpers.go new file mode 100644 index 000000000000..a713ff6d8a6f --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/polymorphic_helpers.go @@ -0,0 +1,32 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmysqlflexibleservers + +import "encoding/json" + +func unmarshalBackupStoreDetailsClassification(rawMsg json.RawMessage) (BackupStoreDetailsClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b BackupStoreDetailsClassification + switch m["objectType"] { + case "FullBackupStoreDetails": + b = &FullBackupStoreDetails{} + default: + b = &BackupStoreDetails{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/replicas_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/replicas_client.go index 5ea31711b268..f738bcdb6c46 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/replicas_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/replicas_client.go @@ -45,7 +45,7 @@ func NewReplicasClient(subscriptionID string, credential azcore.TokenCredential, // NewListByServerPager - List all the replicas for a given server. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - options - ReplicasClientListByServerOptions contains the optional parameters for the ReplicasClient.NewListByServerPager @@ -93,7 +93,7 @@ func (client *ReplicasClient) listByServerCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/replicas_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/replicas_client_example_test.go index 55f588b29d19..a775d2240390 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/replicas_client_example_test.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/replicas_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ReplicasListByServer.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ReplicasListByServer.json func ExampleReplicasClient_NewListByServerPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/response_types.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/response_types.go index 69911d414618..50b5b585c276 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/response_types.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/response_types.go @@ -8,6 +8,41 @@ package armmysqlflexibleservers +// AzureADAdministratorsClientCreateOrUpdateResponse contains the response from method AzureADAdministratorsClient.BeginCreateOrUpdate. +type AzureADAdministratorsClientCreateOrUpdateResponse struct { + // Represents a Administrator. + AzureADAdministrator +} + +// AzureADAdministratorsClientDeleteResponse contains the response from method AzureADAdministratorsClient.BeginDelete. +type AzureADAdministratorsClientDeleteResponse struct { + // placeholder for future response values +} + +// AzureADAdministratorsClientGetResponse contains the response from method AzureADAdministratorsClient.Get. +type AzureADAdministratorsClientGetResponse struct { + // Represents a Administrator. + AzureADAdministrator +} + +// AzureADAdministratorsClientListByServerResponse contains the response from method AzureADAdministratorsClient.NewListByServerPager. +type AzureADAdministratorsClientListByServerResponse struct { + // A List of azure ad administrators. + AdministratorListResult +} + +// BackupAndExportClientCreateResponse contains the response from method BackupAndExportClient.BeginCreate. +type BackupAndExportClientCreateResponse struct { + // Represents BackupAndExport API Response + BackupAndExportResponse +} + +// BackupAndExportClientValidateBackupResponse contains the response from method BackupAndExportClient.ValidateBackup. +type BackupAndExportClientValidateBackupResponse struct { + // Represents ValidateBackup API Response + ValidateBackupResponse +} + // BackupsClientGetResponse contains the response from method BackupsClient.Get. type BackupsClientGetResponse struct { // Server backup properties @@ -20,12 +55,24 @@ type BackupsClientListByServerResponse struct { ServerBackupListResult } +// BackupsClientPutResponse contains the response from method BackupsClient.Put. +type BackupsClientPutResponse struct { + // Server backup properties + ServerBackup +} + // CheckNameAvailabilityClientExecuteResponse contains the response from method CheckNameAvailabilityClient.Execute. type CheckNameAvailabilityClientExecuteResponse struct { // Represents a resource name availability. NameAvailability } +// CheckNameAvailabilityWithoutLocationClientExecuteResponse contains the response from method CheckNameAvailabilityWithoutLocationClient.Execute. +type CheckNameAvailabilityWithoutLocationClientExecuteResponse struct { + // Represents a resource name availability. + NameAvailability +} + // CheckVirtualNetworkSubnetUsageClientExecuteResponse contains the response from method CheckVirtualNetworkSubnetUsageClient.Execute. type CheckVirtualNetworkSubnetUsageClientExecuteResponse struct { // Virtual network subnet usage data. @@ -38,6 +85,12 @@ type ConfigurationsClientBatchUpdateResponse struct { ConfigurationListResult } +// ConfigurationsClientCreateOrUpdateResponse contains the response from method ConfigurationsClient.BeginCreateOrUpdate. +type ConfigurationsClientCreateOrUpdateResponse struct { + // Represents a Configuration. + Configuration +} + // ConfigurationsClientGetResponse contains the response from method ConfigurationsClient.Get. type ConfigurationsClientGetResponse struct { // Represents a Configuration. @@ -114,6 +167,12 @@ type LocationBasedCapabilitiesClientListResponse struct { CapabilitiesListResult } +// LogFilesClientListByServerResponse contains the response from method LogFilesClient.NewListByServerPager. +type LogFilesClientListByServerResponse struct { + // A List of logFiles. + LogFileListResult +} + // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { // A list of resource provider operations. @@ -160,6 +219,11 @@ type ServersClientListResponse struct { ServerListResult } +// ServersClientResetGtidResponse contains the response from method ServersClient.BeginResetGtid. +type ServersClientResetGtidResponse struct { + // placeholder for future response values +} + // ServersClientRestartResponse contains the response from method ServersClient.BeginRestart. type ServersClientRestartResponse struct { // placeholder for future response values diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/servers_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/servers_client.go index 85469d00afaf..d8511351d10f 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/servers_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/servers_client.go @@ -46,7 +46,7 @@ func NewServersClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreate - Creates a new server or updates an existing server. The update action will overwrite the existing server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - parameters - The required parameters for creating or updating a server. @@ -71,7 +71,7 @@ func (client *ServersClient) BeginCreate(ctx context.Context, resourceGroupName // Create - Creates a new server or updates an existing server. The update action will overwrite the existing server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-preview func (client *ServersClient) create(ctx context.Context, resourceGroupName string, serverName string, parameters Server, options *ServersClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "ServersClient.BeginCreate" @@ -113,7 +113,7 @@ func (client *ServersClient) createCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -125,7 +125,7 @@ func (client *ServersClient) createCreateRequest(ctx context.Context, resourceGr // BeginDelete - Deletes a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - options - ServersClientBeginDeleteOptions contains the optional parameters for the ServersClient.BeginDelete method. @@ -136,7 +136,8 @@ func (client *ServersClient) BeginDelete(ctx context.Context, resourceGroupName return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServersClientDeleteResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -149,7 +150,7 @@ func (client *ServersClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-preview func (client *ServersClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ServersClient.BeginDelete" @@ -191,7 +192,7 @@ func (client *ServersClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -200,7 +201,7 @@ func (client *ServersClient) deleteCreateRequest(ctx context.Context, resourceGr // BeginFailover - Manual failover a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - options - ServersClientBeginFailoverOptions contains the optional parameters for the ServersClient.BeginFailover method. @@ -224,7 +225,7 @@ func (client *ServersClient) BeginFailover(ctx context.Context, resourceGroupNam // Failover - Manual failover a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-preview func (client *ServersClient) failover(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginFailoverOptions) (*http.Response, error) { var err error const operationName = "ServersClient.BeginFailover" @@ -266,7 +267,7 @@ func (client *ServersClient) failoverCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -275,7 +276,7 @@ func (client *ServersClient) failoverCreateRequest(ctx context.Context, resource // Get - Gets information about a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - options - ServersClientGetOptions contains the optional parameters for the ServersClient.Get method. @@ -321,7 +322,7 @@ func (client *ServersClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -338,7 +339,7 @@ func (client *ServersClient) getHandleResponse(resp *http.Response) (ServersClie // NewListPager - List all the servers in a given subscription. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-preview // - options - ServersClientListOptions contains the optional parameters for the ServersClient.NewListPager method. func (client *ServersClient) NewListPager(options *ServersClientListOptions) *runtime.Pager[ServersClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ServersClientListResponse]{ @@ -375,7 +376,7 @@ func (client *ServersClient) listCreateRequest(ctx context.Context, options *Ser return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -392,7 +393,7 @@ func (client *ServersClient) listHandleResponse(resp *http.Response) (ServersCli // NewListByResourceGroupPager - List all the servers in a given resource group. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ServersClientListByResourceGroupOptions contains the optional parameters for the ServersClient.NewListByResourceGroupPager // method. @@ -435,7 +436,7 @@ func (client *ServersClient) listByResourceGroupCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -450,10 +451,90 @@ func (client *ServersClient) listByResourceGroupHandleResponse(resp *http.Respon return result, nil } +// BeginResetGtid - Resets GTID on a server. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-30-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serverName - The name of the server. +// - parameters - The required parameters for resetting GTID on a server. +// - options - ServersClientBeginResetGtidOptions contains the optional parameters for the ServersClient.BeginResetGtid method. +func (client *ServersClient) BeginResetGtid(ctx context.Context, resourceGroupName string, serverName string, parameters ServerGtidSetParameter, options *ServersClientBeginResetGtidOptions) (*runtime.Poller[ServersClientResetGtidResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.resetGtid(ctx, resourceGroupName, serverName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServersClientResetGtidResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ServersClientResetGtidResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ResetGtid - Resets GTID on a server. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-30-preview +func (client *ServersClient) resetGtid(ctx context.Context, resourceGroupName string, serverName string, parameters ServerGtidSetParameter, options *ServersClientBeginResetGtidOptions) (*http.Response, error) { + var err error + const operationName = "ServersClient.BeginResetGtid" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.resetGtidCreateRequest(ctx, resourceGroupName, serverName, 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.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// resetGtidCreateRequest creates the ResetGtid request. +func (client *ServersClient) resetGtidCreateRequest(ctx context.Context, resourceGroupName string, serverName string, parameters ServerGtidSetParameter, options *ServersClientBeginResetGtidOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/resetGtid" + 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 serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + 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", "2022-09-30-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 +} + // BeginRestart - Restarts a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - parameters - The required parameters for restarting a server. @@ -478,7 +559,7 @@ func (client *ServersClient) BeginRestart(ctx context.Context, resourceGroupName // Restart - Restarts a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-preview func (client *ServersClient) restart(ctx context.Context, resourceGroupName string, serverName string, parameters ServerRestartParameter, options *ServersClientBeginRestartOptions) (*http.Response, error) { var err error const operationName = "ServersClient.BeginRestart" @@ -520,7 +601,7 @@ func (client *ServersClient) restartCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -532,7 +613,7 @@ func (client *ServersClient) restartCreateRequest(ctx context.Context, resourceG // BeginStart - Starts a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - options - ServersClientBeginStartOptions contains the optional parameters for the ServersClient.BeginStart method. @@ -556,7 +637,7 @@ func (client *ServersClient) BeginStart(ctx context.Context, resourceGroupName s // Start - Starts a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-preview func (client *ServersClient) start(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginStartOptions) (*http.Response, error) { var err error const operationName = "ServersClient.BeginStart" @@ -598,7 +679,7 @@ func (client *ServersClient) startCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -607,7 +688,7 @@ func (client *ServersClient) startCreateRequest(ctx context.Context, resourceGro // BeginStop - Stops a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - options - ServersClientBeginStopOptions contains the optional parameters for the ServersClient.BeginStop method. @@ -631,7 +712,7 @@ func (client *ServersClient) BeginStop(ctx context.Context, resourceGroupName st // Stop - Stops a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-preview func (client *ServersClient) stop(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginStopOptions) (*http.Response, error) { var err error const operationName = "ServersClient.BeginStop" @@ -673,7 +754,7 @@ func (client *ServersClient) stopCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -683,7 +764,7 @@ func (client *ServersClient) stopCreateRequest(ctx context.Context, resourceGrou // server definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - parameters - The required parameters for updating a server. @@ -709,7 +790,7 @@ func (client *ServersClient) BeginUpdate(ctx context.Context, resourceGroupName // definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-preview func (client *ServersClient) update(ctx context.Context, resourceGroupName string, serverName string, parameters ServerForUpdate, options *ServersClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "ServersClient.BeginUpdate" @@ -751,7 +832,7 @@ func (client *ServersClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-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/mysql/armmysqlflexibleservers/servers_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/servers_client_example_test.go index 7235eaba632a..d897da168ddf 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/servers_client_example_test.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/servers_client_example_test.go @@ -17,10 +17,10 @@ import ( "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/mysql/armmysqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerCreate.json func ExampleServersClient_BeginCreate_createANewServer() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -120,7 +120,7 @@ func ExampleServersClient_BeginCreate_createANewServer() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerCreateReplica.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerCreateReplica.json func ExampleServersClient_BeginCreate_createAReplicaServer() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -197,7 +197,7 @@ func ExampleServersClient_BeginCreate_createAReplicaServer() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerCreateWithPointInTimeRestore.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerCreateWithPointInTimeRestore.json func ExampleServersClient_BeginCreate_createAServerAsAPointInTimeRestore() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -281,7 +281,7 @@ func ExampleServersClient_BeginCreate_createAServerAsAPointInTimeRestore() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerCreateWithBYOK.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerCreateWithBYOK.json func ExampleServersClient_BeginCreate_createAServerWithByok() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -298,7 +298,7 @@ func ExampleServersClient_BeginCreate_createAServerWithByok() { "num": to.Ptr("1"), }, Identity: &armmysqlflexibleservers.Identity{ - Type: to.Ptr("UserAssigned"), + Type: to.Ptr(armmysqlflexibleservers.ManagedServiceIdentityTypeUserAssigned), UserAssignedIdentities: map[string]any{ "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity": map[string]any{}, }, @@ -394,7 +394,7 @@ func ExampleServersClient_BeginCreate_createAServerWithByok() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerUpdate.json func ExampleServersClient_BeginUpdate_updateAServer() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -409,6 +409,7 @@ func ExampleServersClient_BeginUpdate_updateAServer() { Properties: &armmysqlflexibleservers.ServerPropertiesForUpdate{ Storage: &armmysqlflexibleservers.Storage{ AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), + AutoIoScaling: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), Iops: to.Ptr[int32](200), StorageSizeGB: to.Ptr[int32](30), }, @@ -459,6 +460,7 @@ func ExampleServersClient_BeginUpdate_updateAServer() { // State: to.Ptr(armmysqlflexibleservers.ServerStateReady), // Storage: &armmysqlflexibleservers.Storage{ // AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), + // AutoIoScaling: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), // Iops: to.Ptr[int32](200), // StorageSizeGB: to.Ptr[int32](30), // StorageSKU: to.Ptr("Premium_LRS"), @@ -472,7 +474,7 @@ func ExampleServersClient_BeginUpdate_updateAServer() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerUpdateWithCustomerMaintenanceWindow.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerUpdateWithCustomerMaintenanceWindow.json func ExampleServersClient_BeginUpdate_updateServerCustomerMaintenanceWindow() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -551,7 +553,7 @@ func ExampleServersClient_BeginUpdate_updateServerCustomerMaintenanceWindow() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerUpdateWithBYOK.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerUpdateWithBYOK.json func ExampleServersClient_BeginUpdate_updateServerWithByok() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -564,7 +566,7 @@ func ExampleServersClient_BeginUpdate_updateServerWithByok() { } poller, err := clientFactory.NewServersClient().BeginUpdate(ctx, "testrg", "mysqltestserver", armmysqlflexibleservers.ServerForUpdate{ Identity: &armmysqlflexibleservers.Identity{ - Type: to.Ptr("UserAssigned"), + Type: to.Ptr(armmysqlflexibleservers.ManagedServiceIdentityTypeUserAssigned), UserAssignedIdentities: map[string]any{ "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity": map[string]any{}, }, @@ -638,7 +640,7 @@ func ExampleServersClient_BeginUpdate_updateServerWithByok() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerDelete.json func ExampleServersClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -659,7 +661,7 @@ func ExampleServersClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerGet.json func ExampleServersClient_Get_getAServer() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -712,6 +714,7 @@ func ExampleServersClient_Get_getAServer() { // State: to.Ptr(armmysqlflexibleservers.ServerStateReady), // Storage: &armmysqlflexibleservers.Storage{ // AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), + // AutoIoScaling: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), // Iops: to.Ptr[int32](600), // StorageSizeGB: to.Ptr[int32](100), // StorageSKU: to.Ptr("Premium_LRS"), @@ -725,7 +728,7 @@ func ExampleServersClient_Get_getAServer() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerGetWithVnet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerGetWithVnet.json func ExampleServersClient_Get_getAServerWithVnet() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -792,7 +795,7 @@ func ExampleServersClient_Get_getAServerWithVnet() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServersListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServersListByResourceGroup.json func ExampleServersClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -958,7 +961,7 @@ func ExampleServersClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServersList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServersList.json func ExampleServersClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1124,7 +1127,7 @@ func ExampleServersClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerFailover.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerFailover.json func ExampleServersClient_BeginFailover() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1145,7 +1148,7 @@ func ExampleServersClient_BeginFailover() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerRestart.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerRestart.json func ExampleServersClient_BeginRestart() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1169,7 +1172,7 @@ func ExampleServersClient_BeginRestart() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerStart.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerStart.json func ExampleServersClient_BeginStart() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1190,7 +1193,7 @@ func ExampleServersClient_BeginStart() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerStop.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerStop.json func ExampleServersClient_BeginStop() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1210,3 +1213,26 @@ func ExampleServersClient_BeginStop() { log.Fatalf("failed to pull the result: %v", err) } } + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerResetGtid.json +func ExampleServersClient_BeginResetGtid() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewServersClient().BeginResetGtid(ctx, "TestGroup", "testserver", armmysqlflexibleservers.ServerGtidSetParameter{ + GtidSet: to.Ptr("4aff5b51-97ba-11ed-a955-002248036acc:1-16"), + }, 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/selfhelp/armselfhelp/CHANGELOG.md b/sdk/resourcemanager/selfhelp/armselfhelp/CHANGELOG.md index 9ae03a8c0a21..c1dd33999e24 100644 --- a/sdk/resourcemanager/selfhelp/armselfhelp/CHANGELOG.md +++ b/sdk/resourcemanager/selfhelp/armselfhelp/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 2.0.0-beta.2 (2023-11-30) +### Features Added + +- Support for test fakes and OpenTelemetry trace spans. + + ## 1.1.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/assets.json b/sdk/resourcemanager/selfhelp/armselfhelp/assets.json index 715067d3fd64..af8b16bb56ad 100644 --- a/sdk/resourcemanager/selfhelp/armselfhelp/assets.json +++ b/sdk/resourcemanager/selfhelp/armselfhelp/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "go", "TagPrefix": "go/resourcemanager/selfhelp/armselfhelp", - "Tag": "go/resourcemanager/selfhelp/armselfhelp_217ee4f51b" + "Tag": "go/resourcemanager/selfhelp/armselfhelp_a3e613db90" } diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/autorest.md b/sdk/resourcemanager/selfhelp/armselfhelp/autorest.md index b1038bb54032..76bf3b91f9da 100644 --- a/sdk/resourcemanager/selfhelp/armselfhelp/autorest.md +++ b/sdk/resourcemanager/selfhelp/armselfhelp/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/help/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/help/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/help/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/help/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.0 -tag: package-2023-06-01 +module-version: 2.0.0-beta.2 +tag: package-2023-09-01-preview ``` \ No newline at end of file diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/checknameavailability_client.go b/sdk/resourcemanager/selfhelp/armselfhelp/checknameavailability_client.go new file mode 100644 index 000000000000..00da8efec6fe --- /dev/null +++ b/sdk/resourcemanager/selfhelp/armselfhelp/checknameavailability_client.go @@ -0,0 +1,98 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armselfhelp + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// CheckNameAvailabilityClient contains the methods for the CheckNameAvailability group. +// Don't use this type directly, use NewCheckNameAvailabilityClient() instead. +type CheckNameAvailabilityClient struct { + internal *arm.Client +} + +// NewCheckNameAvailabilityClient creates a new instance of CheckNameAvailabilityClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewCheckNameAvailabilityClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*CheckNameAvailabilityClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CheckNameAvailabilityClient{ + internal: cl, + } + return client, nil +} + +// Post - This API is used to check the uniqueness of a resource name used for a diagnostic, troubleshooter or solutions +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - scope - This is an extension resource provider and only resource level extension is supported at the moment. +// - options - CheckNameAvailabilityClientPostOptions contains the optional parameters for the CheckNameAvailabilityClient.Post +// method. +func (client *CheckNameAvailabilityClient) Post(ctx context.Context, scope string, options *CheckNameAvailabilityClientPostOptions) (CheckNameAvailabilityClientPostResponse, error) { + var err error + const operationName = "CheckNameAvailabilityClient.Post" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.postCreateRequest(ctx, scope, options) + if err != nil { + return CheckNameAvailabilityClientPostResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CheckNameAvailabilityClientPostResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CheckNameAvailabilityClientPostResponse{}, err + } + resp, err := client.postHandleResponse(httpResp) + return resp, err +} + +// postCreateRequest creates the Post request. +func (client *CheckNameAvailabilityClient) postCreateRequest(ctx context.Context, scope string, options *CheckNameAvailabilityClientPostOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Help/checkNameAvailability" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.CheckNameAvailabilityRequest != nil { + if err := runtime.MarshalAsJSON(req, *options.CheckNameAvailabilityRequest); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// postHandleResponse handles the Post response. +func (client *CheckNameAvailabilityClient) postHandleResponse(resp *http.Response) (CheckNameAvailabilityClientPostResponse, error) { + result := CheckNameAvailabilityClientPostResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResponse); err != nil { + return CheckNameAvailabilityClientPostResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/checknameavailability_client_example_test.go b/sdk/resourcemanager/selfhelp/armselfhelp/checknameavailability_client_example_test.go new file mode 100644 index 000000000000..5a1317538c52 --- /dev/null +++ b/sdk/resourcemanager/selfhelp/armselfhelp/checknameavailability_client_example_test.go @@ -0,0 +1,75 @@ +//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 armselfhelp_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/selfhelp/armselfhelp/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/CheckNameAvailabilityForDiagnosticWhenNameIsAvailable.json +func ExampleCheckNameAvailabilityClient_Post_exampleWhenNameIsAvailableForADiagnosticResource() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armselfhelp.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewCheckNameAvailabilityClient().Post(ctx, "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6", &armselfhelp.CheckNameAvailabilityClientPostOptions{CheckNameAvailabilityRequest: &armselfhelp.CheckNameAvailabilityRequest{ + Name: to.Ptr("sampleName"), + Type: to.Ptr("Microsoft.Help/diagnostics"), + }, + }) + 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.CheckNameAvailabilityResponse = armselfhelp.CheckNameAvailabilityResponse{ + // NameAvailable: to.Ptr(true), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/CheckNameAvailabilityForDiagnosticWhenNameIsNotAvailable.json +func ExampleCheckNameAvailabilityClient_Post_exampleWhenNameIsNotAvailableForADiagnosticResource() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armselfhelp.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewCheckNameAvailabilityClient().Post(ctx, "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6", &armselfhelp.CheckNameAvailabilityClientPostOptions{CheckNameAvailabilityRequest: &armselfhelp.CheckNameAvailabilityRequest{ + Name: to.Ptr("sampleName"), + Type: to.Ptr("Microsoft.Help/diagnostics"), + }, + }) + 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.CheckNameAvailabilityResponse = armselfhelp.CheckNameAvailabilityResponse{ + // Message: to.Ptr("Name not available"), + // NameAvailable: to.Ptr(false), + // Reason: to.Ptr("Name is already in use"), + // } +} diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/client_factory.go b/sdk/resourcemanager/selfhelp/armselfhelp/client_factory.go index 7525678908ae..29dc7d41ffb4 100644 --- a/sdk/resourcemanager/selfhelp/armselfhelp/client_factory.go +++ b/sdk/resourcemanager/selfhelp/armselfhelp/client_factory.go @@ -35,6 +35,12 @@ func NewClientFactory(credential azcore.TokenCredential, options *arm.ClientOpti }, nil } +// NewCheckNameAvailabilityClient creates a new instance of CheckNameAvailabilityClient. +func (c *ClientFactory) NewCheckNameAvailabilityClient() *CheckNameAvailabilityClient { + subClient, _ := NewCheckNameAvailabilityClient(c.credential, c.options) + return subClient +} + // NewDiagnosticsClient creates a new instance of DiagnosticsClient. func (c *ClientFactory) NewDiagnosticsClient() *DiagnosticsClient { subClient, _ := NewDiagnosticsClient(c.credential, c.options) @@ -52,3 +58,15 @@ func (c *ClientFactory) NewOperationsClient() *OperationsClient { subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } + +// NewSolutionClient creates a new instance of SolutionClient. +func (c *ClientFactory) NewSolutionClient() *SolutionClient { + subClient, _ := NewSolutionClient(c.credential, c.options) + return subClient +} + +// NewTroubleshootersClient creates a new instance of TroubleshootersClient. +func (c *ClientFactory) NewTroubleshootersClient() *TroubleshootersClient { + subClient, _ := NewTroubleshootersClient(c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/constants.go b/sdk/resourcemanager/selfhelp/armselfhelp/constants.go index aed2443f6d9f..40389b912112 100644 --- a/sdk/resourcemanager/selfhelp/armselfhelp/constants.go +++ b/sdk/resourcemanager/selfhelp/armselfhelp/constants.go @@ -10,7 +10,7 @@ package armselfhelp const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/selfhelp/armselfhelp" - moduleVersion = "v1.1.0" + moduleVersion = "v2.0.0-beta.2" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -27,6 +27,66 @@ func PossibleActionTypeValues() []ActionType { } } +// AggregationType - Allowed values are Sum, Avg, Count, Min, Max. Default is Sum +type AggregationType string + +const ( + AggregationTypeAvg AggregationType = "Avg" + AggregationTypeCount AggregationType = "Count" + AggregationTypeMax AggregationType = "Max" + AggregationTypeMin AggregationType = "Min" + AggregationTypeSum AggregationType = "Sum" +) + +// PossibleAggregationTypeValues returns the possible values for the AggregationType const type. +func PossibleAggregationTypeValues() []AggregationType { + return []AggregationType{ + AggregationTypeAvg, + AggregationTypeCount, + AggregationTypeMax, + AggregationTypeMin, + AggregationTypeSum, + } +} + +// AutomatedCheckResultType - Type of Result. +type AutomatedCheckResultType string + +const ( + AutomatedCheckResultTypeError AutomatedCheckResultType = "Error" + AutomatedCheckResultTypeInformation AutomatedCheckResultType = "Information" + AutomatedCheckResultTypeSuccess AutomatedCheckResultType = "Success" + AutomatedCheckResultTypeWarning AutomatedCheckResultType = "Warning" +) + +// PossibleAutomatedCheckResultTypeValues returns the possible values for the AutomatedCheckResultType const type. +func PossibleAutomatedCheckResultTypeValues() []AutomatedCheckResultType { + return []AutomatedCheckResultType{ + AutomatedCheckResultTypeError, + AutomatedCheckResultTypeInformation, + AutomatedCheckResultTypeSuccess, + AutomatedCheckResultTypeWarning, + } +} + +// Confidence - Confidence of the search result. +type Confidence string + +const ( + ConfidenceHigh Confidence = "High" + ConfidenceLow Confidence = "Low" + ConfidenceMedium Confidence = "Medium" +) + +// PossibleConfidenceValues returns the possible values for the Confidence const type. +func PossibleConfidenceValues() []Confidence { + return []Confidence{ + ConfidenceHigh, + ConfidenceLow, + ConfidenceMedium, + } +} + // CreatedByType - The type of identity that created the resource. type CreatedByType string @@ -47,6 +107,50 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } +// DiagnosticProvisioningState - Status of diagnostic provisioning. +type DiagnosticProvisioningState string + +const ( + // DiagnosticProvisioningStateCanceled - When Diagnostic request gets canceled. + DiagnosticProvisioningStateCanceled DiagnosticProvisioningState = "Canceled" + // DiagnosticProvisioningStateFailed - All Diagnostics failed to run. + DiagnosticProvisioningStateFailed DiagnosticProvisioningState = "Failed" + // DiagnosticProvisioningStatePartialComplete - Some Diagnostics are still running or failed. + DiagnosticProvisioningStatePartialComplete DiagnosticProvisioningState = "PartialComplete" + // DiagnosticProvisioningStateSucceeded - All Diagnostics in the Batch succeeded. + DiagnosticProvisioningStateSucceeded DiagnosticProvisioningState = "Succeeded" +) + +// PossibleDiagnosticProvisioningStateValues returns the possible values for the DiagnosticProvisioningState const type. +func PossibleDiagnosticProvisioningStateValues() []DiagnosticProvisioningState { + return []DiagnosticProvisioningState{ + DiagnosticProvisioningStateCanceled, + DiagnosticProvisioningStateFailed, + DiagnosticProvisioningStatePartialComplete, + DiagnosticProvisioningStateSucceeded, + } +} + +// ExecutionStatus - Status of Troubleshooter Step execution. +type ExecutionStatus string + +const ( + ExecutionStatusFailed ExecutionStatus = "Failed" + ExecutionStatusRunning ExecutionStatus = "Running" + ExecutionStatusSuccess ExecutionStatus = "Success" + ExecutionStatusWarning ExecutionStatus = "Warning" +) + +// PossibleExecutionStatusValues returns the possible values for the ExecutionStatus const type. +func PossibleExecutionStatusValues() []ExecutionStatus { + return []ExecutionStatus{ + ExecutionStatusFailed, + ExecutionStatusRunning, + ExecutionStatusSuccess, + ExecutionStatusWarning, + } +} + // ImportanceLevel - Importance level of the insight. type ImportanceLevel string @@ -68,6 +172,24 @@ func PossibleImportanceLevelValues() []ImportanceLevel { } } +// Name - Trigger criterion name. +type Name string + +const ( + NameProblemClassificationID Name = "ProblemClassificationId" + NameReplacementKey Name = "ReplacementKey" + NameSolutionID Name = "SolutionId" +) + +// PossibleNameValues returns the possible values for the Name const type. +func PossibleNameValues() []Name { + return []Name{ + NameProblemClassificationID, + NameReplacementKey, + NameSolutionID, + } +} + // Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default // value is "user,system" type Origin string @@ -87,27 +209,97 @@ func PossibleOriginValues() []Origin { } } -// ProvisioningState - Status of diagnostic provisioning. -type ProvisioningState string +// QuestionContentType - Default is Text. +type QuestionContentType string const ( - // ProvisioningStateCanceled - When Diagnostic request gets canceled. - ProvisioningStateCanceled ProvisioningState = "Canceled" - // ProvisioningStateFailed - All Diagnostics failed to run. - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStatePartialComplete - Some Diagnostics are still running or failed. - ProvisioningStatePartialComplete ProvisioningState = "PartialComplete" - // ProvisioningStateSucceeded - All Diagnostics in the Batch succeeded. - ProvisioningStateSucceeded ProvisioningState = "Succeeded" + QuestionContentTypeHTML QuestionContentType = "Html" + QuestionContentTypeMarkdown QuestionContentType = "Markdown" + QuestionContentTypeText QuestionContentType = "Text" ) -// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ - ProvisioningStateCanceled, - ProvisioningStateFailed, - ProvisioningStatePartialComplete, - ProvisioningStateSucceeded, +// PossibleQuestionContentTypeValues returns the possible values for the QuestionContentType const type. +func PossibleQuestionContentTypeValues() []QuestionContentType { + return []QuestionContentType{ + QuestionContentTypeHTML, + QuestionContentTypeMarkdown, + QuestionContentTypeText, + } +} + +// QuestionType - Text Input. Will be a single line input. +type QuestionType string + +const ( + // QuestionTypeDropdown - SingleChoice dropdown. + QuestionTypeDropdown QuestionType = "Dropdown" + // QuestionTypeMultiLineInfoBox - MultiLineInfoBox + QuestionTypeMultiLineInfoBox QuestionType = "MultiLineInfoBox" + // QuestionTypeRadioButton - SingleChoice radio button + QuestionTypeRadioButton QuestionType = "RadioButton" + // QuestionTypeTextInput - Text Input + QuestionTypeTextInput QuestionType = "TextInput" +) + +// PossibleQuestionTypeValues returns the possible values for the QuestionType const type. +func PossibleQuestionTypeValues() []QuestionType { + return []QuestionType{ + QuestionTypeDropdown, + QuestionTypeMultiLineInfoBox, + QuestionTypeRadioButton, + QuestionTypeTextInput, + } +} + +// ResultType - Result type of the search result. +type ResultType string + +const ( + ResultTypeCommunity ResultType = "Community" + ResultTypeDocumentation ResultType = "Documentation" +) + +// PossibleResultTypeValues returns the possible values for the ResultType const type. +func PossibleResultTypeValues() []ResultType { + return []ResultType{ + ResultTypeCommunity, + ResultTypeDocumentation, + } +} + +// SolutionProvisioningState - Status of solution provisioning. +type SolutionProvisioningState string + +const ( + SolutionProvisioningStateCanceled SolutionProvisioningState = "Canceled" + SolutionProvisioningStateFailed SolutionProvisioningState = "Failed" + SolutionProvisioningStateSucceeded SolutionProvisioningState = "Succeeded" +) + +// PossibleSolutionProvisioningStateValues returns the possible values for the SolutionProvisioningState const type. +func PossibleSolutionProvisioningStateValues() []SolutionProvisioningState { + return []SolutionProvisioningState{ + SolutionProvisioningStateCanceled, + SolutionProvisioningStateFailed, + SolutionProvisioningStateSucceeded, + } +} + +// SolutionType - Solution Type. +type SolutionType string + +const ( + // SolutionTypeDiagnostics - Diagnostics resource type. + SolutionTypeDiagnostics SolutionType = "Diagnostics" + // SolutionTypeSolutions - Solutions resource type. + SolutionTypeSolutions SolutionType = "Solutions" +) + +// PossibleSolutionTypeValues returns the possible values for the SolutionType const type. +func PossibleSolutionTypeValues() []SolutionType { + return []SolutionType{ + SolutionTypeDiagnostics, + SolutionTypeSolutions, } } @@ -137,3 +329,45 @@ func PossibleStatusValues() []Status { StatusTimeout, } } + +// TroubleshooterProvisioningState - Status of troubleshooter provisioning. +type TroubleshooterProvisioningState string + +const ( + TroubleshooterProvisioningStateAutoContinue TroubleshooterProvisioningState = "AutoContinue" + TroubleshooterProvisioningStateCanceled TroubleshooterProvisioningState = "Canceled" + TroubleshooterProvisioningStateFailed TroubleshooterProvisioningState = "Failed" + TroubleshooterProvisioningStateRunning TroubleshooterProvisioningState = "Running" + TroubleshooterProvisioningStateSucceeded TroubleshooterProvisioningState = "Succeeded" +) + +// PossibleTroubleshooterProvisioningStateValues returns the possible values for the TroubleshooterProvisioningState const type. +func PossibleTroubleshooterProvisioningStateValues() []TroubleshooterProvisioningState { + return []TroubleshooterProvisioningState{ + TroubleshooterProvisioningStateAutoContinue, + TroubleshooterProvisioningStateCanceled, + TroubleshooterProvisioningStateFailed, + TroubleshooterProvisioningStateRunning, + TroubleshooterProvisioningStateSucceeded, + } +} + +// Type - Type of Troubleshooting step. +type Type string + +const ( + TypeAutomatedCheck Type = "AutomatedCheck" + TypeDecision Type = "Decision" + TypeInsight Type = "Insight" + TypeSolution Type = "Solution" +) + +// PossibleTypeValues returns the possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{ + TypeAutomatedCheck, + TypeDecision, + TypeInsight, + TypeSolution, + } +} diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/diagnostics_client.go b/sdk/resourcemanager/selfhelp/armselfhelp/diagnostics_client.go index c2298a0002e0..5bb26186431d 100644 --- a/sdk/resourcemanager/selfhelp/armselfhelp/diagnostics_client.go +++ b/sdk/resourcemanager/selfhelp/armselfhelp/diagnostics_client.go @@ -40,73 +40,14 @@ func NewDiagnosticsClient(credential azcore.TokenCredential, options *arm.Client return client, nil } -// CheckNameAvailability - This API is used to check the uniqueness of a resource name used for a diagnostic check. +// BeginCreate - Creates a diagnostic for the specific resource using solutionId and requiredInputs* from discovery solutions. +// Diagnostics tells you precisely the root cause of the issue and the steps to address it. +// You can get diagnostics once you discover the relevant solution for your Azure issue. +// Note: requiredInputs’ from Discovery solutions response must be passed via ‘additionalParameters’ as an input to Diagnostics +// API. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01 -// - scope - This is an extension resource provider and only resource level extension is supported at the moment. -// - options - DiagnosticsClientCheckNameAvailabilityOptions contains the optional parameters for the DiagnosticsClient.CheckNameAvailability -// method. -func (client *DiagnosticsClient) CheckNameAvailability(ctx context.Context, scope string, options *DiagnosticsClientCheckNameAvailabilityOptions) (DiagnosticsClientCheckNameAvailabilityResponse, error) { - var err error - const operationName = "DiagnosticsClient.CheckNameAvailability" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.checkNameAvailabilityCreateRequest(ctx, scope, options) - if err != nil { - return DiagnosticsClientCheckNameAvailabilityResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DiagnosticsClientCheckNameAvailabilityResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return DiagnosticsClientCheckNameAvailabilityResponse{}, err - } - resp, err := client.checkNameAvailabilityHandleResponse(httpResp) - return resp, err -} - -// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. -func (client *DiagnosticsClient) checkNameAvailabilityCreateRequest(ctx context.Context, scope string, options *DiagnosticsClientCheckNameAvailabilityOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Help/checkNameAvailability" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.CheckNameAvailabilityRequest != nil { - if err := runtime.MarshalAsJSON(req, *options.CheckNameAvailabilityRequest); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. -func (client *DiagnosticsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (DiagnosticsClientCheckNameAvailabilityResponse, error) { - result := DiagnosticsClientCheckNameAvailabilityResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResponse); err != nil { - return DiagnosticsClientCheckNameAvailabilityResponse{}, err - } - return result, nil -} - -// BeginCreate - Diagnostics tells you precisely the root cause of the issue and how to address it. You can get diagnostics -// once you discover and identify the relevant solution for your Azure issue. -// You can create diagnostics using the ‘solutionId’ from Solution Discovery API response and ‘additionalParameters’ -// Note: ‘requiredParameterSets’ from Solutions Discovery API response must be passed via ‘additionalParameters’ as an input -// to Diagnostics API -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-06-01 +// Generated from API version 2023-09-01-preview // - scope - This is an extension resource provider and only resource level extension is supported at the moment. // - diagnosticsResourceName - Unique resource name for insight resources // - diagnosticResourceRequest - The required request body for this insightResource invocation. @@ -129,14 +70,14 @@ func (client *DiagnosticsClient) BeginCreate(ctx context.Context, scope string, } } -// Create - Diagnostics tells you precisely the root cause of the issue and how to address it. You can get diagnostics once -// you discover and identify the relevant solution for your Azure issue. -// You can create diagnostics using the ‘solutionId’ from Solution Discovery API response and ‘additionalParameters’ -// Note: ‘requiredParameterSets’ from Solutions Discovery API response must be passed via ‘additionalParameters’ as an input -// to Diagnostics API +// Create - Creates a diagnostic for the specific resource using solutionId and requiredInputs* from discovery solutions. +// Diagnostics tells you precisely the root cause of the issue and the steps to address it. +// You can get diagnostics once you discover the relevant solution for your Azure issue. +// Note: requiredInputs’ from Discovery solutions response must be passed via ‘additionalParameters’ as an input to Diagnostics +// API. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01 +// Generated from API version 2023-09-01-preview func (client *DiagnosticsClient) create(ctx context.Context, scope string, diagnosticsResourceName string, diagnosticResourceRequest DiagnosticResource, options *DiagnosticsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "DiagnosticsClient.BeginCreate" @@ -171,7 +112,7 @@ func (client *DiagnosticsClient) createCreateRequest(ctx context.Context, scope return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01") + reqQP.Set("api-version", "2023-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, diagnosticResourceRequest); err != nil { @@ -183,7 +124,7 @@ func (client *DiagnosticsClient) createCreateRequest(ctx context.Context, scope // Get - Get the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01 +// Generated from API version 2023-09-01-preview // - scope - This is an extension resource provider and only resource level extension is supported at the moment. // - diagnosticsResourceName - Unique resource name for insight resources // - options - DiagnosticsClientGetOptions contains the optional parameters for the DiagnosticsClient.Get method. @@ -222,7 +163,7 @@ func (client *DiagnosticsClient) getCreateRequest(ctx context.Context, scope str return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01") + reqQP.Set("api-version", "2023-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/diagnostics_client_example_test.go b/sdk/resourcemanager/selfhelp/armselfhelp/diagnostics_client_example_test.go index f75a6602b932..f961bc1be19c 100644 --- a/sdk/resourcemanager/selfhelp/armselfhelp/diagnostics_client_example_test.go +++ b/sdk/resourcemanager/selfhelp/armselfhelp/diagnostics_client_example_test.go @@ -13,68 +13,11 @@ 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/selfhelp/armselfhelp" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/selfhelp/armselfhelp/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/help/resource-manager/Microsoft.Help/stable/2023-06-01/examples/CheckNameAvailabilityForDiagnosticWhenNameIsAvailable.json -func ExampleDiagnosticsClient_CheckNameAvailability_exampleWhenNameIsAvailableForADiagnosticResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armselfhelp.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiagnosticsClient().CheckNameAvailability(ctx, "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6", &armselfhelp.DiagnosticsClientCheckNameAvailabilityOptions{CheckNameAvailabilityRequest: &armselfhelp.CheckNameAvailabilityRequest{ - Name: to.Ptr("sampleName"), - Type: to.Ptr("Microsoft.Help/diagnostics"), - }, - }) - 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.CheckNameAvailabilityResponse = armselfhelp.CheckNameAvailabilityResponse{ - // NameAvailable: to.Ptr(true), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/help/resource-manager/Microsoft.Help/stable/2023-06-01/examples/CheckNameAvailabilityForDiagnosticWhenNameIsNotAvailable.json -func ExampleDiagnosticsClient_CheckNameAvailability_exampleWhenNameIsNotAvailableForADiagnosticResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armselfhelp.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiagnosticsClient().CheckNameAvailability(ctx, "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6", &armselfhelp.DiagnosticsClientCheckNameAvailabilityOptions{CheckNameAvailabilityRequest: &armselfhelp.CheckNameAvailabilityRequest{ - Name: to.Ptr("sampleName"), - Type: to.Ptr("Microsoft.Help/diagnostics"), - }, - }) - 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.CheckNameAvailabilityResponse = armselfhelp.CheckNameAvailabilityResponse{ - // Message: to.Ptr("Name not available"), - // NameAvailable: to.Ptr(false), - // Reason: to.Ptr("Name is already in use"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/help/resource-manager/Microsoft.Help/stable/2023-06-01/examples/CreateDiagnosticForKeyVaultResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/CreateDiagnosticForKeyVaultResource.json func ExampleDiagnosticsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -85,7 +28,7 @@ func ExampleDiagnosticsClient_BeginCreate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewDiagnosticsClient().BeginCreate(ctx, "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read", "VMNotWorkingInsight", armselfhelp.DiagnosticResource{}, nil) + poller, err := clientFactory.NewDiagnosticsClient().BeginCreate(ctx, "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read", "VMNotWorkingInsight", armselfhelp.DiagnosticResource{}, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -99,7 +42,7 @@ func ExampleDiagnosticsClient_BeginCreate() { // res.DiagnosticResource = armselfhelp.DiagnosticResource{ // Name: to.Ptr("Microsoft.Help/diagnostics"), // Type: to.Ptr("VMNotWorkingInsight"), - // ID: to.Ptr("subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read/providers/Microsoft.Help/diagnostics/VMNotWorkingInsight"), + // ID: to.Ptr("/subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read/providers/Microsoft.Help/diagnostics/VMNotWorkingInsight"), // Properties: &armselfhelp.DiagnosticResourceProperties{ // AcceptedAt: to.Ptr("2023-03-10T03:04:40Z"), // Diagnostics: []*armselfhelp.Diagnostic{ @@ -118,12 +61,12 @@ func ExampleDiagnosticsClient_BeginCreate() { // SolutionID: to.Ptr("sampleSolutionId"), // Status: to.Ptr(armselfhelp.StatusSucceeded), // }}, - // ProvisioningState: to.Ptr(armselfhelp.ProvisioningStateSucceeded), + // ProvisioningState: to.Ptr(armselfhelp.DiagnosticProvisioningStateSucceeded), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/help/resource-manager/Microsoft.Help/stable/2023-06-01/examples/GetDiagnosticForKeyVaultResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/GetDiagnosticForKeyVaultResource.json func ExampleDiagnosticsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -134,7 +77,7 @@ func ExampleDiagnosticsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewDiagnosticsClient().Get(ctx, "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read", "VMNotWorkingInsight", nil) + res, err := clientFactory.NewDiagnosticsClient().Get(ctx, "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read", "VMNotWorkingInsight", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -144,7 +87,7 @@ func ExampleDiagnosticsClient_Get() { // res.DiagnosticResource = armselfhelp.DiagnosticResource{ // Name: to.Ptr("Microsoft.Help/diagnostics"), // Type: to.Ptr("VMNotWorkingInsight"), - // ID: to.Ptr("subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read/providers/Microsoft.Help/diagnostics/VMNotWorkingInsight"), + // ID: to.Ptr("/subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read/providers/Microsoft.Help/diagnostics/VMNotWorkingInsight"), // Properties: &armselfhelp.DiagnosticResourceProperties{ // AcceptedAt: to.Ptr("2023-03-10T03:04:40Z"), // Diagnostics: []*armselfhelp.Diagnostic{ @@ -163,7 +106,7 @@ func ExampleDiagnosticsClient_Get() { // SolutionID: to.Ptr("sampleSolutionId"), // Status: to.Ptr(armselfhelp.StatusSucceeded), // }}, - // ProvisioningState: to.Ptr(armselfhelp.ProvisioningStateSucceeded), + // ProvisioningState: to.Ptr(armselfhelp.DiagnosticProvisioningStateSucceeded), // }, // } } diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/discoverysolution_client.go b/sdk/resourcemanager/selfhelp/armselfhelp/discoverysolution_client.go index f976b86cedcb..d068f7383b1c 100644 --- a/sdk/resourcemanager/selfhelp/armselfhelp/discoverysolution_client.go +++ b/sdk/resourcemanager/selfhelp/armselfhelp/discoverysolution_client.go @@ -38,15 +38,18 @@ func NewDiscoverySolutionClient(credential azcore.TokenCredential, options *arm. return client, nil } -// NewListPager - Solutions Discovery is the initial point of entry within Help API, which helps you identify the relevant -// solutions for your Azure issue. -// You can discover solutions using resourceUri OR resourceUri + problemClassificationId. -// We will do our best in returning relevant diagnostics for your Azure issue. -// Get the problemClassificationId(s) using this reference [https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP]. -// Note: ‘requiredParameterSets’ from Solutions Discovery API response must be passed via ‘additionalParameters’ as an input -// to Diagnostics API. +// NewListPager - Lists the relevant Azure diagnostics and solutions using problemClassification API [https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP]) +// AND resourceUri or +// resourceType. Discovery Solutions is the initial entry point within Help API, which identifies relevant Azure diagnostics +// and solutions. We will do our best to return the most effective solutions +// based on the type of inputs, in the request URL +// Mandatory input : problemClassificationId (Use the problemClassification API [https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP]) +// Optional input: resourceUri OR +// resource Type +// Note: ‘requiredInputs’ from Discovery solutions response must be passed via ‘additionalParameters’ as an input to Diagnostics +// and Solutions API. // -// Generated from API version 2023-06-01 +// Generated from API version 2023-09-01-preview // - scope - This is an extension resource provider and only resource level extension is supported at the moment. // - options - DiscoverySolutionClientListOptions contains the optional parameters for the DiscoverySolutionClient.NewListPager // method. @@ -82,7 +85,7 @@ func (client *DiscoverySolutionClient) listCreateRequest(ctx context.Context, sc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01") + reqQP.Set("api-version", "2023-09-01-preview") if options != nil && options.Skiptoken != nil { reqQP.Set("$skiptoken", *options.Skiptoken) } diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/discoverysolution_client_example_test.go b/sdk/resourcemanager/selfhelp/armselfhelp/discoverysolution_client_example_test.go index dc312f66a24f..3f130375419e 100644 --- a/sdk/resourcemanager/selfhelp/armselfhelp/discoverysolution_client_example_test.go +++ b/sdk/resourcemanager/selfhelp/armselfhelp/discoverysolution_client_example_test.go @@ -13,12 +13,13 @@ 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/selfhelp/armselfhelp" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/selfhelp/armselfhelp/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/help/resource-manager/Microsoft.Help/stable/2023-06-01/examples/ListDiscoverySolutionsForKeyVaultResource.json -func ExampleDiscoverySolutionClient_NewListPager() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/ListDiscoverySolutionsAtResourceScope.json +func ExampleDiscoverySolutionClient_NewListPager_listDiscoverySolutionsAtResourceScope() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -28,7 +29,7 @@ func ExampleDiscoverySolutionClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewDiscoverySolutionClient().NewListPager("subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read", &armselfhelp.DiscoverySolutionClientListOptions{Filter: nil, + pager := clientFactory.NewDiscoverySolutionClient().NewListPager("subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read", &armselfhelp.DiscoverySolutionClientListOptions{Filter: to.Ptr("ProblemClassificationId eq 'SampleProblemClassificationId1'"), Skiptoken: nil, }) for pager.More() { @@ -44,44 +45,65 @@ func ExampleDiscoverySolutionClient_NewListPager() { // page.DiscoveryResponse = armselfhelp.DiscoveryResponse{ // Value: []*armselfhelp.SolutionMetadataResource{ // { - // Name: to.Ptr("SampleSolutionId1"), + // Name: to.Ptr("SampleProblemClassificationId1"), // Type: to.Ptr("Microsoft.Help/discoverySolutions"), - // ID: to.Ptr("subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read/providers/Microsoft.Help/discoverySolutions/SampleSolutionId1"), - // Properties: &armselfhelp.SolutionMetadataProperties{ - // Description: to.Ptr("This is a diagnostic"), - // RequiredParameterSets: [][]*string{ - // []*string{ - // to.Ptr("ResourceUri")}}, - // SolutionID: to.Ptr("SampleSolutionId1"), - // SolutionType: to.Ptr("Diagnostics"), - // }, + // ID: to.Ptr("/subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read/providers/Microsoft.Help/discoverySolutions/SampleProblemClassificationId1"), + // Properties: &armselfhelp.Solutions{ + // Solutions: []*armselfhelp.SolutionMetadataProperties{ + // { + // Description: to.Ptr("This is an azure solution to troubleshoot subscription issues."), + // RequiredInputs: []*string{ + // to.Ptr("SubscriptionId")}, + // SolutionID: to.Ptr("SampleSolutionId1"), + // SolutionType: to.Ptr(armselfhelp.SolutionTypeDiagnostics), + // }}, // }, - // { - // Name: to.Ptr("SampleSolutionId2"), - // Type: to.Ptr("Microsoft.Help/discoverySolutions"), - // ID: to.Ptr("subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read/providers/Microsoft.Help/discoverySolutions/SampleSolutionId2"), - // Properties: &armselfhelp.SolutionMetadataProperties{ - // Description: to.Ptr("This is a diagnostic"), - // RequiredParameterSets: [][]*string{ - // []*string{ - // to.Ptr("ResourceUri")}}, - // SolutionID: to.Ptr("SampleSolutionId2"), - // SolutionType: to.Ptr("Diagnostics"), - // }, - // }, - // { - // Name: to.Ptr("SampleSolutionId3"), - // Type: to.Ptr("Microsoft.Help/discoverySolutions"), - // ID: to.Ptr("subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read/providers/Microsoft.Help/discoverySolutions/SampleSolutionId3"), - // Properties: &armselfhelp.SolutionMetadataProperties{ - // Description: to.Ptr("This is a diagnostic"), - // RequiredParameterSets: [][]*string{ - // []*string{ - // to.Ptr("ResourceUri")}}, - // SolutionID: to.Ptr("SampleSolutionId3"), - // SolutionType: to.Ptr("Diagnostics"), - // }, - // }}, - // } + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/ListDiscoverySolutionsAtSubscriptionScope.json +func ExampleDiscoverySolutionClient_NewListPager_listDiscoverySolutionsAtSubscriptionScope() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armselfhelp.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewDiscoverySolutionClient().NewListPager("subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6", &armselfhelp.DiscoverySolutionClientListOptions{Filter: to.Ptr("ProblemClassificationId eq 'SampleProblemClassificationId1'"), + Skiptoken: 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.DiscoveryResponse = armselfhelp.DiscoveryResponse{ + // Value: []*armselfhelp.SolutionMetadataResource{ + // { + // Name: to.Ptr("SampleProblemClassificationId1"), + // Type: to.Ptr("Microsoft.Help/discoverySolutions"), + // ID: to.Ptr("/subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/providers/Microsoft.Help/discoverySolutions/SampleProblemClassificationId1"), + // Properties: &armselfhelp.Solutions{ + // Solutions: []*armselfhelp.SolutionMetadataProperties{ + // { + // Description: to.Ptr("This is an azure solution to troubleshoot subscription issues."), + // RequiredInputs: []*string{ + // to.Ptr("SubscriptionId")}, + // SolutionID: to.Ptr("SampleSolutionId1"), + // SolutionType: to.Ptr(armselfhelp.SolutionTypeDiagnostics), + // }}, + // }, + // }}, + // } } } diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/fake/checknameavailability_server.go b/sdk/resourcemanager/selfhelp/armselfhelp/fake/checknameavailability_server.go new file mode 100644 index 000000000000..962e4d502c10 --- /dev/null +++ b/sdk/resourcemanager/selfhelp/armselfhelp/fake/checknameavailability_server.go @@ -0,0 +1,107 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/selfhelp/armselfhelp/v2" + "net/http" + "net/url" + "reflect" + "regexp" +) + +// CheckNameAvailabilityServer is a fake server for instances of the armselfhelp.CheckNameAvailabilityClient type. +type CheckNameAvailabilityServer struct { + // Post is the fake for method CheckNameAvailabilityClient.Post + // HTTP status codes to indicate success: http.StatusOK + Post func(ctx context.Context, scope string, options *armselfhelp.CheckNameAvailabilityClientPostOptions) (resp azfake.Responder[armselfhelp.CheckNameAvailabilityClientPostResponse], errResp azfake.ErrorResponder) +} + +// NewCheckNameAvailabilityServerTransport creates a new instance of CheckNameAvailabilityServerTransport with the provided implementation. +// The returned CheckNameAvailabilityServerTransport instance is connected to an instance of armselfhelp.CheckNameAvailabilityClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCheckNameAvailabilityServerTransport(srv *CheckNameAvailabilityServer) *CheckNameAvailabilityServerTransport { + return &CheckNameAvailabilityServerTransport{srv: srv} +} + +// CheckNameAvailabilityServerTransport connects instances of armselfhelp.CheckNameAvailabilityClient to instances of CheckNameAvailabilityServer. +// Don't use this type directly, use NewCheckNameAvailabilityServerTransport instead. +type CheckNameAvailabilityServerTransport struct { + srv *CheckNameAvailabilityServer +} + +// Do implements the policy.Transporter interface for CheckNameAvailabilityServerTransport. +func (c *CheckNameAvailabilityServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "CheckNameAvailabilityClient.Post": + resp, err = c.dispatchPost(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *CheckNameAvailabilityServerTransport) dispatchPost(req *http.Request) (*http.Response, error) { + if c.srv.Post == nil { + return nil, &nonRetriableError{errors.New("fake for method Post not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Help/checkNameAvailability` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armselfhelp.CheckNameAvailabilityRequest](req) + if err != nil { + return nil, err + } + scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) + if err != nil { + return nil, err + } + var options *armselfhelp.CheckNameAvailabilityClientPostOptions + if !reflect.ValueOf(body).IsZero() { + options = &armselfhelp.CheckNameAvailabilityClientPostOptions{ + CheckNameAvailabilityRequest: &body, + } + } + respr, errRespr := c.srv.Post(req.Context(), scopeParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CheckNameAvailabilityResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/fake/diagnostics_server.go b/sdk/resourcemanager/selfhelp/armselfhelp/fake/diagnostics_server.go index dfaaa3264d65..c7f55a86a349 100644 --- a/sdk/resourcemanager/selfhelp/armselfhelp/fake/diagnostics_server.go +++ b/sdk/resourcemanager/selfhelp/armselfhelp/fake/diagnostics_server.go @@ -15,19 +15,14 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/selfhelp/armselfhelp" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/selfhelp/armselfhelp/v2" "net/http" "net/url" - "reflect" "regexp" ) // DiagnosticsServer is a fake server for instances of the armselfhelp.DiagnosticsClient type. type DiagnosticsServer struct { - // CheckNameAvailability is the fake for method DiagnosticsClient.CheckNameAvailability - // HTTP status codes to indicate success: http.StatusOK - CheckNameAvailability func(ctx context.Context, scope string, options *armselfhelp.DiagnosticsClientCheckNameAvailabilityOptions) (resp azfake.Responder[armselfhelp.DiagnosticsClientCheckNameAvailabilityResponse], errResp azfake.ErrorResponder) - // BeginCreate is the fake for method DiagnosticsClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated BeginCreate func(ctx context.Context, scope string, diagnosticsResourceName string, diagnosticResourceRequest armselfhelp.DiagnosticResource, options *armselfhelp.DiagnosticsClientBeginCreateOptions) (resp azfake.PollerResponder[armselfhelp.DiagnosticsClientCreateResponse], errResp azfake.ErrorResponder) @@ -66,8 +61,6 @@ func (d *DiagnosticsServerTransport) Do(req *http.Request) (*http.Response, erro var err error switch method { - case "DiagnosticsClient.CheckNameAvailability": - resp, err = d.dispatchCheckNameAvailability(req) case "DiagnosticsClient.BeginCreate": resp, err = d.dispatchBeginCreate(req) case "DiagnosticsClient.Get": @@ -83,45 +76,6 @@ func (d *DiagnosticsServerTransport) Do(req *http.Request) (*http.Response, erro return resp, nil } -func (d *DiagnosticsServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { - if d.srv.CheckNameAvailability == nil { - return nil, &nonRetriableError{errors.New("fake for method CheckNameAvailability not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Help/checkNameAvailability` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armselfhelp.CheckNameAvailabilityRequest](req) - if err != nil { - return nil, err - } - scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) - if err != nil { - return nil, err - } - var options *armselfhelp.DiagnosticsClientCheckNameAvailabilityOptions - if !reflect.ValueOf(body).IsZero() { - options = &armselfhelp.DiagnosticsClientCheckNameAvailabilityOptions{ - CheckNameAvailabilityRequest: &body, - } - } - respr, errRespr := d.srv.CheckNameAvailability(req.Context(), scopeParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CheckNameAvailabilityResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} - func (d *DiagnosticsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { if d.srv.BeginCreate == nil { return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/fake/discoverysolution_server.go b/sdk/resourcemanager/selfhelp/armselfhelp/fake/discoverysolution_server.go index f617951121d3..dc99b01ab550 100644 --- a/sdk/resourcemanager/selfhelp/armselfhelp/fake/discoverysolution_server.go +++ b/sdk/resourcemanager/selfhelp/armselfhelp/fake/discoverysolution_server.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/selfhelp/armselfhelp" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/selfhelp/armselfhelp/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/fake/operations_server.go b/sdk/resourcemanager/selfhelp/armselfhelp/fake/operations_server.go index 66d32f167317..52111ca6217c 100644 --- a/sdk/resourcemanager/selfhelp/armselfhelp/fake/operations_server.go +++ b/sdk/resourcemanager/selfhelp/armselfhelp/fake/operations_server.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/selfhelp/armselfhelp" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/selfhelp/armselfhelp/v2" "net/http" ) diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/fake/server_factory.go b/sdk/resourcemanager/selfhelp/armselfhelp/fake/server_factory.go index a6b0cf4164c6..5e7c9cedc626 100644 --- a/sdk/resourcemanager/selfhelp/armselfhelp/fake/server_factory.go +++ b/sdk/resourcemanager/selfhelp/armselfhelp/fake/server_factory.go @@ -19,9 +19,12 @@ import ( // ServerFactory is a fake server for instances of the armselfhelp.ClientFactory type. type ServerFactory struct { - DiagnosticsServer DiagnosticsServer - DiscoverySolutionServer DiscoverySolutionServer - OperationsServer OperationsServer + CheckNameAvailabilityServer CheckNameAvailabilityServer + DiagnosticsServer DiagnosticsServer + DiscoverySolutionServer DiscoverySolutionServer + OperationsServer OperationsServer + SolutionServer SolutionServer + TroubleshootersServer TroubleshootersServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -36,11 +39,14 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armselfhelp.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trDiagnosticsServer *DiagnosticsServerTransport - trDiscoverySolutionServer *DiscoverySolutionServerTransport - trOperationsServer *OperationsServerTransport + srv *ServerFactory + trMu sync.Mutex + trCheckNameAvailabilityServer *CheckNameAvailabilityServerTransport + trDiagnosticsServer *DiagnosticsServerTransport + trDiscoverySolutionServer *DiscoverySolutionServerTransport + trOperationsServer *OperationsServerTransport + trSolutionServer *SolutionServerTransport + trTroubleshootersServer *TroubleshootersServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -56,6 +62,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { + case "CheckNameAvailabilityClient": + initServer(s, &s.trCheckNameAvailabilityServer, func() *CheckNameAvailabilityServerTransport { + return NewCheckNameAvailabilityServerTransport(&s.srv.CheckNameAvailabilityServer) + }) + resp, err = s.trCheckNameAvailabilityServer.Do(req) case "DiagnosticsClient": initServer(s, &s.trDiagnosticsServer, func() *DiagnosticsServerTransport { return NewDiagnosticsServerTransport(&s.srv.DiagnosticsServer) }) resp, err = s.trDiagnosticsServer.Do(req) @@ -67,6 +78,14 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "OperationsClient": initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) resp, err = s.trOperationsServer.Do(req) + case "SolutionClient": + initServer(s, &s.trSolutionServer, func() *SolutionServerTransport { return NewSolutionServerTransport(&s.srv.SolutionServer) }) + resp, err = s.trSolutionServer.Do(req) + case "TroubleshootersClient": + initServer(s, &s.trTroubleshootersServer, func() *TroubleshootersServerTransport { + return NewTroubleshootersServerTransport(&s.srv.TroubleshootersServer) + }) + resp, err = s.trTroubleshootersServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) } diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/fake/solution_server.go b/sdk/resourcemanager/selfhelp/armselfhelp/fake/solution_server.go new file mode 100644 index 000000000000..0e1fc0c45a99 --- /dev/null +++ b/sdk/resourcemanager/selfhelp/armselfhelp/fake/solution_server.go @@ -0,0 +1,214 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/selfhelp/armselfhelp/v2" + "net/http" + "net/url" + "regexp" +) + +// SolutionServer is a fake server for instances of the armselfhelp.SolutionClient type. +type SolutionServer struct { + // BeginCreate is the fake for method SolutionClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, scope string, solutionResourceName string, solutionRequestBody armselfhelp.SolutionResource, options *armselfhelp.SolutionClientBeginCreateOptions) (resp azfake.PollerResponder[armselfhelp.SolutionClientCreateResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SolutionClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, scope string, solutionResourceName string, options *armselfhelp.SolutionClientGetOptions) (resp azfake.Responder[armselfhelp.SolutionClientGetResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method SolutionClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, scope string, solutionResourceName string, solutionPatchRequestBody armselfhelp.SolutionPatchRequestBody, options *armselfhelp.SolutionClientBeginUpdateOptions) (resp azfake.PollerResponder[armselfhelp.SolutionClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewSolutionServerTransport creates a new instance of SolutionServerTransport with the provided implementation. +// The returned SolutionServerTransport instance is connected to an instance of armselfhelp.SolutionClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSolutionServerTransport(srv *SolutionServer) *SolutionServerTransport { + return &SolutionServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armselfhelp.SolutionClientCreateResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armselfhelp.SolutionClientUpdateResponse]](), + } +} + +// SolutionServerTransport connects instances of armselfhelp.SolutionClient to instances of SolutionServer. +// Don't use this type directly, use NewSolutionServerTransport instead. +type SolutionServerTransport struct { + srv *SolutionServer + beginCreate *tracker[azfake.PollerResponder[armselfhelp.SolutionClientCreateResponse]] + beginUpdate *tracker[azfake.PollerResponder[armselfhelp.SolutionClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for SolutionServerTransport. +func (s *SolutionServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "SolutionClient.BeginCreate": + resp, err = s.dispatchBeginCreate(req) + case "SolutionClient.Get": + resp, err = s.dispatchGet(req) + case "SolutionClient.BeginUpdate": + resp, err = s.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SolutionServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if s.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := s.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Help/solutions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armselfhelp.SolutionResource](req) + if err != nil { + return nil, err + } + scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) + if err != nil { + return nil, err + } + solutionResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginCreate(req.Context(), scopeParam, solutionResourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + s.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + s.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + s.beginCreate.remove(req) + } + + return resp, nil +} + +func (s *SolutionServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Help/solutions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) + if err != nil { + return nil, err + } + solutionResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), scopeParam, solutionResourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SolutionResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SolutionServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := s.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Help/solutions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armselfhelp.SolutionPatchRequestBody](req) + if err != nil { + return nil, err + } + scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) + if err != nil { + return nil, err + } + solutionResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("solutionResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginUpdate(req.Context(), scopeParam, solutionResourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + s.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + s.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/fake/troubleshooters_server.go b/sdk/resourcemanager/selfhelp/armselfhelp/fake/troubleshooters_server.go new file mode 100644 index 000000000000..503dace0e8cd --- /dev/null +++ b/sdk/resourcemanager/selfhelp/armselfhelp/fake/troubleshooters_server.go @@ -0,0 +1,280 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/selfhelp/armselfhelp/v2" + "net/http" + "net/url" + "reflect" + "regexp" +) + +// TroubleshootersServer is a fake server for instances of the armselfhelp.TroubleshootersClient type. +type TroubleshootersServer struct { + // Continue is the fake for method TroubleshootersClient.Continue + // HTTP status codes to indicate success: http.StatusNoContent + Continue func(ctx context.Context, scope string, troubleshooterName string, options *armselfhelp.TroubleshootersClientContinueOptions) (resp azfake.Responder[armselfhelp.TroubleshootersClientContinueResponse], errResp azfake.ErrorResponder) + + // Create is the fake for method TroubleshootersClient.Create + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + Create func(ctx context.Context, scope string, troubleshooterName string, createTroubleshooterRequestBody armselfhelp.TroubleshooterResource, options *armselfhelp.TroubleshootersClientCreateOptions) (resp azfake.Responder[armselfhelp.TroubleshootersClientCreateResponse], errResp azfake.ErrorResponder) + + // End is the fake for method TroubleshootersClient.End + // HTTP status codes to indicate success: http.StatusNoContent + End func(ctx context.Context, scope string, troubleshooterName string, options *armselfhelp.TroubleshootersClientEndOptions) (resp azfake.Responder[armselfhelp.TroubleshootersClientEndResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method TroubleshootersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, scope string, troubleshooterName string, options *armselfhelp.TroubleshootersClientGetOptions) (resp azfake.Responder[armselfhelp.TroubleshootersClientGetResponse], errResp azfake.ErrorResponder) + + // Restart is the fake for method TroubleshootersClient.Restart + // HTTP status codes to indicate success: http.StatusOK + Restart func(ctx context.Context, scope string, troubleshooterName string, options *armselfhelp.TroubleshootersClientRestartOptions) (resp azfake.Responder[armselfhelp.TroubleshootersClientRestartResponse], errResp azfake.ErrorResponder) +} + +// NewTroubleshootersServerTransport creates a new instance of TroubleshootersServerTransport with the provided implementation. +// The returned TroubleshootersServerTransport instance is connected to an instance of armselfhelp.TroubleshootersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewTroubleshootersServerTransport(srv *TroubleshootersServer) *TroubleshootersServerTransport { + return &TroubleshootersServerTransport{srv: srv} +} + +// TroubleshootersServerTransport connects instances of armselfhelp.TroubleshootersClient to instances of TroubleshootersServer. +// Don't use this type directly, use NewTroubleshootersServerTransport instead. +type TroubleshootersServerTransport struct { + srv *TroubleshootersServer +} + +// Do implements the policy.Transporter interface for TroubleshootersServerTransport. +func (t *TroubleshootersServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "TroubleshootersClient.Continue": + resp, err = t.dispatchContinue(req) + case "TroubleshootersClient.Create": + resp, err = t.dispatchCreate(req) + case "TroubleshootersClient.End": + resp, err = t.dispatchEnd(req) + case "TroubleshootersClient.Get": + resp, err = t.dispatchGet(req) + case "TroubleshootersClient.Restart": + resp, err = t.dispatchRestart(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (t *TroubleshootersServerTransport) dispatchContinue(req *http.Request) (*http.Response, error) { + if t.srv.Continue == nil { + return nil, &nonRetriableError{errors.New("fake for method Continue not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Help/troubleshooters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/continue` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armselfhelp.ContinueRequestBody](req) + if err != nil { + return nil, err + } + scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) + if err != nil { + return nil, err + } + troubleshooterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("troubleshooterName")]) + if err != nil { + return nil, err + } + var options *armselfhelp.TroubleshootersClientContinueOptions + if !reflect.ValueOf(body).IsZero() { + options = &armselfhelp.TroubleshootersClientContinueOptions{ + ContinueRequestBody: &body, + } + } + respr, errRespr := t.srv.Continue(req.Context(), scopeParam, troubleshooterNameParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + if val := server.GetResponse(respr).Location; val != nil { + resp.Header.Set("Location", *val) + } + return resp, nil +} + +func (t *TroubleshootersServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { + if t.srv.Create == nil { + return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Help/troubleshooters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armselfhelp.TroubleshooterResource](req) + if err != nil { + return nil, err + } + scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) + if err != nil { + return nil, err + } + troubleshooterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("troubleshooterName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.Create(req.Context(), scopeParam, troubleshooterNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TroubleshooterResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (t *TroubleshootersServerTransport) dispatchEnd(req *http.Request) (*http.Response, error) { + if t.srv.End == nil { + return nil, &nonRetriableError{errors.New("fake for method End not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Help/troubleshooters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/end` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) + if err != nil { + return nil, err + } + troubleshooterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("troubleshooterName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.End(req.Context(), scopeParam, troubleshooterNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + if val := server.GetResponse(respr).Location; val != nil { + resp.Header.Set("Location", *val) + } + return resp, nil +} + +func (t *TroubleshootersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if t.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Help/troubleshooters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) + if err != nil { + return nil, err + } + troubleshooterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("troubleshooterName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.Get(req.Context(), scopeParam, troubleshooterNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TroubleshooterResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (t *TroubleshootersServerTransport) dispatchRestart(req *http.Request) (*http.Response, error) { + if t.srv.Restart == nil { + return nil, &nonRetriableError{errors.New("fake for method Restart not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Help/troubleshooters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/restart` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) + if err != nil { + return nil, err + } + troubleshooterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("troubleshooterName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.Restart(req.Context(), scopeParam, troubleshooterNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RestartTroubleshooterResponse, req) + if err != nil { + return nil, err + } + if val := server.GetResponse(respr).Location; val != nil { + resp.Header.Set("Location", *val) + } + return resp, nil +} diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/go.mod b/sdk/resourcemanager/selfhelp/armselfhelp/go.mod index 9346e0fc07de..39e74146da99 100644 --- a/sdk/resourcemanager/selfhelp/armselfhelp/go.mod +++ b/sdk/resourcemanager/selfhelp/armselfhelp/go.mod @@ -1,4 +1,4 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/selfhelp/armselfhelp +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/selfhelp/armselfhelp/v2 go 1.18 diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/help_live_test.go b/sdk/resourcemanager/selfhelp/armselfhelp/help_live_test.go index a4c9f8a098c9..3520f30551b5 100644 --- a/sdk/resourcemanager/selfhelp/armselfhelp/help_live_test.go +++ b/sdk/resourcemanager/selfhelp/armselfhelp/help_live_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2/testutil" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/selfhelp/armselfhelp" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/selfhelp/armselfhelp/v2" "github.com/stretchr/testify/suite" ) diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/models.go b/sdk/resourcemanager/selfhelp/armselfhelp/models.go index 5fab7e87ab18..942fccf47527 100644 --- a/sdk/resourcemanager/selfhelp/armselfhelp/models.go +++ b/sdk/resourcemanager/selfhelp/armselfhelp/models.go @@ -10,6 +10,15 @@ package armselfhelp import "time" +// AutomatedCheckResult - Only for AutomatedStep type +type AutomatedCheckResult struct { + // Insight Article Content + Result *string + + // Type of Result. + Type *AutomatedCheckResultType +} + // CheckNameAvailabilityRequest - The check availability request body. type CheckNameAvailabilityRequest struct { // The name of the resource for which availability needs to be checked. @@ -31,6 +40,14 @@ type CheckNameAvailabilityResponse struct { Reason *string } +// ContinueRequestBody - Troubleshooter ContinueRequest body. +type ContinueRequestBody struct { + Responses []*TroubleshooterResponse + + // Unique id of the result. + StepID *string +} + // Diagnostic - Properties returned with in an insight. type Diagnostic struct { // Error definition. @@ -60,7 +77,7 @@ type DiagnosticResource struct { // Diagnostic Resource properties. Properties *DiagnosticResourceProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource @@ -88,7 +105,7 @@ type DiagnosticResourceProperties struct { Diagnostics []*Diagnostic // READ-ONLY; Status of diagnostic provisioning. - ProvisioningState *ProvisioningState + ProvisioningState *DiagnosticProvisioningState } // DiscoveryResponse - Discovery response. @@ -96,7 +113,7 @@ type DiscoveryResponse struct { // The link used to get the next page of solution metadata. NextLink *string - // The list of solution metadata. + // The list of metadata. Value []*SolutionMetadataResource } @@ -115,7 +132,52 @@ type Error struct { Type *string } -// Insight - Detailed insights(s) obtained via the invocation of an insight diagnostic troubleshooter. +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info any + + // READ-ONLY; The additional info type. + Type *string +} + +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo + + // READ-ONLY; The error code. + Code *string + + // READ-ONLY; The error details. + Details []*ErrorDetail + + // READ-ONLY; The error message. + Message *string + + // READ-ONLY; The error target. + Target *string +} + +// Filter criterion +type Filter struct { + // Filter name + Name *string + + // Filter operator + Operator *string + + // Filter values + Values *string +} + +// FilterGroup - Filter group +type FilterGroup struct { + // List of filters + Filter []*Filter +} + +// Insight - Detailed insights(s) obtained via the invocation of an insight diagnostic type Insight struct { // Article id. ID *string @@ -130,6 +192,27 @@ type Insight struct { Title *string } +// MetricsBasedChart - Solutions metrics based chart +type MetricsBasedChart struct { + // Allowed values are Sum, Avg, Count, Min, Max. Default is Sum + AggregationType *AggregationType + + // Filter group + FilterGroup *FilterGroup + + // Chart name + Name *string + + // Place holder used in HTML Content replace control with the content + ReplacementKey *string + + // Time span duration + TimeSpanDuration *string + + // Chart title + Title *string +} + // Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { // Localized display information for this particular operation. @@ -179,27 +262,117 @@ type OperationListResult struct { Value []*Operation } -// SolutionMetadataProperties - Diagnostic solution metadata. -type SolutionMetadataProperties struct { - // A detailed description of solution. - Description *string +// ReplacementMaps - Solution replacement maps. +type ReplacementMaps struct { + // Solution diagnostics results. + Diagnostics []*SolutionsDiagnostic + + // Solution metrics based charts + MetricsBasedCharts []*MetricsBasedChart + + // Solutions Troubleshooters + Troubleshooters []*SolutionsTroubleshooters + + // Group of Videos + VideoGroups []*VideoGroup + + // Video solutions, which have the power to engage the customer by stimulating their senses + Videos []*Video + + // Solution AzureKB results + WebResults []*WebResult +} + +// ResponseOption - The status of the resource. +type ResponseOption struct { + // Unique string. + Key *string + + // Option description + Value *string +} + +// ResponseValidationProperties - Troubleshooter step input response validation properties +type ResponseValidationProperties struct { + // Default True + IsRequired *bool + + // Max text input (open Ended Text). + MaxLength *int64 + + // Regex used for the input validation. + Regex *string + + // Validation Error Message. + ValidationErrorMessage *string +} + +// RestartTroubleshooterResponse - Troubleshooter restart response +type RestartTroubleshooterResponse struct { + // READ-ONLY; Updated TroubleshooterResource Name . + TroubleshooterResourceName *string +} + +// SearchResult - Details of an AzureKB search result. +type SearchResult struct { + // Confidence of the search result. + Confidence *Confidence + + // Content of the search result. + Content *string + + // Link to the document. + Link *string - // Required parameters for invoking this particular solution. - RequiredParameterSets [][]*string + // rank of the search result + Rank *int32 + + // Result type of the search result. + ResultType *ResultType + + // Unique id of the result. + SolutionID *string + + // Source of the search result. + Source *string + + // Title of the search result. + Title *string +} + +// Section - Part of the solution and are dividers in the solution rendering. +type Section struct { + // Solution sections content. + Content *string + + // Solution replacement maps. + ReplacementMaps *ReplacementMaps + + // Solution sections title. + Title *string +} +// SolutionMetadataProperties - Metadata Properties +type SolutionMetadataProperties struct { // Solution Id. SolutionID *string - // Solution Type. - SolutionType *string + // READ-ONLY; A detailed description of solution. + Description *string + + // READ-ONLY; Required parameters for invoking this particular solution. + RequiredInputs []*string + + // READ-ONLY; Solution Type. + SolutionType *SolutionType } -// SolutionMetadataResource - Solution Metadata resource +// SolutionMetadataResource - Metadata resource type SolutionMetadataResource struct { // Solution metadata Resource properties. - Properties *SolutionMetadataProperties + Properties *Solutions - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource @@ -212,6 +385,156 @@ type SolutionMetadataResource struct { Type *string } +// SolutionPatchRequestBody - Solution response. +type SolutionPatchRequestBody struct { + // Solution result + Properties *SolutionResourceProperties +} + +// SolutionResource - Solution response. +type SolutionResource struct { + // Solution result + Properties *SolutionResourceProperties + + // READ-ONLY; Full resource uri of the resource. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Type of resource. + Type *string +} + +// SolutionResourceProperties - Solution result +type SolutionResourceProperties struct { + // The HTML content that needs to be rendered and shown to customer. + Content *string + + // Client input parameters to run Solution + Parameters map[string]*string + + // Status of solution provisioning. + ProvisioningState *SolutionProvisioningState + + // Solution replacement maps. + ReplacementMaps *ReplacementMaps + + // List of section object. + Sections []*Section + + // Solution Id to identify single solution. + SolutionID *string + + // The title. + Title *string + + // Solution request trigger criteria + TriggerCriteria []*TriggerCriterion +} + +// Solutions - List of solutions +type Solutions struct { + // List of metadata. + Solutions []*SolutionMetadataProperties +} + +// SolutionsDiagnostic - Solutions Diagnostic +type SolutionsDiagnostic struct { + // Diagnostic insights + Insights []*Insight + + // Place holder used in HTML Content replace control with the content + ReplacementKey *string + + // Required parameters of this item + RequiredParameters []*string + + // Solution Id to identify single Solutions Diagnostic + SolutionID *string + + // Denotes the status of the diagnostic resource. + Status *Status + + // Details of the status + StatusDetails *string +} + +// SolutionsTroubleshooters - Troubleshooters in Solutions +type SolutionsTroubleshooters struct { + // Solution Id to identify single Solutions Troubleshooter + SolutionID *string + + // Troubleshooter summary + Summary *string + + // Troubleshooter title + Title *string +} + +// Step - Troubleshooter step +type Step struct { + // Only for AutomatedStep type + AutomatedCheckResults *AutomatedCheckResult + + // Step description. + Description *string + + // The error detail. + Error *ErrorDetail + + // Status of Troubleshooter Step execution. + ExecutionStatus *ExecutionStatus + + // This field has more detailed status description of the execution status. + ExecutionStatusDescription *string + + // Get or sets the Step guidance. + Guidance *string + + // Unique step id. + ID *string + Inputs []*StepInput + Insights []*Insight + + // is this last step of the workflow. + IsLastStep *bool + + // Step title. + Title *string + + // Type of Troubleshooting step. + Type *Type +} + +// StepInput - Details of step input. +type StepInput struct { + // User question content. + QuestionContent *string + + // Default is Text. + QuestionContentType *QuestionContentType + + // Use Index as QuestionId. + QuestionID *string + + // Text Input. Will be a single line input. + QuestionType *string + + // Result of Automate step. + RecommendedOption *string + + // Place holder text for response hints. + ResponseHint *string + ResponseOptions []*ResponseOption + + // Troubleshooter step input response validation properties + ResponseValidationProperties *ResponseValidationProperties + + // Text of response that was selected. + SelectedOptionValue *string +} + // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). @@ -232,3 +555,98 @@ type SystemData struct { // The type of identity that last modified the resource. LastModifiedByType *CreatedByType } + +// TriggerCriterion - Solution request trigger criterion. SolutionId/ProblemClassificationId is the only supported trigger +// type for Solution PUT request. ReplacementKey is the only supported trigger type for Solution PATCH +// request. +type TriggerCriterion struct { + // Trigger criterion name. + Name *Name + + // Trigger criterion value. + Value *string +} + +// TroubleshooterInstanceProperties - Troubleshooter Instance properties. +type TroubleshooterInstanceProperties struct { + // Client input parameters to run Troubleshooter Resource + Parameters map[string]*string + + // Solution Id to identify single troubleshooter. + SolutionID *string + + // READ-ONLY; Status of troubleshooter provisioning. + ProvisioningState *TroubleshooterProvisioningState + + // READ-ONLY; List of step object. + Steps []*Step +} + +// TroubleshooterResource - Troubleshooter response. +type TroubleshooterResource struct { + // Troubleshooter Instance properties. + Properties *TroubleshooterInstanceProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// TroubleshooterResponse - User Response for Troubleshooter continue request +type TroubleshooterResponse struct { + // id of the question. + QuestionID *string + + // Text Input. Will be a single line input. + QuestionType *QuestionType + + // Response key for SingleInput. For Multi-line test/open ended question it is free form text + Response *string +} + +// Video detail +type Video struct { + // Place holder used in HTML Content replace control with the insight content + ReplacementKey *string + + // Link to the video + Src *string + + // Title of the video + Title *string +} + +// VideoGroup - Video group detail +type VideoGroup struct { + // Place holder used in HTML Content replace control with the insight content + ReplacementKey *string + + // List of videos will be shown to customers + Videos []*VideoGroupVideo +} + +// VideoGroupVideo - VideoGroup video detail +type VideoGroupVideo struct { + // Link to the video + Src *string + + // Title of the video + Title *string +} + +// WebResult - AzureKB web result +type WebResult struct { + // Place holder used in HTML Content replace control with the content + ReplacementKey *string + + // AzureKB search results + SearchResults []*SearchResult +} diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/models_serde.go b/sdk/resourcemanager/selfhelp/armselfhelp/models_serde.go index 756e72de7f39..44d329abeb4d 100644 --- a/sdk/resourcemanager/selfhelp/armselfhelp/models_serde.go +++ b/sdk/resourcemanager/selfhelp/armselfhelp/models_serde.go @@ -15,6 +15,37 @@ import ( "reflect" ) +// MarshalJSON implements the json.Marshaller interface for type AutomatedCheckResult. +func (a AutomatedCheckResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "result", a.Result) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomatedCheckResult. +func (a *AutomatedCheckResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "result": + err = unpopulate(val, "Result", &a.Result) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityRequest. func (c CheckNameAvailabilityRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -81,6 +112,37 @@ func (c *CheckNameAvailabilityResponse) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ContinueRequestBody. +func (c ContinueRequestBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "responses", c.Responses) + populate(objectMap, "stepId", c.StepID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContinueRequestBody. +func (c *ContinueRequestBody) 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 "responses": + err = unpopulate(val, "Responses", &c.Responses) + delete(rawMsg, key) + case "stepId": + err = unpopulate(val, "StepID", &c.StepID) + 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 Diagnostic. func (d Diagnostic) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -307,6 +369,142 @@ func (e *Error) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "info", e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) 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 "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) 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 ErrorDetail. +func (e *ErrorDetail) 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 Filter. +func (f Filter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", f.Name) + populate(objectMap, "operator", f.Operator) + populate(objectMap, "values", f.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Filter. +func (f *Filter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "operator": + err = unpopulate(val, "Operator", &f.Operator) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &f.Values) + 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 FilterGroup. +func (f FilterGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "filter", f.Filter) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FilterGroup. +func (f *FilterGroup) 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 "filter": + err = unpopulate(val, "Filter", &f.Filter) + 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 Insight. func (i Insight) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -346,6 +544,53 @@ func (i *Insight) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type MetricsBasedChart. +func (m MetricsBasedChart) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "aggregationType", m.AggregationType) + populate(objectMap, "filterGroup", m.FilterGroup) + populate(objectMap, "name", m.Name) + populate(objectMap, "replacementKey", m.ReplacementKey) + populate(objectMap, "timeSpanDuration", m.TimeSpanDuration) + populate(objectMap, "title", m.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricsBasedChart. +func (m *MetricsBasedChart) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aggregationType": + err = unpopulate(val, "AggregationType", &m.AggregationType) + delete(rawMsg, key) + case "filterGroup": + err = unpopulate(val, "FilterGroup", &m.FilterGroup) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "replacementKey": + err = unpopulate(val, "ReplacementKey", &m.ReplacementKey) + delete(rawMsg, key) + case "timeSpanDuration": + err = unpopulate(val, "TimeSpanDuration", &m.TimeSpanDuration) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &m.Title) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Operation. func (o Operation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -459,141 +704,1021 @@ func (o *OperationListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SolutionMetadataProperties. -func (s SolutionMetadataProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReplacementMaps. +func (r ReplacementMaps) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", s.Description) - populate(objectMap, "requiredParameterSets", s.RequiredParameterSets) - populate(objectMap, "solutionId", s.SolutionID) - populate(objectMap, "solutionType", s.SolutionType) + populate(objectMap, "diagnostics", r.Diagnostics) + populate(objectMap, "metricsBasedCharts", r.MetricsBasedCharts) + populate(objectMap, "troubleshooters", r.Troubleshooters) + populate(objectMap, "videoGroups", r.VideoGroups) + populate(objectMap, "videos", r.Videos) + populate(objectMap, "webResults", r.WebResults) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionMetadataProperties. -func (s *SolutionMetadataProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplacementMaps. +func (r *ReplacementMaps) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &s.Description) + case "diagnostics": + err = unpopulate(val, "Diagnostics", &r.Diagnostics) delete(rawMsg, key) - case "requiredParameterSets": - err = unpopulate(val, "RequiredParameterSets", &s.RequiredParameterSets) + case "metricsBasedCharts": + err = unpopulate(val, "MetricsBasedCharts", &r.MetricsBasedCharts) delete(rawMsg, key) - case "solutionId": - err = unpopulate(val, "SolutionID", &s.SolutionID) + case "troubleshooters": + err = unpopulate(val, "Troubleshooters", &r.Troubleshooters) delete(rawMsg, key) - case "solutionType": - err = unpopulate(val, "SolutionType", &s.SolutionType) + case "videoGroups": + err = unpopulate(val, "VideoGroups", &r.VideoGroups) + delete(rawMsg, key) + case "videos": + err = unpopulate(val, "Videos", &r.Videos) + delete(rawMsg, key) + case "webResults": + err = unpopulate(val, "WebResults", &r.WebResults) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SolutionMetadataResource. -func (s SolutionMetadataResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResponseOption. +func (r ResponseOption) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "systemData", s.SystemData) - populate(objectMap, "type", s.Type) + populate(objectMap, "key", r.Key) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionMetadataResource. -func (s *SolutionMetadataResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResponseOption. +func (r *ResponseOption) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) + case "key": + err = unpopulate(val, "Key", &r.Key) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &s.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) + case "value": + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResponseValidationProperties. +func (r ResponseValidationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + populate(objectMap, "isRequired", r.IsRequired) + populate(objectMap, "maxLength", r.MaxLength) + populate(objectMap, "regex", r.Regex) + populate(objectMap, "validationErrorMessage", r.ValidationErrorMessage) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResponseValidationProperties. +func (r *ResponseValidationProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) + case "isRequired": + err = unpopulate(val, "IsRequired", &r.IsRequired) delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) + case "maxLength": + err = unpopulate(val, "MaxLength", &r.MaxLength) delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + case "regex": + err = unpopulate(val, "Regex", &r.Regex) delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + case "validationErrorMessage": + err = unpopulate(val, "ValidationErrorMessage", &r.ValidationErrorMessage) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RestartTroubleshooterResponse. +func (r RestartTroubleshooterResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "troubleshooterResourceName", r.TroubleshooterResourceName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestartTroubleshooterResponse. +func (r *RestartTroubleshooterResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "troubleshooterResourceName": + err = unpopulate(val, "TroubleshooterResourceName", &r.TroubleshooterResourceName) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -func populate(m map[string]any, k string, v any) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { +// MarshalJSON implements the json.Marshaller interface for type SearchResult. +func (s SearchResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "confidence", s.Confidence) + populate(objectMap, "content", s.Content) + populate(objectMap, "link", s.Link) + populate(objectMap, "rank", s.Rank) + populate(objectMap, "resultType", s.ResultType) + populate(objectMap, "solutionId", s.SolutionID) + populate(objectMap, "source", s.Source) + populate(objectMap, "title", s.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SearchResult. +func (s *SearchResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "confidence": + err = unpopulate(val, "Confidence", &s.Confidence) + delete(rawMsg, key) + case "content": + err = unpopulate(val, "Content", &s.Content) + delete(rawMsg, key) + case "link": + err = unpopulate(val, "Link", &s.Link) + delete(rawMsg, key) + case "rank": + err = unpopulate(val, "Rank", &s.Rank) + delete(rawMsg, key) + case "resultType": + err = unpopulate(val, "ResultType", &s.ResultType) + delete(rawMsg, key) + case "solutionId": + err = unpopulate(val, "SolutionID", &s.SolutionID) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &s.Source) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &s.Title) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Section. +func (s Section) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "content", s.Content) + populate(objectMap, "replacementMaps", s.ReplacementMaps) + populate(objectMap, "title", s.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Section. +func (s *Section) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "content": + err = unpopulate(val, "Content", &s.Content) + delete(rawMsg, key) + case "replacementMaps": + err = unpopulate(val, "ReplacementMaps", &s.ReplacementMaps) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &s.Title) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SolutionMetadataProperties. +func (s SolutionMetadataProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", s.Description) + populate(objectMap, "requiredInputs", s.RequiredInputs) + populate(objectMap, "solutionId", s.SolutionID) + populate(objectMap, "solutionType", s.SolutionType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionMetadataProperties. +func (s *SolutionMetadataProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "requiredInputs": + err = unpopulate(val, "RequiredInputs", &s.RequiredInputs) + delete(rawMsg, key) + case "solutionId": + err = unpopulate(val, "SolutionID", &s.SolutionID) + delete(rawMsg, key) + case "solutionType": + err = unpopulate(val, "SolutionType", &s.SolutionType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SolutionMetadataResource. +func (s SolutionMetadataResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionMetadataResource. +func (s *SolutionMetadataResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SolutionPatchRequestBody. +func (s SolutionPatchRequestBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionPatchRequestBody. +func (s *SolutionPatchRequestBody) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SolutionResource. +func (s SolutionResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionResource. +func (s *SolutionResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SolutionResourceProperties. +func (s SolutionResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "content", s.Content) + populate(objectMap, "parameters", s.Parameters) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "replacementMaps", s.ReplacementMaps) + populate(objectMap, "sections", s.Sections) + populate(objectMap, "solutionId", s.SolutionID) + populate(objectMap, "title", s.Title) + populate(objectMap, "triggerCriteria", s.TriggerCriteria) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionResourceProperties. +func (s *SolutionResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "content": + err = unpopulate(val, "Content", &s.Content) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, "Parameters", &s.Parameters) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "replacementMaps": + err = unpopulate(val, "ReplacementMaps", &s.ReplacementMaps) + delete(rawMsg, key) + case "sections": + err = unpopulate(val, "Sections", &s.Sections) + delete(rawMsg, key) + case "solutionId": + err = unpopulate(val, "SolutionID", &s.SolutionID) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &s.Title) + delete(rawMsg, key) + case "triggerCriteria": + err = unpopulate(val, "TriggerCriteria", &s.TriggerCriteria) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Solutions. +func (s Solutions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "solutions", s.Solutions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Solutions. +func (s *Solutions) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "solutions": + err = unpopulate(val, "Solutions", &s.Solutions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SolutionsDiagnostic. +func (s SolutionsDiagnostic) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "insights", s.Insights) + populate(objectMap, "replacementKey", s.ReplacementKey) + populate(objectMap, "requiredParameters", s.RequiredParameters) + populate(objectMap, "solutionId", s.SolutionID) + populate(objectMap, "status", s.Status) + populate(objectMap, "statusDetails", s.StatusDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionsDiagnostic. +func (s *SolutionsDiagnostic) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "insights": + err = unpopulate(val, "Insights", &s.Insights) + delete(rawMsg, key) + case "replacementKey": + err = unpopulate(val, "ReplacementKey", &s.ReplacementKey) + delete(rawMsg, key) + case "requiredParameters": + err = unpopulate(val, "RequiredParameters", &s.RequiredParameters) + delete(rawMsg, key) + case "solutionId": + err = unpopulate(val, "SolutionID", &s.SolutionID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + case "statusDetails": + err = unpopulate(val, "StatusDetails", &s.StatusDetails) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SolutionsTroubleshooters. +func (s SolutionsTroubleshooters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "solutionId", s.SolutionID) + populate(objectMap, "summary", s.Summary) + populate(objectMap, "title", s.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionsTroubleshooters. +func (s *SolutionsTroubleshooters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "solutionId": + err = unpopulate(val, "SolutionID", &s.SolutionID) + delete(rawMsg, key) + case "summary": + err = unpopulate(val, "Summary", &s.Summary) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &s.Title) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Step. +func (s Step) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "automatedCheckResults", s.AutomatedCheckResults) + populate(objectMap, "description", s.Description) + populate(objectMap, "error", s.Error) + populate(objectMap, "executionStatus", s.ExecutionStatus) + populate(objectMap, "executionStatusDescription", s.ExecutionStatusDescription) + populate(objectMap, "guidance", s.Guidance) + populate(objectMap, "id", s.ID) + populate(objectMap, "inputs", s.Inputs) + populate(objectMap, "insights", s.Insights) + populate(objectMap, "isLastStep", s.IsLastStep) + populate(objectMap, "title", s.Title) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Step. +func (s *Step) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "automatedCheckResults": + err = unpopulate(val, "AutomatedCheckResults", &s.AutomatedCheckResults) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &s.Error) + delete(rawMsg, key) + case "executionStatus": + err = unpopulate(val, "ExecutionStatus", &s.ExecutionStatus) + delete(rawMsg, key) + case "executionStatusDescription": + err = unpopulate(val, "ExecutionStatusDescription", &s.ExecutionStatusDescription) + delete(rawMsg, key) + case "guidance": + err = unpopulate(val, "Guidance", &s.Guidance) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "inputs": + err = unpopulate(val, "Inputs", &s.Inputs) + delete(rawMsg, key) + case "insights": + err = unpopulate(val, "Insights", &s.Insights) + delete(rawMsg, key) + case "isLastStep": + err = unpopulate(val, "IsLastStep", &s.IsLastStep) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &s.Title) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StepInput. +func (s StepInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "questionContent", s.QuestionContent) + populate(objectMap, "questionContentType", s.QuestionContentType) + populate(objectMap, "questionId", s.QuestionID) + populate(objectMap, "questionType", s.QuestionType) + populate(objectMap, "recommendedOption", s.RecommendedOption) + populate(objectMap, "responseHint", s.ResponseHint) + populate(objectMap, "responseOptions", s.ResponseOptions) + populate(objectMap, "responseValidationProperties", s.ResponseValidationProperties) + populate(objectMap, "selectedOptionValue", s.SelectedOptionValue) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StepInput. +func (s *StepInput) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "questionContent": + err = unpopulate(val, "QuestionContent", &s.QuestionContent) + delete(rawMsg, key) + case "questionContentType": + err = unpopulate(val, "QuestionContentType", &s.QuestionContentType) + delete(rawMsg, key) + case "questionId": + err = unpopulate(val, "QuestionID", &s.QuestionID) + delete(rawMsg, key) + case "questionType": + err = unpopulate(val, "QuestionType", &s.QuestionType) + delete(rawMsg, key) + case "recommendedOption": + err = unpopulate(val, "RecommendedOption", &s.RecommendedOption) + delete(rawMsg, key) + case "responseHint": + err = unpopulate(val, "ResponseHint", &s.ResponseHint) + delete(rawMsg, key) + case "responseOptions": + err = unpopulate(val, "ResponseOptions", &s.ResponseOptions) + delete(rawMsg, key) + case "responseValidationProperties": + err = unpopulate(val, "ResponseValidationProperties", &s.ResponseValidationProperties) + delete(rawMsg, key) + case "selectedOptionValue": + err = unpopulate(val, "SelectedOptionValue", &s.SelectedOptionValue) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TriggerCriterion. +func (t TriggerCriterion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", t.Name) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TriggerCriterion. +func (t *TriggerCriterion) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TroubleshooterInstanceProperties. +func (t TroubleshooterInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "parameters", t.Parameters) + populate(objectMap, "provisioningState", t.ProvisioningState) + populate(objectMap, "solutionId", t.SolutionID) + populate(objectMap, "steps", t.Steps) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TroubleshooterInstanceProperties. +func (t *TroubleshooterInstanceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "parameters": + err = unpopulate(val, "Parameters", &t.Parameters) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) + delete(rawMsg, key) + case "solutionId": + err = unpopulate(val, "SolutionID", &t.SolutionID) + delete(rawMsg, key) + case "steps": + err = unpopulate(val, "Steps", &t.Steps) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TroubleshooterResource. +func (t TroubleshooterResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TroubleshooterResource. +func (t *TroubleshooterResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TroubleshooterResponse. +func (t TroubleshooterResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "questionId", t.QuestionID) + populate(objectMap, "questionType", t.QuestionType) + populate(objectMap, "response", t.Response) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TroubleshooterResponse. +func (t *TroubleshooterResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "questionId": + err = unpopulate(val, "QuestionID", &t.QuestionID) + delete(rawMsg, key) + case "questionType": + err = unpopulate(val, "QuestionType", &t.QuestionType) + delete(rawMsg, key) + case "response": + err = unpopulate(val, "Response", &t.Response) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Video. +func (v Video) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "replacementKey", v.ReplacementKey) + populate(objectMap, "src", v.Src) + populate(objectMap, "title", v.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Video. +func (v *Video) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "replacementKey": + err = unpopulate(val, "ReplacementKey", &v.ReplacementKey) + delete(rawMsg, key) + case "src": + err = unpopulate(val, "Src", &v.Src) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &v.Title) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VideoGroup. +func (v VideoGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "replacementKey", v.ReplacementKey) + populate(objectMap, "videos", v.Videos) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VideoGroup. +func (v *VideoGroup) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "replacementKey": + err = unpopulate(val, "ReplacementKey", &v.ReplacementKey) + delete(rawMsg, key) + case "videos": + err = unpopulate(val, "Videos", &v.Videos) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VideoGroupVideo. +func (v VideoGroupVideo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "src", v.Src) + populate(objectMap, "title", v.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VideoGroupVideo. +func (v *VideoGroupVideo) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "src": + err = unpopulate(val, "Src", &v.Src) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &v.Title) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WebResult. +func (w WebResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "replacementKey", w.ReplacementKey) + populate(objectMap, "searchResults", w.SearchResults) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebResult. +func (w *WebResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "replacementKey": + err = unpopulate(val, "ReplacementKey", &w.ReplacementKey) + delete(rawMsg, key) + case "searchResults": + err = unpopulate(val, "SearchResults", &w.SearchResults) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func populateAny(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else { m[k] = v } } diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/operations_client.go b/sdk/resourcemanager/selfhelp/armselfhelp/operations_client.go index 146667c0728d..3df665c2653d 100644 --- a/sdk/resourcemanager/selfhelp/armselfhelp/operations_client.go +++ b/sdk/resourcemanager/selfhelp/armselfhelp/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Returns list of operations. // -// Generated from API version 2023-06-01 +// Generated from API version 2023-09-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", "2023-06-01") + reqQP.Set("api-version", "2023-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/operations_client_example_test.go b/sdk/resourcemanager/selfhelp/armselfhelp/operations_client_example_test.go index 7a2ad0c62a2e..e7794993c21b 100644 --- a/sdk/resourcemanager/selfhelp/armselfhelp/operations_client_example_test.go +++ b/sdk/resourcemanager/selfhelp/armselfhelp/operations_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/selfhelp/armselfhelp" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/selfhelp/armselfhelp/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/help/resource-manager/Microsoft.Help/stable/2023-06-01/examples/ListOperations.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/ListOperations.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/options.go b/sdk/resourcemanager/selfhelp/armselfhelp/options.go index 266495866a7d..ec04742a43fe 100644 --- a/sdk/resourcemanager/selfhelp/armselfhelp/options.go +++ b/sdk/resourcemanager/selfhelp/armselfhelp/options.go @@ -8,19 +8,18 @@ package armselfhelp +// CheckNameAvailabilityClientPostOptions contains the optional parameters for the CheckNameAvailabilityClient.Post method. +type CheckNameAvailabilityClientPostOptions struct { + // The required parameters for availability check. + CheckNameAvailabilityRequest *CheckNameAvailabilityRequest +} + // DiagnosticsClientBeginCreateOptions contains the optional parameters for the DiagnosticsClient.BeginCreate method. type DiagnosticsClientBeginCreateOptions struct { // Resumes the LRO from the provided token. ResumeToken string } -// DiagnosticsClientCheckNameAvailabilityOptions contains the optional parameters for the DiagnosticsClient.CheckNameAvailability -// method. -type DiagnosticsClientCheckNameAvailabilityOptions struct { - // The required parameters for availability check. - CheckNameAvailabilityRequest *CheckNameAvailabilityRequest -} - // DiagnosticsClientGetOptions contains the optional parameters for the DiagnosticsClient.Get method. type DiagnosticsClientGetOptions struct { // placeholder for future optional parameters @@ -28,14 +27,12 @@ type DiagnosticsClientGetOptions struct { // DiscoverySolutionClientListOptions contains the optional parameters for the DiscoverySolutionClient.NewListPager method. type DiscoverySolutionClientListOptions struct { - // Can be used to filter solutionIds by 'ProblemClassificationId'. The filter supports only 'and' and 'eq' operators. Example: - // $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e' - // and ProblemClassificationId eq '0a9673c2-7af6-4e19-90d3-4ee2461076d9'. + // 'ProblemClassificationId' or 'Id' is a mandatory filter to get solutions ids. It also supports optional 'ResourceType' + // and 'SolutionType' filters. The filter supports only 'and', 'or' and 'eq' + // operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e' Filter *string - // Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, - // the value of the nextLink element will include a skiptoken parameter that - // specifies a starting point to use for subsequent calls. + // Skiptoken is only used if a previous operation returned a partial result. Skiptoken *string } @@ -43,3 +40,46 @@ type DiscoverySolutionClientListOptions struct { type OperationsClientListOptions struct { // placeholder for future optional parameters } + +// SolutionClientBeginCreateOptions contains the optional parameters for the SolutionClient.BeginCreate method. +type SolutionClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SolutionClientBeginUpdateOptions contains the optional parameters for the SolutionClient.BeginUpdate method. +type SolutionClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SolutionClientGetOptions contains the optional parameters for the SolutionClient.Get method. +type SolutionClientGetOptions struct { + // placeholder for future optional parameters +} + +// TroubleshootersClientContinueOptions contains the optional parameters for the TroubleshootersClient.Continue method. +type TroubleshootersClientContinueOptions struct { + // The required request body for going to next step in Troubleshooter resource. + ContinueRequestBody *ContinueRequestBody +} + +// TroubleshootersClientCreateOptions contains the optional parameters for the TroubleshootersClient.Create method. +type TroubleshootersClientCreateOptions struct { + // placeholder for future optional parameters +} + +// TroubleshootersClientEndOptions contains the optional parameters for the TroubleshootersClient.End method. +type TroubleshootersClientEndOptions struct { + // placeholder for future optional parameters +} + +// TroubleshootersClientGetOptions contains the optional parameters for the TroubleshootersClient.Get method. +type TroubleshootersClientGetOptions struct { + // placeholder for future optional parameters +} + +// TroubleshootersClientRestartOptions contains the optional parameters for the TroubleshootersClient.Restart method. +type TroubleshootersClientRestartOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/response_types.go b/sdk/resourcemanager/selfhelp/armselfhelp/response_types.go index cd4d51cb0628..db1110d156a8 100644 --- a/sdk/resourcemanager/selfhelp/armselfhelp/response_types.go +++ b/sdk/resourcemanager/selfhelp/armselfhelp/response_types.go @@ -8,8 +8,8 @@ package armselfhelp -// DiagnosticsClientCheckNameAvailabilityResponse contains the response from method DiagnosticsClient.CheckNameAvailability. -type DiagnosticsClientCheckNameAvailabilityResponse struct { +// CheckNameAvailabilityClientPostResponse contains the response from method CheckNameAvailabilityClient.Post. +type CheckNameAvailabilityClientPostResponse struct { // Response for whether the requested resource name is available or not. CheckNameAvailabilityResponse } @@ -37,3 +37,54 @@ type OperationsClientListResponse struct { // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. OperationListResult } + +// SolutionClientCreateResponse contains the response from method SolutionClient.BeginCreate. +type SolutionClientCreateResponse struct { + // Solution response. + SolutionResource +} + +// SolutionClientGetResponse contains the response from method SolutionClient.Get. +type SolutionClientGetResponse struct { + // Solution response. + SolutionResource +} + +// SolutionClientUpdateResponse contains the response from method SolutionClient.BeginUpdate. +type SolutionClientUpdateResponse struct { + // Solution response. + SolutionResource +} + +// TroubleshootersClientContinueResponse contains the response from method TroubleshootersClient.Continue. +type TroubleshootersClientContinueResponse struct { + // Location contains the information returned from the Location header response. + Location *string +} + +// TroubleshootersClientCreateResponse contains the response from method TroubleshootersClient.Create. +type TroubleshootersClientCreateResponse struct { + // Troubleshooter response. + TroubleshooterResource +} + +// TroubleshootersClientEndResponse contains the response from method TroubleshootersClient.End. +type TroubleshootersClientEndResponse struct { + // Location contains the information returned from the Location header response. + Location *string +} + +// TroubleshootersClientGetResponse contains the response from method TroubleshootersClient.Get. +type TroubleshootersClientGetResponse struct { + // Troubleshooter response. + TroubleshooterResource +} + +// TroubleshootersClientRestartResponse contains the response from method TroubleshootersClient.Restart. +type TroubleshootersClientRestartResponse struct { + // Troubleshooter restart response + RestartTroubleshooterResponse + + // Location contains the information returned from the Location header response. + Location *string +} diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/solution_client.go b/sdk/resourcemanager/selfhelp/armselfhelp/solution_client.go new file mode 100644 index 000000000000..c3cb3e40bc87 --- /dev/null +++ b/sdk/resourcemanager/selfhelp/armselfhelp/solution_client.go @@ -0,0 +1,270 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armselfhelp + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SolutionClient contains the methods for the Solution group. +// Don't use this type directly, use NewSolutionClient() instead. +type SolutionClient struct { + internal *arm.Client +} + +// NewSolutionClient creates a new instance of SolutionClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSolutionClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SolutionClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SolutionClient{ + internal: cl, + } + return client, nil +} + +// BeginCreate - Creates a solution for the specific Azure resource or subscription using the triggering criteria ‘solutionId +// and requiredInputs’ from discovery solutions. Solutions are a rich, insightful and a +// centralized self help experience that brings all the relevant content to troubleshoot an Azure issue into a unified experience. +// Solutions include the following components : Text, Diagnostics , +// Troubleshooters, Images , Video tutorials, Tables , custom charts, images , AzureKB, etc, with capabilities to support +// new solutions types in the future. Each solution type may require one or more +// ‘requiredParameters’ that are required to execute the individual solution component. In the absence of the ‘requiredParameters’ +// it is likely that some of the solutions might fail execution, and you +// might see an empty response. +// Note: +// 1. ‘requiredInputs’ from Discovery solutions response must be passed via ‘parameters’ in the request body of Solutions +// API. +// 2. ‘requiredParameters’ from the Solutions response is the same as ‘ additionalParameters’ in the request for diagnostics +// 3. ‘requiredParameters’ from the Solutions response is the same as ‘properties.parameters’ in the request for Troubleshooters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - scope - This is an extension resource provider and only resource level extension is supported at the moment. +// - solutionResourceName - Solution resource Name. +// - solutionRequestBody - The required request body for this solution resource creation. +// - options - SolutionClientBeginCreateOptions contains the optional parameters for the SolutionClient.BeginCreate method. +func (client *SolutionClient) BeginCreate(ctx context.Context, scope string, solutionResourceName string, solutionRequestBody SolutionResource, options *SolutionClientBeginCreateOptions) (*runtime.Poller[SolutionClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, scope, solutionResourceName, solutionRequestBody, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SolutionClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SolutionClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Creates a solution for the specific Azure resource or subscription using the triggering criteria ‘solutionId and +// requiredInputs’ from discovery solutions. Solutions are a rich, insightful and a +// centralized self help experience that brings all the relevant content to troubleshoot an Azure issue into a unified experience. +// Solutions include the following components : Text, Diagnostics , +// Troubleshooters, Images , Video tutorials, Tables , custom charts, images , AzureKB, etc, with capabilities to support +// new solutions types in the future. Each solution type may require one or more +// ‘requiredParameters’ that are required to execute the individual solution component. In the absence of the ‘requiredParameters’ +// it is likely that some of the solutions might fail execution, and you +// might see an empty response. +// Note: +// 1. ‘requiredInputs’ from Discovery solutions response must be passed via ‘parameters’ in the request body of Solutions +// API. +// 2. ‘requiredParameters’ from the Solutions response is the same as ‘ additionalParameters’ in the request for diagnostics +// 3. ‘requiredParameters’ from the Solutions response is the same as ‘properties.parameters’ in the request for Troubleshooters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *SolutionClient) create(ctx context.Context, scope string, solutionResourceName string, solutionRequestBody SolutionResource, options *SolutionClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "SolutionClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, scope, solutionResourceName, solutionRequestBody, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *SolutionClient) createCreateRequest(ctx context.Context, scope string, solutionResourceName string, solutionRequestBody SolutionResource, options *SolutionClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Help/solutions/{solutionResourceName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if solutionResourceName == "" { + return nil, errors.New("parameter solutionResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{solutionResourceName}", url.PathEscape(solutionResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, solutionRequestBody); err != nil { + return nil, err + } + return req, nil +} + +// Get - Get the solution using the applicable solutionResourceName while creating the solution. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - scope - This is an extension resource provider and only resource level extension is supported at the moment. +// - solutionResourceName - Solution resource Name. +// - options - SolutionClientGetOptions contains the optional parameters for the SolutionClient.Get method. +func (client *SolutionClient) Get(ctx context.Context, scope string, solutionResourceName string, options *SolutionClientGetOptions) (SolutionClientGetResponse, error) { + var err error + const operationName = "SolutionClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, scope, solutionResourceName, options) + if err != nil { + return SolutionClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SolutionClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SolutionClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SolutionClient) getCreateRequest(ctx context.Context, scope string, solutionResourceName string, options *SolutionClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Help/solutions/{solutionResourceName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if solutionResourceName == "" { + return nil, errors.New("parameter solutionResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{solutionResourceName}", url.PathEscape(solutionResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SolutionClient) getHandleResponse(resp *http.Response) (SolutionClientGetResponse, error) { + result := SolutionClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SolutionResource); err != nil { + return SolutionClientGetResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update the requiredInputs or additional information needed to execute the solution +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - scope - This is an extension resource provider and only resource level extension is supported at the moment. +// - solutionResourceName - Solution resource Name. +// - solutionPatchRequestBody - The required request body for updating a solution resource. +// - options - SolutionClientBeginUpdateOptions contains the optional parameters for the SolutionClient.BeginUpdate method. +func (client *SolutionClient) BeginUpdate(ctx context.Context, scope string, solutionResourceName string, solutionPatchRequestBody SolutionPatchRequestBody, options *SolutionClientBeginUpdateOptions) (*runtime.Poller[SolutionClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, scope, solutionResourceName, solutionPatchRequestBody, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SolutionClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SolutionClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update the requiredInputs or additional information needed to execute the solution +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +func (client *SolutionClient) update(ctx context.Context, scope string, solutionResourceName string, solutionPatchRequestBody SolutionPatchRequestBody, options *SolutionClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "SolutionClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, scope, solutionResourceName, solutionPatchRequestBody, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *SolutionClient) updateCreateRequest(ctx context.Context, scope string, solutionResourceName string, solutionPatchRequestBody SolutionPatchRequestBody, options *SolutionClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Help/solutions/{solutionResourceName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if solutionResourceName == "" { + return nil, errors.New("parameter solutionResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{solutionResourceName}", url.PathEscape(solutionResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, solutionPatchRequestBody); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/solution_client_example_test.go b/sdk/resourcemanager/selfhelp/armselfhelp/solution_client_example_test.go new file mode 100644 index 000000000000..f5fa88d66ea7 --- /dev/null +++ b/sdk/resourcemanager/selfhelp/armselfhelp/solution_client_example_test.go @@ -0,0 +1,476 @@ +//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 armselfhelp_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/selfhelp/armselfhelp/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/Solution_Create.json +func ExampleSolutionClient_BeginCreate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armselfhelp.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSolutionClient().BeginCreate(ctx, "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp", "SolutionResourceName1", armselfhelp.SolutionResource{ + Properties: &armselfhelp.SolutionResourceProperties{ + Parameters: map[string]*string{ + "resourceUri": to.Ptr("subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp"), + }, + TriggerCriteria: []*armselfhelp.TriggerCriterion{ + { + Name: to.Ptr(armselfhelp.NameSolutionID), + Value: to.Ptr("SolutionId1"), + }}, + }, + }, 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.SolutionResource = armselfhelp.SolutionResource{ + // Name: to.Ptr("SolutionResourceName1"), + // Type: to.Ptr("Microsoft.Help/solutions"), + // ID: to.Ptr("/subscriptions/mySubscription/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp/providers/Microsoft.Help/solutions/SolutionResourceName1"), + // Properties: &armselfhelp.SolutionResourceProperties{ + // Content: to.Ptr("

sample content

"), + // ProvisioningState: to.Ptr(armselfhelp.SolutionProvisioningStateSucceeded), + // ReplacementMaps: &armselfhelp.ReplacementMaps{ + // Diagnostics: []*armselfhelp.SolutionsDiagnostic{ + // { + // Insights: []*armselfhelp.Insight{ + // { + // ID: to.Ptr("InsightArticleId"), + // ImportanceLevel: to.Ptr(armselfhelp.ImportanceLevelCritical), + // Results: to.Ptr("Article Content"), + // Title: to.Ptr("An example title for an Insight"), + // }}, + // ReplacementKey: to.Ptr(""), + // SolutionID: to.Ptr("sampleSolutionId1"), + // Status: to.Ptr(armselfhelp.StatusSucceeded), + // StatusDetails: to.Ptr(""), + // }, + // { + // Insights: []*armselfhelp.Insight{ + // }, + // ReplacementKey: to.Ptr(""), + // RequiredParameters: []*string{ + // to.Ptr("parameter1"), + // to.Ptr("parameter2")}, + // SolutionID: to.Ptr("sampleSolutionId2"), + // Status: to.Ptr(armselfhelp.StatusFailed), + // StatusDetails: to.Ptr(""), + // }, + // { + // Insights: []*armselfhelp.Insight{ + // }, + // ReplacementKey: to.Ptr(""), + // RequiredParameters: []*string{ + // to.Ptr("parameter1"), + // to.Ptr("parameter2")}, + // SolutionID: to.Ptr("sampleSolutionId3"), + // Status: to.Ptr(armselfhelp.StatusFailed), + // StatusDetails: to.Ptr("Timeout text authored in Solution article "), + // }, + // { + // Insights: []*armselfhelp.Insight{ + // }, + // ReplacementKey: to.Ptr(""), + // RequiredParameters: []*string{ + // to.Ptr("parameter1"), + // to.Ptr("parameter2")}, + // SolutionID: to.Ptr("sampleSolutionId4"), + // Status: to.Ptr(armselfhelp.StatusFailed), + // StatusDetails: to.Ptr("Sample status details"), + // }}, + // MetricsBasedCharts: []*armselfhelp.MetricsBasedChart{ + // { + // Name: to.Ptr("CPU_percent"), + // AggregationType: to.Ptr(armselfhelp.AggregationTypeMax), + // ReplacementKey: to.Ptr(""), + // TimeSpanDuration: to.Ptr("1d"), + // Title: to.Ptr("CPU Usage in the last one day"), + // }, + // { + // Name: to.Ptr("memory_percent"), + // AggregationType: to.Ptr(armselfhelp.AggregationTypeMax), + // ReplacementKey: to.Ptr(""), + // TimeSpanDuration: to.Ptr("1d"), + // Title: to.Ptr("Memory Usage in the last one day"), + // }, + // { + // Name: to.Ptr("io_consumption_percent"), + // AggregationType: to.Ptr(armselfhelp.AggregationTypeMax), + // ReplacementKey: to.Ptr(""), + // TimeSpanDuration: to.Ptr("1d"), + // Title: to.Ptr("IOPS Usage in the last one day"), + // }, + // { + // Name: to.Ptr("active_connections"), + // AggregationType: to.Ptr(armselfhelp.AggregationTypeMax), + // ReplacementKey: to.Ptr(""), + // TimeSpanDuration: to.Ptr("1d"), + // Title: to.Ptr("Active Connections in the last one day"), + // }}, + // VideoGroups: []*armselfhelp.VideoGroup{ + // { + // ReplacementKey: to.Ptr(""), + // Videos: []*armselfhelp.VideoGroupVideo{ + // { + // Src: to.Ptr("sampleLink"), + // Title: to.Ptr("widthtest"), + // }}, + // }}, + // Videos: []*armselfhelp.Video{ + // { + // Src: to.Ptr("sampleLink"), + // Title: to.Ptr("CI - CD with Azure DevOps"), + // ReplacementKey: to.Ptr(""), + // }}, + // WebResults: []*armselfhelp.WebResult{ + // { + // ReplacementKey: to.Ptr(""), + // SearchResults: []*armselfhelp.SearchResult{ + // { + // Confidence: to.Ptr(armselfhelp.ConfidenceHigh), + // Content: to.Ptr("I sysprep a VM and now I cannot connect to it via RDP"), + // Link: to.Ptr("sampleLink"), + // Rank: to.Ptr[int32](1), + // ResultType: to.Ptr(armselfhelp.ResultTypeCommunity), + // SolutionID: to.Ptr("sampleSolutionId"), + // Source: to.Ptr("sampleSource"), + // Title: to.Ptr("Cannot RDP VM after SysPrep"), + // }}, + // }}, + // }, + // Sections: []*armselfhelp.Section{ + // { + // Content: to.Ptr("

sample content

"), + // ReplacementMaps: &armselfhelp.ReplacementMaps{ + // }, + // Title: to.Ptr("RBAC Authentication Common Solutions"), + // }}, + // SolutionID: to.Ptr("sampleSolutionId"), + // Title: to.Ptr("RBAC Authentication Common Solutions"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/Solution_Get.json +func ExampleSolutionClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armselfhelp.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSolutionClient().Get(ctx, "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp", "SolutionResource1", 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.SolutionResource = armselfhelp.SolutionResource{ + // Name: to.Ptr("SolutionResource1"), + // Type: to.Ptr("Microsoft.Help/solutions"), + // ID: to.Ptr("/subscriptions/mySubscription/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp/providers/Microsoft.Help/solutions/SolutionResource1"), + // Properties: &armselfhelp.SolutionResourceProperties{ + // Content: to.Ptr("

Sample content

"), + // ProvisioningState: to.Ptr(armselfhelp.SolutionProvisioningStateSucceeded), + // ReplacementMaps: &armselfhelp.ReplacementMaps{ + // Diagnostics: []*armselfhelp.SolutionsDiagnostic{ + // { + // Insights: []*armselfhelp.Insight{ + // { + // ID: to.Ptr("InsightArticleId"), + // ImportanceLevel: to.Ptr(armselfhelp.ImportanceLevelCritical), + // Results: to.Ptr("Article Content"), + // Title: to.Ptr("An example title for an Insight"), + // }}, + // ReplacementKey: to.Ptr(""), + // SolutionID: to.Ptr("sampleSolutionId3"), + // Status: to.Ptr(armselfhelp.StatusSucceeded), + // StatusDetails: to.Ptr(""), + // }, + // { + // Insights: []*armselfhelp.Insight{ + // }, + // ReplacementKey: to.Ptr(""), + // RequiredParameters: []*string{ + // to.Ptr("parameter1"), + // to.Ptr("parameter2")}, + // SolutionID: to.Ptr("sampleSolutionId4"), + // Status: to.Ptr(armselfhelp.StatusSucceeded), + // StatusDetails: to.Ptr(""), + // }, + // { + // Insights: []*armselfhelp.Insight{ + // }, + // ReplacementKey: to.Ptr(""), + // RequiredParameters: []*string{ + // to.Ptr("parameter1"), + // to.Ptr("parameter2")}, + // SolutionID: to.Ptr("sampleSolutionId5"), + // Status: to.Ptr(armselfhelp.StatusFailed), + // StatusDetails: to.Ptr("Timeout text authored in Solution article "), + // }, + // { + // Insights: []*armselfhelp.Insight{ + // }, + // ReplacementKey: to.Ptr(""), + // RequiredParameters: []*string{ + // to.Ptr("parameter1"), + // to.Ptr("parameter2")}, + // SolutionID: to.Ptr("sampleSolutionId6"), + // Status: to.Ptr(armselfhelp.StatusFailed), + // StatusDetails: to.Ptr("Some text "), + // }}, + // MetricsBasedCharts: []*armselfhelp.MetricsBasedChart{ + // { + // Name: to.Ptr("CPU_percent"), + // AggregationType: to.Ptr(armselfhelp.AggregationTypeMax), + // ReplacementKey: to.Ptr(""), + // TimeSpanDuration: to.Ptr("1d"), + // Title: to.Ptr("CPU Usage in the last one day"), + // }, + // { + // Name: to.Ptr("memory_percent"), + // AggregationType: to.Ptr(armselfhelp.AggregationTypeMax), + // ReplacementKey: to.Ptr(""), + // TimeSpanDuration: to.Ptr("1d"), + // Title: to.Ptr("Memory Usage in the last one day"), + // }, + // { + // Name: to.Ptr("io_consumption_percent"), + // AggregationType: to.Ptr(armselfhelp.AggregationTypeMax), + // ReplacementKey: to.Ptr(""), + // TimeSpanDuration: to.Ptr("1d"), + // Title: to.Ptr("IOPS Usage in the last one day"), + // }, + // { + // Name: to.Ptr("active_connections"), + // AggregationType: to.Ptr(armselfhelp.AggregationTypeMax), + // ReplacementKey: to.Ptr(""), + // TimeSpanDuration: to.Ptr("1d"), + // Title: to.Ptr("Active Connections in the last one day"), + // }}, + // VideoGroups: []*armselfhelp.VideoGroup{ + // { + // ReplacementKey: to.Ptr(""), + // Videos: []*armselfhelp.VideoGroupVideo{ + // { + // Src: to.Ptr("sampleVideoSource2"), + // Title: to.Ptr("widthtest"), + // }}, + // }}, + // Videos: []*armselfhelp.Video{ + // { + // Src: to.Ptr("sampleVideoSource"), + // Title: to.Ptr("CI - CD with Azure DevOps"), + // ReplacementKey: to.Ptr(""), + // }}, + // WebResults: []*armselfhelp.WebResult{ + // { + // ReplacementKey: to.Ptr(""), + // SearchResults: []*armselfhelp.SearchResult{ + // { + // Confidence: to.Ptr(armselfhelp.ConfidenceHigh), + // Content: to.Ptr("I sysprep a VM and now I cannot connect to it via RDP"), + // Link: to.Ptr("sampleLink"), + // Rank: to.Ptr[int32](1), + // ResultType: to.Ptr(armselfhelp.ResultTypeCommunity), + // SolutionID: to.Ptr("sampleSolutionId2"), + // Source: to.Ptr("sampleSource"), + // Title: to.Ptr("Cannot RDP VM after SysPrep"), + // }}, + // }}, + // }, + // Sections: []*armselfhelp.Section{ + // { + // Content: to.Ptr("

sample content

"), + // ReplacementMaps: &armselfhelp.ReplacementMaps{ + // }, + // Title: to.Ptr("RBAC Authentication Common Solutions"), + // }}, + // SolutionID: to.Ptr("sampleSolutionId1"), + // Title: to.Ptr("RBAC Authentication Common Solutions"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/Solution_Update.json +func ExampleSolutionClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armselfhelp.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSolutionClient().BeginUpdate(ctx, "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp", "SolutionResourceName1", armselfhelp.SolutionPatchRequestBody{}, 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.SolutionResource = armselfhelp.SolutionResource{ + // Name: to.Ptr("SolutionResourceName1"), + // Type: to.Ptr("Microsoft.Help/solutions"), + // ID: to.Ptr("/subscriptions/mySubscription/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp/providers/Microsoft.Help/solutions/SolutionResourceName1"), + // Properties: &armselfhelp.SolutionResourceProperties{ + // Content: to.Ptr("

sample content

"), + // ProvisioningState: to.Ptr(armselfhelp.SolutionProvisioningStateSucceeded), + // ReplacementMaps: &armselfhelp.ReplacementMaps{ + // Diagnostics: []*armselfhelp.SolutionsDiagnostic{ + // { + // Insights: []*armselfhelp.Insight{ + // { + // ID: to.Ptr("InsightArticleId"), + // ImportanceLevel: to.Ptr(armselfhelp.ImportanceLevelCritical), + // Results: to.Ptr("Article Content"), + // Title: to.Ptr("An example title for an Insight"), + // }}, + // ReplacementKey: to.Ptr(""), + // SolutionID: to.Ptr("sampleSolutionId1"), + // Status: to.Ptr(armselfhelp.StatusSucceeded), + // StatusDetails: to.Ptr(""), + // }, + // { + // Insights: []*armselfhelp.Insight{ + // }, + // ReplacementKey: to.Ptr(""), + // RequiredParameters: []*string{ + // to.Ptr("parameter1"), + // to.Ptr("parameter2")}, + // SolutionID: to.Ptr("sampleSolutionId2"), + // Status: to.Ptr(armselfhelp.StatusFailed), + // StatusDetails: to.Ptr(""), + // }, + // { + // Insights: []*armselfhelp.Insight{ + // }, + // ReplacementKey: to.Ptr(""), + // RequiredParameters: []*string{ + // to.Ptr("parameter1"), + // to.Ptr("parameter2")}, + // SolutionID: to.Ptr("sampleSolutionId3"), + // Status: to.Ptr(armselfhelp.StatusFailed), + // StatusDetails: to.Ptr("Timeout text authored in Solution article "), + // }, + // { + // Insights: []*armselfhelp.Insight{ + // }, + // ReplacementKey: to.Ptr(""), + // RequiredParameters: []*string{ + // to.Ptr("parameter1"), + // to.Ptr("parameter2")}, + // SolutionID: to.Ptr("sampleSolutionId4"), + // Status: to.Ptr(armselfhelp.StatusFailed), + // StatusDetails: to.Ptr("Sample status details"), + // }}, + // MetricsBasedCharts: []*armselfhelp.MetricsBasedChart{ + // { + // Name: to.Ptr("CPU_percent"), + // AggregationType: to.Ptr(armselfhelp.AggregationTypeMax), + // ReplacementKey: to.Ptr(""), + // TimeSpanDuration: to.Ptr("1d"), + // Title: to.Ptr("CPU Usage in the last one day"), + // }, + // { + // Name: to.Ptr("memory_percent"), + // AggregationType: to.Ptr(armselfhelp.AggregationTypeMax), + // ReplacementKey: to.Ptr(""), + // TimeSpanDuration: to.Ptr("1d"), + // Title: to.Ptr("Memory Usage in the last one day"), + // }, + // { + // Name: to.Ptr("io_consumption_percent"), + // AggregationType: to.Ptr(armselfhelp.AggregationTypeMax), + // ReplacementKey: to.Ptr(""), + // TimeSpanDuration: to.Ptr("1d"), + // Title: to.Ptr("IOPS Usage in the last one day"), + // }, + // { + // Name: to.Ptr("active_connections"), + // AggregationType: to.Ptr(armselfhelp.AggregationTypeMax), + // ReplacementKey: to.Ptr(""), + // TimeSpanDuration: to.Ptr("1d"), + // Title: to.Ptr("Active Connections in the last one day"), + // }}, + // VideoGroups: []*armselfhelp.VideoGroup{ + // { + // ReplacementKey: to.Ptr(""), + // Videos: []*armselfhelp.VideoGroupVideo{ + // { + // Src: to.Ptr("sampleLink"), + // Title: to.Ptr("widthtest"), + // }}, + // }}, + // Videos: []*armselfhelp.Video{ + // { + // Src: to.Ptr("sampleLink"), + // Title: to.Ptr("CI - CD with Azure DevOps"), + // ReplacementKey: to.Ptr(""), + // }}, + // WebResults: []*armselfhelp.WebResult{ + // { + // ReplacementKey: to.Ptr(""), + // SearchResults: []*armselfhelp.SearchResult{ + // { + // Confidence: to.Ptr(armselfhelp.ConfidenceHigh), + // Content: to.Ptr("I sysprep a VM and now I cannot connect to it via RDP"), + // Link: to.Ptr("sampleLink"), + // Rank: to.Ptr[int32](1), + // ResultType: to.Ptr(armselfhelp.ResultTypeCommunity), + // SolutionID: to.Ptr("sampleSolutionId"), + // Source: to.Ptr("sampleSource"), + // Title: to.Ptr("Cannot RDP VM after SysPrep"), + // }}, + // }}, + // }, + // Sections: []*armselfhelp.Section{ + // { + // Content: to.Ptr("

sample content

"), + // ReplacementMaps: &armselfhelp.ReplacementMaps{ + // }, + // Title: to.Ptr("RBAC Authentication Common Solutions"), + // }}, + // SolutionID: to.Ptr("sampleSolutionId"), + // Title: to.Ptr("RBAC Authentication Common Solutions"), + // }, + // } +} diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/troubleshooters_client.go b/sdk/resourcemanager/selfhelp/armselfhelp/troubleshooters_client.go new file mode 100644 index 000000000000..5c033026e212 --- /dev/null +++ b/sdk/resourcemanager/selfhelp/armselfhelp/troubleshooters_client.go @@ -0,0 +1,356 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armselfhelp + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// TroubleshootersClient contains the methods for the Troubleshooters group. +// Don't use this type directly, use NewTroubleshootersClient() instead. +type TroubleshootersClient struct { + internal *arm.Client +} + +// NewTroubleshootersClient creates a new instance of TroubleshootersClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewTroubleshootersClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*TroubleshootersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TroubleshootersClient{ + internal: cl, + } + return client, nil +} + +// Continue - Uses ‘stepId’ and ‘responses’ as the trigger to continue the troubleshooting steps for the respective troubleshooter +// resource name. Continue API is used to provide inputs that are required for the +// specific troubleshooter to progress into the next step in the process. This API is used after the Troubleshooter has been +// created using the Create API. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - scope - This is an extension resource provider and only resource level extension is supported at the moment. +// - troubleshooterName - Troubleshooter resource Name. +// - options - TroubleshootersClientContinueOptions contains the optional parameters for the TroubleshootersClient.Continue +// method. +func (client *TroubleshootersClient) Continue(ctx context.Context, scope string, troubleshooterName string, options *TroubleshootersClientContinueOptions) (TroubleshootersClientContinueResponse, error) { + var err error + const operationName = "TroubleshootersClient.Continue" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.continueCreateRequest(ctx, scope, troubleshooterName, options) + if err != nil { + return TroubleshootersClientContinueResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TroubleshootersClientContinueResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return TroubleshootersClientContinueResponse{}, err + } + resp, err := client.continueHandleResponse(httpResp) + return resp, err +} + +// continueCreateRequest creates the Continue request. +func (client *TroubleshootersClient) continueCreateRequest(ctx context.Context, scope string, troubleshooterName string, options *TroubleshootersClientContinueOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName}/continue" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if troubleshooterName == "" { + return nil, errors.New("parameter troubleshooterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{troubleshooterName}", url.PathEscape(troubleshooterName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.ContinueRequestBody != nil { + if err := runtime.MarshalAsJSON(req, *options.ContinueRequestBody); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// continueHandleResponse handles the Continue response. +func (client *TroubleshootersClient) continueHandleResponse(resp *http.Response) (TroubleshootersClientContinueResponse, error) { + result := TroubleshootersClientContinueResponse{} + if val := resp.Header.Get("Location"); val != "" { + result.Location = &val + } + return result, nil +} + +// Create - Creates the specific troubleshooter action under a resource or subscription using the ‘solutionId’ and ‘properties.parameters’ +// as the trigger. Troubleshooters are step-by-step interactive guidance +// that scope the problem by collecting additional inputs from you in each stage while troubleshooting an Azure issue. You +// will be guided down decision tree style workflow and the best possible solution +// will be presented at the end of the workflow. Create API creates the Troubleshooter API using ‘parameters’ and ‘solutionId’ +// After creating the Troubleshooter instance, the following APIs can be used: +// CONTINUE API: to move to the next step in the flow GET API: to identify the next step after executing the CONTINUE API. +// Note: ‘requiredParameters’ from solutions response must be passed via ‘properties. parameters’ in the request body of Troubleshooters +// API. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - scope - This is an extension resource provider and only resource level extension is supported at the moment. +// - troubleshooterName - Troubleshooter resource Name. +// - createTroubleshooterRequestBody - The required request body for this Troubleshooter resource creation. +// - options - TroubleshootersClientCreateOptions contains the optional parameters for the TroubleshootersClient.Create method. +func (client *TroubleshootersClient) Create(ctx context.Context, scope string, troubleshooterName string, createTroubleshooterRequestBody TroubleshooterResource, options *TroubleshootersClientCreateOptions) (TroubleshootersClientCreateResponse, error) { + var err error + const operationName = "TroubleshootersClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, scope, troubleshooterName, createTroubleshooterRequestBody, options) + if err != nil { + return TroubleshootersClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TroubleshootersClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return TroubleshootersClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *TroubleshootersClient) createCreateRequest(ctx context.Context, scope string, troubleshooterName string, createTroubleshooterRequestBody TroubleshooterResource, options *TroubleshootersClientCreateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if troubleshooterName == "" { + return nil, errors.New("parameter troubleshooterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{troubleshooterName}", url.PathEscape(troubleshooterName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, createTroubleshooterRequestBody); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *TroubleshootersClient) createHandleResponse(resp *http.Response) (TroubleshootersClientCreateResponse, error) { + result := TroubleshootersClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TroubleshooterResource); err != nil { + return TroubleshootersClientCreateResponse{}, err + } + return result, nil +} + +// End - Ends the troubleshooter action +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - scope - This is an extension resource provider and only resource level extension is supported at the moment. +// - troubleshooterName - Troubleshooter resource Name. +// - options - TroubleshootersClientEndOptions contains the optional parameters for the TroubleshootersClient.End method. +func (client *TroubleshootersClient) End(ctx context.Context, scope string, troubleshooterName string, options *TroubleshootersClientEndOptions) (TroubleshootersClientEndResponse, error) { + var err error + const operationName = "TroubleshootersClient.End" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.endCreateRequest(ctx, scope, troubleshooterName, options) + if err != nil { + return TroubleshootersClientEndResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TroubleshootersClientEndResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return TroubleshootersClientEndResponse{}, err + } + resp, err := client.endHandleResponse(httpResp) + return resp, err +} + +// endCreateRequest creates the End request. +func (client *TroubleshootersClient) endCreateRequest(ctx context.Context, scope string, troubleshooterName string, options *TroubleshootersClientEndOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName}/end" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if troubleshooterName == "" { + return nil, errors.New("parameter troubleshooterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{troubleshooterName}", url.PathEscape(troubleshooterName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// endHandleResponse handles the End response. +func (client *TroubleshootersClient) endHandleResponse(resp *http.Response) (TroubleshootersClientEndResponse, error) { + result := TroubleshootersClientEndResponse{} + if val := resp.Header.Get("Location"); val != "" { + result.Location = &val + } + return result, nil +} + +// Get - Gets troubleshooter instance result which includes the step status/result of the troubleshooter resource name that +// is being executed. Get API is used to retrieve the result of a Troubleshooter +// instance, which includes the status and result of each step in the Troubleshooter workflow. This API requires the Troubleshooter +// resource name that was created using the Create API. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - scope - This is an extension resource provider and only resource level extension is supported at the moment. +// - troubleshooterName - Troubleshooter resource Name. +// - options - TroubleshootersClientGetOptions contains the optional parameters for the TroubleshootersClient.Get method. +func (client *TroubleshootersClient) Get(ctx context.Context, scope string, troubleshooterName string, options *TroubleshootersClientGetOptions) (TroubleshootersClientGetResponse, error) { + var err error + const operationName = "TroubleshootersClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, scope, troubleshooterName, options) + if err != nil { + return TroubleshootersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TroubleshootersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TroubleshootersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *TroubleshootersClient) getCreateRequest(ctx context.Context, scope string, troubleshooterName string, options *TroubleshootersClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if troubleshooterName == "" { + return nil, errors.New("parameter troubleshooterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{troubleshooterName}", url.PathEscape(troubleshooterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *TroubleshootersClient) getHandleResponse(resp *http.Response) (TroubleshootersClientGetResponse, error) { + result := TroubleshootersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TroubleshooterResource); err != nil { + return TroubleshootersClientGetResponse{}, err + } + return result, nil +} + +// Restart - Restarts the troubleshooter API using applicable troubleshooter resource name as the input. It returns new resource +// name which should be used in subsequent request. The old resource name is obsolete +// after this API is invoked. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-09-01-preview +// - scope - This is an extension resource provider and only resource level extension is supported at the moment. +// - troubleshooterName - Troubleshooter resource Name. +// - options - TroubleshootersClientRestartOptions contains the optional parameters for the TroubleshootersClient.Restart method. +func (client *TroubleshootersClient) Restart(ctx context.Context, scope string, troubleshooterName string, options *TroubleshootersClientRestartOptions) (TroubleshootersClientRestartResponse, error) { + var err error + const operationName = "TroubleshootersClient.Restart" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.restartCreateRequest(ctx, scope, troubleshooterName, options) + if err != nil { + return TroubleshootersClientRestartResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TroubleshootersClientRestartResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TroubleshootersClientRestartResponse{}, err + } + resp, err := client.restartHandleResponse(httpResp) + return resp, err +} + +// restartCreateRequest creates the Restart request. +func (client *TroubleshootersClient) restartCreateRequest(ctx context.Context, scope string, troubleshooterName string, options *TroubleshootersClientRestartOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName}/restart" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if troubleshooterName == "" { + return nil, errors.New("parameter troubleshooterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{troubleshooterName}", url.PathEscape(troubleshooterName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// restartHandleResponse handles the Restart response. +func (client *TroubleshootersClient) restartHandleResponse(resp *http.Response) (TroubleshootersClientRestartResponse, error) { + result := TroubleshootersClientRestartResponse{} + if val := resp.Header.Get("Location"); val != "" { + result.Location = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.RestartTroubleshooterResponse); err != nil { + return TroubleshootersClientRestartResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/selfhelp/armselfhelp/troubleshooters_client_example_test.go b/sdk/resourcemanager/selfhelp/armselfhelp/troubleshooters_client_example_test.go new file mode 100644 index 000000000000..f6648dd15cdd --- /dev/null +++ b/sdk/resourcemanager/selfhelp/armselfhelp/troubleshooters_client_example_test.go @@ -0,0 +1,215 @@ +//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 armselfhelp_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/selfhelp/armselfhelp/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/Troubleshooter_Create.json +func ExampleTroubleshootersClient_Create() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armselfhelp.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewTroubleshootersClient().Create(ctx, "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp", "abf168ed-1b54-454a-86f6-e4b62253d3b1", armselfhelp.TroubleshooterResource{ + Properties: &armselfhelp.TroubleshooterInstanceProperties{ + Parameters: map[string]*string{ + "ResourceURI": to.Ptr("subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp"), + }, + SolutionID: to.Ptr("SampleTroubleshooterSolutionId"), + }, + }, 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.TroubleshooterResource = armselfhelp.TroubleshooterResource{ + // Name: to.Ptr("abf168ed-1b54-454a-86f6-e4b62253d3b1"), + // Type: to.Ptr("Microsoft.Help/troubleshooters"), + // ID: to.Ptr("/subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp/providers/Microsoft.Help/troubleshooter/abf168ed-1b54-454a-86f6-e4b62253d3b1"), + // Properties: &armselfhelp.TroubleshooterInstanceProperties{ + // Parameters: map[string]*string{ + // "ResourceURI": to.Ptr("subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp"), + // }, + // ProvisioningState: to.Ptr(armselfhelp.TroubleshooterProvisioningStateSucceeded), + // SolutionID: to.Ptr("SampleTroubleshooterSolutionId"), + // Steps: []*armselfhelp.Step{ + // { + // Type: to.Ptr(armselfhelp.TypeDecision), + // Description: to.Ptr("step description"), + // ExecutionStatus: to.Ptr(armselfhelp.ExecutionStatusSuccess), + // ExecutionStatusDescription: to.Ptr("Step is success"), + // Guidance: to.Ptr("IP address is used to check if the VM would be reachable from the given IP Address. We have prepopulated the IP address from your browser. If the field is left empty, the generic internet address space will be used."), + // ID: to.Ptr("SampleStepId"), + // Inputs: []*armselfhelp.StepInput{ + // { + // QuestionContent: to.Ptr("Is VPN Connected?"), + // QuestionContentType: to.Ptr(armselfhelp.QuestionContentTypeText), + // QuestionID: to.Ptr("6cbe3f23-f3c2-41f3-886e-0cfbeee19b24"), + // QuestionType: to.Ptr("MultiChoice"), + // ResponseOptions: []*armselfhelp.ResponseOption{ + // { + // Key: to.Ptr("Yes"), + // Value: to.Ptr("1"), + // }, + // { + // Key: to.Ptr("No"), + // Value: to.Ptr("0"), + // }}, + // ResponseValidationProperties: &armselfhelp.ResponseValidationProperties{ + // IsRequired: to.Ptr(true), + // MaxLength: to.Ptr[int64](1), + // }, + // }}, + // IsLastStep: to.Ptr(true), + // Title: to.Ptr("Step title"), + // }}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/Troubleshooter_Get.json +func ExampleTroubleshootersClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armselfhelp.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewTroubleshootersClient().Get(ctx, "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp", "abf168ed-1b54-454a-86f6-e4b62253d3b1", 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.TroubleshooterResource = armselfhelp.TroubleshooterResource{ + // Name: to.Ptr("abf168ed-1b54-454a-86f6-e4b62253d3b1"), + // Type: to.Ptr("Microsoft.Help/troubleshooters"), + // ID: to.Ptr("/subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp/providers/Microsoft.Help/troubleshooter/abf168ed-1b54-454a-86f6-e4b62253d3b1"), + // Properties: &armselfhelp.TroubleshooterInstanceProperties{ + // ProvisioningState: to.Ptr(armselfhelp.TroubleshooterProvisioningStateSucceeded), + // SolutionID: to.Ptr("SampleTroubleshooterSolutionId"), + // Steps: []*armselfhelp.Step{ + // { + // Type: to.Ptr(armselfhelp.TypeDecision), + // Description: to.Ptr("step description"), + // ExecutionStatus: to.Ptr(armselfhelp.ExecutionStatusSuccess), + // ExecutionStatusDescription: to.Ptr("Step is success"), + // Guidance: to.Ptr("IP address is used to check if the VM would be reachable from the given IP Address. We have prepopulated the IP address from your browser. If the field is left empty, the generic internet address space will be used."), + // ID: to.Ptr("SampleId"), + // Inputs: []*armselfhelp.StepInput{ + // { + // QuestionContent: to.Ptr("Is VPN Connected?"), + // QuestionContentType: to.Ptr(armselfhelp.QuestionContentTypeText), + // QuestionID: to.Ptr("SampleQuestionId"), + // QuestionType: to.Ptr("MultiChoice"), + // ResponseOptions: []*armselfhelp.ResponseOption{ + // { + // Key: to.Ptr("Yes"), + // Value: to.Ptr("1"), + // }, + // { + // Key: to.Ptr("No"), + // Value: to.Ptr("0"), + // }}, + // ResponseValidationProperties: &armselfhelp.ResponseValidationProperties{ + // IsRequired: to.Ptr(true), + // MaxLength: to.Ptr[int64](1), + // }, + // }}, + // IsLastStep: to.Ptr(true), + // Title: to.Ptr("Step title"), + // }}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/Troubleshooter_Continue.json +func ExampleTroubleshootersClient_Continue() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armselfhelp.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewTroubleshootersClient().Continue(ctx, "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp", "abf168ed-1b54-454a-86f6-e4b62253d3b1", &armselfhelp.TroubleshootersClientContinueOptions{ContinueRequestBody: &armselfhelp.ContinueRequestBody{ + StepID: to.Ptr("SampleStepId"), + Responses: []*armselfhelp.TroubleshooterResponse{ + { + QuestionID: to.Ptr("SampleQuestionId"), + QuestionType: to.Ptr(armselfhelp.QuestionType("Text")), + Response: to.Ptr("Connection exception"), + }}, + }, + }) + 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/3066a973f4baf2e2bf072a013b585a820bb10146/specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/Troubleshooter_End.json +func ExampleTroubleshootersClient_End() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armselfhelp.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewTroubleshootersClient().End(ctx, "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp", "abf168ed-1b54-454a-86f6-e4b62253d3b1", 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/3066a973f4baf2e2bf072a013b585a820bb10146/specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/Troubleshooter_Restart.json +func ExampleTroubleshootersClient_Restart() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armselfhelp.NewClientFactory(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewTroubleshootersClient().Restart(ctx, "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp", "abf168ed-1b54-454a-86f6-e4b62253d3b1", 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.RestartTroubleshooterResponse = armselfhelp.RestartTroubleshooterResponse{ + // TroubleshooterResourceName: to.Ptr("SampleTroubleshooterResourceName"), + // } +} diff --git a/sdk/resourcemanager/signalr/armsignalr/CHANGELOG.md b/sdk/resourcemanager/signalr/armsignalr/CHANGELOG.md index 88bfeff83cef..dc25bd6df532 100644 --- a/sdk/resourcemanager/signalr/armsignalr/CHANGELOG.md +++ b/sdk/resourcemanager/signalr/armsignalr/CHANGELOG.md @@ -1,5 +1,26 @@ # Release History +## 1.3.0-beta.1 (2023-11-30) +### Features Added + +- New function `*Client.ListReplicaSKUs(context.Context, string, string, string, *ClientListReplicaSKUsOptions) (ClientListReplicaSKUsResponse, error)` +- New function `*ClientFactory.NewReplicasClient() *ReplicasClient` +- New function `NewReplicasClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ReplicasClient, error)` +- New function `*ReplicasClient.BeginCreateOrUpdate(context.Context, string, string, string, Replica, *ReplicasClientBeginCreateOrUpdateOptions) (*runtime.Poller[ReplicasClientCreateOrUpdateResponse], error)` +- New function `*ReplicasClient.Delete(context.Context, string, string, string, *ReplicasClientDeleteOptions) (ReplicasClientDeleteResponse, error)` +- New function `*ReplicasClient.Get(context.Context, string, string, string, *ReplicasClientGetOptions) (ReplicasClientGetResponse, error)` +- New function `*ReplicasClient.NewListPager(string, string, *ReplicasClientListOptions) *runtime.Pager[ReplicasClientListResponse]` +- New function `*ReplicasClient.BeginRestart(context.Context, string, string, string, *ReplicasClientBeginRestartOptions) (*runtime.Poller[ReplicasClientRestartResponse], error)` +- New function `*ReplicasClient.BeginUpdate(context.Context, string, string, string, Replica, *ReplicasClientBeginUpdateOptions) (*runtime.Poller[ReplicasClientUpdateResponse], error)` +- New struct `IPRule` +- New struct `Replica` +- New struct `ReplicaList` +- New struct `ReplicaProperties` +- New field `IPRules` in struct `NetworkACLs` +- New field `SystemData` in struct `PrivateLinkResource` +- New field `RegionEndpointEnabled`, `ResourceStopped` in struct `Properties` + + ## 1.2.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/signalr/armsignalr/assets.json b/sdk/resourcemanager/signalr/armsignalr/assets.json index b123f62d3818..11a82b814298 100644 --- a/sdk/resourcemanager/signalr/armsignalr/assets.json +++ b/sdk/resourcemanager/signalr/armsignalr/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "go", "TagPrefix": "go/resourcemanager/signalr/armsignalr", - "Tag": "go/resourcemanager/signalr/armsignalr_6305e72793" + "Tag": "go/resourcemanager/signalr/armsignalr_d43ddfe6a5" } diff --git a/sdk/resourcemanager/signalr/armsignalr/autorest.md b/sdk/resourcemanager/signalr/armsignalr/autorest.md index fbcf2311e2a9..2a410e780917 100644 --- a/sdk/resourcemanager/signalr/armsignalr/autorest.md +++ b/sdk/resourcemanager/signalr/armsignalr/autorest.md @@ -5,8 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.2.0 +module-version: 1.3.0-beta.1 +tag: package-2023-08-01-preview ``` \ No newline at end of file diff --git a/sdk/resourcemanager/signalr/armsignalr/client.go b/sdk/resourcemanager/signalr/armsignalr/client.go index 85485574ed23..fb247abc6fc7 100644 --- a/sdk/resourcemanager/signalr/armsignalr/client.go +++ b/sdk/resourcemanager/signalr/armsignalr/client.go @@ -28,8 +28,7 @@ type Client struct { } // NewClient creates a new instance of Client with the specified values. -// - subscriptionID - Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) { @@ -47,7 +46,7 @@ func NewClient(subscriptionID string, credential azcore.TokenCredential, options // CheckNameAvailability - Checks that the resource name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview // - location - the region // - parameters - Parameters supplied to the operation. // - options - ClientCheckNameAvailabilityOptions contains the optional parameters for the Client.CheckNameAvailability method. @@ -89,7 +88,7 @@ func (client *Client) checkNameAvailabilityCreateRequest(ctx context.Context, lo return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -110,9 +109,8 @@ func (client *Client) checkNameAvailabilityHandleResponse(resp *http.Response) ( // BeginCreateOrUpdate - Create or update a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - parameters - Parameters for the create or update operation // - options - ClientBeginCreateOrUpdateOptions contains the optional parameters for the Client.BeginCreateOrUpdate method. @@ -123,7 +121,8 @@ func (client *Client) BeginCreateOrUpdate(ctx context.Context, resourceGroupName return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -136,7 +135,7 @@ func (client *Client) BeginCreateOrUpdate(ctx context.Context, resourceGroupName // CreateOrUpdate - Create or update a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview func (client *Client) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceInfo, options *ClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "Client.BeginCreateOrUpdate" @@ -178,7 +177,7 @@ func (client *Client) createOrUpdateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -190,9 +189,8 @@ func (client *Client) createOrUpdateCreateRequest(ctx context.Context, resourceG // BeginDelete - Operation to delete a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - ClientBeginDeleteOptions contains the optional parameters for the Client.BeginDelete method. func (client *Client) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginDeleteOptions) (*runtime.Poller[ClientDeleteResponse], error) { @@ -216,7 +214,7 @@ func (client *Client) BeginDelete(ctx context.Context, resourceGroupName string, // Delete - Operation to delete a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview func (client *Client) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "Client.BeginDelete" @@ -258,7 +256,7 @@ func (client *Client) deleteCreateRequest(ctx context.Context, resourceGroupName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,9 +265,8 @@ func (client *Client) deleteCreateRequest(ctx context.Context, resourceGroupName // Get - Get the resource and its properties. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - ClientGetOptions contains the optional parameters for the Client.Get method. func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string, options *ClientGetOptions) (ClientGetResponse, error) { @@ -314,7 +311,7 @@ func (client *Client) getCreateRequest(ctx context.Context, resourceGroupName st return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -331,9 +328,8 @@ func (client *Client) getHandleResponse(resp *http.Response) (ClientGetResponse, // NewListByResourceGroupPager - Handles requests to list all resources in a resource group. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ClientListByResourceGroupOptions contains the optional parameters for the Client.NewListByResourceGroupPager // method. func (client *Client) NewListByResourceGroupPager(resourceGroupName string, options *ClientListByResourceGroupOptions) *runtime.Pager[ClientListByResourceGroupResponse] { @@ -375,7 +371,7 @@ func (client *Client) listByResourceGroupCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -392,7 +388,7 @@ func (client *Client) listByResourceGroupHandleResponse(resp *http.Response) (Cl // NewListBySubscriptionPager - Handles requests to list all resources in a subscription. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview // - options - ClientListBySubscriptionOptions contains the optional parameters for the Client.NewListBySubscriptionPager method. func (client *Client) NewListBySubscriptionPager(options *ClientListBySubscriptionOptions) *runtime.Pager[ClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[ClientListBySubscriptionResponse]{ @@ -429,7 +425,7 @@ func (client *Client) listBySubscriptionCreateRequest(ctx context.Context, optio return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -447,9 +443,8 @@ func (client *Client) listBySubscriptionHandleResponse(resp *http.Response) (Cli // ListKeys - Get the access keys of the resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - ClientListKeysOptions contains the optional parameters for the Client.ListKeys method. func (client *Client) ListKeys(ctx context.Context, resourceGroupName string, resourceName string, options *ClientListKeysOptions) (ClientListKeysResponse, error) { @@ -494,7 +489,7 @@ func (client *Client) listKeysCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -509,12 +504,80 @@ func (client *Client) listKeysHandleResponse(resp *http.Response) (ClientListKey return result, nil } +// ListReplicaSKUs - List all available skus of the replica resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - replicaName - The name of the replica. +// - options - ClientListReplicaSKUsOptions contains the optional parameters for the Client.ListReplicaSKUs method. +func (client *Client) ListReplicaSKUs(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ClientListReplicaSKUsOptions) (ClientListReplicaSKUsResponse, error) { + var err error + const operationName = "Client.ListReplicaSKUs" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listReplicaSKUsCreateRequest(ctx, resourceGroupName, resourceName, replicaName, options) + if err != nil { + return ClientListReplicaSKUsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClientListReplicaSKUsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientListReplicaSKUsResponse{}, err + } + resp, err := client.listReplicaSKUsHandleResponse(httpResp) + return resp, err +} + +// listReplicaSKUsCreateRequest creates the ListReplicaSKUs request. +func (client *Client) listReplicaSKUsCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ClientListReplicaSKUsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}/skus" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if replicaName == "" { + return nil, errors.New("parameter replicaName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicaName}", url.PathEscape(replicaName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listReplicaSKUsHandleResponse handles the ListReplicaSKUs response. +func (client *Client) listReplicaSKUsHandleResponse(resp *http.Response) (ClientListReplicaSKUsResponse, error) { + result := ClientListReplicaSKUsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SKUList); err != nil { + return ClientListReplicaSKUsResponse{}, err + } + return result, nil +} + // ListSKUs - List all available skus of the resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - ClientListSKUsOptions contains the optional parameters for the Client.ListSKUs method. func (client *Client) ListSKUs(ctx context.Context, resourceGroupName string, resourceName string, options *ClientListSKUsOptions) (ClientListSKUsResponse, error) { @@ -559,7 +622,7 @@ func (client *Client) listSKUsCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -578,9 +641,8 @@ func (client *Client) listSKUsHandleResponse(resp *http.Response) (ClientListSKU // same time. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - parameters - Parameter that describes the Regenerate Key Operation. // - options - ClientBeginRegenerateKeyOptions contains the optional parameters for the Client.BeginRegenerateKey method. @@ -591,7 +653,7 @@ func (client *Client) BeginRegenerateKey(ctx context.Context, resourceGroupName return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientRegenerateKeyResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + FinalStateVia: runtime.FinalStateViaLocation, Tracer: client.internal.Tracer(), }) return poller, err @@ -606,7 +668,7 @@ func (client *Client) BeginRegenerateKey(ctx context.Context, resourceGroupName // time. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview func (client *Client) regenerateKey(ctx context.Context, resourceGroupName string, resourceName string, parameters RegenerateKeyParameters, options *ClientBeginRegenerateKeyOptions) (*http.Response, error) { var err error const operationName = "Client.BeginRegenerateKey" @@ -621,7 +683,7 @@ func (client *Client) regenerateKey(ctx context.Context, resourceGroupName strin if err != nil { return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { err = runtime.NewResponseError(httpResp) return nil, err } @@ -648,7 +710,7 @@ func (client *Client) regenerateKeyCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -660,9 +722,8 @@ func (client *Client) regenerateKeyCreateRequest(ctx context.Context, resourceGr // BeginRestart - Operation to restart a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - ClientBeginRestartOptions contains the optional parameters for the Client.BeginRestart method. func (client *Client) BeginRestart(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginRestartOptions) (*runtime.Poller[ClientRestartResponse], error) { @@ -672,7 +733,7 @@ func (client *Client) BeginRestart(ctx context.Context, resourceGroupName string return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientRestartResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + FinalStateVia: runtime.FinalStateViaLocation, Tracer: client.internal.Tracer(), }) return poller, err @@ -686,7 +747,7 @@ func (client *Client) BeginRestart(ctx context.Context, resourceGroupName string // Restart - Operation to restart a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview func (client *Client) restart(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginRestartOptions) (*http.Response, error) { var err error const operationName = "Client.BeginRestart" @@ -728,7 +789,7 @@ func (client *Client) restartCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -737,9 +798,8 @@ func (client *Client) restartCreateRequest(ctx context.Context, resourceGroupNam // BeginUpdate - Operation to update an exiting resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - parameters - Parameters for the update operation // - options - ClientBeginUpdateOptions contains the optional parameters for the Client.BeginUpdate method. @@ -750,7 +810,8 @@ func (client *Client) BeginUpdate(ctx context.Context, resourceGroupName string, return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientUpdateResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -763,7 +824,7 @@ func (client *Client) BeginUpdate(ctx context.Context, resourceGroupName string, // Update - Operation to update an exiting resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview func (client *Client) update(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceInfo, options *ClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "Client.BeginUpdate" @@ -805,7 +866,7 @@ func (client *Client) updateCreateRequest(ctx context.Context, resourceGroupName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-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/signalr/armsignalr/client_example_test.go b/sdk/resourcemanager/signalr/armsignalr/client_example_test.go index d3e36cb7aac7..78b7c59f76e0 100644 --- a/sdk/resourcemanager/signalr/armsignalr/client_example_test.go +++ b/sdk/resourcemanager/signalr/armsignalr/client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/signalr/armsignalr" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_CheckNameAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_CheckNameAvailability.json func ExampleClient_CheckNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -46,7 +46,7 @@ func ExampleClient_CheckNameAvailability() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_ListBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_ListBySubscription.json func ExampleClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -74,6 +74,14 @@ func ExampleClient_NewListBySubscriptionPager() { // Name: to.Ptr("mySignalRService"), // Type: to.Ptr("Microsoft.SignalRService/SignalR"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService"), + // SystemData: &armsignalr.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // }, // Location: to.Ptr("eastus"), // Tags: map[string]*string{ // "key1": to.Ptr("value1"), @@ -129,6 +137,19 @@ func ExampleClient_NewListBySubscriptionPager() { // }, // NetworkACLs: &armsignalr.NetworkACLs{ // DefaultAction: to.Ptr(armsignalr.ACLActionDeny), + // IPRules: []*armsignalr.IPRule{ + // { + // Action: to.Ptr(armsignalr.ACLActionAllow), + // Value: to.Ptr("123.456.789.123/24"), + // }, + // { + // Action: to.Ptr(armsignalr.ACLActionAllow), + // Value: to.Ptr("123.456.789.123"), + // }, + // { + // Action: to.Ptr(armsignalr.ACLActionAllow), + // Value: to.Ptr("AppService"), + // }}, // PrivateEndpoints: []*armsignalr.PrivateEndpointACL{ // { // Allow: []*armsignalr.SignalRRequestType{ @@ -145,6 +166,14 @@ func ExampleClient_NewListBySubscriptionPager() { // Name: to.Ptr("mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), // Type: to.Ptr("Microsoft.SignalRService/SignalR/privateEndpointConnections"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // SystemData: &armsignalr.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // }, // Properties: &armsignalr.PrivateEndpointConnectionProperties{ // PrivateEndpoint: &armsignalr.PrivateEndpoint{ // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), @@ -155,18 +184,11 @@ func ExampleClient_NewListBySubscriptionPager() { // }, // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), // }, - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, // }}, // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), // PublicNetworkAccess: to.Ptr("Enabled"), // PublicPort: to.Ptr[int32](443), + // RegionEndpointEnabled: to.Ptr("Enabled"), // ResourceLogConfiguration: &armsignalr.ResourceLogConfiguration{ // Categories: []*armsignalr.ResourceLogCategory{ // { @@ -174,6 +196,7 @@ func ExampleClient_NewListBySubscriptionPager() { // Enabled: to.Ptr("true"), // }}, // }, + // ResourceStopped: to.Ptr("false"), // ServerPort: to.Ptr[int32](443), // Serverless: &armsignalr.ServerlessSettings{ // ConnectionTimeoutInSeconds: to.Ptr[int32](5), @@ -195,20 +218,12 @@ func ExampleClient_NewListBySubscriptionPager() { // Size: to.Ptr("P1"), // Tier: to.Ptr(armsignalr.SignalRSKUTierPremium), // }, - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, // }}, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_ListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_ListByResourceGroup.json func ExampleClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -236,6 +251,14 @@ func ExampleClient_NewListByResourceGroupPager() { // Name: to.Ptr("mySignalRService"), // Type: to.Ptr("Microsoft.SignalRService/SignalR"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService"), + // SystemData: &armsignalr.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // }, // Location: to.Ptr("eastus"), // Tags: map[string]*string{ // "key1": to.Ptr("value1"), @@ -291,6 +314,19 @@ func ExampleClient_NewListByResourceGroupPager() { // }, // NetworkACLs: &armsignalr.NetworkACLs{ // DefaultAction: to.Ptr(armsignalr.ACLActionDeny), + // IPRules: []*armsignalr.IPRule{ + // { + // Action: to.Ptr(armsignalr.ACLActionAllow), + // Value: to.Ptr("123.456.789.123/24"), + // }, + // { + // Action: to.Ptr(armsignalr.ACLActionAllow), + // Value: to.Ptr("123.456.789.123"), + // }, + // { + // Action: to.Ptr(armsignalr.ACLActionAllow), + // Value: to.Ptr("AppService"), + // }}, // PrivateEndpoints: []*armsignalr.PrivateEndpointACL{ // { // Allow: []*armsignalr.SignalRRequestType{ @@ -307,6 +343,14 @@ func ExampleClient_NewListByResourceGroupPager() { // Name: to.Ptr("mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), // Type: to.Ptr("Microsoft.SignalRService/SignalR/privateEndpointConnections"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // SystemData: &armsignalr.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // }, // Properties: &armsignalr.PrivateEndpointConnectionProperties{ // PrivateEndpoint: &armsignalr.PrivateEndpoint{ // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), @@ -317,18 +361,11 @@ func ExampleClient_NewListByResourceGroupPager() { // }, // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), // }, - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, // }}, // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), // PublicNetworkAccess: to.Ptr("Enabled"), // PublicPort: to.Ptr[int32](443), + // RegionEndpointEnabled: to.Ptr("Enabled"), // ResourceLogConfiguration: &armsignalr.ResourceLogConfiguration{ // Categories: []*armsignalr.ResourceLogCategory{ // { @@ -336,6 +373,7 @@ func ExampleClient_NewListByResourceGroupPager() { // Enabled: to.Ptr("true"), // }}, // }, + // ResourceStopped: to.Ptr("false"), // ServerPort: to.Ptr[int32](443), // Serverless: &armsignalr.ServerlessSettings{ // ConnectionTimeoutInSeconds: to.Ptr[int32](5), @@ -357,20 +395,12 @@ func ExampleClient_NewListByResourceGroupPager() { // Size: to.Ptr("P1"), // Tier: to.Ptr(armsignalr.SignalRSKUTierPremium), // }, - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, // }}, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_Get.json func ExampleClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -392,6 +422,14 @@ func ExampleClient_Get() { // Name: to.Ptr("mySignalRService"), // Type: to.Ptr("Microsoft.SignalRService/SignalR"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService"), + // SystemData: &armsignalr.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // }, // Location: to.Ptr("eastus"), // Tags: map[string]*string{ // "key1": to.Ptr("value1"), @@ -447,6 +485,19 @@ func ExampleClient_Get() { // }, // NetworkACLs: &armsignalr.NetworkACLs{ // DefaultAction: to.Ptr(armsignalr.ACLActionDeny), + // IPRules: []*armsignalr.IPRule{ + // { + // Action: to.Ptr(armsignalr.ACLActionAllow), + // Value: to.Ptr("123.456.789.123/24"), + // }, + // { + // Action: to.Ptr(armsignalr.ACLActionAllow), + // Value: to.Ptr("123.456.789.123"), + // }, + // { + // Action: to.Ptr(armsignalr.ACLActionAllow), + // Value: to.Ptr("AppService"), + // }}, // PrivateEndpoints: []*armsignalr.PrivateEndpointACL{ // { // Allow: []*armsignalr.SignalRRequestType{ @@ -463,6 +514,14 @@ func ExampleClient_Get() { // Name: to.Ptr("mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), // Type: to.Ptr("Microsoft.SignalRService/SignalR/privateEndpointConnections"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // SystemData: &armsignalr.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // }, // Properties: &armsignalr.PrivateEndpointConnectionProperties{ // PrivateEndpoint: &armsignalr.PrivateEndpoint{ // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), @@ -473,18 +532,11 @@ func ExampleClient_Get() { // }, // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), // }, - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, // }}, // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), // PublicNetworkAccess: to.Ptr("Enabled"), // PublicPort: to.Ptr[int32](443), + // RegionEndpointEnabled: to.Ptr("Enabled"), // ResourceLogConfiguration: &armsignalr.ResourceLogConfiguration{ // Categories: []*armsignalr.ResourceLogCategory{ // { @@ -492,6 +544,7 @@ func ExampleClient_Get() { // Enabled: to.Ptr("true"), // }}, // }, + // ResourceStopped: to.Ptr("false"), // ServerPort: to.Ptr[int32](443), // Serverless: &armsignalr.ServerlessSettings{ // ConnectionTimeoutInSeconds: to.Ptr[int32](5), @@ -513,18 +566,10 @@ func ExampleClient_Get() { // Size: to.Ptr("P1"), // Tier: to.Ptr(armsignalr.SignalRSKUTierPremium), // }, - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_CreateOrUpdate.json func ExampleClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -637,6 +682,14 @@ func ExampleClient_BeginCreateOrUpdate() { // Name: to.Ptr("mySignalRService"), // Type: to.Ptr("Microsoft.SignalRService/SignalR"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService"), + // SystemData: &armsignalr.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // }, // Location: to.Ptr("eastus"), // Tags: map[string]*string{ // "key1": to.Ptr("value1"), @@ -692,6 +745,19 @@ func ExampleClient_BeginCreateOrUpdate() { // }, // NetworkACLs: &armsignalr.NetworkACLs{ // DefaultAction: to.Ptr(armsignalr.ACLActionDeny), + // IPRules: []*armsignalr.IPRule{ + // { + // Action: to.Ptr(armsignalr.ACLActionAllow), + // Value: to.Ptr("123.456.789.123/24"), + // }, + // { + // Action: to.Ptr(armsignalr.ACLActionAllow), + // Value: to.Ptr("123.456.789.123"), + // }, + // { + // Action: to.Ptr(armsignalr.ACLActionAllow), + // Value: to.Ptr("AppService"), + // }}, // PrivateEndpoints: []*armsignalr.PrivateEndpointACL{ // { // Allow: []*armsignalr.SignalRRequestType{ @@ -708,6 +774,14 @@ func ExampleClient_BeginCreateOrUpdate() { // Name: to.Ptr("mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), // Type: to.Ptr("Microsoft.SignalRService/SignalR/privateEndpointConnections"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // SystemData: &armsignalr.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // }, // Properties: &armsignalr.PrivateEndpointConnectionProperties{ // PrivateEndpoint: &armsignalr.PrivateEndpoint{ // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), @@ -718,18 +792,11 @@ func ExampleClient_BeginCreateOrUpdate() { // }, // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), // }, - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, // }}, // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), // PublicNetworkAccess: to.Ptr("Enabled"), // PublicPort: to.Ptr[int32](443), + // RegionEndpointEnabled: to.Ptr("Enabled"), // ResourceLogConfiguration: &armsignalr.ResourceLogConfiguration{ // Categories: []*armsignalr.ResourceLogCategory{ // { @@ -737,6 +804,7 @@ func ExampleClient_BeginCreateOrUpdate() { // Enabled: to.Ptr("true"), // }}, // }, + // ResourceStopped: to.Ptr("false"), // ServerPort: to.Ptr[int32](443), // Serverless: &armsignalr.ServerlessSettings{ // ConnectionTimeoutInSeconds: to.Ptr[int32](5), @@ -758,18 +826,10 @@ func ExampleClient_BeginCreateOrUpdate() { // Size: to.Ptr("P1"), // Tier: to.Ptr(armsignalr.SignalRSKUTierPremium), // }, - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_Delete.json func ExampleClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -790,7 +850,7 @@ func ExampleClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_Update.json func ExampleClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -903,6 +963,14 @@ func ExampleClient_BeginUpdate() { // Name: to.Ptr("mySignalRService"), // Type: to.Ptr("Microsoft.SignalRService/SignalR"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService"), + // SystemData: &armsignalr.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // }, // Location: to.Ptr("eastus"), // Tags: map[string]*string{ // "key1": to.Ptr("value1"), @@ -958,6 +1026,19 @@ func ExampleClient_BeginUpdate() { // }, // NetworkACLs: &armsignalr.NetworkACLs{ // DefaultAction: to.Ptr(armsignalr.ACLActionDeny), + // IPRules: []*armsignalr.IPRule{ + // { + // Action: to.Ptr(armsignalr.ACLActionAllow), + // Value: to.Ptr("123.456.789.123/24"), + // }, + // { + // Action: to.Ptr(armsignalr.ACLActionAllow), + // Value: to.Ptr("123.456.789.123"), + // }, + // { + // Action: to.Ptr(armsignalr.ACLActionAllow), + // Value: to.Ptr("AppService"), + // }}, // PrivateEndpoints: []*armsignalr.PrivateEndpointACL{ // { // Allow: []*armsignalr.SignalRRequestType{ @@ -974,6 +1055,14 @@ func ExampleClient_BeginUpdate() { // Name: to.Ptr("mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), // Type: to.Ptr("Microsoft.SignalRService/SignalR/privateEndpointConnections"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // SystemData: &armsignalr.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // }, // Properties: &armsignalr.PrivateEndpointConnectionProperties{ // PrivateEndpoint: &armsignalr.PrivateEndpoint{ // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), @@ -984,18 +1073,11 @@ func ExampleClient_BeginUpdate() { // }, // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), // }, - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, // }}, // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), // PublicNetworkAccess: to.Ptr("Enabled"), // PublicPort: to.Ptr[int32](443), + // RegionEndpointEnabled: to.Ptr("Enabled"), // ResourceLogConfiguration: &armsignalr.ResourceLogConfiguration{ // Categories: []*armsignalr.ResourceLogCategory{ // { @@ -1003,6 +1085,7 @@ func ExampleClient_BeginUpdate() { // Enabled: to.Ptr("true"), // }}, // }, + // ResourceStopped: to.Ptr("false"), // ServerPort: to.Ptr[int32](443), // Serverless: &armsignalr.ServerlessSettings{ // ConnectionTimeoutInSeconds: to.Ptr[int32](5), @@ -1024,18 +1107,10 @@ func ExampleClient_BeginUpdate() { // Size: to.Ptr("P1"), // Tier: to.Ptr(armsignalr.SignalRSKUTierPremium), // }, - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_ListKeys.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_ListKeys.json func ExampleClient_ListKeys() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1057,7 +1132,7 @@ func ExampleClient_ListKeys() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_RegenerateKey.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_RegenerateKey.json func ExampleClient_BeginRegenerateKey() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1074,13 +1149,122 @@ func ExampleClient_BeginRegenerateKey() { if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + 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.Keys = armsignalr.Keys{ + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_Restart.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_ListReplicaSkus.json +func ExampleClient_ListReplicaSKUs() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsignalr.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewClient().ListReplicaSKUs(ctx, "myResourceGroup", "mySignalRService", "mySignalRService-eastus", 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.SKUList = armsignalr.SKUList{ + // Value: []*armsignalr.SKU{ + // { + // Capacity: &armsignalr.SKUCapacity{ + // Default: to.Ptr[int32](1), + // AllowedValues: []*int32{ + // to.Ptr[int32](1)}, + // Maximum: to.Ptr[int32](1), + // Minimum: to.Ptr[int32](0), + // ScaleType: to.Ptr(armsignalr.ScaleTypeManual), + // }, + // ResourceType: to.Ptr("Microsoft.SignalRService/SignalR/replicas"), + // SKU: &armsignalr.ResourceSKU{ + // Name: to.Ptr("Free_F1"), + // Tier: to.Ptr(armsignalr.SignalRSKUTierFree), + // }, + // }, + // { + // Capacity: &armsignalr.SKUCapacity{ + // Default: to.Ptr[int32](1), + // AllowedValues: []*int32{ + // to.Ptr[int32](1), + // to.Ptr[int32](2), + // to.Ptr[int32](3), + // to.Ptr[int32](4), + // to.Ptr[int32](5), + // to.Ptr[int32](6), + // to.Ptr[int32](7), + // to.Ptr[int32](8), + // to.Ptr[int32](9), + // to.Ptr[int32](10), + // to.Ptr[int32](20), + // to.Ptr[int32](30), + // to.Ptr[int32](40), + // to.Ptr[int32](50), + // to.Ptr[int32](60), + // to.Ptr[int32](70), + // to.Ptr[int32](80), + // to.Ptr[int32](90), + // to.Ptr[int32](100)}, + // Maximum: to.Ptr[int32](100), + // Minimum: to.Ptr[int32](0), + // ScaleType: to.Ptr(armsignalr.ScaleTypeManual), + // }, + // ResourceType: to.Ptr("Microsoft.SignalRService/SignalR/replicas"), + // SKU: &armsignalr.ResourceSKU{ + // Name: to.Ptr("Standard_S1"), + // Tier: to.Ptr(armsignalr.SignalRSKUTierStandard), + // }, + // }, + // { + // Capacity: &armsignalr.SKUCapacity{ + // Default: to.Ptr[int32](1), + // AllowedValues: []*int32{ + // to.Ptr[int32](1), + // to.Ptr[int32](2), + // to.Ptr[int32](3), + // to.Ptr[int32](4), + // to.Ptr[int32](5), + // to.Ptr[int32](6), + // to.Ptr[int32](7), + // to.Ptr[int32](8), + // to.Ptr[int32](9), + // to.Ptr[int32](10), + // to.Ptr[int32](20), + // to.Ptr[int32](30), + // to.Ptr[int32](40), + // to.Ptr[int32](50), + // to.Ptr[int32](60), + // to.Ptr[int32](70), + // to.Ptr[int32](80), + // to.Ptr[int32](90), + // to.Ptr[int32](100)}, + // Maximum: to.Ptr[int32](100), + // Minimum: to.Ptr[int32](0), + // ScaleType: to.Ptr(armsignalr.ScaleTypeAutomatic), + // }, + // ResourceType: to.Ptr("Microsoft.SignalRService/SignalR/replicas"), + // SKU: &armsignalr.ResourceSKU{ + // Name: to.Ptr("Premium_P1"), + // Tier: to.Ptr(armsignalr.SignalRSKUTierStandard), + // }, + // }}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_Restart.json func ExampleClient_BeginRestart() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1101,7 +1285,7 @@ func ExampleClient_BeginRestart() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_ListSkus.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_ListSkus.json func ExampleClient_ListSKUs() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1125,7 +1309,6 @@ func ExampleClient_ListSKUs() { // Capacity: &armsignalr.SKUCapacity{ // Default: to.Ptr[int32](1), // AllowedValues: []*int32{ - // to.Ptr[int32](0), // to.Ptr[int32](1)}, // Maximum: to.Ptr[int32](1), // Minimum: to.Ptr[int32](0), @@ -1141,23 +1324,67 @@ func ExampleClient_ListSKUs() { // Capacity: &armsignalr.SKUCapacity{ // Default: to.Ptr[int32](1), // AllowedValues: []*int32{ - // to.Ptr[int32](0), // to.Ptr[int32](1), // to.Ptr[int32](2), + // to.Ptr[int32](3), + // to.Ptr[int32](4), // to.Ptr[int32](5), + // to.Ptr[int32](6), + // to.Ptr[int32](7), + // to.Ptr[int32](8), + // to.Ptr[int32](9), // to.Ptr[int32](10), // to.Ptr[int32](20), + // to.Ptr[int32](30), + // to.Ptr[int32](40), // to.Ptr[int32](50), + // to.Ptr[int32](60), + // to.Ptr[int32](70), + // to.Ptr[int32](80), + // to.Ptr[int32](90), // to.Ptr[int32](100)}, // Maximum: to.Ptr[int32](100), // Minimum: to.Ptr[int32](0), - // ScaleType: to.Ptr(armsignalr.ScaleTypeAutomatic), + // ScaleType: to.Ptr(armsignalr.ScaleTypeManual), // }, // ResourceType: to.Ptr("Microsoft.SignalRService/SignalR"), // SKU: &armsignalr.ResourceSKU{ // Name: to.Ptr("Standard_S1"), // Tier: to.Ptr(armsignalr.SignalRSKUTierStandard), // }, - // }}, - // } + // }, + // { + // Capacity: &armsignalr.SKUCapacity{ + // Default: to.Ptr[int32](1), + // AllowedValues: []*int32{ + // to.Ptr[int32](1), + // to.Ptr[int32](2), + // to.Ptr[int32](3), + // to.Ptr[int32](4), + // to.Ptr[int32](5), + // to.Ptr[int32](6), + // to.Ptr[int32](7), + // to.Ptr[int32](8), + // to.Ptr[int32](9), + // to.Ptr[int32](10), + // to.Ptr[int32](20), + // to.Ptr[int32](30), + // to.Ptr[int32](40), + // to.Ptr[int32](50), + // to.Ptr[int32](60), + // to.Ptr[int32](70), + // to.Ptr[int32](80), + // to.Ptr[int32](90), + // to.Ptr[int32](100)}, + // Maximum: to.Ptr[int32](100), + // Minimum: to.Ptr[int32](0), + // ScaleType: to.Ptr(armsignalr.ScaleTypeAutomatic), + // }, + // ResourceType: to.Ptr("Microsoft.SignalRService/SignalR/replicas"), + // SKU: &armsignalr.ResourceSKU{ + // Name: to.Ptr("Premium_P1"), + // Tier: to.Ptr(armsignalr.SignalRSKUTierStandard), + // }, + // }}, + // } } diff --git a/sdk/resourcemanager/signalr/armsignalr/client_factory.go b/sdk/resourcemanager/signalr/armsignalr/client_factory.go index 0dfc3a860ef2..ba8d712211ba 100644 --- a/sdk/resourcemanager/signalr/armsignalr/client_factory.go +++ b/sdk/resourcemanager/signalr/armsignalr/client_factory.go @@ -23,8 +23,7 @@ type ClientFactory struct { // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. -// - subscriptionID - Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - 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) { @@ -74,6 +73,12 @@ func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesCli return subClient } +// NewReplicasClient creates a new instance of ReplicasClient. +func (c *ClientFactory) NewReplicasClient() *ReplicasClient { + subClient, _ := NewReplicasClient(c.subscriptionID, c.credential, c.options) + return subClient +} + // NewSharedPrivateLinkResourcesClient creates a new instance of SharedPrivateLinkResourcesClient. func (c *ClientFactory) NewSharedPrivateLinkResourcesClient() *SharedPrivateLinkResourcesClient { subClient, _ := NewSharedPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) diff --git a/sdk/resourcemanager/signalr/armsignalr/constants.go b/sdk/resourcemanager/signalr/armsignalr/constants.go index 9385b5c748f1..5a19134545a1 100644 --- a/sdk/resourcemanager/signalr/armsignalr/constants.go +++ b/sdk/resourcemanager/signalr/armsignalr/constants.go @@ -10,7 +10,7 @@ package armsignalr const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/signalr/armsignalr" - moduleVersion = "v1.2.0" + moduleVersion = "v1.3.0-beta.1" ) // ACLAction - Azure Networking ACL Action. @@ -184,7 +184,7 @@ func PossibleScaleTypeValues() []ScaleType { } } -// ServiceKind - The kind of the service, it can be SignalR or RawWebSockets +// ServiceKind - The kind of the service type ServiceKind string const ( diff --git a/sdk/resourcemanager/signalr/armsignalr/customcertificates_client.go b/sdk/resourcemanager/signalr/armsignalr/customcertificates_client.go index ba76c47265c4..cb07f0248f3c 100644 --- a/sdk/resourcemanager/signalr/armsignalr/customcertificates_client.go +++ b/sdk/resourcemanager/signalr/armsignalr/customcertificates_client.go @@ -28,8 +28,7 @@ type CustomCertificatesClient struct { } // NewCustomCertificatesClient creates a new instance of CustomCertificatesClient with the specified values. -// - subscriptionID - Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewCustomCertificatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CustomCertificatesClient, error) { @@ -47,9 +46,8 @@ func NewCustomCertificatesClient(subscriptionID string, credential azcore.TokenC // BeginCreateOrUpdate - Create or update a custom certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - certificateName - Custom certificate name // - options - CustomCertificatesClientBeginCreateOrUpdateOptions contains the optional parameters for the CustomCertificatesClient.BeginCreateOrUpdate @@ -61,7 +59,8 @@ func (client *CustomCertificatesClient) BeginCreateOrUpdate(ctx context.Context, return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CustomCertificatesClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -74,7 +73,7 @@ func (client *CustomCertificatesClient) BeginCreateOrUpdate(ctx context.Context, // CreateOrUpdate - Create or update a custom certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview func (client *CustomCertificatesClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, parameters CustomCertificate, options *CustomCertificatesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "CustomCertificatesClient.BeginCreateOrUpdate" @@ -120,7 +119,7 @@ func (client *CustomCertificatesClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -132,9 +131,8 @@ func (client *CustomCertificatesClient) createOrUpdateCreateRequest(ctx context. // Delete - Delete a custom certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - certificateName - Custom certificate name // - options - CustomCertificatesClientDeleteOptions contains the optional parameters for the CustomCertificatesClient.Delete @@ -184,7 +182,7 @@ func (client *CustomCertificatesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -193,9 +191,8 @@ func (client *CustomCertificatesClient) deleteCreateRequest(ctx context.Context, // Get - Get a custom certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - certificateName - Custom certificate name // - options - CustomCertificatesClientGetOptions contains the optional parameters for the CustomCertificatesClient.Get method. @@ -245,7 +242,7 @@ func (client *CustomCertificatesClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -262,9 +259,8 @@ func (client *CustomCertificatesClient) getHandleResponse(resp *http.Response) ( // NewListPager - List all custom certificates. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - CustomCertificatesClientListOptions contains the optional parameters for the CustomCertificatesClient.NewListPager // method. @@ -311,7 +307,7 @@ func (client *CustomCertificatesClient) listCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/signalr/armsignalr/customcertificates_client_example_test.go b/sdk/resourcemanager/signalr/armsignalr/customcertificates_client_example_test.go index 624cf1f4aeef..d323bded677b 100644 --- a/sdk/resourcemanager/signalr/armsignalr/customcertificates_client_example_test.go +++ b/sdk/resourcemanager/signalr/armsignalr/customcertificates_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/signalr/armsignalr" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomCertificates_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomCertificates_List.json func ExampleCustomCertificatesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -57,7 +57,7 @@ func ExampleCustomCertificatesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomCertificates_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomCertificates_Get.json func ExampleCustomCertificatesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -88,7 +88,7 @@ func ExampleCustomCertificatesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomCertificates_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomCertificates_CreateOrUpdate.json func ExampleCustomCertificatesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -129,7 +129,7 @@ func ExampleCustomCertificatesClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomCertificates_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomCertificates_Delete.json func ExampleCustomCertificatesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/signalr/armsignalr/customdomains_client.go b/sdk/resourcemanager/signalr/armsignalr/customdomains_client.go index 112744643dca..2a9857868f30 100644 --- a/sdk/resourcemanager/signalr/armsignalr/customdomains_client.go +++ b/sdk/resourcemanager/signalr/armsignalr/customdomains_client.go @@ -28,8 +28,7 @@ type CustomDomainsClient struct { } // NewCustomDomainsClient creates a new instance of CustomDomainsClient with the specified values. -// - subscriptionID - Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewCustomDomainsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CustomDomainsClient, error) { @@ -47,9 +46,8 @@ func NewCustomDomainsClient(subscriptionID string, credential azcore.TokenCreden // BeginCreateOrUpdate - Create or update a custom domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - name - Custom domain name. // - options - CustomDomainsClientBeginCreateOrUpdateOptions contains the optional parameters for the CustomDomainsClient.BeginCreateOrUpdate @@ -61,7 +59,8 @@ func (client *CustomDomainsClient) BeginCreateOrUpdate(ctx context.Context, reso return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CustomDomainsClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -74,7 +73,7 @@ func (client *CustomDomainsClient) BeginCreateOrUpdate(ctx context.Context, reso // CreateOrUpdate - Create or update a custom domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview func (client *CustomDomainsClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, name string, parameters CustomDomain, options *CustomDomainsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "CustomDomainsClient.BeginCreateOrUpdate" @@ -120,7 +119,7 @@ func (client *CustomDomainsClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -132,9 +131,8 @@ func (client *CustomDomainsClient) createOrUpdateCreateRequest(ctx context.Conte // BeginDelete - Delete a custom domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - name - Custom domain name. // - options - CustomDomainsClientBeginDeleteOptions contains the optional parameters for the CustomDomainsClient.BeginDelete @@ -160,7 +158,7 @@ func (client *CustomDomainsClient) BeginDelete(ctx context.Context, resourceGrou // Delete - Delete a custom domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview func (client *CustomDomainsClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, name string, options *CustomDomainsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CustomDomainsClient.BeginDelete" @@ -206,7 +204,7 @@ func (client *CustomDomainsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -215,9 +213,8 @@ func (client *CustomDomainsClient) deleteCreateRequest(ctx context.Context, reso // Get - Get a custom domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - name - Custom domain name. // - options - CustomDomainsClientGetOptions contains the optional parameters for the CustomDomainsClient.Get method. @@ -267,7 +264,7 @@ func (client *CustomDomainsClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -284,9 +281,8 @@ func (client *CustomDomainsClient) getHandleResponse(resp *http.Response) (Custo // NewListPager - List all custom domains. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - CustomDomainsClientListOptions contains the optional parameters for the CustomDomainsClient.NewListPager method. func (client *CustomDomainsClient) NewListPager(resourceGroupName string, resourceName string, options *CustomDomainsClientListOptions) *runtime.Pager[CustomDomainsClientListResponse] { @@ -332,7 +328,7 @@ func (client *CustomDomainsClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/signalr/armsignalr/customdomains_client_example_test.go b/sdk/resourcemanager/signalr/armsignalr/customdomains_client_example_test.go index bf0888c32ac3..57742a4d0fd4 100644 --- a/sdk/resourcemanager/signalr/armsignalr/customdomains_client_example_test.go +++ b/sdk/resourcemanager/signalr/armsignalr/customdomains_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/signalr/armsignalr" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomDomains_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomDomains_List.json func ExampleCustomDomainsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -57,7 +57,7 @@ func ExampleCustomDomainsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomDomains_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomDomains_Get.json func ExampleCustomDomainsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -88,7 +88,7 @@ func ExampleCustomDomainsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomDomains_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomDomains_CreateOrUpdate.json func ExampleCustomDomainsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -116,7 +116,7 @@ func ExampleCustomDomainsClient_BeginCreateOrUpdate() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomDomains_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomDomains_Delete.json func ExampleCustomDomainsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/signalr/armsignalr/fake/replicas_server.go b/sdk/resourcemanager/signalr/armsignalr/fake/replicas_server.go new file mode 100644 index 000000000000..62e9a9803275 --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/fake/replicas_server.go @@ -0,0 +1,375 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/signalr/armsignalr" + "net/http" + "net/url" + "regexp" +) + +// ReplicasServer is a fake server for instances of the armsignalr.ReplicasClient type. +type ReplicasServer struct { + // BeginCreateOrUpdate is the fake for method ReplicasClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters armsignalr.Replica, options *armsignalr.ReplicasClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armsignalr.ReplicasClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method ReplicasClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *armsignalr.ReplicasClientDeleteOptions) (resp azfake.Responder[armsignalr.ReplicasClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ReplicasClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *armsignalr.ReplicasClientGetOptions) (resp azfake.Responder[armsignalr.ReplicasClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method ReplicasClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, resourceName string, options *armsignalr.ReplicasClientListOptions) (resp azfake.PagerResponder[armsignalr.ReplicasClientListResponse]) + + // BeginRestart is the fake for method ReplicasClient.BeginRestart + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginRestart func(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *armsignalr.ReplicasClientBeginRestartOptions) (resp azfake.PollerResponder[armsignalr.ReplicasClientRestartResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method ReplicasClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters armsignalr.Replica, options *armsignalr.ReplicasClientBeginUpdateOptions) (resp azfake.PollerResponder[armsignalr.ReplicasClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewReplicasServerTransport creates a new instance of ReplicasServerTransport with the provided implementation. +// The returned ReplicasServerTransport instance is connected to an instance of armsignalr.ReplicasClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewReplicasServerTransport(srv *ReplicasServer) *ReplicasServerTransport { + return &ReplicasServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armsignalr.ReplicasClientCreateOrUpdateResponse]](), + newListPager: newTracker[azfake.PagerResponder[armsignalr.ReplicasClientListResponse]](), + beginRestart: newTracker[azfake.PollerResponder[armsignalr.ReplicasClientRestartResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armsignalr.ReplicasClientUpdateResponse]](), + } +} + +// ReplicasServerTransport connects instances of armsignalr.ReplicasClient to instances of ReplicasServer. +// Don't use this type directly, use NewReplicasServerTransport instead. +type ReplicasServerTransport struct { + srv *ReplicasServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armsignalr.ReplicasClientCreateOrUpdateResponse]] + newListPager *tracker[azfake.PagerResponder[armsignalr.ReplicasClientListResponse]] + beginRestart *tracker[azfake.PollerResponder[armsignalr.ReplicasClientRestartResponse]] + beginUpdate *tracker[azfake.PollerResponder[armsignalr.ReplicasClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for ReplicasServerTransport. +func (r *ReplicasServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ReplicasClient.BeginCreateOrUpdate": + resp, err = r.dispatchBeginCreateOrUpdate(req) + case "ReplicasClient.Delete": + resp, err = r.dispatchDelete(req) + case "ReplicasClient.Get": + resp, err = r.dispatchGet(req) + case "ReplicasClient.NewListPager": + resp, err = r.dispatchNewListPager(req) + case "ReplicasClient.BeginRestart": + resp, err = r.dispatchBeginRestart(req) + case "ReplicasClient.BeginUpdate": + resp, err = r.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (r *ReplicasServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if r.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := r.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/signalR/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsignalr.Replica](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + replicaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("replicaName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, resourceNameParam, replicaNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + r.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + r.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + r.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (r *ReplicasServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if r.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/signalR/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + replicaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("replicaName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.Delete(req.Context(), resourceGroupNameParam, resourceNameParam, replicaNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (r *ReplicasServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if r.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/signalR/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + replicaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("replicaName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.Get(req.Context(), resourceGroupNameParam, resourceNameParam, replicaNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Replica, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (r *ReplicasServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if r.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := r.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/signalR/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + resp := r.srv.NewListPager(resourceGroupNameParam, resourceNameParam, nil) + newListPager = &resp + r.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsignalr.ReplicasClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + r.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + r.newListPager.remove(req) + } + return resp, nil +} + +func (r *ReplicasServerTransport) dispatchBeginRestart(req *http.Request) (*http.Response, error) { + if r.srv.BeginRestart == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginRestart not implemented")} + } + beginRestart := r.beginRestart.get(req) + if beginRestart == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/signalR/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/restart` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + replicaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("replicaName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.BeginRestart(req.Context(), resourceGroupNameParam, resourceNameParam, replicaNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginRestart = &respr + r.beginRestart.add(req, beginRestart) + } + + resp, err := server.PollerResponderNext(beginRestart, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + r.beginRestart.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginRestart) { + r.beginRestart.remove(req) + } + + return resp, nil +} + +func (r *ReplicasServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if r.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := r.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/signalR/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsignalr.Replica](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + replicaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("replicaName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.BeginUpdate(req.Context(), resourceGroupNameParam, resourceNameParam, replicaNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + r.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + r.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + r.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/signalr/armsignalr/fake/server.go b/sdk/resourcemanager/signalr/armsignalr/fake/server.go index f3d2f9580bb7..c590b3b25717 100644 --- a/sdk/resourcemanager/signalr/armsignalr/fake/server.go +++ b/sdk/resourcemanager/signalr/armsignalr/fake/server.go @@ -52,12 +52,16 @@ type Server struct { // HTTP status codes to indicate success: http.StatusOK ListKeys func(ctx context.Context, resourceGroupName string, resourceName string, options *armsignalr.ClientListKeysOptions) (resp azfake.Responder[armsignalr.ClientListKeysResponse], errResp azfake.ErrorResponder) + // ListReplicaSKUs is the fake for method Client.ListReplicaSKUs + // HTTP status codes to indicate success: http.StatusOK + ListReplicaSKUs func(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *armsignalr.ClientListReplicaSKUsOptions) (resp azfake.Responder[armsignalr.ClientListReplicaSKUsResponse], errResp azfake.ErrorResponder) + // ListSKUs is the fake for method Client.ListSKUs // HTTP status codes to indicate success: http.StatusOK ListSKUs func(ctx context.Context, resourceGroupName string, resourceName string, options *armsignalr.ClientListSKUsOptions) (resp azfake.Responder[armsignalr.ClientListSKUsResponse], errResp azfake.ErrorResponder) // BeginRegenerateKey is the fake for method Client.BeginRegenerateKey - // HTTP status codes to indicate success: http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginRegenerateKey func(ctx context.Context, resourceGroupName string, resourceName string, parameters armsignalr.RegenerateKeyParameters, options *armsignalr.ClientBeginRegenerateKeyOptions) (resp azfake.PollerResponder[armsignalr.ClientRegenerateKeyResponse], errResp azfake.ErrorResponder) // BeginRestart is the fake for method Client.BeginRestart @@ -124,6 +128,8 @@ func (s *ServerTransport) Do(req *http.Request) (*http.Response, error) { resp, err = s.dispatchNewListBySubscriptionPager(req) case "Client.ListKeys": resp, err = s.dispatchListKeys(req) + case "Client.ListReplicaSKUs": + resp, err = s.dispatchListReplicaSKUs(req) case "Client.ListSKUs": resp, err = s.dispatchListSKUs(req) case "Client.BeginRegenerateKey": @@ -404,6 +410,43 @@ func (s *ServerTransport) dispatchListKeys(req *http.Request) (*http.Response, e return resp, nil } +func (s *ServerTransport) dispatchListReplicaSKUs(req *http.Request) (*http.Response, error) { + if s.srv.ListReplicaSKUs == nil { + return nil, &nonRetriableError{errors.New("fake for method ListReplicaSKUs not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/signalR/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/skus` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + replicaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("replicaName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.ListReplicaSKUs(req.Context(), resourceGroupNameParam, resourceNameParam, replicaNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SKUList, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (s *ServerTransport) dispatchListSKUs(req *http.Request) (*http.Response, error) { if s.srv.ListSKUs == nil { return nil, &nonRetriableError{errors.New("fake for method ListSKUs not implemented")} @@ -474,9 +517,9 @@ func (s *ServerTransport) dispatchBeginRegenerateKey(req *http.Request) (*http.R return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { s.beginRegenerateKey.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } if !server.PollerResponderMore(beginRegenerateKey) { s.beginRegenerateKey.remove(req) diff --git a/sdk/resourcemanager/signalr/armsignalr/fake/server_factory.go b/sdk/resourcemanager/signalr/armsignalr/fake/server_factory.go index afc870f318b4..1e7c73b07ce2 100644 --- a/sdk/resourcemanager/signalr/armsignalr/fake/server_factory.go +++ b/sdk/resourcemanager/signalr/armsignalr/fake/server_factory.go @@ -25,6 +25,7 @@ type ServerFactory struct { OperationsServer OperationsServer PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer PrivateLinkResourcesServer PrivateLinkResourcesServer + ReplicasServer ReplicasServer SharedPrivateLinkResourcesServer SharedPrivateLinkResourcesServer UsagesServer UsagesServer } @@ -49,6 +50,7 @@ type ServerFactoryTransport struct { trOperationsServer *OperationsServerTransport trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport trPrivateLinkResourcesServer *PrivateLinkResourcesServerTransport + trReplicasServer *ReplicasServerTransport trSharedPrivateLinkResourcesServer *SharedPrivateLinkResourcesServerTransport trUsagesServer *UsagesServerTransport } @@ -92,6 +94,9 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewPrivateLinkResourcesServerTransport(&s.srv.PrivateLinkResourcesServer) }) resp, err = s.trPrivateLinkResourcesServer.Do(req) + case "ReplicasClient": + initServer(s, &s.trReplicasServer, func() *ReplicasServerTransport { return NewReplicasServerTransport(&s.srv.ReplicasServer) }) + resp, err = s.trReplicasServer.Do(req) case "SharedPrivateLinkResourcesClient": initServer(s, &s.trSharedPrivateLinkResourcesServer, func() *SharedPrivateLinkResourcesServerTransport { return NewSharedPrivateLinkResourcesServerTransport(&s.srv.SharedPrivateLinkResourcesServer) diff --git a/sdk/resourcemanager/signalr/armsignalr/models.go b/sdk/resourcemanager/signalr/armsignalr/models.go index 096e0fdeb19f..1769ee7076d5 100644 --- a/sdk/resourcemanager/signalr/armsignalr/models.go +++ b/sdk/resourcemanager/signalr/armsignalr/models.go @@ -22,16 +22,16 @@ type CustomCertificate struct { // REQUIRED; Custom certificate properties. Properties *CustomCertificateProperties - // READ-ONLY; Fully qualified resource Id for the resource. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; The name of the resource. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -64,16 +64,16 @@ type CustomDomain struct { // REQUIRED; Properties of a custom domain. Properties *CustomDomainProperties - // READ-ONLY; Fully qualified resource Id for the resource. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; The name of the resource. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -136,6 +136,15 @@ type Feature struct { Properties map[string]*string } +// IPRule - An IP rule +type IPRule struct { + // Azure Networking ACL Action. + Action *ACLAction + + // An IP or CIDR or ServiceTag + Value *string +} + // Keys - A class represents the access keys of the resource. type Keys struct { // Connection string constructed via the primaryKey @@ -249,7 +258,8 @@ type NameAvailabilityParameters struct { // REQUIRED; The resource name to validate. e.g."my-resource-name" Name *string - // REQUIRED; The resource type. Can be "Microsoft.SignalRService/SignalR" or "Microsoft.SignalRService/webPubSub" + // REQUIRED; The resource type. Can be "Microsoft.SignalRService/SignalR", "Microsoft.SignalRService/WebPubSub", "Microsoft.SignalRService/SignalR/replicas" + // or "Microsoft.SignalRService/WebPubSub/replicas" Type *string } @@ -267,6 +277,9 @@ type NetworkACLs struct { // Azure Networking ACL Action. DefaultAction *ACLAction + // IP rules for filtering public traffic + IPRules []*IPRule + // ACLs for requests from private endpoints PrivateEndpoints []*PrivateEndpointACL @@ -346,16 +359,16 @@ type PrivateEndpointConnection struct { // Private endpoint connection properties Properties *PrivateEndpointConnectionProperties - // READ-ONLY; Fully qualified resource Id for the resource. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; The name of the resource. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -389,13 +402,16 @@ type PrivateLinkResource struct { // Private link resource properties Properties *PrivateLinkResourceProperties - // READ-ONLY; Fully qualified resource Id for the resource. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; The name of the resource. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -464,9 +480,18 @@ type Properties struct { // network ACLs. PublicNetworkAccess *string + // Enable or disable the regional endpoint. Default to "Enabled". When it's Disabled, new connections will not be routed to + // this endpoint, however existing connections will not be affected. This property + // is replica specific. Disable the regional endpoint without replica is not allowed. + RegionEndpointEnabled *string + // Resource log configuration of a Microsoft.SignalRService resource. ResourceLogConfiguration *ResourceLogConfiguration + // Stop or start the resource. Default to "False". When it's true, the data plane of the resource is shutdown. When it's false, + // the data plane of the resource is started. + ResourceStopped *string + // Serverless settings. Serverless *ServerlessSettings @@ -510,36 +535,82 @@ type RegenerateKeyParameters struct { KeyType *KeyType } +// Replica - A class represent a replica resource. +type Replica struct { + // REQUIRED; The geo-location where the resource lives + Location *string + Properties *ReplicaProperties + + // The billing information of the resource. + SKU *ResourceSKU + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +type ReplicaList struct { + // The URL the client should use to fetch the next page (per server side paging). It's null for now, added for future use. + NextLink *string + + // List of the replica + Value []*Replica +} + +type ReplicaProperties struct { + // Enable or disable the regional endpoint. Default to "Enabled". When it's Disabled, new connections will not be routed to + // this endpoint, however existing connections will not be affected. + RegionEndpointEnabled *string + + // Stop or start the resource. Default to "false". When it's true, the data plane of the resource is shutdown. When it's false, + // the data plane of the resource is started. + ResourceStopped *string + + // READ-ONLY; Provisioning state of the resource. + ProvisioningState *ProvisioningState +} + // ResourceInfo - A class represent a resource. type ResourceInfo struct { + // REQUIRED; The geo-location where the resource lives + Location *string + // A class represent managed identities used for request and response Identity *ManagedIdentity - // The kind of the service, it can be SignalR or RawWebSockets + // The kind of the service Kind *ServiceKind - // The GEO location of the resource. e.g. West US | East US | North Central US | South Central US. - Location *string - // A class that describes the properties of the resource Properties *Properties // The billing information of the resource. SKU *ResourceSKU - // Tags of the service which is a list of key value pairs that describe the resource. + // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource Id for the resource. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; The name of the resource. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -688,16 +759,16 @@ type SharedPrivateLinkResource struct { // Describes the properties of an existing Shared Private Link Resource Properties *SharedPrivateLinkResourceProperties - // READ-ONLY; Fully qualified resource Id for the resource. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; The name of the resource. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -752,7 +823,8 @@ type SystemData struct { // TLSSettings - TLS settings for the resource type TLSSettings struct { - // Request client certificate during TLS handshake if enabled + // Request client certificate during TLS handshake if enabled. Not supported for free tier. Any input will be ignored for + // free tier. ClientCertEnabled *bool } diff --git a/sdk/resourcemanager/signalr/armsignalr/models_serde.go b/sdk/resourcemanager/signalr/armsignalr/models_serde.go index 8d7bf299c7d4..f0ee3e4eb801 100644 --- a/sdk/resourcemanager/signalr/armsignalr/models_serde.go +++ b/sdk/resourcemanager/signalr/armsignalr/models_serde.go @@ -338,6 +338,37 @@ func (f *Feature) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type IPRule. +func (i IPRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "action", i.Action) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPRule. +func (i *IPRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &i.Action) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Keys. func (k Keys) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -692,6 +723,7 @@ func (n *NetworkACL) UnmarshalJSON(data []byte) error { func (n NetworkACLs) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "defaultAction", n.DefaultAction) + populate(objectMap, "ipRules", n.IPRules) populate(objectMap, "privateEndpoints", n.PrivateEndpoints) populate(objectMap, "publicNetwork", n.PublicNetwork) return json.Marshal(objectMap) @@ -709,6 +741,9 @@ func (n *NetworkACLs) UnmarshalJSON(data []byte) error { case "defaultAction": err = unpopulate(val, "DefaultAction", &n.DefaultAction) delete(rawMsg, key) + case "ipRules": + err = unpopulate(val, "IPRules", &n.IPRules) + delete(rawMsg, key) case "privateEndpoints": err = unpopulate(val, "PrivateEndpoints", &n.PrivateEndpoints) delete(rawMsg, key) @@ -1044,6 +1079,7 @@ func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } @@ -1066,6 +1102,9 @@ func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) @@ -1198,7 +1237,9 @@ func (p Properties) MarshalJSON() ([]byte, error) { populate(objectMap, "provisioningState", p.ProvisioningState) populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) populate(objectMap, "publicPort", p.PublicPort) + populate(objectMap, "regionEndpointEnabled", p.RegionEndpointEnabled) populate(objectMap, "resourceLogConfiguration", p.ResourceLogConfiguration) + populate(objectMap, "resourceStopped", p.ResourceStopped) populate(objectMap, "serverPort", p.ServerPort) populate(objectMap, "serverless", p.Serverless) populate(objectMap, "sharedPrivateLinkResources", p.SharedPrivateLinkResources) @@ -1256,9 +1297,15 @@ func (p *Properties) UnmarshalJSON(data []byte) error { case "publicPort": err = unpopulate(val, "PublicPort", &p.PublicPort) delete(rawMsg, key) + case "regionEndpointEnabled": + err = unpopulate(val, "RegionEndpointEnabled", &p.RegionEndpointEnabled) + delete(rawMsg, key) case "resourceLogConfiguration": err = unpopulate(val, "ResourceLogConfiguration", &p.ResourceLogConfiguration) delete(rawMsg, key) + case "resourceStopped": + err = unpopulate(val, "ResourceStopped", &p.ResourceStopped) + delete(rawMsg, key) case "serverPort": err = unpopulate(val, "ServerPort", &p.ServerPort) delete(rawMsg, key) @@ -1312,6 +1359,127 @@ func (r *RegenerateKeyParameters) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Replica. +func (r Replica) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "sku", r.SKU) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Replica. +func (r *Replica) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &r.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReplicaList. +func (r ReplicaList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicaList. +func (r *ReplicaList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReplicaProperties. +func (r ReplicaProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "regionEndpointEnabled", r.RegionEndpointEnabled) + populate(objectMap, "resourceStopped", r.ResourceStopped) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicaProperties. +func (r *ReplicaProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "regionEndpointEnabled": + err = unpopulate(val, "RegionEndpointEnabled", &r.RegionEndpointEnabled) + delete(rawMsg, key) + case "resourceStopped": + err = unpopulate(val, "ResourceStopped", &r.ResourceStopped) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ResourceInfo. func (r ResourceInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/sdk/resourcemanager/signalr/armsignalr/operations_client.go b/sdk/resourcemanager/signalr/armsignalr/operations_client.go index ca293cf359dc..24176b969039 100644 --- a/sdk/resourcemanager/signalr/armsignalr/operations_client.go +++ b/sdk/resourcemanager/signalr/armsignalr/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available REST API operations of the Microsoft.SignalRService provider. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-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", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/signalr/armsignalr/operations_client_example_test.go b/sdk/resourcemanager/signalr/armsignalr/operations_client_example_test.go index 75545b78ab75..16a1964ea81e 100644 --- a/sdk/resourcemanager/signalr/armsignalr/operations_client_example_test.go +++ b/sdk/resourcemanager/signalr/armsignalr/operations_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/signalr/armsignalr" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/Operations_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/Operations_List.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/signalr/armsignalr/options.go b/sdk/resourcemanager/signalr/armsignalr/options.go index aca4ba099782..dd5236936463 100644 --- a/sdk/resourcemanager/signalr/armsignalr/options.go +++ b/sdk/resourcemanager/signalr/armsignalr/options.go @@ -63,6 +63,11 @@ type ClientListKeysOptions struct { // placeholder for future optional parameters } +// ClientListReplicaSKUsOptions contains the optional parameters for the Client.ListReplicaSKUs method. +type ClientListReplicaSKUsOptions struct { + // placeholder for future optional parameters +} + // ClientListSKUsOptions contains the optional parameters for the Client.ListSKUs method. type ClientListSKUsOptions struct { // placeholder for future optional parameters @@ -149,6 +154,39 @@ type PrivateLinkResourcesClientListOptions struct { // placeholder for future optional parameters } +// ReplicasClientBeginCreateOrUpdateOptions contains the optional parameters for the ReplicasClient.BeginCreateOrUpdate method. +type ReplicasClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ReplicasClientBeginRestartOptions contains the optional parameters for the ReplicasClient.BeginRestart method. +type ReplicasClientBeginRestartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ReplicasClientBeginUpdateOptions contains the optional parameters for the ReplicasClient.BeginUpdate method. +type ReplicasClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ReplicasClientDeleteOptions contains the optional parameters for the ReplicasClient.Delete method. +type ReplicasClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ReplicasClientGetOptions contains the optional parameters for the ReplicasClient.Get method. +type ReplicasClientGetOptions struct { + // placeholder for future optional parameters +} + +// ReplicasClientListOptions contains the optional parameters for the ReplicasClient.NewListPager method. +type ReplicasClientListOptions struct { + // placeholder for future optional parameters +} + // SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginCreateOrUpdate // method. type SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions struct { diff --git a/sdk/resourcemanager/signalr/armsignalr/privateendpointconnections_client.go b/sdk/resourcemanager/signalr/armsignalr/privateendpointconnections_client.go index b644d19f40b2..a339096ee576 100644 --- a/sdk/resourcemanager/signalr/armsignalr/privateendpointconnections_client.go +++ b/sdk/resourcemanager/signalr/armsignalr/privateendpointconnections_client.go @@ -28,8 +28,7 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -// - subscriptionID - Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { @@ -47,10 +46,9 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginDelete - Delete the specified private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - privateEndpointConnectionName - The name of the private endpoint connection -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete // method. @@ -75,7 +73,7 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Delete the specified private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginDelete" @@ -121,7 +119,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -130,10 +128,9 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Get the specified private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - privateEndpointConnectionName - The name of the private endpoint connection -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get // method. @@ -183,7 +180,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -200,9 +197,8 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListPager - List private endpoint connections // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager // method. @@ -249,7 +245,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,10 +263,9 @@ func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Re // Update - Update the state of specified private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - privateEndpointConnectionName - The name of the private endpoint connection -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - parameters - The resource of private endpoint and its properties // - options - PrivateEndpointConnectionsClientUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Update @@ -321,7 +316,7 @@ func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-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/signalr/armsignalr/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/signalr/armsignalr/privateendpointconnections_client_example_test.go index 54daaa20fc5d..d28ac6905229 100644 --- a/sdk/resourcemanager/signalr/armsignalr/privateendpointconnections_client_example_test.go +++ b/sdk/resourcemanager/signalr/armsignalr/privateendpointconnections_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/signalr/armsignalr" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRPrivateEndpointConnections_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRPrivateEndpointConnections_List.json func ExamplePrivateEndpointConnectionsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -46,6 +46,14 @@ func ExamplePrivateEndpointConnectionsClient_NewListPager() { // Name: to.Ptr("mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), // Type: to.Ptr("Microsoft.SignalRService/SignalR/privateEndpointConnections"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // SystemData: &armsignalr.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // }, // Properties: &armsignalr.PrivateEndpointConnectionProperties{ // GroupIDs: []*string{ // to.Ptr("signalr")}, @@ -58,20 +66,12 @@ func ExamplePrivateEndpointConnectionsClient_NewListPager() { // }, // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), // }, - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, // }}, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRPrivateEndpointConnections_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRPrivateEndpointConnections_Get.json func ExamplePrivateEndpointConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -93,6 +93,14 @@ func ExamplePrivateEndpointConnectionsClient_Get() { // Name: to.Ptr("mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), // Type: to.Ptr("Microsoft.SignalRService/SignalR/privateEndpointConnections"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // SystemData: &armsignalr.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // }, // Properties: &armsignalr.PrivateEndpointConnectionProperties{ // GroupIDs: []*string{ // to.Ptr("signalr")}, @@ -105,18 +113,10 @@ func ExamplePrivateEndpointConnectionsClient_Get() { // }, // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), // }, - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRPrivateEndpointConnections_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRPrivateEndpointConnections_Update.json func ExamplePrivateEndpointConnectionsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -129,9 +129,7 @@ func ExamplePrivateEndpointConnectionsClient_Update() { } res, err := clientFactory.NewPrivateEndpointConnectionsClient().Update(ctx, "mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e", "myResourceGroup", "mySignalRService", armsignalr.PrivateEndpointConnection{ Properties: &armsignalr.PrivateEndpointConnectionProperties{ - PrivateEndpoint: &armsignalr.PrivateEndpoint{ - ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - }, + PrivateEndpoint: &armsignalr.PrivateEndpoint{}, PrivateLinkServiceConnectionState: &armsignalr.PrivateLinkServiceConnectionState{ ActionsRequired: to.Ptr("None"), Status: to.Ptr(armsignalr.PrivateLinkServiceConnectionStatusApproved), @@ -148,6 +146,14 @@ func ExamplePrivateEndpointConnectionsClient_Update() { // Name: to.Ptr("mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), // Type: to.Ptr("Microsoft.SignalRService/SignalR/privateEndpointConnections"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // SystemData: &armsignalr.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // }, // Properties: &armsignalr.PrivateEndpointConnectionProperties{ // GroupIDs: []*string{ // to.Ptr("signalr")}, @@ -160,18 +166,10 @@ func ExamplePrivateEndpointConnectionsClient_Update() { // }, // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), // }, - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRPrivateEndpointConnections_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRPrivateEndpointConnections_Delete.json func ExamplePrivateEndpointConnectionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/signalr/armsignalr/privatelinkresources_client.go b/sdk/resourcemanager/signalr/armsignalr/privatelinkresources_client.go index e9f3706c8aee..d456e8fd4c10 100644 --- a/sdk/resourcemanager/signalr/armsignalr/privatelinkresources_client.go +++ b/sdk/resourcemanager/signalr/armsignalr/privatelinkresources_client.go @@ -28,8 +28,7 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -// - subscriptionID - Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { @@ -46,9 +45,8 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // NewListPager - Get the private link resources that need to be created for a resource. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListPager // method. @@ -95,7 +93,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/signalr/armsignalr/privatelinkresources_client_example_test.go b/sdk/resourcemanager/signalr/armsignalr/privatelinkresources_client_example_test.go index 9e13d0fda66d..8484259461c1 100644 --- a/sdk/resourcemanager/signalr/armsignalr/privatelinkresources_client_example_test.go +++ b/sdk/resourcemanager/signalr/armsignalr/privatelinkresources_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/signalr/armsignalr" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRPrivateLinkResources_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRPrivateLinkResources_List.json func ExamplePrivateLinkResourcesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -59,6 +59,22 @@ func ExamplePrivateLinkResourcesClient_NewListPager() { // Description: to.Ptr("Azure App Service can be used as an upstream"), // GroupID: to.Ptr("sites"), // }, + // }, + // { + // Name: to.Ptr("vault"), + // Properties: &armsignalr.ShareablePrivateLinkResourceProperties{ + // Type: to.Ptr("Microsoft.KeyVault/vaults"), + // Description: to.Ptr("Azure Key Vault can be used as credentials store"), + // GroupID: to.Ptr("vault"), + // }, + // }, + // { + // Name: to.Ptr("table"), + // Properties: &armsignalr.ShareablePrivateLinkResourceProperties{ + // Type: to.Ptr("Microsoft.Storage/storageAccounts"), + // Description: to.Ptr("Azure Storage Table can be used as message store"), + // GroupID: to.Ptr("table"), + // }, // }}, // }, // }}, diff --git a/sdk/resourcemanager/signalr/armsignalr/replicas_client.go b/sdk/resourcemanager/signalr/armsignalr/replicas_client.go new file mode 100644 index 000000000000..8bea58845f38 --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/replicas_client.go @@ -0,0 +1,488 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsignalr + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ReplicasClient contains the methods for the SignalRReplicas group. +// Don't use this type directly, use NewReplicasClient() instead. +type ReplicasClient struct { + internal *arm.Client + subscriptionID string +} + +// NewReplicasClient creates a new instance of ReplicasClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicasClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicasClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ReplicasClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update a replica. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - replicaName - The name of the replica. +// - parameters - Parameters for the create or update operation +// - options - ReplicasClientBeginCreateOrUpdateOptions contains the optional parameters for the ReplicasClient.BeginCreateOrUpdate +// method. +func (client *ReplicasClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, options *ReplicasClientBeginCreateOrUpdateOptions) (*runtime.Poller[ReplicasClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, replicaName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicasClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ReplicasClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create or update a replica. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-01-preview +func (client *ReplicasClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, options *ReplicasClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ReplicasClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, replicaName, 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.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ReplicasClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, options *ReplicasClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if replicaName == "" { + return nil, errors.New("parameter replicaName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicaName}", url.PathEscape(replicaName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-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 +} + +// Delete - Operation to delete a replica. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - replicaName - The name of the replica. +// - options - ReplicasClientDeleteOptions contains the optional parameters for the ReplicasClient.Delete method. +func (client *ReplicasClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientDeleteOptions) (ReplicasClientDeleteResponse, error) { + var err error + const operationName = "ReplicasClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, replicaName, options) + if err != nil { + return ReplicasClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ReplicasClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ReplicasClientDeleteResponse{}, err + } + return ReplicasClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ReplicasClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if replicaName == "" { + return nil, errors.New("parameter replicaName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicaName}", url.PathEscape(replicaName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the replica and its properties. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - replicaName - The name of the replica. +// - options - ReplicasClientGetOptions contains the optional parameters for the ReplicasClient.Get method. +func (client *ReplicasClient) Get(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientGetOptions) (ReplicasClientGetResponse, error) { + var err error + const operationName = "ReplicasClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, replicaName, options) + if err != nil { + return ReplicasClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ReplicasClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ReplicasClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ReplicasClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if replicaName == "" { + return nil, errors.New("parameter replicaName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicaName}", url.PathEscape(replicaName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ReplicasClient) getHandleResponse(resp *http.Response) (ReplicasClientGetResponse, error) { + result := ReplicasClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Replica); err != nil { + return ReplicasClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all replicas belong to this resource +// +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - options - ReplicasClientListOptions contains the optional parameters for the ReplicasClient.NewListPager method. +func (client *ReplicasClient) NewListPager(resourceGroupName string, resourceName string, options *ReplicasClientListOptions) *runtime.Pager[ReplicasClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ReplicasClientListResponse]{ + More: func(page ReplicasClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ReplicasClientListResponse) (ReplicasClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ReplicasClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, resourceName, options) + }, nil) + if err != nil { + return ReplicasClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ReplicasClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ReplicasClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ReplicasClient) listHandleResponse(resp *http.Response) (ReplicasClientListResponse, error) { + result := ReplicasClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ReplicaList); err != nil { + return ReplicasClientListResponse{}, err + } + return result, nil +} + +// BeginRestart - Operation to restart a replica. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - replicaName - The name of the replica. +// - options - ReplicasClientBeginRestartOptions contains the optional parameters for the ReplicasClient.BeginRestart method. +func (client *ReplicasClient) BeginRestart(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientBeginRestartOptions) (*runtime.Poller[ReplicasClientRestartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.restart(ctx, resourceGroupName, resourceName, replicaName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicasClientRestartResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ReplicasClientRestartResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Restart - Operation to restart a replica. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-01-preview +func (client *ReplicasClient) restart(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientBeginRestartOptions) (*http.Response, error) { + var err error + const operationName = "ReplicasClient.BeginRestart" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.restartCreateRequest(ctx, resourceGroupName, resourceName, replicaName, 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, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// restartCreateRequest creates the Restart request. +func (client *ReplicasClient) restartCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientBeginRestartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}/restart" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if replicaName == "" { + return nil, errors.New("parameter replicaName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicaName}", url.PathEscape(replicaName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginUpdate - Operation to update an exiting replica. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - replicaName - The name of the replica. +// - parameters - Parameters for the update operation +// - options - ReplicasClientBeginUpdateOptions contains the optional parameters for the ReplicasClient.BeginUpdate method. +func (client *ReplicasClient) BeginUpdate(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, options *ReplicasClientBeginUpdateOptions) (*runtime.Poller[ReplicasClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, resourceName, replicaName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicasClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ReplicasClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Operation to update an exiting replica. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-01-preview +func (client *ReplicasClient) update(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, options *ReplicasClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ReplicasClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, replicaName, 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.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *ReplicasClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, options *ReplicasClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if replicaName == "" { + return nil, errors.New("parameter replicaName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicaName}", url.PathEscape(replicaName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-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 +} diff --git a/sdk/resourcemanager/signalr/armsignalr/replicas_client_example_test.go b/sdk/resourcemanager/signalr/armsignalr/replicas_client_example_test.go new file mode 100644 index 000000000000..65bd2cccec33 --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/replicas_client_example_test.go @@ -0,0 +1,291 @@ +//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 armsignalr_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/signalr/armsignalr" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRReplicas_List.json +func ExampleReplicasClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsignalr.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewReplicasClient().NewListPager("myResourceGroup", "mySignalRService", 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.ReplicaList = armsignalr.ReplicaList{ + // Value: []*armsignalr.Replica{ + // { + // Name: to.Ptr("mySignalRService-eastus"), + // Type: to.Ptr("Microsoft.SignalRService/SignalR"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/replicas/mySignalRService-eastus"), + // SystemData: &armsignalr.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // }, + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // }, + // Properties: &armsignalr.ReplicaProperties{ + // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), + // RegionEndpointEnabled: to.Ptr("Enabled"), + // ResourceStopped: to.Ptr("false"), + // }, + // SKU: &armsignalr.ResourceSKU{ + // Name: to.Ptr("Premium_P1"), + // Capacity: to.Ptr[int32](1), + // Size: to.Ptr("P1"), + // Tier: to.Ptr(armsignalr.SignalRSKUTierPremium), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRReplicas_Get.json +func ExampleReplicasClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsignalr.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewReplicasClient().Get(ctx, "myResourceGroup", "mySignalRService", "mySignalRService-eastus", 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.Replica = armsignalr.Replica{ + // Name: to.Ptr("mySignalRService-eastus"), + // Type: to.Ptr("Microsoft.SignalRService/SignalR"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/replicas/mySignalRService-eastus"), + // SystemData: &armsignalr.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // }, + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // }, + // Properties: &armsignalr.ReplicaProperties{ + // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), + // RegionEndpointEnabled: to.Ptr("Enabled"), + // ResourceStopped: to.Ptr("false"), + // }, + // SKU: &armsignalr.ResourceSKU{ + // Name: to.Ptr("Premium_P1"), + // Capacity: to.Ptr[int32](1), + // Size: to.Ptr("P1"), + // Tier: to.Ptr(armsignalr.SignalRSKUTierPremium), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRReplicas_CreateOrUpdate.json +func ExampleReplicasClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsignalr.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewReplicasClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "mySignalRService", "mySignalRService-eastus", armsignalr.Replica{ + Location: to.Ptr("eastus"), + Tags: map[string]*string{ + "key1": to.Ptr("value1"), + }, + Properties: &armsignalr.ReplicaProperties{ + ResourceStopped: to.Ptr("false"), + }, + SKU: &armsignalr.ResourceSKU{ + Name: to.Ptr("Premium_P1"), + Capacity: to.Ptr[int32](1), + Tier: to.Ptr(armsignalr.SignalRSKUTierPremium), + }, + }, 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.Replica = armsignalr.Replica{ + // Name: to.Ptr("mySignalRService-eastus"), + // Type: to.Ptr("Microsoft.SignalRService/SignalR"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/replicas/mySignalRService-eastus"), + // SystemData: &armsignalr.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // }, + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // }, + // Properties: &armsignalr.ReplicaProperties{ + // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), + // RegionEndpointEnabled: to.Ptr("Enabled"), + // ResourceStopped: to.Ptr("false"), + // }, + // SKU: &armsignalr.ResourceSKU{ + // Name: to.Ptr("Premium_P1"), + // Capacity: to.Ptr[int32](1), + // Size: to.Ptr("P1"), + // Tier: to.Ptr(armsignalr.SignalRSKUTierPremium), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRReplicas_Delete.json +func ExampleReplicasClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsignalr.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewReplicasClient().Delete(ctx, "myResourceGroup", "mySignalRService", "mySignalRService-eastus", 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRReplicas_Update.json +func ExampleReplicasClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsignalr.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewReplicasClient().BeginUpdate(ctx, "myResourceGroup", "mySignalRService", "mySignalRService-eastus", armsignalr.Replica{ + Location: to.Ptr("eastus"), + Tags: map[string]*string{ + "key1": to.Ptr("value1"), + }, + Properties: &armsignalr.ReplicaProperties{ + ResourceStopped: to.Ptr("false"), + }, + SKU: &armsignalr.ResourceSKU{ + Name: to.Ptr("Premium_P1"), + Capacity: to.Ptr[int32](1), + Tier: to.Ptr(armsignalr.SignalRSKUTierPremium), + }, + }, 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.Replica = armsignalr.Replica{ + // Name: to.Ptr("mySignalRService-eastus"), + // Type: to.Ptr("Microsoft.SignalRService/SignalR"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/replicas/mySignalRService-eastus"), + // SystemData: &armsignalr.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), + // }, + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // }, + // Properties: &armsignalr.ReplicaProperties{ + // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), + // RegionEndpointEnabled: to.Ptr("Enabled"), + // ResourceStopped: to.Ptr("false"), + // }, + // SKU: &armsignalr.ResourceSKU{ + // Name: to.Ptr("Premium_P1"), + // Capacity: to.Ptr[int32](1), + // Size: to.Ptr("P1"), + // Tier: to.Ptr(armsignalr.SignalRSKUTierPremium), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRReplicas_Restart.json +func ExampleReplicasClient_BeginRestart() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsignalr.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewReplicasClient().BeginRestart(ctx, "myResourceGroup", "mySignalRService", "mySignalRService-eastus", 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/signalr/armsignalr/response_types.go b/sdk/resourcemanager/signalr/armsignalr/response_types.go index 427aa3b59983..4076cc5243a5 100644 --- a/sdk/resourcemanager/signalr/armsignalr/response_types.go +++ b/sdk/resourcemanager/signalr/armsignalr/response_types.go @@ -49,6 +49,12 @@ type ClientListKeysResponse struct { Keys } +// ClientListReplicaSKUsResponse contains the response from method Client.ListReplicaSKUs. +type ClientListReplicaSKUsResponse struct { + // The list skus operation response + SKUList +} + // ClientListSKUsResponse contains the response from method Client.ListSKUs. type ClientListSKUsResponse struct { // The list skus operation response @@ -153,6 +159,39 @@ type PrivateLinkResourcesClientListResponse struct { PrivateLinkResourceList } +// ReplicasClientCreateOrUpdateResponse contains the response from method ReplicasClient.BeginCreateOrUpdate. +type ReplicasClientCreateOrUpdateResponse struct { + // A class represent a replica resource. + Replica +} + +// ReplicasClientDeleteResponse contains the response from method ReplicasClient.Delete. +type ReplicasClientDeleteResponse struct { + // placeholder for future response values +} + +// ReplicasClientGetResponse contains the response from method ReplicasClient.Get. +type ReplicasClientGetResponse struct { + // A class represent a replica resource. + Replica +} + +// ReplicasClientListResponse contains the response from method ReplicasClient.NewListPager. +type ReplicasClientListResponse struct { + ReplicaList +} + +// ReplicasClientRestartResponse contains the response from method ReplicasClient.BeginRestart. +type ReplicasClientRestartResponse struct { + // placeholder for future response values +} + +// ReplicasClientUpdateResponse contains the response from method ReplicasClient.BeginUpdate. +type ReplicasClientUpdateResponse struct { + // A class represent a replica resource. + Replica +} + // SharedPrivateLinkResourcesClientCreateOrUpdateResponse contains the response from method SharedPrivateLinkResourcesClient.BeginCreateOrUpdate. type SharedPrivateLinkResourcesClientCreateOrUpdateResponse struct { // Describes a Shared Private Link Resource diff --git a/sdk/resourcemanager/signalr/armsignalr/sharedprivatelinkresources_client.go b/sdk/resourcemanager/signalr/armsignalr/sharedprivatelinkresources_client.go index 337cb4c739fa..6eee0447fc86 100644 --- a/sdk/resourcemanager/signalr/armsignalr/sharedprivatelinkresources_client.go +++ b/sdk/resourcemanager/signalr/armsignalr/sharedprivatelinkresources_client.go @@ -28,8 +28,7 @@ type SharedPrivateLinkResourcesClient struct { } // NewSharedPrivateLinkResourcesClient creates a new instance of SharedPrivateLinkResourcesClient with the specified values. -// - subscriptionID - Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewSharedPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SharedPrivateLinkResourcesClient, error) { @@ -47,10 +46,9 @@ func NewSharedPrivateLinkResourcesClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Create or update a shared private link resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview // - sharedPrivateLinkResourceName - The name of the shared private link resource -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - parameters - The shared private link resource // - options - SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginCreateOrUpdate @@ -62,7 +60,8 @@ func (client *SharedPrivateLinkResourcesClient) BeginCreateOrUpdate(ctx context. return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SharedPrivateLinkResourcesClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -75,7 +74,7 @@ func (client *SharedPrivateLinkResourcesClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Create or update a shared private link resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview func (client *SharedPrivateLinkResourcesClient) createOrUpdate(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, parameters SharedPrivateLinkResource, options *SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "SharedPrivateLinkResourcesClient.BeginCreateOrUpdate" @@ -121,7 +120,7 @@ func (client *SharedPrivateLinkResourcesClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -133,10 +132,9 @@ func (client *SharedPrivateLinkResourcesClient) createOrUpdateCreateRequest(ctx // BeginDelete - Delete the specified shared private link resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview // - sharedPrivateLinkResourceName - The name of the shared private link resource -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - SharedPrivateLinkResourcesClientBeginDeleteOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginDelete // method. @@ -161,7 +159,7 @@ func (client *SharedPrivateLinkResourcesClient) BeginDelete(ctx context.Context, // Delete - Delete the specified shared private link resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview func (client *SharedPrivateLinkResourcesClient) deleteOperation(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *SharedPrivateLinkResourcesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "SharedPrivateLinkResourcesClient.BeginDelete" @@ -207,7 +205,7 @@ func (client *SharedPrivateLinkResourcesClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -216,10 +214,9 @@ func (client *SharedPrivateLinkResourcesClient) deleteCreateRequest(ctx context. // Get - Get the specified shared private link resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview // - sharedPrivateLinkResourceName - The name of the shared private link resource -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - SharedPrivateLinkResourcesClientGetOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.Get // method. @@ -269,7 +266,7 @@ func (client *SharedPrivateLinkResourcesClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -286,9 +283,8 @@ func (client *SharedPrivateLinkResourcesClient) getHandleResponse(resp *http.Res // NewListPager - List shared private link resources // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - SharedPrivateLinkResourcesClientListOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.NewListPager // method. @@ -335,7 +331,7 @@ func (client *SharedPrivateLinkResourcesClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/signalr/armsignalr/sharedprivatelinkresources_client_example_test.go b/sdk/resourcemanager/signalr/armsignalr/sharedprivatelinkresources_client_example_test.go index a83a0f00eb87..e329bbea54d6 100644 --- a/sdk/resourcemanager/signalr/armsignalr/sharedprivatelinkresources_client_example_test.go +++ b/sdk/resourcemanager/signalr/armsignalr/sharedprivatelinkresources_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/signalr/armsignalr" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRSharedPrivateLinkResources_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRSharedPrivateLinkResources_List.json func ExampleSharedPrivateLinkResourcesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -58,7 +58,7 @@ func ExampleSharedPrivateLinkResourcesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRSharedPrivateLinkResources_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRSharedPrivateLinkResources_Get.json func ExampleSharedPrivateLinkResourcesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -90,7 +90,7 @@ func ExampleSharedPrivateLinkResourcesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRSharedPrivateLinkResources_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRSharedPrivateLinkResources_CreateOrUpdate.json func ExampleSharedPrivateLinkResourcesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -132,7 +132,7 @@ func ExampleSharedPrivateLinkResourcesClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRSharedPrivateLinkResources_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRSharedPrivateLinkResources_Delete.json func ExampleSharedPrivateLinkResourcesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/signalr/armsignalr/usages_client.go b/sdk/resourcemanager/signalr/armsignalr/usages_client.go index 8d8d7df5078f..f9eb5ece59fa 100644 --- a/sdk/resourcemanager/signalr/armsignalr/usages_client.go +++ b/sdk/resourcemanager/signalr/armsignalr/usages_client.go @@ -28,8 +28,7 @@ type UsagesClient struct { } // NewUsagesClient creates a new instance of UsagesClient with the specified values. -// - subscriptionID - Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UsagesClient, error) { @@ -46,7 +45,7 @@ func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, o // NewListPager - List resource usage quotas by location. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview // - location - the location like "eastus" // - options - UsagesClientListOptions contains the optional parameters for the UsagesClient.NewListPager method. func (client *UsagesClient) NewListPager(location string, options *UsagesClientListOptions) *runtime.Pager[UsagesClientListResponse] { @@ -88,7 +87,7 @@ func (client *UsagesClient) listCreateRequest(ctx context.Context, location stri return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/signalr/armsignalr/usages_client_example_test.go b/sdk/resourcemanager/signalr/armsignalr/usages_client_example_test.go index 34c0ef8fdede..9eaf8d8b88dd 100644 --- a/sdk/resourcemanager/signalr/armsignalr/usages_client_example_test.go +++ b/sdk/resourcemanager/signalr/armsignalr/usages_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/signalr/armsignalr" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/Usages_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/Usages_List.json func ExampleUsagesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/support/armsupport/CHANGELOG.md b/sdk/resourcemanager/support/armsupport/CHANGELOG.md index 1328ddef3c1a..fe19cec5d320 100644 --- a/sdk/resourcemanager/support/armsupport/CHANGELOG.md +++ b/sdk/resourcemanager/support/armsupport/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 2.0.0-beta.2 (2023-11-30) +### Features Added + +- Support for test fakes and OpenTelemetry trace spans. + + ## 1.2.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/support/armsupport/autorest.md b/sdk/resourcemanager/support/armsupport/autorest.md index 4c0427ad2612..a704d2775426 100644 --- a/sdk/resourcemanager/support/armsupport/autorest.md +++ b/sdk/resourcemanager/support/armsupport/autorest.md @@ -5,8 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.2.0 +module-version: 2.0.0-beta.2 +tag: package-preview-2022-09 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/support/armsupport/chattranscripts_client.go b/sdk/resourcemanager/support/armsupport/chattranscripts_client.go new file mode 100644 index 000000000000..cdabab6de684 --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/chattranscripts_client.go @@ -0,0 +1,168 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsupport + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ChatTranscriptsClient contains the methods for the ChatTranscripts group. +// Don't use this type directly, use NewChatTranscriptsClient() instead. +type ChatTranscriptsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewChatTranscriptsClient creates a new instance of ChatTranscriptsClient with the specified values. +// - subscriptionID - Azure subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewChatTranscriptsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ChatTranscriptsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ChatTranscriptsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Returns chatTranscript details for a support ticket under a subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-01-preview +// - supportTicketName - Support ticket name. +// - chatTranscriptName - ChatTranscript name. +// - options - ChatTranscriptsClientGetOptions contains the optional parameters for the ChatTranscriptsClient.Get method. +func (client *ChatTranscriptsClient) Get(ctx context.Context, supportTicketName string, chatTranscriptName string, options *ChatTranscriptsClientGetOptions) (ChatTranscriptsClientGetResponse, error) { + var err error + const operationName = "ChatTranscriptsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, supportTicketName, chatTranscriptName, options) + if err != nil { + return ChatTranscriptsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ChatTranscriptsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ChatTranscriptsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ChatTranscriptsClient) getCreateRequest(ctx context.Context, supportTicketName string, chatTranscriptName string, options *ChatTranscriptsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/chatTranscripts/{chatTranscriptName}" + if supportTicketName == "" { + return nil, errors.New("parameter supportTicketName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{supportTicketName}", url.PathEscape(supportTicketName)) + if chatTranscriptName == "" { + return nil, errors.New("parameter chatTranscriptName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{chatTranscriptName}", url.PathEscape(chatTranscriptName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ChatTranscriptsClient) getHandleResponse(resp *http.Response) (ChatTranscriptsClientGetResponse, error) { + result := ChatTranscriptsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ChatTranscriptDetails); err != nil { + return ChatTranscriptsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all chat transcripts for a support ticket under subscription +// +// Generated from API version 2022-09-01-preview +// - supportTicketName - Support ticket name. +// - options - ChatTranscriptsClientListOptions contains the optional parameters for the ChatTranscriptsClient.NewListPager +// method. +func (client *ChatTranscriptsClient) NewListPager(supportTicketName string, options *ChatTranscriptsClientListOptions) *runtime.Pager[ChatTranscriptsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ChatTranscriptsClientListResponse]{ + More: func(page ChatTranscriptsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ChatTranscriptsClientListResponse) (ChatTranscriptsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ChatTranscriptsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, supportTicketName, options) + }, nil) + if err != nil { + return ChatTranscriptsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ChatTranscriptsClient) listCreateRequest(ctx context.Context, supportTicketName string, options *ChatTranscriptsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/chatTranscripts" + if supportTicketName == "" { + return nil, errors.New("parameter supportTicketName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{supportTicketName}", url.PathEscape(supportTicketName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ChatTranscriptsClient) listHandleResponse(resp *http.Response) (ChatTranscriptsClientListResponse, error) { + result := ChatTranscriptsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ChatTranscriptsListResult); err != nil { + return ChatTranscriptsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/support/armsupport/chattranscripts_client_example_test.go b/sdk/resourcemanager/support/armsupport/chattranscripts_client_example_test.go new file mode 100644 index 000000000000..5f4f12d88e97 --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/chattranscripts_client_example_test.go @@ -0,0 +1,134 @@ +//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 armsupport_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListChatTranscriptsForSubscriptionSupportTicket.json +func ExampleChatTranscriptsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewChatTranscriptsClient().NewListPager("testticket", 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.ChatTranscriptsListResult = armsupport.ChatTranscriptsListResult{ + // Value: []*armsupport.ChatTranscriptDetails{ + // { + // Name: to.Ptr("55989c71-1727-4cd9-abad-ddb8770f71cd"), + // Type: to.Ptr("Microsoft.Support/chatTranscripts"), + // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/2207120020000085/chatTranscripts/55989c71-1727-4cd9-abad-ddb8770f71cd"), + // Properties: &armsupport.ChatTranscriptDetailsProperties{ + // Messages: []*armsupport.MessageProperties{ + // { + // Body: to.Ptr("Hi"), + // CommunicationDirection: to.Ptr(armsupport.CommunicationDirectionOutbound), + // ContentType: to.Ptr(armsupport.TranscriptContentType("text")), + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-24T20:18:19.000Z"); return t}()), + // Sender: to.Ptr("support engineer"), + // }, + // { + // Body: to.Ptr("hi"), + // CommunicationDirection: to.Ptr(armsupport.CommunicationDirectionInbound), + // ContentType: to.Ptr(armsupport.TranscriptContentType("text")), + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-24T20:19:16.000Z"); return t}()), + // Sender: to.Ptr("user"), + // }}, + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-22T22:46:35.000Z"); return t}()), + // }, + // }, + // { + // Name: to.Ptr("f15051e3-a2f2-489f-9e64-8cfa203f44f8"), + // Type: to.Ptr("Microsoft.Support/chatTranscripts"), + // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/2207120020000085/chatTranscripts/f15051e3-a2f2-489f-9e64-8cfa203f44f8"), + // Properties: &armsupport.ChatTranscriptDetailsProperties{ + // Messages: []*armsupport.MessageProperties{ + // { + // Body: to.Ptr("Hi again"), + // CommunicationDirection: to.Ptr(armsupport.CommunicationDirectionOutbound), + // ContentType: to.Ptr(armsupport.TranscriptContentType("text")), + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-25T20:18:19.000Z"); return t}()), + // Sender: to.Ptr("support engineer 2"), + // }, + // { + // Body: to.Ptr("hello"), + // CommunicationDirection: to.Ptr(armsupport.CommunicationDirectionInbound), + // ContentType: to.Ptr(armsupport.TranscriptContentType("text")), + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-25T20:19:16.000Z"); return t}()), + // Sender: to.Ptr("user"), + // }}, + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-22T22:46:35.000Z"); return t}()), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/GetchatTranscriptDetailsForSubscriptionSupportTicket.json +func ExampleChatTranscriptsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewChatTranscriptsClient().Get(ctx, "testticket", "69586795-45e9-45b5-bd9e-c9bb237d3e44", 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.ChatTranscriptDetails = armsupport.ChatTranscriptDetails{ + // Name: to.Ptr("testmessage"), + // Type: to.Ptr("Microsoft.Support/chatTranscripts"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket/chatTranscripts/69586795-45e9-45b5-bd9e-c9bb237d3e44"), + // Properties: &armsupport.ChatTranscriptDetailsProperties{ + // Messages: []*armsupport.MessageProperties{ + // { + // Body: to.Ptr("Hi again"), + // CommunicationDirection: to.Ptr(armsupport.CommunicationDirectionOutbound), + // ContentType: to.Ptr(armsupport.TranscriptContentType("text")), + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-23T20:18:19.000Z"); return t}()), + // Sender: to.Ptr("support engineer 2"), + // }, + // { + // Body: to.Ptr("hello"), + // CommunicationDirection: to.Ptr(armsupport.CommunicationDirectionInbound), + // ContentType: to.Ptr(armsupport.TranscriptContentType("text")), + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-23T20:19:16.000Z"); return t}()), + // Sender: to.Ptr("user"), + // }}, + // }, + // } +} diff --git a/sdk/resourcemanager/support/armsupport/chattranscriptsnosubscription_client.go b/sdk/resourcemanager/support/armsupport/chattranscriptsnosubscription_client.go new file mode 100644 index 000000000000..1a592257df07 --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/chattranscriptsnosubscription_client.go @@ -0,0 +1,102 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsupport + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ChatTranscriptsNoSubscriptionClient contains the methods for the ChatTranscriptsNoSubscription group. +// Don't use this type directly, use NewChatTranscriptsNoSubscriptionClient() instead. +type ChatTranscriptsNoSubscriptionClient struct { + internal *arm.Client +} + +// NewChatTranscriptsNoSubscriptionClient creates a new instance of ChatTranscriptsNoSubscriptionClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewChatTranscriptsNoSubscriptionClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ChatTranscriptsNoSubscriptionClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ChatTranscriptsNoSubscriptionClient{ + internal: cl, + } + return client, nil +} + +// Get - Returns chatTranscript details for a no subscription support ticket. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-01-preview +// - supportTicketName - Support ticket name. +// - chatTranscriptName - ChatTranscript name. +// - options - ChatTranscriptsNoSubscriptionClientGetOptions contains the optional parameters for the ChatTranscriptsNoSubscriptionClient.Get +// method. +func (client *ChatTranscriptsNoSubscriptionClient) Get(ctx context.Context, supportTicketName string, chatTranscriptName string, options *ChatTranscriptsNoSubscriptionClientGetOptions) (ChatTranscriptsNoSubscriptionClientGetResponse, error) { + var err error + const operationName = "ChatTranscriptsNoSubscriptionClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, supportTicketName, chatTranscriptName, options) + if err != nil { + return ChatTranscriptsNoSubscriptionClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ChatTranscriptsNoSubscriptionClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ChatTranscriptsNoSubscriptionClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ChatTranscriptsNoSubscriptionClient) getCreateRequest(ctx context.Context, supportTicketName string, chatTranscriptName string, options *ChatTranscriptsNoSubscriptionClientGetOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Support/supportTickets/{supportTicketName}/chatTranscripts/{chatTranscriptName}" + if supportTicketName == "" { + return nil, errors.New("parameter supportTicketName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{supportTicketName}", url.PathEscape(supportTicketName)) + if chatTranscriptName == "" { + return nil, errors.New("parameter chatTranscriptName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{chatTranscriptName}", url.PathEscape(chatTranscriptName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ChatTranscriptsNoSubscriptionClient) getHandleResponse(resp *http.Response) (ChatTranscriptsNoSubscriptionClientGetResponse, error) { + result := ChatTranscriptsNoSubscriptionClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ChatTranscriptDetails); err != nil { + return ChatTranscriptsNoSubscriptionClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/support/armsupport/chattranscriptsnosubscription_client_example_test.go b/sdk/resourcemanager/support/armsupport/chattranscriptsnosubscription_client_example_test.go new file mode 100644 index 000000000000..3681971daa0f --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/chattranscriptsnosubscription_client_example_test.go @@ -0,0 +1,60 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armsupport_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/GetchatTranscriptDetailsForSupportTicket.json +func ExampleChatTranscriptsNoSubscriptionClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewChatTranscriptsNoSubscriptionClient().Get(ctx, "testticket", "b371192a-b094-4a71-b093-7246029b0a54", 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.ChatTranscriptDetails = armsupport.ChatTranscriptDetails{ + // Name: to.Ptr("testmessage"), + // Type: to.Ptr("Microsoft.Support/chatTranscripts"), + // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/testticket/chatTranscripts/b371192a-b094-4a71-b093-7246029b0a54"), + // Properties: &armsupport.ChatTranscriptDetailsProperties{ + // Messages: []*armsupport.MessageProperties{ + // { + // Body: to.Ptr("Hi again"), + // CommunicationDirection: to.Ptr(armsupport.CommunicationDirectionOutbound), + // ContentType: to.Ptr(armsupport.TranscriptContentType("text")), + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-25T20:18:19.000Z"); return t}()), + // Sender: to.Ptr("support engineer 2"), + // }, + // { + // Body: to.Ptr("hello"), + // CommunicationDirection: to.Ptr(armsupport.CommunicationDirectionInbound), + // ContentType: to.Ptr(armsupport.TranscriptContentType("text")), + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-25T20:19:16.000Z"); return t}()), + // Sender: to.Ptr("user"), + // }}, + // }, + // } +} diff --git a/sdk/resourcemanager/support/armsupport/client_factory.go b/sdk/resourcemanager/support/armsupport/client_factory.go index 1a79077bb6b3..0677fdba59e1 100644 --- a/sdk/resourcemanager/support/armsupport/client_factory.go +++ b/sdk/resourcemanager/support/armsupport/client_factory.go @@ -37,12 +37,54 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } +// NewChatTranscriptsClient creates a new instance of ChatTranscriptsClient. +func (c *ClientFactory) NewChatTranscriptsClient() *ChatTranscriptsClient { + subClient, _ := NewChatTranscriptsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewChatTranscriptsNoSubscriptionClient creates a new instance of ChatTranscriptsNoSubscriptionClient. +func (c *ClientFactory) NewChatTranscriptsNoSubscriptionClient() *ChatTranscriptsNoSubscriptionClient { + subClient, _ := NewChatTranscriptsNoSubscriptionClient(c.credential, c.options) + return subClient +} + // NewCommunicationsClient creates a new instance of CommunicationsClient. func (c *ClientFactory) NewCommunicationsClient() *CommunicationsClient { subClient, _ := NewCommunicationsClient(c.subscriptionID, c.credential, c.options) return subClient } +// NewCommunicationsNoSubscriptionClient creates a new instance of CommunicationsNoSubscriptionClient. +func (c *ClientFactory) NewCommunicationsNoSubscriptionClient() *CommunicationsNoSubscriptionClient { + subClient, _ := NewCommunicationsNoSubscriptionClient(c.credential, c.options) + return subClient +} + +// NewFileWorkspacesClient creates a new instance of FileWorkspacesClient. +func (c *ClientFactory) NewFileWorkspacesClient() *FileWorkspacesClient { + subClient, _ := NewFileWorkspacesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewFileWorkspacesNoSubscriptionClient creates a new instance of FileWorkspacesNoSubscriptionClient. +func (c *ClientFactory) NewFileWorkspacesNoSubscriptionClient() *FileWorkspacesNoSubscriptionClient { + subClient, _ := NewFileWorkspacesNoSubscriptionClient(c.credential, c.options) + return subClient +} + +// NewFilesClient creates a new instance of FilesClient. +func (c *ClientFactory) NewFilesClient() *FilesClient { + subClient, _ := NewFilesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewFilesNoSubscriptionClient creates a new instance of FilesNoSubscriptionClient. +func (c *ClientFactory) NewFilesNoSubscriptionClient() *FilesNoSubscriptionClient { + subClient, _ := NewFilesNoSubscriptionClient(c.credential, c.options) + return subClient +} + // NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { subClient, _ := NewOperationsClient(c.credential, c.options) @@ -61,8 +103,26 @@ func (c *ClientFactory) NewServicesClient() *ServicesClient { return subClient } +// NewTicketChatTranscriptsNoSubscriptionClient creates a new instance of TicketChatTranscriptsNoSubscriptionClient. +func (c *ClientFactory) NewTicketChatTranscriptsNoSubscriptionClient() *TicketChatTranscriptsNoSubscriptionClient { + subClient, _ := NewTicketChatTranscriptsNoSubscriptionClient(c.credential, c.options) + return subClient +} + +// NewTicketCommunicationsNoSubscriptionClient creates a new instance of TicketCommunicationsNoSubscriptionClient. +func (c *ClientFactory) NewTicketCommunicationsNoSubscriptionClient() *TicketCommunicationsNoSubscriptionClient { + subClient, _ := NewTicketCommunicationsNoSubscriptionClient(c.credential, c.options) + return subClient +} + // NewTicketsClient creates a new instance of TicketsClient. func (c *ClientFactory) NewTicketsClient() *TicketsClient { subClient, _ := NewTicketsClient(c.subscriptionID, c.credential, c.options) return subClient } + +// NewTicketsNoSubscriptionClient creates a new instance of TicketsNoSubscriptionClient. +func (c *ClientFactory) NewTicketsNoSubscriptionClient() *TicketsNoSubscriptionClient { + subClient, _ := NewTicketsNoSubscriptionClient(c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/support/armsupport/communications_client.go b/sdk/resourcemanager/support/armsupport/communications_client.go index baa0e3b2304f..7d5e4e790c8a 100644 --- a/sdk/resourcemanager/support/armsupport/communications_client.go +++ b/sdk/resourcemanager/support/armsupport/communications_client.go @@ -48,7 +48,7 @@ func NewCommunicationsClient(subscriptionID string, credential azcore.TokenCrede // name for adding a new communication to the support ticket. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-04-01 +// Generated from API version 2022-09-01-preview // - supportTicketName - Support ticket name. // - checkNameAvailabilityInput - Input to check. // - options - CommunicationsClientCheckNameAvailabilityOptions contains the optional parameters for the CommunicationsClient.CheckNameAvailability @@ -91,7 +91,7 @@ func (client *CommunicationsClient) checkNameAvailabilityCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-04-01") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, checkNameAvailabilityInput); err != nil { @@ -112,7 +112,7 @@ func (client *CommunicationsClient) checkNameAvailabilityHandleResponse(resp *ht // BeginCreate - Adds a new customer communication to an Azure support ticket. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-04-01 +// Generated from API version 2022-09-01-preview // - supportTicketName - Support ticket name. // - communicationName - Communication name. // - createCommunicationParameters - Communication object. @@ -139,7 +139,7 @@ func (client *CommunicationsClient) BeginCreate(ctx context.Context, supportTick // Create - Adds a new customer communication to an Azure support ticket. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-04-01 +// Generated from API version 2022-09-01-preview func (client *CommunicationsClient) create(ctx context.Context, supportTicketName string, communicationName string, createCommunicationParameters CommunicationDetails, options *CommunicationsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "CommunicationsClient.BeginCreate" @@ -181,7 +181,7 @@ func (client *CommunicationsClient) createCreateRequest(ctx context.Context, sup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-04-01") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, createCommunicationParameters); err != nil { @@ -193,7 +193,7 @@ func (client *CommunicationsClient) createCreateRequest(ctx context.Context, sup // Get - Returns communication details for a support ticket. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-04-01 +// Generated from API version 2022-09-01-preview // - supportTicketName - Support ticket name. // - communicationName - Communication name. // - options - CommunicationsClientGetOptions contains the optional parameters for the CommunicationsClient.Get method. @@ -239,7 +239,7 @@ func (client *CommunicationsClient) getCreateRequest(ctx context.Context, suppor return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-04-01") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -261,7 +261,7 @@ func (client *CommunicationsClient) getHandleResponse(resp *http.Response) (Comm // Support ticket data is available for 18 months after ticket creation. If a ticket was created more than 18 months ago, // a request for data might cause an error. // -// Generated from API version 2020-04-01 +// Generated from API version 2022-09-01-preview // - supportTicketName - Support ticket name. // - options - CommunicationsClientListOptions contains the optional parameters for the CommunicationsClient.NewListPager method. func (client *CommunicationsClient) NewListPager(supportTicketName string, options *CommunicationsClientListOptions) *runtime.Pager[CommunicationsClientListResponse] { @@ -309,7 +309,7 @@ func (client *CommunicationsClient) listCreateRequest(ctx context.Context, suppo if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2020-04-01") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/support/armsupport/communications_client_example_test.go b/sdk/resourcemanager/support/armsupport/communications_client_example_test.go index 19c3b5819264..3200b679a961 100644 --- a/sdk/resourcemanager/support/armsupport/communications_client_example_test.go +++ b/sdk/resourcemanager/support/armsupport/communications_client_example_test.go @@ -15,10 +15,10 @@ import ( "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/support/armsupport" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/CheckNameAvailabilityForSupportTicketCommunication.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CheckNameAvailabilityForSupportTicketCommunication.json func ExampleCommunicationsClient_CheckNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -46,7 +46,7 @@ func ExampleCommunicationsClient_CheckNameAvailability() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/ListCommunicationsForSubscriptionSupportTicket.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListCommunicationsForSubscriptionSupportTicket.json func ExampleCommunicationsClient_NewListPager_listCommunicationsForASubscriptionSupportTicket() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -102,7 +102,7 @@ func ExampleCommunicationsClient_NewListPager_listCommunicationsForASubscription } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/ListWebCommunicationsForSubscriptionSupportTicketCreatedOnOrAfter.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListWebCommunicationsForSubscriptionSupportTicketCreatedOnOrAfter.json func ExampleCommunicationsClient_NewListPager_listWebCommunicationCreatedOnOrAfterASpecificDateForASubscriptionSupportTicket() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -158,7 +158,7 @@ func ExampleCommunicationsClient_NewListPager_listWebCommunicationCreatedOnOrAft } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/ListWebCommunicationsForSubscriptionSupportTicket.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListWebCommunicationsForSubscriptionSupportTicket.json func ExampleCommunicationsClient_NewListPager_listWebCommunicationsForASubscriptionSupportTicket() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -214,7 +214,7 @@ func ExampleCommunicationsClient_NewListPager_listWebCommunicationsForASubscript } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/GetCommunicationDetailsForSubscriptionSupportTicket.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/GetCommunicationDetailsForSubscriptionSupportTicket.json func ExampleCommunicationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -247,7 +247,7 @@ func ExampleCommunicationsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/CreateSupportTicketCommunication.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateSupportTicketCommunication.json func ExampleCommunicationsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/support/armsupport/communicationsnosubscription_client.go b/sdk/resourcemanager/support/armsupport/communicationsnosubscription_client.go new file mode 100644 index 000000000000..ba116f791bd9 --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/communicationsnosubscription_client.go @@ -0,0 +1,240 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsupport + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CommunicationsNoSubscriptionClient contains the methods for the CommunicationsNoSubscription group. +// Don't use this type directly, use NewCommunicationsNoSubscriptionClient() instead. +type CommunicationsNoSubscriptionClient struct { + internal *arm.Client +} + +// NewCommunicationsNoSubscriptionClient creates a new instance of CommunicationsNoSubscriptionClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewCommunicationsNoSubscriptionClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*CommunicationsNoSubscriptionClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CommunicationsNoSubscriptionClient{ + internal: cl, + } + return client, nil +} + +// CheckNameAvailability - Check the availability of a resource name. This API should be used to check the uniqueness of the +// name for adding a new communication to the support ticket. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-01-preview +// - supportTicketName - Support ticket name. +// - checkNameAvailabilityInput - Input to check. +// - options - CommunicationsNoSubscriptionClientCheckNameAvailabilityOptions contains the optional parameters for the CommunicationsNoSubscriptionClient.CheckNameAvailability +// method. +func (client *CommunicationsNoSubscriptionClient) CheckNameAvailability(ctx context.Context, supportTicketName string, checkNameAvailabilityInput CheckNameAvailabilityInput, options *CommunicationsNoSubscriptionClientCheckNameAvailabilityOptions) (CommunicationsNoSubscriptionClientCheckNameAvailabilityResponse, error) { + var err error + const operationName = "CommunicationsNoSubscriptionClient.CheckNameAvailability" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.checkNameAvailabilityCreateRequest(ctx, supportTicketName, checkNameAvailabilityInput, options) + if err != nil { + return CommunicationsNoSubscriptionClientCheckNameAvailabilityResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CommunicationsNoSubscriptionClientCheckNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CommunicationsNoSubscriptionClientCheckNameAvailabilityResponse{}, err + } + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err +} + +// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. +func (client *CommunicationsNoSubscriptionClient) checkNameAvailabilityCreateRequest(ctx context.Context, supportTicketName string, checkNameAvailabilityInput CheckNameAvailabilityInput, options *CommunicationsNoSubscriptionClientCheckNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Support/supportTickets/{supportTicketName}/checkNameAvailability" + if supportTicketName == "" { + return nil, errors.New("parameter supportTicketName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{supportTicketName}", url.PathEscape(supportTicketName)) + 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", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, checkNameAvailabilityInput); err != nil { + return nil, err + } + return req, nil +} + +// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. +func (client *CommunicationsNoSubscriptionClient) checkNameAvailabilityHandleResponse(resp *http.Response) (CommunicationsNoSubscriptionClientCheckNameAvailabilityResponse, error) { + result := CommunicationsNoSubscriptionClientCheckNameAvailabilityResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityOutput); err != nil { + return CommunicationsNoSubscriptionClientCheckNameAvailabilityResponse{}, err + } + return result, nil +} + +// BeginCreate - Adds a new customer communication to an Azure support ticket. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-01-preview +// - supportTicketName - Support ticket name. +// - communicationName - Communication name. +// - createCommunicationParameters - Communication object. +// - options - CommunicationsNoSubscriptionClientBeginCreateOptions contains the optional parameters for the CommunicationsNoSubscriptionClient.BeginCreate +// method. +func (client *CommunicationsNoSubscriptionClient) BeginCreate(ctx context.Context, supportTicketName string, communicationName string, createCommunicationParameters CommunicationDetails, options *CommunicationsNoSubscriptionClientBeginCreateOptions) (*runtime.Poller[CommunicationsNoSubscriptionClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, supportTicketName, communicationName, createCommunicationParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CommunicationsNoSubscriptionClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CommunicationsNoSubscriptionClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Adds a new customer communication to an Azure support ticket. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-01-preview +func (client *CommunicationsNoSubscriptionClient) create(ctx context.Context, supportTicketName string, communicationName string, createCommunicationParameters CommunicationDetails, options *CommunicationsNoSubscriptionClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "CommunicationsNoSubscriptionClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, supportTicketName, communicationName, createCommunicationParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *CommunicationsNoSubscriptionClient) createCreateRequest(ctx context.Context, supportTicketName string, communicationName string, createCommunicationParameters CommunicationDetails, options *CommunicationsNoSubscriptionClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}" + if supportTicketName == "" { + return nil, errors.New("parameter supportTicketName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{supportTicketName}", url.PathEscape(supportTicketName)) + if communicationName == "" { + return nil, errors.New("parameter communicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{communicationName}", url.PathEscape(communicationName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, createCommunicationParameters); err != nil { + return nil, err + } + return req, nil +} + +// Get - Returns communication details for a support ticket. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-01-preview +// - supportTicketName - Support ticket name. +// - communicationName - Communication name. +// - options - CommunicationsNoSubscriptionClientGetOptions contains the optional parameters for the CommunicationsNoSubscriptionClient.Get +// method. +func (client *CommunicationsNoSubscriptionClient) Get(ctx context.Context, supportTicketName string, communicationName string, options *CommunicationsNoSubscriptionClientGetOptions) (CommunicationsNoSubscriptionClientGetResponse, error) { + var err error + const operationName = "CommunicationsNoSubscriptionClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, supportTicketName, communicationName, options) + if err != nil { + return CommunicationsNoSubscriptionClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CommunicationsNoSubscriptionClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CommunicationsNoSubscriptionClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *CommunicationsNoSubscriptionClient) getCreateRequest(ctx context.Context, supportTicketName string, communicationName string, options *CommunicationsNoSubscriptionClientGetOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}" + if supportTicketName == "" { + return nil, errors.New("parameter supportTicketName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{supportTicketName}", url.PathEscape(supportTicketName)) + if communicationName == "" { + return nil, errors.New("parameter communicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{communicationName}", url.PathEscape(communicationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CommunicationsNoSubscriptionClient) getHandleResponse(resp *http.Response) (CommunicationsNoSubscriptionClientGetResponse, error) { + result := CommunicationsNoSubscriptionClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CommunicationDetails); err != nil { + return CommunicationsNoSubscriptionClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/support/armsupport/communicationsnosubscription_client_example_test.go b/sdk/resourcemanager/support/armsupport/communicationsnosubscription_client_example_test.go new file mode 100644 index 000000000000..afa2f92faec6 --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/communicationsnosubscription_client_example_test.go @@ -0,0 +1,123 @@ +//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 armsupport_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/support/armsupport/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CheckNameAvailabilityForNoSubscriptionSupportTicketCommunication.json +func ExampleCommunicationsNoSubscriptionClient_CheckNameAvailability() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewCommunicationsNoSubscriptionClient().CheckNameAvailability(ctx, "testticket", armsupport.CheckNameAvailabilityInput{ + Name: to.Ptr("sampleName"), + Type: to.Ptr(armsupport.TypeMicrosoftSupportCommunications), + }, 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.CheckNameAvailabilityOutput = armsupport.CheckNameAvailabilityOutput{ + // Message: to.Ptr("Name not available"), + // NameAvailable: to.Ptr(false), + // Reason: to.Ptr("Name is already in use"), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/GetCommunicationDetailsForSupportTicket.json +func ExampleCommunicationsNoSubscriptionClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewCommunicationsNoSubscriptionClient().Get(ctx, "testticket", "testmessage", 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.CommunicationDetails = armsupport.CommunicationDetails{ + // Name: to.Ptr("testmessage"), + // Type: to.Ptr("Microsoft.Support/communications"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket/communications/testmessage"), + // Properties: &armsupport.CommunicationDetailsProperties{ + // Body: to.Ptr("this is a test message"), + // CommunicationDirection: to.Ptr(armsupport.CommunicationDirectionOutbound), + // CommunicationType: to.Ptr(armsupport.CommunicationTypeWeb), + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-08-24T20:18:19.000Z"); return t}()), + // Sender: to.Ptr("user@contoso.com"), + // Subject: to.Ptr("this is a test message"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateNoSubscriptionSupportTicketCommunication.json +func ExampleCommunicationsNoSubscriptionClient_BeginCreate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewCommunicationsNoSubscriptionClient().BeginCreate(ctx, "testticket", "testcommunication", armsupport.CommunicationDetails{ + Properties: &armsupport.CommunicationDetailsProperties{ + Body: to.Ptr("This is a test message from a customer!"), + Sender: to.Ptr("user@contoso.com"), + Subject: to.Ptr("This is a test message from a customer!"), + }, + }, 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.CommunicationDetails = armsupport.CommunicationDetails{ + // Name: to.Ptr("testcommunication"), + // Type: to.Ptr("Microsoft.Support/communications"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket/communications/testcommunication"), + // Properties: &armsupport.CommunicationDetailsProperties{ + // Body: to.Ptr("This is a test message from a customer!"), + // CommunicationDirection: to.Ptr(armsupport.CommunicationDirectionOutbound), + // CommunicationType: to.Ptr(armsupport.CommunicationTypeWeb), + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-10T20:18:19.000Z"); return t}()), + // Sender: to.Ptr("user@contoso.com"), + // Subject: to.Ptr("This is a test message from a customer!"), + // }, + // } +} diff --git a/sdk/resourcemanager/support/armsupport/constants.go b/sdk/resourcemanager/support/armsupport/constants.go index fb4c069935a2..6742cc06d1d2 100644 --- a/sdk/resourcemanager/support/armsupport/constants.go +++ b/sdk/resourcemanager/support/armsupport/constants.go @@ -10,7 +10,7 @@ package armsupport const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport" - moduleVersion = "v1.2.0" + moduleVersion = "v2.0.0-beta.2" ) // CommunicationDirection - Direction of communication. @@ -45,6 +45,42 @@ func PossibleCommunicationTypeValues() []CommunicationType { } } +// Consent - Advanced diagnostic consent to be updated on the support ticket. +type Consent string + +const ( + ConsentNo Consent = "No" + ConsentYes Consent = "Yes" +) + +// PossibleConsentValues returns the possible values for the Consent const type. +func PossibleConsentValues() []Consent { + return []Consent{ + ConsentNo, + ConsentYes, + } +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + // PreferredContactMethod - Preferred contact method. type PreferredContactMethod string @@ -100,6 +136,14 @@ func PossibleStatusValues() []Status { } } +// TranscriptContentType - Content type. +type TranscriptContentType string + +// PossibleTranscriptContentTypeValues returns the possible values for the TranscriptContentType const type. +func PossibleTranscriptContentTypeValues() []TranscriptContentType { + return []TranscriptContentType{} +} + // Type - The type of resource. type Type string @@ -115,3 +159,19 @@ func PossibleTypeValues() []Type { TypeMicrosoftSupportSupportTickets, } } + +// UserConsent - User consent value provided +type UserConsent string + +const ( + UserConsentNo UserConsent = "No" + UserConsentYes UserConsent = "Yes" +) + +// PossibleUserConsentValues returns the possible values for the UserConsent const type. +func PossibleUserConsentValues() []UserConsent { + return []UserConsent{ + UserConsentNo, + UserConsentYes, + } +} diff --git a/sdk/resourcemanager/support/armsupport/fake/chattranscripts_server.go b/sdk/resourcemanager/support/armsupport/fake/chattranscripts_server.go new file mode 100644 index 000000000000..1399f8b6fb2d --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/fake/chattranscripts_server.go @@ -0,0 +1,148 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2" + "net/http" + "net/url" + "regexp" +) + +// ChatTranscriptsServer is a fake server for instances of the armsupport.ChatTranscriptsClient type. +type ChatTranscriptsServer struct { + // Get is the fake for method ChatTranscriptsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, supportTicketName string, chatTranscriptName string, options *armsupport.ChatTranscriptsClientGetOptions) (resp azfake.Responder[armsupport.ChatTranscriptsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method ChatTranscriptsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(supportTicketName string, options *armsupport.ChatTranscriptsClientListOptions) (resp azfake.PagerResponder[armsupport.ChatTranscriptsClientListResponse]) +} + +// NewChatTranscriptsServerTransport creates a new instance of ChatTranscriptsServerTransport with the provided implementation. +// The returned ChatTranscriptsServerTransport instance is connected to an instance of armsupport.ChatTranscriptsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewChatTranscriptsServerTransport(srv *ChatTranscriptsServer) *ChatTranscriptsServerTransport { + return &ChatTranscriptsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armsupport.ChatTranscriptsClientListResponse]](), + } +} + +// ChatTranscriptsServerTransport connects instances of armsupport.ChatTranscriptsClient to instances of ChatTranscriptsServer. +// Don't use this type directly, use NewChatTranscriptsServerTransport instead. +type ChatTranscriptsServerTransport struct { + srv *ChatTranscriptsServer + newListPager *tracker[azfake.PagerResponder[armsupport.ChatTranscriptsClientListResponse]] +} + +// Do implements the policy.Transporter interface for ChatTranscriptsServerTransport. +func (c *ChatTranscriptsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ChatTranscriptsClient.Get": + resp, err = c.dispatchGet(req) + case "ChatTranscriptsClient.NewListPager": + resp, err = c.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *ChatTranscriptsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Support/supportTickets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/chatTranscripts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + supportTicketNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("supportTicketName")]) + if err != nil { + return nil, err + } + chatTranscriptNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("chatTranscriptName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), supportTicketNameParam, chatTranscriptNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ChatTranscriptDetails, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *ChatTranscriptsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := c.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Support/supportTickets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/chatTranscripts` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + supportTicketNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("supportTicketName")]) + if err != nil { + return nil, err + } + resp := c.srv.NewListPager(supportTicketNameParam, nil) + newListPager = &resp + c.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsupport.ChatTranscriptsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + c.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/support/armsupport/fake/chattranscriptsnosubscription_server.go b/sdk/resourcemanager/support/armsupport/fake/chattranscriptsnosubscription_server.go new file mode 100644 index 000000000000..da0a0008d3a6 --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/fake/chattranscriptsnosubscription_server.go @@ -0,0 +1,100 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2" + "net/http" + "net/url" + "regexp" +) + +// ChatTranscriptsNoSubscriptionServer is a fake server for instances of the armsupport.ChatTranscriptsNoSubscriptionClient type. +type ChatTranscriptsNoSubscriptionServer struct { + // Get is the fake for method ChatTranscriptsNoSubscriptionClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, supportTicketName string, chatTranscriptName string, options *armsupport.ChatTranscriptsNoSubscriptionClientGetOptions) (resp azfake.Responder[armsupport.ChatTranscriptsNoSubscriptionClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewChatTranscriptsNoSubscriptionServerTransport creates a new instance of ChatTranscriptsNoSubscriptionServerTransport with the provided implementation. +// The returned ChatTranscriptsNoSubscriptionServerTransport instance is connected to an instance of armsupport.ChatTranscriptsNoSubscriptionClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewChatTranscriptsNoSubscriptionServerTransport(srv *ChatTranscriptsNoSubscriptionServer) *ChatTranscriptsNoSubscriptionServerTransport { + return &ChatTranscriptsNoSubscriptionServerTransport{srv: srv} +} + +// ChatTranscriptsNoSubscriptionServerTransport connects instances of armsupport.ChatTranscriptsNoSubscriptionClient to instances of ChatTranscriptsNoSubscriptionServer. +// Don't use this type directly, use NewChatTranscriptsNoSubscriptionServerTransport instead. +type ChatTranscriptsNoSubscriptionServerTransport struct { + srv *ChatTranscriptsNoSubscriptionServer +} + +// Do implements the policy.Transporter interface for ChatTranscriptsNoSubscriptionServerTransport. +func (c *ChatTranscriptsNoSubscriptionServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ChatTranscriptsNoSubscriptionClient.Get": + resp, err = c.dispatchGet(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *ChatTranscriptsNoSubscriptionServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/providers/Microsoft\.Support/supportTickets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/chatTranscripts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + supportTicketNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("supportTicketName")]) + if err != nil { + return nil, err + } + chatTranscriptNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("chatTranscriptName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), supportTicketNameParam, chatTranscriptNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ChatTranscriptDetails, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/support/armsupport/fake/communications_server.go b/sdk/resourcemanager/support/armsupport/fake/communications_server.go index ff0f75cd16e4..e9280f92dc3c 100644 --- a/sdk/resourcemanager/support/armsupport/fake/communications_server.go +++ b/sdk/resourcemanager/support/armsupport/fake/communications_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/support/armsupport/fake/communicationsnosubscription_server.go b/sdk/resourcemanager/support/armsupport/fake/communicationsnosubscription_server.go new file mode 100644 index 000000000000..5a01706253b7 --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/fake/communicationsnosubscription_server.go @@ -0,0 +1,197 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2" + "net/http" + "net/url" + "regexp" +) + +// CommunicationsNoSubscriptionServer is a fake server for instances of the armsupport.CommunicationsNoSubscriptionClient type. +type CommunicationsNoSubscriptionServer struct { + // CheckNameAvailability is the fake for method CommunicationsNoSubscriptionClient.CheckNameAvailability + // HTTP status codes to indicate success: http.StatusOK + CheckNameAvailability func(ctx context.Context, supportTicketName string, checkNameAvailabilityInput armsupport.CheckNameAvailabilityInput, options *armsupport.CommunicationsNoSubscriptionClientCheckNameAvailabilityOptions) (resp azfake.Responder[armsupport.CommunicationsNoSubscriptionClientCheckNameAvailabilityResponse], errResp azfake.ErrorResponder) + + // BeginCreate is the fake for method CommunicationsNoSubscriptionClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginCreate func(ctx context.Context, supportTicketName string, communicationName string, createCommunicationParameters armsupport.CommunicationDetails, options *armsupport.CommunicationsNoSubscriptionClientBeginCreateOptions) (resp azfake.PollerResponder[armsupport.CommunicationsNoSubscriptionClientCreateResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method CommunicationsNoSubscriptionClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, supportTicketName string, communicationName string, options *armsupport.CommunicationsNoSubscriptionClientGetOptions) (resp azfake.Responder[armsupport.CommunicationsNoSubscriptionClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewCommunicationsNoSubscriptionServerTransport creates a new instance of CommunicationsNoSubscriptionServerTransport with the provided implementation. +// The returned CommunicationsNoSubscriptionServerTransport instance is connected to an instance of armsupport.CommunicationsNoSubscriptionClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCommunicationsNoSubscriptionServerTransport(srv *CommunicationsNoSubscriptionServer) *CommunicationsNoSubscriptionServerTransport { + return &CommunicationsNoSubscriptionServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armsupport.CommunicationsNoSubscriptionClientCreateResponse]](), + } +} + +// CommunicationsNoSubscriptionServerTransport connects instances of armsupport.CommunicationsNoSubscriptionClient to instances of CommunicationsNoSubscriptionServer. +// Don't use this type directly, use NewCommunicationsNoSubscriptionServerTransport instead. +type CommunicationsNoSubscriptionServerTransport struct { + srv *CommunicationsNoSubscriptionServer + beginCreate *tracker[azfake.PollerResponder[armsupport.CommunicationsNoSubscriptionClientCreateResponse]] +} + +// Do implements the policy.Transporter interface for CommunicationsNoSubscriptionServerTransport. +func (c *CommunicationsNoSubscriptionServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "CommunicationsNoSubscriptionClient.CheckNameAvailability": + resp, err = c.dispatchCheckNameAvailability(req) + case "CommunicationsNoSubscriptionClient.BeginCreate": + resp, err = c.dispatchBeginCreate(req) + case "CommunicationsNoSubscriptionClient.Get": + resp, err = c.dispatchGet(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *CommunicationsNoSubscriptionServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { + if c.srv.CheckNameAvailability == nil { + return nil, &nonRetriableError{errors.New("fake for method CheckNameAvailability not implemented")} + } + const regexStr = `/providers/Microsoft\.Support/supportTickets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/checkNameAvailability` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsupport.CheckNameAvailabilityInput](req) + if err != nil { + return nil, err + } + supportTicketNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("supportTicketName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.CheckNameAvailability(req.Context(), supportTicketNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CheckNameAvailabilityOutput, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CommunicationsNoSubscriptionServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if c.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := c.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/providers/Microsoft\.Support/supportTickets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/communications/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsupport.CommunicationDetails](req) + if err != nil { + return nil, err + } + supportTicketNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("supportTicketName")]) + if err != nil { + return nil, err + } + communicationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("communicationName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginCreate(req.Context(), supportTicketNameParam, communicationNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + c.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + c.beginCreate.remove(req) + } + + return resp, nil +} + +func (c *CommunicationsNoSubscriptionServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/providers/Microsoft\.Support/supportTickets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/communications/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + supportTicketNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("supportTicketName")]) + if err != nil { + return nil, err + } + communicationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("communicationName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), supportTicketNameParam, communicationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CommunicationDetails, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/support/armsupport/fake/files_server.go b/sdk/resourcemanager/support/armsupport/fake/files_server.go new file mode 100644 index 000000000000..3577fd0f33db --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/fake/files_server.go @@ -0,0 +1,234 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2" + "net/http" + "net/url" + "regexp" +) + +// FilesServer is a fake server for instances of the armsupport.FilesClient type. +type FilesServer struct { + // Create is the fake for method FilesClient.Create + // HTTP status codes to indicate success: http.StatusCreated + Create func(ctx context.Context, fileWorkspaceName string, fileName string, createFileParameters armsupport.FileDetails, options *armsupport.FilesClientCreateOptions) (resp azfake.Responder[armsupport.FilesClientCreateResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method FilesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, fileWorkspaceName string, fileName string, options *armsupport.FilesClientGetOptions) (resp azfake.Responder[armsupport.FilesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method FilesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(fileWorkspaceName string, options *armsupport.FilesClientListOptions) (resp azfake.PagerResponder[armsupport.FilesClientListResponse]) + + // Upload is the fake for method FilesClient.Upload + // HTTP status codes to indicate success: http.StatusNoContent + Upload func(ctx context.Context, fileWorkspaceName string, fileName string, uploadFile armsupport.UploadFile, options *armsupport.FilesClientUploadOptions) (resp azfake.Responder[armsupport.FilesClientUploadResponse], errResp azfake.ErrorResponder) +} + +// NewFilesServerTransport creates a new instance of FilesServerTransport with the provided implementation. +// The returned FilesServerTransport instance is connected to an instance of armsupport.FilesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewFilesServerTransport(srv *FilesServer) *FilesServerTransport { + return &FilesServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armsupport.FilesClientListResponse]](), + } +} + +// FilesServerTransport connects instances of armsupport.FilesClient to instances of FilesServer. +// Don't use this type directly, use NewFilesServerTransport instead. +type FilesServerTransport struct { + srv *FilesServer + newListPager *tracker[azfake.PagerResponder[armsupport.FilesClientListResponse]] +} + +// Do implements the policy.Transporter interface for FilesServerTransport. +func (f *FilesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "FilesClient.Create": + resp, err = f.dispatchCreate(req) + case "FilesClient.Get": + resp, err = f.dispatchGet(req) + case "FilesClient.NewListPager": + resp, err = f.dispatchNewListPager(req) + case "FilesClient.Upload": + resp, err = f.dispatchUpload(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (f *FilesServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { + if f.srv.Create == nil { + return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Support/fileWorkspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/files/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsupport.FileDetails](req) + if err != nil { + return nil, err + } + fileWorkspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fileWorkspaceName")]) + if err != nil { + return nil, err + } + fileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fileName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.Create(req.Context(), fileWorkspaceNameParam, fileNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).FileDetails, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (f *FilesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if f.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Support/fileWorkspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/files/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + fileWorkspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fileWorkspaceName")]) + if err != nil { + return nil, err + } + fileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fileName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.Get(req.Context(), fileWorkspaceNameParam, fileNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).FileDetails, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (f *FilesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if f.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := f.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Support/fileWorkspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/files` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + fileWorkspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fileWorkspaceName")]) + if err != nil { + return nil, err + } + resp := f.srv.NewListPager(fileWorkspaceNameParam, nil) + newListPager = &resp + f.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsupport.FilesClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + f.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + f.newListPager.remove(req) + } + return resp, nil +} + +func (f *FilesServerTransport) dispatchUpload(req *http.Request) (*http.Response, error) { + if f.srv.Upload == nil { + return nil, &nonRetriableError{errors.New("fake for method Upload not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Support/fileWorkspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/files/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/upload` + 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[armsupport.UploadFile](req) + if err != nil { + return nil, err + } + fileWorkspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fileWorkspaceName")]) + if err != nil { + return nil, err + } + fileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fileName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.Upload(req.Context(), fileWorkspaceNameParam, fileNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/support/armsupport/fake/filesnosubscription_server.go b/sdk/resourcemanager/support/armsupport/fake/filesnosubscription_server.go new file mode 100644 index 000000000000..c8bbe9882d73 --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/fake/filesnosubscription_server.go @@ -0,0 +1,234 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2" + "net/http" + "net/url" + "regexp" +) + +// FilesNoSubscriptionServer is a fake server for instances of the armsupport.FilesNoSubscriptionClient type. +type FilesNoSubscriptionServer struct { + // Create is the fake for method FilesNoSubscriptionClient.Create + // HTTP status codes to indicate success: http.StatusCreated + Create func(ctx context.Context, fileWorkspaceName string, fileName string, createFileParameters armsupport.FileDetails, options *armsupport.FilesNoSubscriptionClientCreateOptions) (resp azfake.Responder[armsupport.FilesNoSubscriptionClientCreateResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method FilesNoSubscriptionClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, fileWorkspaceName string, fileName string, options *armsupport.FilesNoSubscriptionClientGetOptions) (resp azfake.Responder[armsupport.FilesNoSubscriptionClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method FilesNoSubscriptionClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(fileWorkspaceName string, options *armsupport.FilesNoSubscriptionClientListOptions) (resp azfake.PagerResponder[armsupport.FilesNoSubscriptionClientListResponse]) + + // Upload is the fake for method FilesNoSubscriptionClient.Upload + // HTTP status codes to indicate success: http.StatusNoContent + Upload func(ctx context.Context, fileWorkspaceName string, fileName string, uploadFile armsupport.UploadFile, options *armsupport.FilesNoSubscriptionClientUploadOptions) (resp azfake.Responder[armsupport.FilesNoSubscriptionClientUploadResponse], errResp azfake.ErrorResponder) +} + +// NewFilesNoSubscriptionServerTransport creates a new instance of FilesNoSubscriptionServerTransport with the provided implementation. +// The returned FilesNoSubscriptionServerTransport instance is connected to an instance of armsupport.FilesNoSubscriptionClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewFilesNoSubscriptionServerTransport(srv *FilesNoSubscriptionServer) *FilesNoSubscriptionServerTransport { + return &FilesNoSubscriptionServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armsupport.FilesNoSubscriptionClientListResponse]](), + } +} + +// FilesNoSubscriptionServerTransport connects instances of armsupport.FilesNoSubscriptionClient to instances of FilesNoSubscriptionServer. +// Don't use this type directly, use NewFilesNoSubscriptionServerTransport instead. +type FilesNoSubscriptionServerTransport struct { + srv *FilesNoSubscriptionServer + newListPager *tracker[azfake.PagerResponder[armsupport.FilesNoSubscriptionClientListResponse]] +} + +// Do implements the policy.Transporter interface for FilesNoSubscriptionServerTransport. +func (f *FilesNoSubscriptionServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "FilesNoSubscriptionClient.Create": + resp, err = f.dispatchCreate(req) + case "FilesNoSubscriptionClient.Get": + resp, err = f.dispatchGet(req) + case "FilesNoSubscriptionClient.NewListPager": + resp, err = f.dispatchNewListPager(req) + case "FilesNoSubscriptionClient.Upload": + resp, err = f.dispatchUpload(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (f *FilesNoSubscriptionServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { + if f.srv.Create == nil { + return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} + } + const regexStr = `/providers/Microsoft\.Support/fileWorkspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/files/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsupport.FileDetails](req) + if err != nil { + return nil, err + } + fileWorkspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fileWorkspaceName")]) + if err != nil { + return nil, err + } + fileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fileName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.Create(req.Context(), fileWorkspaceNameParam, fileNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).FileDetails, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (f *FilesNoSubscriptionServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if f.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/providers/Microsoft\.Support/fileWorkspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/files/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + fileWorkspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fileWorkspaceName")]) + if err != nil { + return nil, err + } + fileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fileName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.Get(req.Context(), fileWorkspaceNameParam, fileNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).FileDetails, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (f *FilesNoSubscriptionServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if f.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := f.newListPager.get(req) + if newListPager == nil { + const regexStr = `/providers/Microsoft\.Support/fileWorkspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/files` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + fileWorkspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fileWorkspaceName")]) + if err != nil { + return nil, err + } + resp := f.srv.NewListPager(fileWorkspaceNameParam, nil) + newListPager = &resp + f.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsupport.FilesNoSubscriptionClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + f.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + f.newListPager.remove(req) + } + return resp, nil +} + +func (f *FilesNoSubscriptionServerTransport) dispatchUpload(req *http.Request) (*http.Response, error) { + if f.srv.Upload == nil { + return nil, &nonRetriableError{errors.New("fake for method Upload not implemented")} + } + const regexStr = `/providers/Microsoft\.Support/fileWorkspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/files/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/upload` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsupport.UploadFile](req) + if err != nil { + return nil, err + } + fileWorkspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fileWorkspaceName")]) + if err != nil { + return nil, err + } + fileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fileName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.Upload(req.Context(), fileWorkspaceNameParam, fileNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/support/armsupport/fake/fileworkspaces_server.go b/sdk/resourcemanager/support/armsupport/fake/fileworkspaces_server.go new file mode 100644 index 000000000000..09c7701153b8 --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/fake/fileworkspaces_server.go @@ -0,0 +1,131 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2" + "net/http" + "net/url" + "regexp" +) + +// FileWorkspacesServer is a fake server for instances of the armsupport.FileWorkspacesClient type. +type FileWorkspacesServer struct { + // Create is the fake for method FileWorkspacesClient.Create + // HTTP status codes to indicate success: http.StatusCreated + Create func(ctx context.Context, fileWorkspaceName string, options *armsupport.FileWorkspacesClientCreateOptions) (resp azfake.Responder[armsupport.FileWorkspacesClientCreateResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method FileWorkspacesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, fileWorkspaceName string, options *armsupport.FileWorkspacesClientGetOptions) (resp azfake.Responder[armsupport.FileWorkspacesClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewFileWorkspacesServerTransport creates a new instance of FileWorkspacesServerTransport with the provided implementation. +// The returned FileWorkspacesServerTransport instance is connected to an instance of armsupport.FileWorkspacesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewFileWorkspacesServerTransport(srv *FileWorkspacesServer) *FileWorkspacesServerTransport { + return &FileWorkspacesServerTransport{srv: srv} +} + +// FileWorkspacesServerTransport connects instances of armsupport.FileWorkspacesClient to instances of FileWorkspacesServer. +// Don't use this type directly, use NewFileWorkspacesServerTransport instead. +type FileWorkspacesServerTransport struct { + srv *FileWorkspacesServer +} + +// Do implements the policy.Transporter interface for FileWorkspacesServerTransport. +func (f *FileWorkspacesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "FileWorkspacesClient.Create": + resp, err = f.dispatchCreate(req) + case "FileWorkspacesClient.Get": + resp, err = f.dispatchGet(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (f *FileWorkspacesServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { + if f.srv.Create == nil { + return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Support/fileWorkspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + fileWorkspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fileWorkspaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.Create(req.Context(), fileWorkspaceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).FileWorkspaceDetails, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (f *FileWorkspacesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if f.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Support/fileWorkspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + fileWorkspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fileWorkspaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.Get(req.Context(), fileWorkspaceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).FileWorkspaceDetails, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/support/armsupport/fake/fileworkspacesnosubscription_server.go b/sdk/resourcemanager/support/armsupport/fake/fileworkspacesnosubscription_server.go new file mode 100644 index 000000000000..1c3f19cd88b1 --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/fake/fileworkspacesnosubscription_server.go @@ -0,0 +1,131 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2" + "net/http" + "net/url" + "regexp" +) + +// FileWorkspacesNoSubscriptionServer is a fake server for instances of the armsupport.FileWorkspacesNoSubscriptionClient type. +type FileWorkspacesNoSubscriptionServer struct { + // Create is the fake for method FileWorkspacesNoSubscriptionClient.Create + // HTTP status codes to indicate success: http.StatusCreated + Create func(ctx context.Context, fileWorkspaceName string, options *armsupport.FileWorkspacesNoSubscriptionClientCreateOptions) (resp azfake.Responder[armsupport.FileWorkspacesNoSubscriptionClientCreateResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method FileWorkspacesNoSubscriptionClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, fileWorkspaceName string, options *armsupport.FileWorkspacesNoSubscriptionClientGetOptions) (resp azfake.Responder[armsupport.FileWorkspacesNoSubscriptionClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewFileWorkspacesNoSubscriptionServerTransport creates a new instance of FileWorkspacesNoSubscriptionServerTransport with the provided implementation. +// The returned FileWorkspacesNoSubscriptionServerTransport instance is connected to an instance of armsupport.FileWorkspacesNoSubscriptionClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewFileWorkspacesNoSubscriptionServerTransport(srv *FileWorkspacesNoSubscriptionServer) *FileWorkspacesNoSubscriptionServerTransport { + return &FileWorkspacesNoSubscriptionServerTransport{srv: srv} +} + +// FileWorkspacesNoSubscriptionServerTransport connects instances of armsupport.FileWorkspacesNoSubscriptionClient to instances of FileWorkspacesNoSubscriptionServer. +// Don't use this type directly, use NewFileWorkspacesNoSubscriptionServerTransport instead. +type FileWorkspacesNoSubscriptionServerTransport struct { + srv *FileWorkspacesNoSubscriptionServer +} + +// Do implements the policy.Transporter interface for FileWorkspacesNoSubscriptionServerTransport. +func (f *FileWorkspacesNoSubscriptionServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "FileWorkspacesNoSubscriptionClient.Create": + resp, err = f.dispatchCreate(req) + case "FileWorkspacesNoSubscriptionClient.Get": + resp, err = f.dispatchGet(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (f *FileWorkspacesNoSubscriptionServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { + if f.srv.Create == nil { + return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} + } + const regexStr = `/providers/Microsoft\.Support/fileWorkspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + fileWorkspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fileWorkspaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.Create(req.Context(), fileWorkspaceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).FileWorkspaceDetails, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (f *FileWorkspacesNoSubscriptionServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if f.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/providers/Microsoft\.Support/fileWorkspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + fileWorkspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fileWorkspaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.Get(req.Context(), fileWorkspaceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).FileWorkspaceDetails, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/support/armsupport/fake/operations_server.go b/sdk/resourcemanager/support/armsupport/fake/operations_server.go index 734de9818fcd..0a4ff2051f66 100644 --- a/sdk/resourcemanager/support/armsupport/fake/operations_server.go +++ b/sdk/resourcemanager/support/armsupport/fake/operations_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2" "net/http" ) diff --git a/sdk/resourcemanager/support/armsupport/fake/problemclassifications_server.go b/sdk/resourcemanager/support/armsupport/fake/problemclassifications_server.go index b3ee808ef91b..8dc58ed51bcc 100644 --- a/sdk/resourcemanager/support/armsupport/fake/problemclassifications_server.go +++ b/sdk/resourcemanager/support/armsupport/fake/problemclassifications_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/support/armsupport/fake/server_factory.go b/sdk/resourcemanager/support/armsupport/fake/server_factory.go index d4167ff357ec..1f64f1eef672 100644 --- a/sdk/resourcemanager/support/armsupport/fake/server_factory.go +++ b/sdk/resourcemanager/support/armsupport/fake/server_factory.go @@ -19,11 +19,21 @@ import ( // ServerFactory is a fake server for instances of the armsupport.ClientFactory type. type ServerFactory struct { - CommunicationsServer CommunicationsServer - OperationsServer OperationsServer - ProblemClassificationsServer ProblemClassificationsServer - ServicesServer ServicesServer - TicketsServer TicketsServer + ChatTranscriptsServer ChatTranscriptsServer + ChatTranscriptsNoSubscriptionServer ChatTranscriptsNoSubscriptionServer + CommunicationsServer CommunicationsServer + CommunicationsNoSubscriptionServer CommunicationsNoSubscriptionServer + FileWorkspacesServer FileWorkspacesServer + FileWorkspacesNoSubscriptionServer FileWorkspacesNoSubscriptionServer + FilesServer FilesServer + FilesNoSubscriptionServer FilesNoSubscriptionServer + OperationsServer OperationsServer + ProblemClassificationsServer ProblemClassificationsServer + ServicesServer ServicesServer + TicketChatTranscriptsNoSubscriptionServer TicketChatTranscriptsNoSubscriptionServer + TicketCommunicationsNoSubscriptionServer TicketCommunicationsNoSubscriptionServer + TicketsServer TicketsServer + TicketsNoSubscriptionServer TicketsNoSubscriptionServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -38,13 +48,23 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armsupport.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trCommunicationsServer *CommunicationsServerTransport - trOperationsServer *OperationsServerTransport - trProblemClassificationsServer *ProblemClassificationsServerTransport - trServicesServer *ServicesServerTransport - trTicketsServer *TicketsServerTransport + srv *ServerFactory + trMu sync.Mutex + trChatTranscriptsServer *ChatTranscriptsServerTransport + trChatTranscriptsNoSubscriptionServer *ChatTranscriptsNoSubscriptionServerTransport + trCommunicationsServer *CommunicationsServerTransport + trCommunicationsNoSubscriptionServer *CommunicationsNoSubscriptionServerTransport + trFileWorkspacesServer *FileWorkspacesServerTransport + trFileWorkspacesNoSubscriptionServer *FileWorkspacesNoSubscriptionServerTransport + trFilesServer *FilesServerTransport + trFilesNoSubscriptionServer *FilesNoSubscriptionServerTransport + trOperationsServer *OperationsServerTransport + trProblemClassificationsServer *ProblemClassificationsServerTransport + trServicesServer *ServicesServerTransport + trTicketChatTranscriptsNoSubscriptionServer *TicketChatTranscriptsNoSubscriptionServerTransport + trTicketCommunicationsNoSubscriptionServer *TicketCommunicationsNoSubscriptionServerTransport + trTicketsServer *TicketsServerTransport + trTicketsNoSubscriptionServer *TicketsNoSubscriptionServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -60,11 +80,44 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { + case "ChatTranscriptsClient": + initServer(s, &s.trChatTranscriptsServer, func() *ChatTranscriptsServerTransport { + return NewChatTranscriptsServerTransport(&s.srv.ChatTranscriptsServer) + }) + resp, err = s.trChatTranscriptsServer.Do(req) + case "ChatTranscriptsNoSubscriptionClient": + initServer(s, &s.trChatTranscriptsNoSubscriptionServer, func() *ChatTranscriptsNoSubscriptionServerTransport { + return NewChatTranscriptsNoSubscriptionServerTransport(&s.srv.ChatTranscriptsNoSubscriptionServer) + }) + resp, err = s.trChatTranscriptsNoSubscriptionServer.Do(req) case "CommunicationsClient": initServer(s, &s.trCommunicationsServer, func() *CommunicationsServerTransport { return NewCommunicationsServerTransport(&s.srv.CommunicationsServer) }) resp, err = s.trCommunicationsServer.Do(req) + case "CommunicationsNoSubscriptionClient": + initServer(s, &s.trCommunicationsNoSubscriptionServer, func() *CommunicationsNoSubscriptionServerTransport { + return NewCommunicationsNoSubscriptionServerTransport(&s.srv.CommunicationsNoSubscriptionServer) + }) + resp, err = s.trCommunicationsNoSubscriptionServer.Do(req) + case "FileWorkspacesClient": + initServer(s, &s.trFileWorkspacesServer, func() *FileWorkspacesServerTransport { + return NewFileWorkspacesServerTransport(&s.srv.FileWorkspacesServer) + }) + resp, err = s.trFileWorkspacesServer.Do(req) + case "FileWorkspacesNoSubscriptionClient": + initServer(s, &s.trFileWorkspacesNoSubscriptionServer, func() *FileWorkspacesNoSubscriptionServerTransport { + return NewFileWorkspacesNoSubscriptionServerTransport(&s.srv.FileWorkspacesNoSubscriptionServer) + }) + resp, err = s.trFileWorkspacesNoSubscriptionServer.Do(req) + case "FilesClient": + initServer(s, &s.trFilesServer, func() *FilesServerTransport { return NewFilesServerTransport(&s.srv.FilesServer) }) + resp, err = s.trFilesServer.Do(req) + case "FilesNoSubscriptionClient": + initServer(s, &s.trFilesNoSubscriptionServer, func() *FilesNoSubscriptionServerTransport { + return NewFilesNoSubscriptionServerTransport(&s.srv.FilesNoSubscriptionServer) + }) + resp, err = s.trFilesNoSubscriptionServer.Do(req) case "OperationsClient": initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) resp, err = s.trOperationsServer.Do(req) @@ -76,9 +129,24 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "ServicesClient": initServer(s, &s.trServicesServer, func() *ServicesServerTransport { return NewServicesServerTransport(&s.srv.ServicesServer) }) resp, err = s.trServicesServer.Do(req) + case "TicketChatTranscriptsNoSubscriptionClient": + initServer(s, &s.trTicketChatTranscriptsNoSubscriptionServer, func() *TicketChatTranscriptsNoSubscriptionServerTransport { + return NewTicketChatTranscriptsNoSubscriptionServerTransport(&s.srv.TicketChatTranscriptsNoSubscriptionServer) + }) + resp, err = s.trTicketChatTranscriptsNoSubscriptionServer.Do(req) + case "TicketCommunicationsNoSubscriptionClient": + initServer(s, &s.trTicketCommunicationsNoSubscriptionServer, func() *TicketCommunicationsNoSubscriptionServerTransport { + return NewTicketCommunicationsNoSubscriptionServerTransport(&s.srv.TicketCommunicationsNoSubscriptionServer) + }) + resp, err = s.trTicketCommunicationsNoSubscriptionServer.Do(req) case "TicketsClient": initServer(s, &s.trTicketsServer, func() *TicketsServerTransport { return NewTicketsServerTransport(&s.srv.TicketsServer) }) resp, err = s.trTicketsServer.Do(req) + case "TicketsNoSubscriptionClient": + initServer(s, &s.trTicketsNoSubscriptionServer, func() *TicketsNoSubscriptionServerTransport { + return NewTicketsNoSubscriptionServerTransport(&s.srv.TicketsNoSubscriptionServer) + }) + resp, err = s.trTicketsNoSubscriptionServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) } diff --git a/sdk/resourcemanager/support/armsupport/fake/services_server.go b/sdk/resourcemanager/support/armsupport/fake/services_server.go index f229188b8e90..8a4157fb46a6 100644 --- a/sdk/resourcemanager/support/armsupport/fake/services_server.go +++ b/sdk/resourcemanager/support/armsupport/fake/services_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/support/armsupport/fake/ticketchattranscriptsnosubscription_server.go b/sdk/resourcemanager/support/armsupport/fake/ticketchattranscriptsnosubscription_server.go new file mode 100644 index 000000000000..14ca4d88f2e9 --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/fake/ticketchattranscriptsnosubscription_server.go @@ -0,0 +1,108 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2" + "net/http" + "net/url" + "regexp" +) + +// TicketChatTranscriptsNoSubscriptionServer is a fake server for instances of the armsupport.TicketChatTranscriptsNoSubscriptionClient type. +type TicketChatTranscriptsNoSubscriptionServer struct { + // NewListPager is the fake for method TicketChatTranscriptsNoSubscriptionClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(supportTicketName string, options *armsupport.TicketChatTranscriptsNoSubscriptionClientListOptions) (resp azfake.PagerResponder[armsupport.TicketChatTranscriptsNoSubscriptionClientListResponse]) +} + +// NewTicketChatTranscriptsNoSubscriptionServerTransport creates a new instance of TicketChatTranscriptsNoSubscriptionServerTransport with the provided implementation. +// The returned TicketChatTranscriptsNoSubscriptionServerTransport instance is connected to an instance of armsupport.TicketChatTranscriptsNoSubscriptionClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewTicketChatTranscriptsNoSubscriptionServerTransport(srv *TicketChatTranscriptsNoSubscriptionServer) *TicketChatTranscriptsNoSubscriptionServerTransport { + return &TicketChatTranscriptsNoSubscriptionServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armsupport.TicketChatTranscriptsNoSubscriptionClientListResponse]](), + } +} + +// TicketChatTranscriptsNoSubscriptionServerTransport connects instances of armsupport.TicketChatTranscriptsNoSubscriptionClient to instances of TicketChatTranscriptsNoSubscriptionServer. +// Don't use this type directly, use NewTicketChatTranscriptsNoSubscriptionServerTransport instead. +type TicketChatTranscriptsNoSubscriptionServerTransport struct { + srv *TicketChatTranscriptsNoSubscriptionServer + newListPager *tracker[azfake.PagerResponder[armsupport.TicketChatTranscriptsNoSubscriptionClientListResponse]] +} + +// Do implements the policy.Transporter interface for TicketChatTranscriptsNoSubscriptionServerTransport. +func (t *TicketChatTranscriptsNoSubscriptionServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "TicketChatTranscriptsNoSubscriptionClient.NewListPager": + resp, err = t.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (t *TicketChatTranscriptsNoSubscriptionServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if t.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := t.newListPager.get(req) + if newListPager == nil { + const regexStr = `/providers/Microsoft\.Support/supportTickets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/chatTranscripts` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + supportTicketNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("supportTicketName")]) + if err != nil { + return nil, err + } + resp := t.srv.NewListPager(supportTicketNameParam, nil) + newListPager = &resp + t.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsupport.TicketChatTranscriptsNoSubscriptionClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + t.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + t.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/support/armsupport/fake/ticketcommunicationsnosubscription_server.go b/sdk/resourcemanager/support/armsupport/fake/ticketcommunicationsnosubscription_server.go new file mode 100644 index 000000000000..69a4f5057e3a --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/fake/ticketcommunicationsnosubscription_server.go @@ -0,0 +1,136 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// TicketCommunicationsNoSubscriptionServer is a fake server for instances of the armsupport.TicketCommunicationsNoSubscriptionClient type. +type TicketCommunicationsNoSubscriptionServer struct { + // NewListPager is the fake for method TicketCommunicationsNoSubscriptionClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(supportTicketName string, options *armsupport.TicketCommunicationsNoSubscriptionClientListOptions) (resp azfake.PagerResponder[armsupport.TicketCommunicationsNoSubscriptionClientListResponse]) +} + +// NewTicketCommunicationsNoSubscriptionServerTransport creates a new instance of TicketCommunicationsNoSubscriptionServerTransport with the provided implementation. +// The returned TicketCommunicationsNoSubscriptionServerTransport instance is connected to an instance of armsupport.TicketCommunicationsNoSubscriptionClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewTicketCommunicationsNoSubscriptionServerTransport(srv *TicketCommunicationsNoSubscriptionServer) *TicketCommunicationsNoSubscriptionServerTransport { + return &TicketCommunicationsNoSubscriptionServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armsupport.TicketCommunicationsNoSubscriptionClientListResponse]](), + } +} + +// TicketCommunicationsNoSubscriptionServerTransport connects instances of armsupport.TicketCommunicationsNoSubscriptionClient to instances of TicketCommunicationsNoSubscriptionServer. +// Don't use this type directly, use NewTicketCommunicationsNoSubscriptionServerTransport instead. +type TicketCommunicationsNoSubscriptionServerTransport struct { + srv *TicketCommunicationsNoSubscriptionServer + newListPager *tracker[azfake.PagerResponder[armsupport.TicketCommunicationsNoSubscriptionClientListResponse]] +} + +// Do implements the policy.Transporter interface for TicketCommunicationsNoSubscriptionServerTransport. +func (t *TicketCommunicationsNoSubscriptionServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "TicketCommunicationsNoSubscriptionClient.NewListPager": + resp, err = t.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (t *TicketCommunicationsNoSubscriptionServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if t.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := t.newListPager.get(req) + if newListPager == nil { + const regexStr = `/providers/Microsoft\.Support/supportTickets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/communications` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + supportTicketNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("supportTicketName")]) + if err != nil { + return nil, err + } + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + var options *armsupport.TicketCommunicationsNoSubscriptionClientListOptions + if topParam != nil || filterParam != nil { + options = &armsupport.TicketCommunicationsNoSubscriptionClientListOptions{ + Top: topParam, + Filter: filterParam, + } + } + resp := t.srv.NewListPager(supportTicketNameParam, options) + newListPager = &resp + t.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsupport.TicketCommunicationsNoSubscriptionClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + t.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + t.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/support/armsupport/fake/tickets_server.go b/sdk/resourcemanager/support/armsupport/fake/tickets_server.go index 03637cf91afd..b8152d14157d 100644 --- a/sdk/resourcemanager/support/armsupport/fake/tickets_server.go +++ b/sdk/resourcemanager/support/armsupport/fake/tickets_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/support/armsupport/fake/ticketsnosubscription_server.go b/sdk/resourcemanager/support/armsupport/fake/ticketsnosubscription_server.go new file mode 100644 index 000000000000..c6c45d3ed592 --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/fake/ticketsnosubscription_server.go @@ -0,0 +1,282 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// TicketsNoSubscriptionServer is a fake server for instances of the armsupport.TicketsNoSubscriptionClient type. +type TicketsNoSubscriptionServer struct { + // CheckNameAvailability is the fake for method TicketsNoSubscriptionClient.CheckNameAvailability + // HTTP status codes to indicate success: http.StatusOK + CheckNameAvailability func(ctx context.Context, checkNameAvailabilityInput armsupport.CheckNameAvailabilityInput, options *armsupport.TicketsNoSubscriptionClientCheckNameAvailabilityOptions) (resp azfake.Responder[armsupport.TicketsNoSubscriptionClientCheckNameAvailabilityResponse], errResp azfake.ErrorResponder) + + // BeginCreate is the fake for method TicketsNoSubscriptionClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginCreate func(ctx context.Context, supportTicketName string, createSupportTicketParameters armsupport.TicketDetails, options *armsupport.TicketsNoSubscriptionClientBeginCreateOptions) (resp azfake.PollerResponder[armsupport.TicketsNoSubscriptionClientCreateResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method TicketsNoSubscriptionClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, supportTicketName string, options *armsupport.TicketsNoSubscriptionClientGetOptions) (resp azfake.Responder[armsupport.TicketsNoSubscriptionClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method TicketsNoSubscriptionClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armsupport.TicketsNoSubscriptionClientListOptions) (resp azfake.PagerResponder[armsupport.TicketsNoSubscriptionClientListResponse]) + + // Update is the fake for method TicketsNoSubscriptionClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, supportTicketName string, updateSupportTicket armsupport.UpdateSupportTicket, options *armsupport.TicketsNoSubscriptionClientUpdateOptions) (resp azfake.Responder[armsupport.TicketsNoSubscriptionClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewTicketsNoSubscriptionServerTransport creates a new instance of TicketsNoSubscriptionServerTransport with the provided implementation. +// The returned TicketsNoSubscriptionServerTransport instance is connected to an instance of armsupport.TicketsNoSubscriptionClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewTicketsNoSubscriptionServerTransport(srv *TicketsNoSubscriptionServer) *TicketsNoSubscriptionServerTransport { + return &TicketsNoSubscriptionServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armsupport.TicketsNoSubscriptionClientCreateResponse]](), + newListPager: newTracker[azfake.PagerResponder[armsupport.TicketsNoSubscriptionClientListResponse]](), + } +} + +// TicketsNoSubscriptionServerTransport connects instances of armsupport.TicketsNoSubscriptionClient to instances of TicketsNoSubscriptionServer. +// Don't use this type directly, use NewTicketsNoSubscriptionServerTransport instead. +type TicketsNoSubscriptionServerTransport struct { + srv *TicketsNoSubscriptionServer + beginCreate *tracker[azfake.PollerResponder[armsupport.TicketsNoSubscriptionClientCreateResponse]] + newListPager *tracker[azfake.PagerResponder[armsupport.TicketsNoSubscriptionClientListResponse]] +} + +// Do implements the policy.Transporter interface for TicketsNoSubscriptionServerTransport. +func (t *TicketsNoSubscriptionServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "TicketsNoSubscriptionClient.CheckNameAvailability": + resp, err = t.dispatchCheckNameAvailability(req) + case "TicketsNoSubscriptionClient.BeginCreate": + resp, err = t.dispatchBeginCreate(req) + case "TicketsNoSubscriptionClient.Get": + resp, err = t.dispatchGet(req) + case "TicketsNoSubscriptionClient.NewListPager": + resp, err = t.dispatchNewListPager(req) + case "TicketsNoSubscriptionClient.Update": + resp, err = t.dispatchUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (t *TicketsNoSubscriptionServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { + if t.srv.CheckNameAvailability == nil { + return nil, &nonRetriableError{errors.New("fake for method CheckNameAvailability not implemented")} + } + body, err := server.UnmarshalRequestAsJSON[armsupport.CheckNameAvailabilityInput](req) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.CheckNameAvailability(req.Context(), body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CheckNameAvailabilityOutput, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (t *TicketsNoSubscriptionServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if t.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := t.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/providers/Microsoft\.Support/supportTickets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsupport.TicketDetails](req) + if err != nil { + return nil, err + } + supportTicketNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("supportTicketName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.BeginCreate(req.Context(), supportTicketNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + t.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + t.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + t.beginCreate.remove(req) + } + + return resp, nil +} + +func (t *TicketsNoSubscriptionServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if t.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/providers/Microsoft\.Support/supportTickets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + supportTicketNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("supportTicketName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.Get(req.Context(), supportTicketNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TicketDetails, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (t *TicketsNoSubscriptionServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if t.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := t.newListPager.get(req) + if newListPager == nil { + qp := req.URL.Query() + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + var options *armsupport.TicketsNoSubscriptionClientListOptions + if topParam != nil || filterParam != nil { + options = &armsupport.TicketsNoSubscriptionClientListOptions{ + Top: topParam, + Filter: filterParam, + } + } + resp := t.srv.NewListPager(options) + newListPager = &resp + t.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsupport.TicketsNoSubscriptionClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + t.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + t.newListPager.remove(req) + } + return resp, nil +} + +func (t *TicketsNoSubscriptionServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if t.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/providers/Microsoft\.Support/supportTickets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsupport.UpdateSupportTicket](req) + if err != nil { + return nil, err + } + supportTicketNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("supportTicketName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.Update(req.Context(), supportTicketNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TicketDetails, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/support/armsupport/files_client.go b/sdk/resourcemanager/support/armsupport/files_client.go new file mode 100644 index 000000000000..b0430f29258b --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/files_client.go @@ -0,0 +1,293 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsupport + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FilesClient contains the methods for the Files group. +// Don't use this type directly, use NewFilesClient() instead. +type FilesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFilesClient creates a new instance of FilesClient with the specified values. +// - subscriptionID - Azure subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewFilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FilesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FilesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Creates a new file under a workspace for the specified subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-01-preview +// - fileWorkspaceName - File workspace name. +// - fileName - File name. +// - createFileParameters - Create file object +// - options - FilesClientCreateOptions contains the optional parameters for the FilesClient.Create method. +func (client *FilesClient) Create(ctx context.Context, fileWorkspaceName string, fileName string, createFileParameters FileDetails, options *FilesClientCreateOptions) (FilesClientCreateResponse, error) { + var err error + const operationName = "FilesClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, fileWorkspaceName, fileName, createFileParameters, options) + if err != nil { + return FilesClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FilesClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return FilesClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *FilesClient) createCreateRequest(ctx context.Context, fileWorkspaceName string, fileName string, createFileParameters FileDetails, options *FilesClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}" + if fileWorkspaceName == "" { + return nil, errors.New("parameter fileWorkspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileWorkspaceName}", url.PathEscape(fileWorkspaceName)) + if fileName == "" { + return nil, errors.New("parameter fileName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileName}", url.PathEscape(fileName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, createFileParameters); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *FilesClient) createHandleResponse(resp *http.Response) (FilesClientCreateResponse, error) { + result := FilesClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FileDetails); err != nil { + return FilesClientCreateResponse{}, err + } + return result, nil +} + +// Get - Returns details of a specific file in a work space. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-01-preview +// - fileWorkspaceName - File Workspace Name +// - fileName - File Name +// - options - FilesClientGetOptions contains the optional parameters for the FilesClient.Get method. +func (client *FilesClient) Get(ctx context.Context, fileWorkspaceName string, fileName string, options *FilesClientGetOptions) (FilesClientGetResponse, error) { + var err error + const operationName = "FilesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, fileWorkspaceName, fileName, options) + if err != nil { + return FilesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FilesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FilesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *FilesClient) getCreateRequest(ctx context.Context, fileWorkspaceName string, fileName string, options *FilesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}" + if fileWorkspaceName == "" { + return nil, errors.New("parameter fileWorkspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileWorkspaceName}", url.PathEscape(fileWorkspaceName)) + if fileName == "" { + return nil, errors.New("parameter fileName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileName}", url.PathEscape(fileName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FilesClient) getHandleResponse(resp *http.Response) (FilesClientGetResponse, error) { + result := FilesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FileDetails); err != nil { + return FilesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all the Files information under a workspace for an Azure subscription. +// +// Generated from API version 2022-09-01-preview +// - fileWorkspaceName - File Workspace Name +// - options - FilesClientListOptions contains the optional parameters for the FilesClient.NewListPager method. +func (client *FilesClient) NewListPager(fileWorkspaceName string, options *FilesClientListOptions) *runtime.Pager[FilesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[FilesClientListResponse]{ + More: func(page FilesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FilesClientListResponse) (FilesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "FilesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, fileWorkspaceName, options) + }, nil) + if err != nil { + return FilesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *FilesClient) listCreateRequest(ctx context.Context, fileWorkspaceName string, options *FilesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files" + if fileWorkspaceName == "" { + return nil, errors.New("parameter fileWorkspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileWorkspaceName}", url.PathEscape(fileWorkspaceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *FilesClient) listHandleResponse(resp *http.Response) (FilesClientListResponse, error) { + result := FilesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FilesListResult); err != nil { + return FilesClientListResponse{}, err + } + return result, nil +} + +// Upload - This API allows you to upload content to a file +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-01-preview +// - fileWorkspaceName - File WorkspaceName +// - fileName - File Name +// - uploadFile - UploadFile object +// - options - FilesClientUploadOptions contains the optional parameters for the FilesClient.Upload method. +func (client *FilesClient) Upload(ctx context.Context, fileWorkspaceName string, fileName string, uploadFile UploadFile, options *FilesClientUploadOptions) (FilesClientUploadResponse, error) { + var err error + const operationName = "FilesClient.Upload" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.uploadCreateRequest(ctx, fileWorkspaceName, fileName, uploadFile, options) + if err != nil { + return FilesClientUploadResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FilesClientUploadResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return FilesClientUploadResponse{}, err + } + return FilesClientUploadResponse{}, nil +} + +// uploadCreateRequest creates the Upload request. +func (client *FilesClient) uploadCreateRequest(ctx context.Context, fileWorkspaceName string, fileName string, uploadFile UploadFile, options *FilesClientUploadOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}/upload" + if fileWorkspaceName == "" { + return nil, errors.New("parameter fileWorkspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileWorkspaceName}", url.PathEscape(fileWorkspaceName)) + if fileName == "" { + return nil, errors.New("parameter fileName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileName}", url.PathEscape(fileName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, uploadFile); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/support/armsupport/files_client_example_test.go b/sdk/resourcemanager/support/armsupport/files_client_example_test.go new file mode 100644 index 000000000000..26e4b575fad2 --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/files_client_example_test.go @@ -0,0 +1,143 @@ +//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 armsupport_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/support/armsupport/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListFilesForSubscriptionUnderFileWorkspace.json +func ExampleFilesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFilesClient().NewListPager("testworkspace", 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.FilesListResult = armsupport.FilesListResult{ + // Value: []*armsupport.FileDetails{ + // { + // Name: to.Ptr("test1.txt"), + // Type: to.Ptr("Microsoft.Support/files"), + // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/fileWorkspaces/testworkspace/files/test1.txt"), + // Properties: &armsupport.FileDetailsProperties{ + // ChunkSize: to.Ptr[float32](41423), + // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-24T20:18:19.000Z"); return t}()), + // FileSize: to.Ptr[float32](41423), + // NumberOfChunks: to.Ptr[float32](1), + // }, + // }, + // { + // Name: to.Ptr("test2.txt"), + // Type: to.Ptr("Microsoft.Support/files"), + // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/fileWorkspaces/testworkspace/files/test2.txt"), + // Properties: &armsupport.FileDetailsProperties{ + // ChunkSize: to.Ptr[float32](41423), + // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-24T20:18:19.000Z"); return t}()), + // FileSize: to.Ptr[float32](41423), + // NumberOfChunks: to.Ptr[float32](1), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/GetFileDetailsForSubscription.json +func ExampleFilesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFilesClient().Get(ctx, "testworkspace", "test.txt", 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.FileDetails = armsupport.FileDetails{ + // Name: to.Ptr("test.txt"), + // Type: to.Ptr("Microsoft.Support/files"), + // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/fileWorkspaces/testworkspace/files/test.txt"), + // Properties: &armsupport.FileDetailsProperties{ + // ChunkSize: to.Ptr[float32](41423), + // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-24T20:18:19.000Z"); return t}()), + // FileSize: to.Ptr[float32](41423), + // NumberOfChunks: to.Ptr[float32](1), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateFileForSubscription.json +func ExampleFilesClient_Create() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewFilesClient().Create(ctx, "testworkspace", "test.txt", armsupport.FileDetails{ + Properties: &armsupport.FileDetailsProperties{ + ChunkSize: to.Ptr[float32](41423), + FileSize: to.Ptr[float32](41423), + NumberOfChunks: to.Ptr[float32](1), + }, + }, 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/UploadFileForSubscription.json +func ExampleFilesClient_Upload() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewFilesClient().Upload(ctx, "testworkspaceName", "test.txt", armsupport.UploadFile{ + ChunkIndex: to.Ptr[float32](0), + Content: to.Ptr("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABd"), + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/support/armsupport/filesnosubscription_client.go b/sdk/resourcemanager/support/armsupport/filesnosubscription_client.go new file mode 100644 index 000000000000..1fe889d50bf3 --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/filesnosubscription_client.go @@ -0,0 +1,277 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsupport + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FilesNoSubscriptionClient contains the methods for the FilesNoSubscription group. +// Don't use this type directly, use NewFilesNoSubscriptionClient() instead. +type FilesNoSubscriptionClient struct { + internal *arm.Client +} + +// NewFilesNoSubscriptionClient creates a new instance of FilesNoSubscriptionClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewFilesNoSubscriptionClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*FilesNoSubscriptionClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FilesNoSubscriptionClient{ + internal: cl, + } + return client, nil +} + +// Create - Creates a new file under a workspace. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-01-preview +// - fileWorkspaceName - File workspace name. +// - fileName - File name. +// - createFileParameters - Create file object +// - options - FilesNoSubscriptionClientCreateOptions contains the optional parameters for the FilesNoSubscriptionClient.Create +// method. +func (client *FilesNoSubscriptionClient) Create(ctx context.Context, fileWorkspaceName string, fileName string, createFileParameters FileDetails, options *FilesNoSubscriptionClientCreateOptions) (FilesNoSubscriptionClientCreateResponse, error) { + var err error + const operationName = "FilesNoSubscriptionClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, fileWorkspaceName, fileName, createFileParameters, options) + if err != nil { + return FilesNoSubscriptionClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FilesNoSubscriptionClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return FilesNoSubscriptionClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *FilesNoSubscriptionClient) createCreateRequest(ctx context.Context, fileWorkspaceName string, fileName string, createFileParameters FileDetails, options *FilesNoSubscriptionClientCreateOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}" + if fileWorkspaceName == "" { + return nil, errors.New("parameter fileWorkspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileWorkspaceName}", url.PathEscape(fileWorkspaceName)) + if fileName == "" { + return nil, errors.New("parameter fileName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileName}", url.PathEscape(fileName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, createFileParameters); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *FilesNoSubscriptionClient) createHandleResponse(resp *http.Response) (FilesNoSubscriptionClientCreateResponse, error) { + result := FilesNoSubscriptionClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FileDetails); err != nil { + return FilesNoSubscriptionClientCreateResponse{}, err + } + return result, nil +} + +// Get - Returns details of a specific file in a work space. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-01-preview +// - fileWorkspaceName - File Workspace Name +// - fileName - File Name +// - options - FilesNoSubscriptionClientGetOptions contains the optional parameters for the FilesNoSubscriptionClient.Get method. +func (client *FilesNoSubscriptionClient) Get(ctx context.Context, fileWorkspaceName string, fileName string, options *FilesNoSubscriptionClientGetOptions) (FilesNoSubscriptionClientGetResponse, error) { + var err error + const operationName = "FilesNoSubscriptionClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, fileWorkspaceName, fileName, options) + if err != nil { + return FilesNoSubscriptionClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FilesNoSubscriptionClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FilesNoSubscriptionClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *FilesNoSubscriptionClient) getCreateRequest(ctx context.Context, fileWorkspaceName string, fileName string, options *FilesNoSubscriptionClientGetOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}" + if fileWorkspaceName == "" { + return nil, errors.New("parameter fileWorkspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileWorkspaceName}", url.PathEscape(fileWorkspaceName)) + if fileName == "" { + return nil, errors.New("parameter fileName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileName}", url.PathEscape(fileName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FilesNoSubscriptionClient) getHandleResponse(resp *http.Response) (FilesNoSubscriptionClientGetResponse, error) { + result := FilesNoSubscriptionClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FileDetails); err != nil { + return FilesNoSubscriptionClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all the Files information under a workspace for an Azure subscription. +// +// Generated from API version 2022-09-01-preview +// - fileWorkspaceName - File Workspace Name +// - options - FilesNoSubscriptionClientListOptions contains the optional parameters for the FilesNoSubscriptionClient.NewListPager +// method. +func (client *FilesNoSubscriptionClient) NewListPager(fileWorkspaceName string, options *FilesNoSubscriptionClientListOptions) *runtime.Pager[FilesNoSubscriptionClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[FilesNoSubscriptionClientListResponse]{ + More: func(page FilesNoSubscriptionClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FilesNoSubscriptionClientListResponse) (FilesNoSubscriptionClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "FilesNoSubscriptionClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, fileWorkspaceName, options) + }, nil) + if err != nil { + return FilesNoSubscriptionClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *FilesNoSubscriptionClient) listCreateRequest(ctx context.Context, fileWorkspaceName string, options *FilesNoSubscriptionClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files" + if fileWorkspaceName == "" { + return nil, errors.New("parameter fileWorkspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileWorkspaceName}", url.PathEscape(fileWorkspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *FilesNoSubscriptionClient) listHandleResponse(resp *http.Response) (FilesNoSubscriptionClientListResponse, error) { + result := FilesNoSubscriptionClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FilesListResult); err != nil { + return FilesNoSubscriptionClientListResponse{}, err + } + return result, nil +} + +// Upload - This API allows you to upload content to a file +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-01-preview +// - fileWorkspaceName - File WorkspaceName +// - fileName - File Name +// - uploadFile - UploadFile object +// - options - FilesNoSubscriptionClientUploadOptions contains the optional parameters for the FilesNoSubscriptionClient.Upload +// method. +func (client *FilesNoSubscriptionClient) Upload(ctx context.Context, fileWorkspaceName string, fileName string, uploadFile UploadFile, options *FilesNoSubscriptionClientUploadOptions) (FilesNoSubscriptionClientUploadResponse, error) { + var err error + const operationName = "FilesNoSubscriptionClient.Upload" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.uploadCreateRequest(ctx, fileWorkspaceName, fileName, uploadFile, options) + if err != nil { + return FilesNoSubscriptionClientUploadResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FilesNoSubscriptionClientUploadResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return FilesNoSubscriptionClientUploadResponse{}, err + } + return FilesNoSubscriptionClientUploadResponse{}, nil +} + +// uploadCreateRequest creates the Upload request. +func (client *FilesNoSubscriptionClient) uploadCreateRequest(ctx context.Context, fileWorkspaceName string, fileName string, uploadFile UploadFile, options *FilesNoSubscriptionClientUploadOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}/upload" + if fileWorkspaceName == "" { + return nil, errors.New("parameter fileWorkspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileWorkspaceName}", url.PathEscape(fileWorkspaceName)) + if fileName == "" { + return nil, errors.New("parameter fileName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileName}", url.PathEscape(fileName)) + 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", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, uploadFile); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/support/armsupport/filesnosubscription_client_example_test.go b/sdk/resourcemanager/support/armsupport/filesnosubscription_client_example_test.go new file mode 100644 index 000000000000..415cc86d0ef9 --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/filesnosubscription_client_example_test.go @@ -0,0 +1,143 @@ +//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 armsupport_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/support/armsupport/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListFilesUnderFileWorkspace.json +func ExampleFilesNoSubscriptionClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFilesNoSubscriptionClient().NewListPager("testworkspace", 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.FilesListResult = armsupport.FilesListResult{ + // Value: []*armsupport.FileDetails{ + // { + // Name: to.Ptr("test1.txt"), + // Type: to.Ptr("Microsoft.Support/files"), + // ID: to.Ptr("/providers/Microsoft.Support/fileWorkspaces/testworkspace/files/test1.txt"), + // Properties: &armsupport.FileDetailsProperties{ + // ChunkSize: to.Ptr[float32](41423), + // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-24T20:18:19.000Z"); return t}()), + // FileSize: to.Ptr[float32](41423), + // NumberOfChunks: to.Ptr[float32](1), + // }, + // }, + // { + // Name: to.Ptr("test1.txt"), + // Type: to.Ptr("Microsoft.Support/files"), + // ID: to.Ptr("/providers/Microsoft.Support/fileWorkspaces/testworkspace/files/test1.txt"), + // Properties: &armsupport.FileDetailsProperties{ + // ChunkSize: to.Ptr[float32](41423), + // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-24T20:18:19.000Z"); return t}()), + // FileSize: to.Ptr[float32](41423), + // NumberOfChunks: to.Ptr[float32](1), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/GetFileDetails.json +func ExampleFilesNoSubscriptionClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFilesNoSubscriptionClient().Get(ctx, "testworkspace", "test.txt", 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.FileDetails = armsupport.FileDetails{ + // Name: to.Ptr("test.txt"), + // Type: to.Ptr("Microsoft.Support/files"), + // ID: to.Ptr("/providers/Microsoft.Support/fileWorkspaces/testworkspace/files/test.txt"), + // Properties: &armsupport.FileDetailsProperties{ + // ChunkSize: to.Ptr[float32](41423), + // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-24T20:18:19.000Z"); return t}()), + // FileSize: to.Ptr[float32](41423), + // NumberOfChunks: to.Ptr[float32](1), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateFile.json +func ExampleFilesNoSubscriptionClient_Create() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewFilesNoSubscriptionClient().Create(ctx, "testworkspace", "test.txt", armsupport.FileDetails{ + Properties: &armsupport.FileDetailsProperties{ + ChunkSize: to.Ptr[float32](41423), + FileSize: to.Ptr[float32](41423), + NumberOfChunks: to.Ptr[float32](1), + }, + }, 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/UploadFile.json +func ExampleFilesNoSubscriptionClient_Upload() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewFilesNoSubscriptionClient().Upload(ctx, "testworkspaceName", "test.txt", armsupport.UploadFile{ + ChunkIndex: to.Ptr[float32](0), + Content: to.Ptr("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABd"), + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/support/armsupport/fileworkspaces_client.go b/sdk/resourcemanager/support/armsupport/fileworkspaces_client.go new file mode 100644 index 000000000000..73b29b1a9c76 --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/fileworkspaces_client.go @@ -0,0 +1,162 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsupport + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FileWorkspacesClient contains the methods for the FileWorkspaces group. +// Don't use this type directly, use NewFileWorkspacesClient() instead. +type FileWorkspacesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFileWorkspacesClient creates a new instance of FileWorkspacesClient with the specified values. +// - subscriptionID - Azure subscription Id. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewFileWorkspacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FileWorkspacesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FileWorkspacesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Creates a new file workspace for the specified subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-01-preview +// - fileWorkspaceName - File workspace name. +// - options - FileWorkspacesClientCreateOptions contains the optional parameters for the FileWorkspacesClient.Create method. +func (client *FileWorkspacesClient) Create(ctx context.Context, fileWorkspaceName string, options *FileWorkspacesClientCreateOptions) (FileWorkspacesClientCreateResponse, error) { + var err error + const operationName = "FileWorkspacesClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, fileWorkspaceName, options) + if err != nil { + return FileWorkspacesClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FileWorkspacesClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return FileWorkspacesClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *FileWorkspacesClient) createCreateRequest(ctx context.Context, fileWorkspaceName string, options *FileWorkspacesClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}" + if fileWorkspaceName == "" { + return nil, errors.New("parameter fileWorkspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileWorkspaceName}", url.PathEscape(fileWorkspaceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *FileWorkspacesClient) createHandleResponse(resp *http.Response) (FileWorkspacesClientCreateResponse, error) { + result := FileWorkspacesClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FileWorkspaceDetails); err != nil { + return FileWorkspacesClientCreateResponse{}, err + } + return result, nil +} + +// Get - Gets details for a specific file workspace in an Azure subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-01-preview +// - fileWorkspaceName - File Workspace Name +// - options - FileWorkspacesClientGetOptions contains the optional parameters for the FileWorkspacesClient.Get method. +func (client *FileWorkspacesClient) Get(ctx context.Context, fileWorkspaceName string, options *FileWorkspacesClientGetOptions) (FileWorkspacesClientGetResponse, error) { + var err error + const operationName = "FileWorkspacesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, fileWorkspaceName, options) + if err != nil { + return FileWorkspacesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FileWorkspacesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FileWorkspacesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *FileWorkspacesClient) getCreateRequest(ctx context.Context, fileWorkspaceName string, options *FileWorkspacesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}" + if fileWorkspaceName == "" { + return nil, errors.New("parameter fileWorkspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileWorkspaceName}", url.PathEscape(fileWorkspaceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FileWorkspacesClient) getHandleResponse(resp *http.Response) (FileWorkspacesClientGetResponse, error) { + result := FileWorkspacesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FileWorkspaceDetails); err != nil { + return FileWorkspacesClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/support/armsupport/fileworkspaces_client_example_test.go b/sdk/resourcemanager/support/armsupport/fileworkspaces_client_example_test.go new file mode 100644 index 000000000000..311f069567c5 --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/fileworkspaces_client_example_test.go @@ -0,0 +1,64 @@ +//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 armsupport_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/GetFileWorkspaceDetailsForSubscription.json +func ExampleFileWorkspacesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFileWorkspacesClient().Get(ctx, "testworkspace", 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.FileWorkspaceDetails = armsupport.FileWorkspaceDetails{ + // Name: to.Ptr("testworkspace"), + // Type: to.Ptr("Microsoft.Support/fileWorkspaces"), + // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/fileWorkspaces/testworkspace"), + // Properties: &armsupport.FileWorkspaceDetailsProperties{ + // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-24T20:18:19.000Z"); return t}()), + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-25T20:18:19.000Z"); return t}()), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateFileWorkspaceForSubscription.json +func ExampleFileWorkspacesClient_Create() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewFileWorkspacesClient().Create(ctx, "testworkspace", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/support/armsupport/fileworkspacesnosubscription_client.go b/sdk/resourcemanager/support/armsupport/fileworkspacesnosubscription_client.go new file mode 100644 index 000000000000..ba88d3adce8b --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/fileworkspacesnosubscription_client.go @@ -0,0 +1,153 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsupport + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FileWorkspacesNoSubscriptionClient contains the methods for the FileWorkspacesNoSubscription group. +// Don't use this type directly, use NewFileWorkspacesNoSubscriptionClient() instead. +type FileWorkspacesNoSubscriptionClient struct { + internal *arm.Client +} + +// NewFileWorkspacesNoSubscriptionClient creates a new instance of FileWorkspacesNoSubscriptionClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewFileWorkspacesNoSubscriptionClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*FileWorkspacesNoSubscriptionClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FileWorkspacesNoSubscriptionClient{ + internal: cl, + } + return client, nil +} + +// Create - Creates a new file workspace. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-01-preview +// - fileWorkspaceName - File workspace name. +// - options - FileWorkspacesNoSubscriptionClientCreateOptions contains the optional parameters for the FileWorkspacesNoSubscriptionClient.Create +// method. +func (client *FileWorkspacesNoSubscriptionClient) Create(ctx context.Context, fileWorkspaceName string, options *FileWorkspacesNoSubscriptionClientCreateOptions) (FileWorkspacesNoSubscriptionClientCreateResponse, error) { + var err error + const operationName = "FileWorkspacesNoSubscriptionClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, fileWorkspaceName, options) + if err != nil { + return FileWorkspacesNoSubscriptionClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FileWorkspacesNoSubscriptionClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return FileWorkspacesNoSubscriptionClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *FileWorkspacesNoSubscriptionClient) createCreateRequest(ctx context.Context, fileWorkspaceName string, options *FileWorkspacesNoSubscriptionClientCreateOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}" + if fileWorkspaceName == "" { + return nil, errors.New("parameter fileWorkspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileWorkspaceName}", url.PathEscape(fileWorkspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *FileWorkspacesNoSubscriptionClient) createHandleResponse(resp *http.Response) (FileWorkspacesNoSubscriptionClientCreateResponse, error) { + result := FileWorkspacesNoSubscriptionClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FileWorkspaceDetails); err != nil { + return FileWorkspacesNoSubscriptionClientCreateResponse{}, err + } + return result, nil +} + +// Get - Gets details for a specific file workspace. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-01-preview +// - fileWorkspaceName - File Workspace Name +// - options - FileWorkspacesNoSubscriptionClientGetOptions contains the optional parameters for the FileWorkspacesNoSubscriptionClient.Get +// method. +func (client *FileWorkspacesNoSubscriptionClient) Get(ctx context.Context, fileWorkspaceName string, options *FileWorkspacesNoSubscriptionClientGetOptions) (FileWorkspacesNoSubscriptionClientGetResponse, error) { + var err error + const operationName = "FileWorkspacesNoSubscriptionClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, fileWorkspaceName, options) + if err != nil { + return FileWorkspacesNoSubscriptionClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FileWorkspacesNoSubscriptionClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FileWorkspacesNoSubscriptionClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *FileWorkspacesNoSubscriptionClient) getCreateRequest(ctx context.Context, fileWorkspaceName string, options *FileWorkspacesNoSubscriptionClientGetOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}" + if fileWorkspaceName == "" { + return nil, errors.New("parameter fileWorkspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileWorkspaceName}", url.PathEscape(fileWorkspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FileWorkspacesNoSubscriptionClient) getHandleResponse(resp *http.Response) (FileWorkspacesNoSubscriptionClientGetResponse, error) { + result := FileWorkspacesNoSubscriptionClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FileWorkspaceDetails); err != nil { + return FileWorkspacesNoSubscriptionClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/support/armsupport/fileworkspacesnosubscription_client_example_test.go b/sdk/resourcemanager/support/armsupport/fileworkspacesnosubscription_client_example_test.go new file mode 100644 index 000000000000..29a2dba44209 --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/fileworkspacesnosubscription_client_example_test.go @@ -0,0 +1,64 @@ +//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 armsupport_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/GetFileWorkspaceDetails.json +func ExampleFileWorkspacesNoSubscriptionClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFileWorkspacesNoSubscriptionClient().Get(ctx, "testworkspace", 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.FileWorkspaceDetails = armsupport.FileWorkspaceDetails{ + // Name: to.Ptr("testworkspace"), + // Type: to.Ptr("Microsoft.Support/fileWorkspaces"), + // ID: to.Ptr("/providers/Microsoft.Support/fileWorkspaces/testworkspace"), + // Properties: &armsupport.FileWorkspaceDetailsProperties{ + // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-24T20:18:19.000Z"); return t}()), + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-25T20:18:19.000Z"); return t}()), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateFileWorkspace.json +func ExampleFileWorkspacesNoSubscriptionClient_Create() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewFileWorkspacesNoSubscriptionClient().Create(ctx, "testworkspace", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/support/armsupport/go.mod b/sdk/resourcemanager/support/armsupport/go.mod index 175cad35117d..e9e167b927aa 100644 --- a/sdk/resourcemanager/support/armsupport/go.mod +++ b/sdk/resourcemanager/support/armsupport/go.mod @@ -1,4 +1,4 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2 go 1.18 diff --git a/sdk/resourcemanager/support/armsupport/models.go b/sdk/resourcemanager/support/armsupport/models.go index 187d169a924f..5483ff2fdb08 100644 --- a/sdk/resourcemanager/support/armsupport/models.go +++ b/sdk/resourcemanager/support/armsupport/models.go @@ -10,6 +10,42 @@ package armsupport import "time" +// ChatTranscriptDetails - Object that represents a Chat Transcript resource. +type ChatTranscriptDetails struct { + // Properties of the resource. + Properties *ChatTranscriptDetailsProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ChatTranscriptDetailsProperties - Describes the properties of a Chat Transcript Details resource. +type ChatTranscriptDetailsProperties struct { + // List of chat transcript communication resources. + Messages []*MessageProperties + + // READ-ONLY; Time in UTC (ISO 8601 format) when the chat began. + StartTime *time.Time +} + +// ChatTranscriptsListResult - Collection of Chat Transcripts resources. +type ChatTranscriptsListResult struct { + // The URI to fetch the next page of Chat Transcripts resources. + NextLink *string + + // List of Chat Transcripts resources. + Value []*ChatTranscriptDetails +} + // CheckNameAvailabilityInput - Input of CheckNameAvailability API. type CheckNameAvailabilityInput struct { // REQUIRED; The resource name to validate. @@ -117,6 +153,93 @@ type Engineer struct { EmailAddress *string } +// FileDetails - Object that represents File Details resource +type FileDetails struct { + // Properties of the resource + Properties *FileDetailsProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// FileDetailsProperties - Describes the properties of a file. +type FileDetailsProperties struct { + // Size of each chunk + ChunkSize *float32 + + // Size of the file to be uploaded + FileSize *float32 + + // Number of chunks to be uploaded + NumberOfChunks *float32 + + // READ-ONLY; Time in UTC (ISO 8601 format) when file workspace was created. + CreatedOn *time.Time +} + +// FileWorkspaceDetails - Object that represents FileWorkspaceDetails resource +type FileWorkspaceDetails struct { + // Properties of the resource + Properties *FileWorkspaceDetailsProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// FileWorkspaceDetailsProperties - Describes the properties of a file workspace. +type FileWorkspaceDetailsProperties struct { + // READ-ONLY; Time in UTC (ISO 8601 format) when file workspace was created. + CreatedOn *time.Time + + // READ-ONLY; Time in UTC (ISO 8601 format) when file workspace is going to expire. + ExpirationTime *time.Time +} + +// FilesListResult - Object that represents a collection of File resources. +type FilesListResult struct { + // The URI to fetch the next page of File resources. + NextLink *string + + // List of File resources. + Value []*FileDetails +} + +// MessageProperties - Describes the properties of a Message Details resource. +type MessageProperties struct { + // REQUIRED; Body of the communication. + Body *string + + // Name of the sender. + Sender *string + + // READ-ONLY; Direction of communication. + CommunicationDirection *CommunicationDirection + + // READ-ONLY; Content type. + ContentType *TranscriptContentType + + // READ-ONLY; Time in UTC (ISO 8601 format) when the communication was created. + CreatedDate *time.Time +} + // Operation - The operation supported by Microsoft Support resource provider. type Operation struct { // The object that describes the operation. @@ -166,6 +289,9 @@ type ProblemClassification struct { type ProblemClassificationProperties struct { // Localized name of problem classification. DisplayName *string + + // This property indicates whether secondary consent is present for problem classification + SecondaryConsentEnabled []*SecondaryConsentEnabled } // ProblemClassificationsListResult - Collection of ProblemClassification resources. @@ -197,6 +323,25 @@ type QuotaTicketDetails struct { QuotaChangeRequests []*QuotaChangeRequest } +// SecondaryConsent - This property indicates secondary consent for the support ticket. +type SecondaryConsent struct { + // The service name for which the secondary consent is being provided. The value needs to be retrieved from the Problem Classification + // API response. + Type *string + + // User consent value provided + UserConsent *UserConsent +} + +// SecondaryConsentEnabled - This property indicates whether secondary consent is present for problem classification. +type SecondaryConsentEnabled struct { + // User consent description. + Description *string + + // The Azure service for which secondary consent is needed for case creation. + Type *string +} + // Service - Object that represents a Service resource. type Service struct { // Properties of the resource. @@ -239,6 +384,27 @@ type ServicesListResult struct { Value []*Service } +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} + // TechnicalTicketDetails - Additional information for technical support ticket. type TechnicalTicketDetails struct { // This is the resource Id of the Azure service resource (For example: A virtual machine resource or an HDInsight resource) @@ -285,6 +451,15 @@ type TicketDetailsProperties struct { // REQUIRED; Title of the support ticket. Title *string + // Advanced diagnostic consent to be updated on the support ticket. + AdvancedDiagnosticConsent *Consent + + // File workspace name. + FileWorkspaceName *string + + // Problem scoping questions associated with the support ticket. + ProblemScopingQuestions *string + // Time in UTC (ISO 8601 format) when the problem started. ProblemStartTime *time.Time @@ -294,12 +469,18 @@ type TicketDetailsProperties struct { // Indicates if this requires a 24x7 response from Azure. Require24X7Response *bool + // This property indicates secondary consents for the support ticket + SecondaryConsent []*SecondaryConsent + // Service Level Agreement information for this support ticket. ServiceLevelAgreement *ServiceLevelAgreement // Information about the support engineer working on this support ticket. SupportEngineer *Engineer + // Support plan id associated with the support ticket. + SupportPlanID *string + // System generated support ticket Id that is unique. SupportTicketID *string @@ -324,6 +505,9 @@ type TicketDetailsProperties struct { // READ-ONLY; Status of the support ticket. Status *string + // READ-ONLY; Support plan type associated with the support ticket. + SupportPlanDisplayName *string + // READ-ONLY; Support plan type associated with the support ticket. SupportPlanType *string } @@ -374,12 +558,27 @@ type UpdateContactProfile struct { // UpdateSupportTicket - Updates severity, ticket status, and contact details in the support ticket. type UpdateSupportTicket struct { + // Advanced diagnostic consent to be updated on the support ticket. + AdvancedDiagnosticConsent *Consent + // Contact details to be updated on the support ticket. ContactDetails *UpdateContactProfile + // This property indicates secondary consents for the support ticket + SecondaryConsent []*SecondaryConsent + // Severity level. Severity *SeverityLevel // Status to be updated on the ticket. Status *Status } + +// UploadFile - File content associated with the file under a workspace. +type UploadFile struct { + // Index of the uploaded chunk (Index starts at 0) + ChunkIndex *float32 + + // File Content in base64 encoded format + Content *string +} diff --git a/sdk/resourcemanager/support/armsupport/models_serde.go b/sdk/resourcemanager/support/armsupport/models_serde.go index c97e668665e5..45577174d39e 100644 --- a/sdk/resourcemanager/support/armsupport/models_serde.go +++ b/sdk/resourcemanager/support/armsupport/models_serde.go @@ -15,6 +15,111 @@ import ( "reflect" ) +// MarshalJSON implements the json.Marshaller interface for type ChatTranscriptDetails. +func (c ChatTranscriptDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ChatTranscriptDetails. +func (c *ChatTranscriptDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ChatTranscriptDetailsProperties. +func (c ChatTranscriptDetailsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "messages", c.Messages) + populateDateTimeRFC3339(objectMap, "startTime", c.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ChatTranscriptDetailsProperties. +func (c *ChatTranscriptDetailsProperties) 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 "messages": + err = unpopulate(val, "Messages", &c.Messages) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &c.StartTime) + 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 ChatTranscriptsListResult. +func (c ChatTranscriptsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ChatTranscriptsListResult. +func (c *ChatTranscriptsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityInput. func (c CheckNameAvailabilityInput) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -284,6 +389,236 @@ func (e *Engineer) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type FileDetails. +func (f FileDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileDetails. +func (f *FileDetails) 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 "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + 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 FileDetailsProperties. +func (f FileDetailsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "chunkSize", f.ChunkSize) + populateDateTimeRFC3339(objectMap, "createdOn", f.CreatedOn) + populate(objectMap, "fileSize", f.FileSize) + populate(objectMap, "numberOfChunks", f.NumberOfChunks) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileDetailsProperties. +func (f *FileDetailsProperties) 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 "chunkSize": + err = unpopulate(val, "ChunkSize", &f.ChunkSize) + delete(rawMsg, key) + case "createdOn": + err = unpopulateDateTimeRFC3339(val, "CreatedOn", &f.CreatedOn) + delete(rawMsg, key) + case "fileSize": + err = unpopulate(val, "FileSize", &f.FileSize) + delete(rawMsg, key) + case "numberOfChunks": + err = unpopulate(val, "NumberOfChunks", &f.NumberOfChunks) + 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 FileWorkspaceDetails. +func (f FileWorkspaceDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileWorkspaceDetails. +func (f *FileWorkspaceDetails) 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 "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + 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 FileWorkspaceDetailsProperties. +func (f FileWorkspaceDetailsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createdOn", f.CreatedOn) + populateDateTimeRFC3339(objectMap, "expirationTime", f.ExpirationTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileWorkspaceDetailsProperties. +func (f *FileWorkspaceDetailsProperties) 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 "createdOn": + err = unpopulateDateTimeRFC3339(val, "CreatedOn", &f.CreatedOn) + delete(rawMsg, key) + case "expirationTime": + err = unpopulateDateTimeRFC3339(val, "ExpirationTime", &f.ExpirationTime) + 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 FilesListResult. +func (f FilesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FilesListResult. +func (f *FilesListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + 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 MessageProperties. +func (m MessageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "body", m.Body) + populate(objectMap, "communicationDirection", m.CommunicationDirection) + populate(objectMap, "contentType", m.ContentType) + populateDateTimeRFC3339(objectMap, "createdDate", m.CreatedDate) + populate(objectMap, "sender", m.Sender) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MessageProperties. +func (m *MessageProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "body": + err = unpopulate(val, "Body", &m.Body) + delete(rawMsg, key) + case "communicationDirection": + err = unpopulate(val, "CommunicationDirection", &m.CommunicationDirection) + delete(rawMsg, key) + case "contentType": + err = unpopulate(val, "ContentType", &m.ContentType) + delete(rawMsg, key) + case "createdDate": + err = unpopulateDateTimeRFC3339(val, "CreatedDate", &m.CreatedDate) + delete(rawMsg, key) + case "sender": + err = unpopulate(val, "Sender", &m.Sender) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Operation. func (o Operation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -424,6 +759,7 @@ func (p *ProblemClassification) UnmarshalJSON(data []byte) error { func (p ProblemClassificationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "secondaryConsentEnabled", p.SecondaryConsentEnabled) return json.Marshal(objectMap) } @@ -439,6 +775,9 @@ func (p *ProblemClassificationProperties) UnmarshalJSON(data []byte) error { case "displayName": err = unpopulate(val, "DisplayName", &p.DisplayName) delete(rawMsg, key) + case "secondaryConsentEnabled": + err = unpopulate(val, "SecondaryConsentEnabled", &p.SecondaryConsentEnabled) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -540,6 +879,68 @@ func (q *QuotaTicketDetails) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SecondaryConsent. +func (s SecondaryConsent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "type", s.Type) + populate(objectMap, "userConsent", s.UserConsent) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecondaryConsent. +func (s *SecondaryConsent) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + case "userConsent": + err = unpopulate(val, "UserConsent", &s.UserConsent) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecondaryConsentEnabled. +func (s SecondaryConsentEnabled) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", s.Description) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecondaryConsentEnabled. +func (s *SecondaryConsentEnabled) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Service. func (s Service) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -672,6 +1073,53 @@ func (s *ServicesListResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type TechnicalTicketDetails. func (t TechnicalTicketDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -741,22 +1189,28 @@ func (t *TicketDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TicketDetailsProperties. func (t TicketDetailsProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "advancedDiagnosticConsent", t.AdvancedDiagnosticConsent) populate(objectMap, "contactDetails", t.ContactDetails) populateDateTimeRFC3339(objectMap, "createdDate", t.CreatedDate) populate(objectMap, "description", t.Description) populate(objectMap, "enrollmentId", t.EnrollmentID) + populate(objectMap, "fileWorkspaceName", t.FileWorkspaceName) populateDateTimeRFC3339(objectMap, "modifiedDate", t.ModifiedDate) populate(objectMap, "problemClassificationDisplayName", t.ProblemClassificationDisplayName) populate(objectMap, "problemClassificationId", t.ProblemClassificationID) + populate(objectMap, "problemScopingQuestions", t.ProblemScopingQuestions) populateDateTimeRFC3339(objectMap, "problemStartTime", t.ProblemStartTime) populate(objectMap, "quotaTicketDetails", t.QuotaTicketDetails) populate(objectMap, "require24X7Response", t.Require24X7Response) + populate(objectMap, "secondaryConsent", t.SecondaryConsent) populate(objectMap, "serviceDisplayName", t.ServiceDisplayName) populate(objectMap, "serviceId", t.ServiceID) populate(objectMap, "serviceLevelAgreement", t.ServiceLevelAgreement) populate(objectMap, "severity", t.Severity) populate(objectMap, "status", t.Status) populate(objectMap, "supportEngineer", t.SupportEngineer) + populate(objectMap, "supportPlanDisplayName", t.SupportPlanDisplayName) + populate(objectMap, "supportPlanId", t.SupportPlanID) populate(objectMap, "supportPlanType", t.SupportPlanType) populate(objectMap, "supportTicketId", t.SupportTicketID) populate(objectMap, "technicalTicketDetails", t.TechnicalTicketDetails) @@ -773,6 +1227,9 @@ func (t *TicketDetailsProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "advancedDiagnosticConsent": + err = unpopulate(val, "AdvancedDiagnosticConsent", &t.AdvancedDiagnosticConsent) + delete(rawMsg, key) case "contactDetails": err = unpopulate(val, "ContactDetails", &t.ContactDetails) delete(rawMsg, key) @@ -785,6 +1242,9 @@ func (t *TicketDetailsProperties) UnmarshalJSON(data []byte) error { case "enrollmentId": err = unpopulate(val, "EnrollmentID", &t.EnrollmentID) delete(rawMsg, key) + case "fileWorkspaceName": + err = unpopulate(val, "FileWorkspaceName", &t.FileWorkspaceName) + delete(rawMsg, key) case "modifiedDate": err = unpopulateDateTimeRFC3339(val, "ModifiedDate", &t.ModifiedDate) delete(rawMsg, key) @@ -794,6 +1254,9 @@ func (t *TicketDetailsProperties) UnmarshalJSON(data []byte) error { case "problemClassificationId": err = unpopulate(val, "ProblemClassificationID", &t.ProblemClassificationID) delete(rawMsg, key) + case "problemScopingQuestions": + err = unpopulate(val, "ProblemScopingQuestions", &t.ProblemScopingQuestions) + delete(rawMsg, key) case "problemStartTime": err = unpopulateDateTimeRFC3339(val, "ProblemStartTime", &t.ProblemStartTime) delete(rawMsg, key) @@ -803,6 +1266,9 @@ func (t *TicketDetailsProperties) UnmarshalJSON(data []byte) error { case "require24X7Response": err = unpopulate(val, "Require24X7Response", &t.Require24X7Response) delete(rawMsg, key) + case "secondaryConsent": + err = unpopulate(val, "SecondaryConsent", &t.SecondaryConsent) + delete(rawMsg, key) case "serviceDisplayName": err = unpopulate(val, "ServiceDisplayName", &t.ServiceDisplayName) delete(rawMsg, key) @@ -821,6 +1287,12 @@ func (t *TicketDetailsProperties) UnmarshalJSON(data []byte) error { case "supportEngineer": err = unpopulate(val, "SupportEngineer", &t.SupportEngineer) delete(rawMsg, key) + case "supportPlanDisplayName": + err = unpopulate(val, "SupportPlanDisplayName", &t.SupportPlanDisplayName) + delete(rawMsg, key) + case "supportPlanId": + err = unpopulate(val, "SupportPlanID", &t.SupportPlanID) + delete(rawMsg, key) case "supportPlanType": err = unpopulate(val, "SupportPlanType", &t.SupportPlanType) delete(rawMsg, key) @@ -934,7 +1406,9 @@ func (u *UpdateContactProfile) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UpdateSupportTicket. func (u UpdateSupportTicket) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "advancedDiagnosticConsent", u.AdvancedDiagnosticConsent) populate(objectMap, "contactDetails", u.ContactDetails) + populate(objectMap, "secondaryConsent", u.SecondaryConsent) populate(objectMap, "severity", u.Severity) populate(objectMap, "status", u.Status) return json.Marshal(objectMap) @@ -949,9 +1423,15 @@ func (u *UpdateSupportTicket) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "advancedDiagnosticConsent": + err = unpopulate(val, "AdvancedDiagnosticConsent", &u.AdvancedDiagnosticConsent) + delete(rawMsg, key) case "contactDetails": err = unpopulate(val, "ContactDetails", &u.ContactDetails) delete(rawMsg, key) + case "secondaryConsent": + err = unpopulate(val, "SecondaryConsent", &u.SecondaryConsent) + delete(rawMsg, key) case "severity": err = unpopulate(val, "Severity", &u.Severity) delete(rawMsg, key) @@ -966,6 +1446,37 @@ func (u *UpdateSupportTicket) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type UploadFile. +func (u UploadFile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "chunkIndex", u.ChunkIndex) + populate(objectMap, "content", u.Content) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UploadFile. +func (u *UploadFile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "chunkIndex": + err = unpopulate(val, "ChunkIndex", &u.ChunkIndex) + delete(rawMsg, key) + case "content": + err = unpopulate(val, "Content", &u.Content) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + func populate(m map[string]any, k string, v any) { if v == nil { return diff --git a/sdk/resourcemanager/support/armsupport/operations_client.go b/sdk/resourcemanager/support/armsupport/operations_client.go index ad0700b50186..4bf3359de552 100644 --- a/sdk/resourcemanager/support/armsupport/operations_client.go +++ b/sdk/resourcemanager/support/armsupport/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - This lists all the available Microsoft Support REST API operations. // -// Generated from API version 2020-04-01 +// Generated from API version 2022-09-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]{ @@ -73,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-04-01") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/support/armsupport/operations_client_example_test.go b/sdk/resourcemanager/support/armsupport/operations_client_example_test.go index dabc4b2885d6..ab267f3b7f59 100644 --- a/sdk/resourcemanager/support/armsupport/operations_client_example_test.go +++ b/sdk/resourcemanager/support/armsupport/operations_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/ListOperations.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListOperations.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/support/armsupport/options.go b/sdk/resourcemanager/support/armsupport/options.go index 07067d1b6b4b..85a4d47df2fe 100644 --- a/sdk/resourcemanager/support/armsupport/options.go +++ b/sdk/resourcemanager/support/armsupport/options.go @@ -8,6 +8,22 @@ package armsupport +// ChatTranscriptsClientGetOptions contains the optional parameters for the ChatTranscriptsClient.Get method. +type ChatTranscriptsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ChatTranscriptsClientListOptions contains the optional parameters for the ChatTranscriptsClient.NewListPager method. +type ChatTranscriptsClientListOptions struct { + // placeholder for future optional parameters +} + +// ChatTranscriptsNoSubscriptionClientGetOptions contains the optional parameters for the ChatTranscriptsNoSubscriptionClient.Get +// method. +type ChatTranscriptsNoSubscriptionClientGetOptions struct { + // placeholder for future optional parameters +} + // CommunicationsClientBeginCreateOptions contains the optional parameters for the CommunicationsClient.BeginCreate method. type CommunicationsClientBeginCreateOptions struct { // Resumes the LRO from the provided token. @@ -37,6 +53,87 @@ type CommunicationsClientListOptions struct { Top *int32 } +// CommunicationsNoSubscriptionClientBeginCreateOptions contains the optional parameters for the CommunicationsNoSubscriptionClient.BeginCreate +// method. +type CommunicationsNoSubscriptionClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CommunicationsNoSubscriptionClientCheckNameAvailabilityOptions contains the optional parameters for the CommunicationsNoSubscriptionClient.CheckNameAvailability +// method. +type CommunicationsNoSubscriptionClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// CommunicationsNoSubscriptionClientGetOptions contains the optional parameters for the CommunicationsNoSubscriptionClient.Get +// method. +type CommunicationsNoSubscriptionClientGetOptions struct { + // placeholder for future optional parameters +} + +// FileWorkspacesClientCreateOptions contains the optional parameters for the FileWorkspacesClient.Create method. +type FileWorkspacesClientCreateOptions struct { + // placeholder for future optional parameters +} + +// FileWorkspacesClientGetOptions contains the optional parameters for the FileWorkspacesClient.Get method. +type FileWorkspacesClientGetOptions struct { + // placeholder for future optional parameters +} + +// FileWorkspacesNoSubscriptionClientCreateOptions contains the optional parameters for the FileWorkspacesNoSubscriptionClient.Create +// method. +type FileWorkspacesNoSubscriptionClientCreateOptions struct { + // placeholder for future optional parameters +} + +// FileWorkspacesNoSubscriptionClientGetOptions contains the optional parameters for the FileWorkspacesNoSubscriptionClient.Get +// method. +type FileWorkspacesNoSubscriptionClientGetOptions struct { + // placeholder for future optional parameters +} + +// FilesClientCreateOptions contains the optional parameters for the FilesClient.Create method. +type FilesClientCreateOptions struct { + // placeholder for future optional parameters +} + +// FilesClientGetOptions contains the optional parameters for the FilesClient.Get method. +type FilesClientGetOptions struct { + // placeholder for future optional parameters +} + +// FilesClientListOptions contains the optional parameters for the FilesClient.NewListPager method. +type FilesClientListOptions struct { + // placeholder for future optional parameters +} + +// FilesClientUploadOptions contains the optional parameters for the FilesClient.Upload method. +type FilesClientUploadOptions struct { + // placeholder for future optional parameters +} + +// FilesNoSubscriptionClientCreateOptions contains the optional parameters for the FilesNoSubscriptionClient.Create method. +type FilesNoSubscriptionClientCreateOptions struct { + // placeholder for future optional parameters +} + +// FilesNoSubscriptionClientGetOptions contains the optional parameters for the FilesNoSubscriptionClient.Get method. +type FilesNoSubscriptionClientGetOptions struct { + // placeholder for future optional parameters +} + +// FilesNoSubscriptionClientListOptions contains the optional parameters for the FilesNoSubscriptionClient.NewListPager method. +type FilesNoSubscriptionClientListOptions struct { + // placeholder for future optional parameters +} + +// FilesNoSubscriptionClientUploadOptions contains the optional parameters for the FilesNoSubscriptionClient.Upload method. +type FilesNoSubscriptionClientUploadOptions struct { + // placeholder for future optional parameters +} + // OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { // placeholder for future optional parameters @@ -63,6 +160,25 @@ type ServicesClientListOptions struct { // placeholder for future optional parameters } +// TicketChatTranscriptsNoSubscriptionClientListOptions contains the optional parameters for the TicketChatTranscriptsNoSubscriptionClient.NewListPager +// method. +type TicketChatTranscriptsNoSubscriptionClientListOptions struct { + // placeholder for future optional parameters +} + +// TicketCommunicationsNoSubscriptionClientListOptions contains the optional parameters for the TicketCommunicationsNoSubscriptionClient.NewListPager +// method. +type TicketCommunicationsNoSubscriptionClientListOptions struct { + // The filter to apply on the operation. You can filter by communicationType and createdDate properties. CommunicationType + // supports Equals ('eq') operator and createdDate supports Greater Than ('gt') and + // Greater Than or Equals ('ge') operators. You may combine the CommunicationType and CreatedDate filters by Logical And ('and') + // operator. + Filter *string + + // The number of values to return in the collection. Default is 10 and max is 10. + Top *int32 +} + // TicketsClientBeginCreateOptions contains the optional parameters for the TicketsClient.BeginCreate method. type TicketsClientBeginCreateOptions struct { // Resumes the LRO from the provided token. @@ -83,9 +199,10 @@ type TicketsClientGetOptions struct { // TicketsClientListOptions contains the optional parameters for the TicketsClient.NewListPager method. type TicketsClientListOptions struct { // The filter to apply on the operation. We support 'odata v4.0' filter semantics. Learn more [https://docs.microsoft.com/odata/concepts/queryoptions-overview]. - // Status filter can only be used with Equals - // ('eq') operator. For CreatedDate filter, the supported operators are Greater Than ('gt') and Greater Than or Equals ('ge'). - // When using both filters, combine them using the logical 'AND'. + // Status, ServiceId, and + // ProblemClassificationId filters can only be used with Equals ('eq') operator. For CreatedDate filter, the supported operators + // are Greater Than ('gt') and Greater Than or Equals ('ge'). When using both + // filters, combine them using the logical 'AND'. Filter *string // The number of values to return in the collection. Default is 25 and max is 100. @@ -96,3 +213,39 @@ type TicketsClientListOptions struct { type TicketsClientUpdateOptions struct { // placeholder for future optional parameters } + +// TicketsNoSubscriptionClientBeginCreateOptions contains the optional parameters for the TicketsNoSubscriptionClient.BeginCreate +// method. +type TicketsNoSubscriptionClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TicketsNoSubscriptionClientCheckNameAvailabilityOptions contains the optional parameters for the TicketsNoSubscriptionClient.CheckNameAvailability +// method. +type TicketsNoSubscriptionClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// TicketsNoSubscriptionClientGetOptions contains the optional parameters for the TicketsNoSubscriptionClient.Get method. +type TicketsNoSubscriptionClientGetOptions struct { + // placeholder for future optional parameters +} + +// TicketsNoSubscriptionClientListOptions contains the optional parameters for the TicketsNoSubscriptionClient.NewListPager +// method. +type TicketsNoSubscriptionClientListOptions struct { + // The filter to apply on the operation. We support 'odata v4.0' filter semantics. Learn more [https://docs.microsoft.com/odata/concepts/queryoptions-overview] + // Status , ServiceId, and ProblemClassificationId filters can only be used with 'eq' operator. For CreatedDate filter, the + // supported operators are 'gt' and 'ge'. When using both filters, combine them + // using the logical 'AND'. + Filter *string + + // The number of values to return in the collection. Default is 25 and max is 100. + Top *int32 +} + +// TicketsNoSubscriptionClientUpdateOptions contains the optional parameters for the TicketsNoSubscriptionClient.Update method. +type TicketsNoSubscriptionClientUpdateOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/support/armsupport/problemclassifications_client.go b/sdk/resourcemanager/support/armsupport/problemclassifications_client.go index 4392e70919cf..ddf2be5f521d 100644 --- a/sdk/resourcemanager/support/armsupport/problemclassifications_client.go +++ b/sdk/resourcemanager/support/armsupport/problemclassifications_client.go @@ -43,7 +43,7 @@ func NewProblemClassificationsClient(credential azcore.TokenCredential, options // Get - Get problem classification details for a specific Azure service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-04-01 +// Generated from API version 2022-09-01-preview // - serviceName - Name of the Azure service available for support. // - problemClassificationName - Name of problem classification. // - options - ProblemClassificationsClientGetOptions contains the optional parameters for the ProblemClassificationsClient.Get @@ -86,7 +86,7 @@ func (client *ProblemClassificationsClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-04-01") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -105,7 +105,7 @@ func (client *ProblemClassificationsClient) getHandleResponse(resp *http.Respons // service and problem classifications obtained programmatically. This practice ensures that you // always have the most recent set of service and problem classification Ids. // -// Generated from API version 2020-04-01 +// Generated from API version 2022-09-01-preview // - serviceName - Name of the Azure service for which the problem classifications need to be retrieved. // - options - ProblemClassificationsClientListOptions contains the optional parameters for the ProblemClassificationsClient.NewListPager // method. @@ -145,7 +145,7 @@ func (client *ProblemClassificationsClient) listCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-04-01") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/support/armsupport/problemclassifications_client_example_test.go b/sdk/resourcemanager/support/armsupport/problemclassifications_client_example_test.go index 553580f7d02d..03400c332efd 100644 --- a/sdk/resourcemanager/support/armsupport/problemclassifications_client_example_test.go +++ b/sdk/resourcemanager/support/armsupport/problemclassifications_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/ListProblemClassifications.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListProblemClassifications.json func ExampleProblemClassificationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -47,6 +47,11 @@ func ExampleProblemClassificationsClient_NewListPager() { // ID: to.Ptr("/providers/Microsoft.Support/services/service_guid/problemClassifications/problemClassification_guid_1"), // Properties: &armsupport.ProblemClassificationProperties{ // DisplayName: to.Ptr("Reservation Management / Exchanges and Refunds"), + // SecondaryConsentEnabled: []*armsupport.SecondaryConsentEnabled{ + // { + // Type: to.Ptr("DatabricksConsent"), + // Description: to.Ptr("For faster resolution, allow Microsoft and Databricks to temporarily have read and write access to your Databricks workspace. We will only access to read and write to your cluster for the purpose of resolving your support issue and in conformance with Microsoft's Privacy Policy."), + // }}, // }, // }, // { @@ -55,6 +60,11 @@ func ExampleProblemClassificationsClient_NewListPager() { // ID: to.Ptr("/providers/Microsoft.Support/services/service_guid/problemClassifications/problemClassification_guid_2"), // Properties: &armsupport.ProblemClassificationProperties{ // DisplayName: to.Ptr("Reservation Management / Request Invoices"), + // SecondaryConsentEnabled: []*armsupport.SecondaryConsentEnabled{ + // { + // Type: to.Ptr("DatabricksConsent"), + // Description: to.Ptr("For faster resolution, allow Microsoft and Databricks to temporarily have read and write access to your Databricks workspace. We will only access to read and write to your cluster for the purpose of resolving your support issue and in conformance with Microsoft's Privacy Policy."), + // }}, // }, // }, // { @@ -63,6 +73,11 @@ func ExampleProblemClassificationsClient_NewListPager() { // ID: to.Ptr("/providers/Microsoft.Support/services/service_guid/problemClassifications/problemClassification_guid_3"), // Properties: &armsupport.ProblemClassificationProperties{ // DisplayName: to.Ptr("Reservation Management / Other Iissues or Requests"), + // SecondaryConsentEnabled: []*armsupport.SecondaryConsentEnabled{ + // { + // Type: to.Ptr("DatabricksConsent"), + // Description: to.Ptr("For faster resolution, allow Microsoft and Databricks to temporarily have read and write access to your Databricks workspace. We will only access to read and write to your cluster for the purpose of resolving your support issue and in conformance with Microsoft's Privacy Policy."), + // }}, // }, // }, // { @@ -71,13 +86,18 @@ func ExampleProblemClassificationsClient_NewListPager() { // ID: to.Ptr("/providers/Microsoft.Support/services/service_guid/problemClassifications/problemClassification_guid_4"), // Properties: &armsupport.ProblemClassificationProperties{ // DisplayName: to.Ptr("Other General Billing Questions"), + // SecondaryConsentEnabled: []*armsupport.SecondaryConsentEnabled{ + // { + // Type: to.Ptr("DatabricksConsent"), + // Description: to.Ptr("For faster resolution, allow Microsoft and Databricks to temporarily have read and write access to your Databricks workspace. We will only access to read and write to your cluster for the purpose of resolving your support issue and in conformance with Microsoft's Privacy Policy."), + // }}, // }, // }}, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/GetProblemClassification.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/GetProblemClassification.json func ExampleProblemClassificationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/support/armsupport/response_types.go b/sdk/resourcemanager/support/armsupport/response_types.go index f52fcbe08053..b81edade4fb2 100644 --- a/sdk/resourcemanager/support/armsupport/response_types.go +++ b/sdk/resourcemanager/support/armsupport/response_types.go @@ -8,6 +8,24 @@ package armsupport +// ChatTranscriptsClientGetResponse contains the response from method ChatTranscriptsClient.Get. +type ChatTranscriptsClientGetResponse struct { + // Object that represents a Chat Transcript resource. + ChatTranscriptDetails +} + +// ChatTranscriptsClientListResponse contains the response from method ChatTranscriptsClient.NewListPager. +type ChatTranscriptsClientListResponse struct { + // Collection of Chat Transcripts resources. + ChatTranscriptsListResult +} + +// ChatTranscriptsNoSubscriptionClientGetResponse contains the response from method ChatTranscriptsNoSubscriptionClient.Get. +type ChatTranscriptsNoSubscriptionClientGetResponse struct { + // Object that represents a Chat Transcript resource. + ChatTranscriptDetails +} + // CommunicationsClientCheckNameAvailabilityResponse contains the response from method CommunicationsClient.CheckNameAvailability. type CommunicationsClientCheckNameAvailabilityResponse struct { // Output of check name availability API. @@ -32,6 +50,94 @@ type CommunicationsClientListResponse struct { CommunicationsListResult } +// CommunicationsNoSubscriptionClientCheckNameAvailabilityResponse contains the response from method CommunicationsNoSubscriptionClient.CheckNameAvailability. +type CommunicationsNoSubscriptionClientCheckNameAvailabilityResponse struct { + // Output of check name availability API. + CheckNameAvailabilityOutput +} + +// CommunicationsNoSubscriptionClientCreateResponse contains the response from method CommunicationsNoSubscriptionClient.BeginCreate. +type CommunicationsNoSubscriptionClientCreateResponse struct { + // Object that represents a Communication resource. + CommunicationDetails +} + +// CommunicationsNoSubscriptionClientGetResponse contains the response from method CommunicationsNoSubscriptionClient.Get. +type CommunicationsNoSubscriptionClientGetResponse struct { + // Object that represents a Communication resource. + CommunicationDetails +} + +// FileWorkspacesClientCreateResponse contains the response from method FileWorkspacesClient.Create. +type FileWorkspacesClientCreateResponse struct { + // Object that represents FileWorkspaceDetails resource + FileWorkspaceDetails +} + +// FileWorkspacesClientGetResponse contains the response from method FileWorkspacesClient.Get. +type FileWorkspacesClientGetResponse struct { + // Object that represents FileWorkspaceDetails resource + FileWorkspaceDetails +} + +// FileWorkspacesNoSubscriptionClientCreateResponse contains the response from method FileWorkspacesNoSubscriptionClient.Create. +type FileWorkspacesNoSubscriptionClientCreateResponse struct { + // Object that represents FileWorkspaceDetails resource + FileWorkspaceDetails +} + +// FileWorkspacesNoSubscriptionClientGetResponse contains the response from method FileWorkspacesNoSubscriptionClient.Get. +type FileWorkspacesNoSubscriptionClientGetResponse struct { + // Object that represents FileWorkspaceDetails resource + FileWorkspaceDetails +} + +// FilesClientCreateResponse contains the response from method FilesClient.Create. +type FilesClientCreateResponse struct { + // Object that represents File Details resource + FileDetails +} + +// FilesClientGetResponse contains the response from method FilesClient.Get. +type FilesClientGetResponse struct { + // Object that represents File Details resource + FileDetails +} + +// FilesClientListResponse contains the response from method FilesClient.NewListPager. +type FilesClientListResponse struct { + // Object that represents a collection of File resources. + FilesListResult +} + +// FilesClientUploadResponse contains the response from method FilesClient.Upload. +type FilesClientUploadResponse struct { + // placeholder for future response values +} + +// FilesNoSubscriptionClientCreateResponse contains the response from method FilesNoSubscriptionClient.Create. +type FilesNoSubscriptionClientCreateResponse struct { + // Object that represents File Details resource + FileDetails +} + +// FilesNoSubscriptionClientGetResponse contains the response from method FilesNoSubscriptionClient.Get. +type FilesNoSubscriptionClientGetResponse struct { + // Object that represents File Details resource + FileDetails +} + +// FilesNoSubscriptionClientListResponse contains the response from method FilesNoSubscriptionClient.NewListPager. +type FilesNoSubscriptionClientListResponse struct { + // Object that represents a collection of File resources. + FilesListResult +} + +// FilesNoSubscriptionClientUploadResponse contains the response from method FilesNoSubscriptionClient.Upload. +type FilesNoSubscriptionClientUploadResponse struct { + // placeholder for future response values +} + // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { // The list of operations supported by Microsoft Support resource provider. @@ -62,6 +168,18 @@ type ServicesClientListResponse struct { ServicesListResult } +// TicketChatTranscriptsNoSubscriptionClientListResponse contains the response from method TicketChatTranscriptsNoSubscriptionClient.NewListPager. +type TicketChatTranscriptsNoSubscriptionClientListResponse struct { + // Collection of Chat Transcripts resources. + ChatTranscriptsListResult +} + +// TicketCommunicationsNoSubscriptionClientListResponse contains the response from method TicketCommunicationsNoSubscriptionClient.NewListPager. +type TicketCommunicationsNoSubscriptionClientListResponse struct { + // Collection of Communication resources. + CommunicationsListResult +} + // TicketsClientCheckNameAvailabilityResponse contains the response from method TicketsClient.CheckNameAvailability. type TicketsClientCheckNameAvailabilityResponse struct { // Output of check name availability API. @@ -91,3 +209,33 @@ type TicketsClientUpdateResponse struct { // Object that represents SupportTicketDetails resource. TicketDetails } + +// TicketsNoSubscriptionClientCheckNameAvailabilityResponse contains the response from method TicketsNoSubscriptionClient.CheckNameAvailability. +type TicketsNoSubscriptionClientCheckNameAvailabilityResponse struct { + // Output of check name availability API. + CheckNameAvailabilityOutput +} + +// TicketsNoSubscriptionClientCreateResponse contains the response from method TicketsNoSubscriptionClient.BeginCreate. +type TicketsNoSubscriptionClientCreateResponse struct { + // Object that represents SupportTicketDetails resource. + TicketDetails +} + +// TicketsNoSubscriptionClientGetResponse contains the response from method TicketsNoSubscriptionClient.Get. +type TicketsNoSubscriptionClientGetResponse struct { + // Object that represents SupportTicketDetails resource. + TicketDetails +} + +// TicketsNoSubscriptionClientListResponse contains the response from method TicketsNoSubscriptionClient.NewListPager. +type TicketsNoSubscriptionClientListResponse struct { + // Object that represents a collection of SupportTicket resources. + TicketsListResult +} + +// TicketsNoSubscriptionClientUpdateResponse contains the response from method TicketsNoSubscriptionClient.Update. +type TicketsNoSubscriptionClientUpdateResponse struct { + // Object that represents SupportTicketDetails resource. + TicketDetails +} diff --git a/sdk/resourcemanager/support/armsupport/services_client.go b/sdk/resourcemanager/support/armsupport/services_client.go index f55d7549ce61..015f89cf1315 100644 --- a/sdk/resourcemanager/support/armsupport/services_client.go +++ b/sdk/resourcemanager/support/armsupport/services_client.go @@ -43,7 +43,7 @@ func NewServicesClient(credential azcore.TokenCredential, options *arm.ClientOpt // Get - Gets a specific Azure service for support ticket creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-04-01 +// Generated from API version 2022-09-01-preview // - serviceName - Name of the Azure service. // - options - ServicesClientGetOptions contains the optional parameters for the ServicesClient.Get method. func (client *ServicesClient) Get(ctx context.Context, serviceName string, options *ServicesClientGetOptions) (ServicesClientGetResponse, error) { @@ -80,7 +80,7 @@ func (client *ServicesClient) getCreateRequest(ctx context.Context, serviceName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-04-01") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -102,7 +102,7 @@ func (client *ServicesClient) getHandleResponse(resp *http.Response) (ServicesCl // obtained programmatically for support ticket creation. This practice ensures that you always have the most recent set of // service and problem classification Ids. // -// Generated from API version 2020-04-01 +// Generated from API version 2022-09-01-preview // - options - ServicesClientListOptions contains the optional parameters for the ServicesClient.NewListPager method. func (client *ServicesClient) NewListPager(options *ServicesClientListOptions) *runtime.Pager[ServicesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ServicesClientListResponse]{ @@ -136,7 +136,7 @@ func (client *ServicesClient) listCreateRequest(ctx context.Context, options *Se return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-04-01") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/support/armsupport/services_client_example_test.go b/sdk/resourcemanager/support/armsupport/services_client_example_test.go index bcf1a4c87d72..948d112bc7e5 100644 --- a/sdk/resourcemanager/support/armsupport/services_client_example_test.go +++ b/sdk/resourcemanager/support/armsupport/services_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/ListServices.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListServices.json func ExampleServicesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -119,7 +119,7 @@ func ExampleServicesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/GetService.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/GetService.json func ExampleServicesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/support/armsupport/ticketchattranscriptsnosubscription_client.go b/sdk/resourcemanager/support/armsupport/ticketchattranscriptsnosubscription_client.go new file mode 100644 index 000000000000..1936c860873d --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/ticketchattranscriptsnosubscription_client.go @@ -0,0 +1,97 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsupport + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// TicketChatTranscriptsNoSubscriptionClient contains the methods for the SupportTicketChatTranscriptsNoSubscription group. +// Don't use this type directly, use NewTicketChatTranscriptsNoSubscriptionClient() instead. +type TicketChatTranscriptsNoSubscriptionClient struct { + internal *arm.Client +} + +// NewTicketChatTranscriptsNoSubscriptionClient creates a new instance of TicketChatTranscriptsNoSubscriptionClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewTicketChatTranscriptsNoSubscriptionClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*TicketChatTranscriptsNoSubscriptionClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TicketChatTranscriptsNoSubscriptionClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Lists all chat transcripts for a support ticket +// +// Generated from API version 2022-09-01-preview +// - supportTicketName - Support ticket name +// - options - TicketChatTranscriptsNoSubscriptionClientListOptions contains the optional parameters for the TicketChatTranscriptsNoSubscriptionClient.NewListPager +// method. +func (client *TicketChatTranscriptsNoSubscriptionClient) NewListPager(supportTicketName string, options *TicketChatTranscriptsNoSubscriptionClientListOptions) *runtime.Pager[TicketChatTranscriptsNoSubscriptionClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[TicketChatTranscriptsNoSubscriptionClientListResponse]{ + More: func(page TicketChatTranscriptsNoSubscriptionClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *TicketChatTranscriptsNoSubscriptionClientListResponse) (TicketChatTranscriptsNoSubscriptionClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TicketChatTranscriptsNoSubscriptionClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, supportTicketName, options) + }, nil) + if err != nil { + return TicketChatTranscriptsNoSubscriptionClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *TicketChatTranscriptsNoSubscriptionClient) listCreateRequest(ctx context.Context, supportTicketName string, options *TicketChatTranscriptsNoSubscriptionClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Support/supportTickets/{supportTicketName}/chatTranscripts" + if supportTicketName == "" { + return nil, errors.New("parameter supportTicketName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{supportTicketName}", url.PathEscape(supportTicketName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *TicketChatTranscriptsNoSubscriptionClient) listHandleResponse(resp *http.Response) (TicketChatTranscriptsNoSubscriptionClientListResponse, error) { + result := TicketChatTranscriptsNoSubscriptionClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ChatTranscriptsListResult); err != nil { + return TicketChatTranscriptsNoSubscriptionClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/support/armsupport/ticketchattranscriptsnosubscription_client_example_test.go b/sdk/resourcemanager/support/armsupport/ticketchattranscriptsnosubscription_client_example_test.go new file mode 100644 index 000000000000..493d75dcebba --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/ticketchattranscriptsnosubscription_client_example_test.go @@ -0,0 +1,92 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armsupport_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListChatTranscriptsForSupportTicket.json +func ExampleTicketChatTranscriptsNoSubscriptionClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewTicketChatTranscriptsNoSubscriptionClient().NewListPager("testticket", 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.ChatTranscriptsListResult = armsupport.ChatTranscriptsListResult{ + // Value: []*armsupport.ChatTranscriptDetails{ + // { + // Name: to.Ptr("55989c71-1727-4cd9-abad-ddb8770f71cd"), + // Type: to.Ptr("Microsoft.Support/chatTranscripts"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/2207120020000085/chatTranscripts/55989c71-1727-4cd9-abad-ddb8770f71cd"), + // Properties: &armsupport.ChatTranscriptDetailsProperties{ + // Messages: []*armsupport.MessageProperties{ + // { + // Body: to.Ptr("Hi"), + // CommunicationDirection: to.Ptr(armsupport.CommunicationDirectionOutbound), + // ContentType: to.Ptr(armsupport.TranscriptContentType("text")), + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-24T20:18:19.000Z"); return t}()), + // Sender: to.Ptr("support engineer"), + // }, + // { + // Body: to.Ptr("hi"), + // CommunicationDirection: to.Ptr(armsupport.CommunicationDirectionInbound), + // ContentType: to.Ptr(armsupport.TranscriptContentType("text")), + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-24T20:19:16.000Z"); return t}()), + // Sender: to.Ptr("user"), + // }}, + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-22T22:46:35.000Z"); return t}()), + // }, + // }, + // { + // Name: to.Ptr("f15051e3-a2f2-489f-9e64-8cfa203f44f8"), + // Type: to.Ptr("Microsoft.Support/chatTranscripts"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/2207120020000085/chatTranscripts/f15051e3-a2f2-489f-9e64-8cfa203f44f8"), + // Properties: &armsupport.ChatTranscriptDetailsProperties{ + // Messages: []*armsupport.MessageProperties{ + // { + // Body: to.Ptr("Hi again"), + // CommunicationDirection: to.Ptr(armsupport.CommunicationDirectionOutbound), + // ContentType: to.Ptr(armsupport.TranscriptContentType("text")), + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-25T20:18:19.000Z"); return t}()), + // Sender: to.Ptr("support engineer 2"), + // }, + // { + // Body: to.Ptr("hello"), + // CommunicationDirection: to.Ptr(armsupport.CommunicationDirectionInbound), + // ContentType: to.Ptr(armsupport.TranscriptContentType("text")), + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-25T20:19:16.000Z"); return t}()), + // Sender: to.Ptr("user"), + // }}, + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-22T22:46:35.000Z"); return t}()), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/support/armsupport/ticketcommunicationsnosubscription_client.go b/sdk/resourcemanager/support/armsupport/ticketcommunicationsnosubscription_client.go new file mode 100644 index 000000000000..cb6357af83ca --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/ticketcommunicationsnosubscription_client.go @@ -0,0 +1,109 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsupport + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// TicketCommunicationsNoSubscriptionClient contains the methods for the SupportTicketCommunicationsNoSubscription group. +// Don't use this type directly, use NewTicketCommunicationsNoSubscriptionClient() instead. +type TicketCommunicationsNoSubscriptionClient struct { + internal *arm.Client +} + +// NewTicketCommunicationsNoSubscriptionClient creates a new instance of TicketCommunicationsNoSubscriptionClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewTicketCommunicationsNoSubscriptionClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*TicketCommunicationsNoSubscriptionClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TicketCommunicationsNoSubscriptionClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Lists all communications (attachments not included) for a support ticket. +// You can also filter support ticket communications by CreatedDate or CommunicationType using the $filter parameter. The +// only type of communication supported today is Web. Output will be a paged result +// with nextLink, using which you can retrieve the next set of Communication results. +// Support ticket data is available for 18 months after ticket creation. If a ticket was created more than 18 months ago, +// a request for data might cause an error. +// +// Generated from API version 2022-09-01-preview +// - supportTicketName - Support ticket name +// - options - TicketCommunicationsNoSubscriptionClientListOptions contains the optional parameters for the TicketCommunicationsNoSubscriptionClient.NewListPager +// method. +func (client *TicketCommunicationsNoSubscriptionClient) NewListPager(supportTicketName string, options *TicketCommunicationsNoSubscriptionClientListOptions) *runtime.Pager[TicketCommunicationsNoSubscriptionClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[TicketCommunicationsNoSubscriptionClientListResponse]{ + More: func(page TicketCommunicationsNoSubscriptionClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *TicketCommunicationsNoSubscriptionClientListResponse) (TicketCommunicationsNoSubscriptionClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TicketCommunicationsNoSubscriptionClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, supportTicketName, options) + }, nil) + if err != nil { + return TicketCommunicationsNoSubscriptionClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *TicketCommunicationsNoSubscriptionClient) listCreateRequest(ctx context.Context, supportTicketName string, options *TicketCommunicationsNoSubscriptionClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications" + if supportTicketName == "" { + return nil, errors.New("parameter supportTicketName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{supportTicketName}", url.PathEscape(supportTicketName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + reqQP.Set("api-version", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *TicketCommunicationsNoSubscriptionClient) listHandleResponse(resp *http.Response) (TicketCommunicationsNoSubscriptionClientListResponse, error) { + result := TicketCommunicationsNoSubscriptionClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CommunicationsListResult); err != nil { + return TicketCommunicationsNoSubscriptionClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/support/armsupport/ticketcommunicationsnosubscription_client_example_test.go b/sdk/resourcemanager/support/armsupport/ticketcommunicationsnosubscription_client_example_test.go new file mode 100644 index 000000000000..aa7f1c45e803 --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/ticketcommunicationsnosubscription_client_example_test.go @@ -0,0 +1,187 @@ +//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 armsupport_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/support/armsupport/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListCommunicationsForSupportTicket.json +func ExampleTicketCommunicationsNoSubscriptionClient_NewListPager_listCommunicationsForANoSubscriptionSupportTicket() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewTicketCommunicationsNoSubscriptionClient().NewListPager("testticket", &armsupport.TicketCommunicationsNoSubscriptionClientListOptions{Top: nil, + Filter: 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.CommunicationsListResult = armsupport.CommunicationsListResult{ + // Value: []*armsupport.CommunicationDetails{ + // { + // Name: to.Ptr("testmessage1"), + // Type: to.Ptr("Microsoft.Support/communications"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket/communications/testmessage1"), + // Properties: &armsupport.CommunicationDetailsProperties{ + // Body: to.Ptr("this is a test message"), + // CommunicationDirection: to.Ptr(armsupport.CommunicationDirectionOutbound), + // CommunicationType: to.Ptr(armsupport.CommunicationTypeWeb), + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-24T20:18:19.000Z"); return t}()), + // Sender: to.Ptr("user@contoso.com"), + // Subject: to.Ptr("this is a test message"), + // }, + // }, + // { + // Name: to.Ptr("testmessage2"), + // Type: to.Ptr("Microsoft.Support/communications"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket/communications/testmessage2"), + // Properties: &armsupport.CommunicationDetailsProperties{ + // Body: to.Ptr("test"), + // CommunicationDirection: to.Ptr(armsupport.CommunicationDirectionOutbound), + // CommunicationType: to.Ptr(armsupport.CommunicationTypeWeb), + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-29T10:53:19.000Z"); return t}()), + // Sender: to.Ptr("user@contoso.com"), + // Subject: to.Ptr("test"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListWebCommunicationsForSupportTicketCreatedOnOrAfter.json +func ExampleTicketCommunicationsNoSubscriptionClient_NewListPager_listWebCommunicationCreatedOnOrAfterASpecificDateForANoSubscriptionSupportTicket() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewTicketCommunicationsNoSubscriptionClient().NewListPager("testticket", &armsupport.TicketCommunicationsNoSubscriptionClientListOptions{Top: nil, + Filter: to.Ptr("communicationType eq 'web' and createdDate ge 2020-03-10T22:08:51Z"), + }) + 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.CommunicationsListResult = armsupport.CommunicationsListResult{ + // Value: []*armsupport.CommunicationDetails{ + // { + // Name: to.Ptr("testmessage1"), + // Type: to.Ptr("Microsoft.Support/communications"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket/communications/testmessage1"), + // Properties: &armsupport.CommunicationDetailsProperties{ + // Body: to.Ptr("this is a test message"), + // CommunicationDirection: to.Ptr(armsupport.CommunicationDirectionOutbound), + // CommunicationType: to.Ptr(armsupport.CommunicationTypeWeb), + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T20:18:19.000Z"); return t}()), + // Sender: to.Ptr("user@contoso.com"), + // Subject: to.Ptr("this is a test message"), + // }, + // }, + // { + // Name: to.Ptr("testmessage2"), + // Type: to.Ptr("Microsoft.Support/communications"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket/communications/testmessage2"), + // Properties: &armsupport.CommunicationDetailsProperties{ + // Body: to.Ptr("test"), + // CommunicationDirection: to.Ptr(armsupport.CommunicationDirectionOutbound), + // CommunicationType: to.Ptr(armsupport.CommunicationTypeWeb), + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-12T10:53:19.000Z"); return t}()), + // Sender: to.Ptr("user@contoso.com"), + // Subject: to.Ptr("test"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListWebCommunicationsForSupportTicket.json +func ExampleTicketCommunicationsNoSubscriptionClient_NewListPager_listWebCommunicationsForANoSubscriptionSupportTicket() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewTicketCommunicationsNoSubscriptionClient().NewListPager("testticket", &armsupport.TicketCommunicationsNoSubscriptionClientListOptions{Top: nil, + Filter: to.Ptr("communicationType eq 'web'"), + }) + 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.CommunicationsListResult = armsupport.CommunicationsListResult{ + // Value: []*armsupport.CommunicationDetails{ + // { + // Name: to.Ptr("testmessage1"), + // Type: to.Ptr("Microsoft.Support/communications"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket/communications/testmessage1"), + // Properties: &armsupport.CommunicationDetailsProperties{ + // Body: to.Ptr("this is a test message"), + // CommunicationDirection: to.Ptr(armsupport.CommunicationDirectionOutbound), + // CommunicationType: to.Ptr(armsupport.CommunicationTypeWeb), + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-10T20:18:19.000Z"); return t}()), + // Sender: to.Ptr("user@contoso.com"), + // Subject: to.Ptr("this is a test message"), + // }, + // }, + // { + // Name: to.Ptr("testmessage2"), + // Type: to.Ptr("Microsoft.Support/communications"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket/communications/testmessage2"), + // Properties: &armsupport.CommunicationDetailsProperties{ + // Body: to.Ptr("test"), + // CommunicationDirection: to.Ptr(armsupport.CommunicationDirectionOutbound), + // CommunicationType: to.Ptr(armsupport.CommunicationTypeWeb), + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T10:53:19.000Z"); return t}()), + // Sender: to.Ptr("user@contoso.com"), + // Subject: to.Ptr("test"), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/support/armsupport/tickets_client.go b/sdk/resourcemanager/support/armsupport/tickets_client.go index 74b712f80d8f..09b1f4c9e9be 100644 --- a/sdk/resourcemanager/support/armsupport/tickets_client.go +++ b/sdk/resourcemanager/support/armsupport/tickets_client.go @@ -48,7 +48,7 @@ func NewTicketsClient(subscriptionID string, credential azcore.TokenCredential, // name for support ticket creation for the selected subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-04-01 +// Generated from API version 2022-09-01-preview // - checkNameAvailabilityInput - Input to check. // - options - TicketsClientCheckNameAvailabilityOptions contains the optional parameters for the TicketsClient.CheckNameAvailability // method. @@ -86,7 +86,7 @@ func (client *TicketsClient) checkNameAvailabilityCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-04-01") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, checkNameAvailabilityInput); err != nil { @@ -124,7 +124,7 @@ func (client *TicketsClient) checkNameAvailabilityHandleResponse(resp *http.Resp // (CSP) partner tenant. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-04-01 +// Generated from API version 2022-09-01-preview // - supportTicketName - Support ticket name. // - createSupportTicketParameters - Support ticket request payload. // - options - TicketsClientBeginCreateOptions contains the optional parameters for the TicketsClient.BeginCreate method. @@ -166,7 +166,7 @@ func (client *TicketsClient) BeginCreate(ctx context.Context, supportTicketName // (CSP) partner tenant. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-04-01 +// Generated from API version 2022-09-01-preview func (client *TicketsClient) create(ctx context.Context, supportTicketName string, createSupportTicketParameters TicketDetails, options *TicketsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "TicketsClient.BeginCreate" @@ -204,7 +204,7 @@ func (client *TicketsClient) createCreateRequest(ctx context.Context, supportTic return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-04-01") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, createSupportTicketParameters); err != nil { @@ -218,7 +218,7 @@ func (client *TicketsClient) createCreateRequest(ctx context.Context, supportTic // error. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-04-01 +// Generated from API version 2022-09-01-preview // - supportTicketName - Support ticket name. // - options - TicketsClientGetOptions contains the optional parameters for the TicketsClient.Get method. func (client *TicketsClient) Get(ctx context.Context, supportTicketName string, options *TicketsClientGetOptions) (TicketsClientGetResponse, error) { @@ -259,7 +259,7 @@ func (client *TicketsClient) getCreateRequest(ctx context.Context, supportTicket return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-04-01") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -274,13 +274,13 @@ func (client *TicketsClient) getHandleResponse(resp *http.Response) (TicketsClie return result, nil } -// NewListPager - Lists all the support tickets for an Azure subscription. You can also filter the support tickets by Status -// or CreatedDate using the $filter parameter. Output will be a paged result with nextLink, -// using which you can retrieve the next set of support tickets. +// NewListPager - Lists all the support tickets for an Azure subscription. You can also filter the support tickets by Status, +// CreatedDate, ServiceId, and ProblemClassificationId using the $filter parameter. Output will +// be a paged result with nextLink, using which you can retrieve the next set of support tickets. // Support ticket data is available for 18 months after ticket creation. If a ticket was created more than 18 months ago, // a request for data might cause an error. // -// Generated from API version 2020-04-01 +// Generated from API version 2022-09-01-preview // - options - TicketsClientListOptions contains the optional parameters for the TicketsClient.NewListPager method. func (client *TicketsClient) NewListPager(options *TicketsClientListOptions) *runtime.Pager[TicketsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[TicketsClientListResponse]{ @@ -323,7 +323,7 @@ func (client *TicketsClient) listCreateRequest(ctx context.Context, options *Tic if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2020-04-01") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -338,15 +338,14 @@ func (client *TicketsClient) listHandleResponse(resp *http.Response) (TicketsCli return result, nil } -// Update - This API allows you to update the severity level, ticket status, and your contact information in the support ticket. +// Update - This API allows you to update the severity level, ticket status, advanced diagnostic consent and your contact +// information in the support ticket. // Note: The severity levels cannot be changed if a support ticket is actively being worked upon by an Azure support engineer. // In such a case, contact your support engineer to request severity update by // adding a new communication using the Communications API. -// Changing the ticket status to closed is allowed only on an unassigned case. When an engineer is actively working on the -// ticket, send your ticket closure request by sending a note to your engineer. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-04-01 +// Generated from API version 2022-09-01-preview // - supportTicketName - Support ticket name. // - updateSupportTicket - UpdateSupportTicket object. // - options - TicketsClientUpdateOptions contains the optional parameters for the TicketsClient.Update method. @@ -388,7 +387,7 @@ func (client *TicketsClient) updateCreateRequest(ctx context.Context, supportTic return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-04-01") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, updateSupportTicket); err != nil { diff --git a/sdk/resourcemanager/support/armsupport/tickets_client_example_test.go b/sdk/resourcemanager/support/armsupport/tickets_client_example_test.go index e1e45c897a51..d547c806774a 100644 --- a/sdk/resourcemanager/support/armsupport/tickets_client_example_test.go +++ b/sdk/resourcemanager/support/armsupport/tickets_client_example_test.go @@ -15,10 +15,10 @@ import ( "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/support/armsupport" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/support/armsupport/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/CheckNameAvailabilityWithSubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CheckNameAvailabilityWithSubscription.json func ExampleTicketsClient_CheckNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -46,7 +46,7 @@ func ExampleTicketsClient_CheckNameAvailability() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/ListSupportTicketsCreatedOnOrAfterAndInOpenStateBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListSupportTicketsCreatedOnOrAfterAndInOpenStateBySubscription.json func ExampleTicketsClient_NewListPager_listSupportTicketsCreatedOnOrAfterACertainDateAndInOpenStateForASubscription() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -78,6 +78,7 @@ func ExampleTicketsClient_NewListPager_listSupportTicketsCreatedOnOrAfterACertai // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/testticket"), // Properties: &armsupport.TicketDetailsProperties{ // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), // ContactDetails: &armsupport.ContactProfile{ // Country: to.Ptr("usa"), // FirstName: to.Ptr("abc"), @@ -88,10 +89,17 @@ func ExampleTicketsClient_NewListPager_listSupportTicketsCreatedOnOrAfterACertai // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-12T21:36:23.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("Connectivity / Cannot connect to virtual machine by using RDP or SSH"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_service_guid/problemClassifications/problemClassification_guid"), + // ProblemScopingQuestions: to.Ptr("{\"articleId\":\"076846c1-4c0b-4b21-91c6-1a30246b3867\",\"scopingDetails\":[{\"question\":\"When did the problem begin?\",\"controlId\":\"problem_start_time\",\"orderId\":1,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"2023-08-31T18:55:00.739Z\",\"value\":\"2023-08-31T18:55:00.739Z\",\"type\":\"datetime\"}},{\"question\":\"API Type of the Cosmos DB account\",\"controlId\":\"api_type\",\"orderId\":2,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"Table\",\"value\":\"tables\",\"type\":\"string\"}},{\"question\":\"Table name\",\"controlId\":\"collection_name_table\",\"orderId\":11,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"Select Table Name\",\"value\":\"dont_know_answer\",\"type\":\"string\"}},{\"question\":\"Provide additional details about the issue you're facing\",\"controlId\":\"problem_description\",\"orderId\":12,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"test ticket, please ignore and close\",\"value\":\"test ticket, please ignore and close\",\"type\":\"string\"}}]}"), // Require24X7Response: to.Ptr(false), + // SecondaryConsent: []*armsupport.SecondaryConsent{ + // { + // Type: to.Ptr("VirtualMachine"), + // UserConsent: to.Ptr(armsupport.UserConsentYes), + // }}, // ServiceDisplayName: to.Ptr("Virtual Machine running Linux"), // ServiceID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_service_guid"), // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ @@ -104,6 +112,8 @@ func ExampleTicketsClient_NewListPager_listSupportTicketsCreatedOnOrAfterACertai // SupportEngineer: &armsupport.Engineer{ // EmailAddress: to.Ptr("xyz@contoso.com"), // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("119120321001170"), // TechnicalTicketDetails: &armsupport.TechnicalTicketDetails{ @@ -128,6 +138,7 @@ func ExampleTicketsClient_NewListPager_listSupportTicketsCreatedOnOrAfterACertai // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-12T21:36:18.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("Add or Edit VAT, TAX ID, or PO Number"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/problemClassification_guid"), @@ -144,6 +155,8 @@ func ExampleTicketsClient_NewListPager_listSupportTicketsCreatedOnOrAfterACertai // SupportEngineer: &armsupport.Engineer{ // EmailAddress: to.Ptr("xyz@contoso.com"), // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("118032014183771"), // Title: to.Ptr("Test - please ignore"), @@ -153,7 +166,127 @@ func ExampleTicketsClient_NewListPager_listSupportTicketsCreatedOnOrAfterACertai } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/ListSupportTicketsBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListSupportTicketsCreatedOnOrAfterAndInUpdatingStateBySubscription.json +func ExampleTicketsClient_NewListPager_listSupportTicketsCreatedOnOrAfterACertainDateAndInUpdatingStateForASubscription() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewTicketsClient().NewListPager(&armsupport.TicketsClientListOptions{Top: nil, + Filter: to.Ptr("createdDate ge 2020-03-10T22:08:51Z and status eq 'Updating'"), + }) + 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.TicketsListResult = armsupport.TicketsListResult{ + // Value: []*armsupport.TicketDetails{ + // { + // Name: to.Ptr("testticket"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/testticket"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("usa"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-12T21:36:23.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Connectivity / Cannot connect to virtual machine by using RDP or SSH"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_service_guid/problemClassifications/problemClassification_guid"), + // ProblemScopingQuestions: to.Ptr("{\"articleId\":\"076846c1-4c0b-4b21-91c6-1a30246b3867\",\"scopingDetails\":[{\"question\":\"When did the problem begin?\",\"controlId\":\"problem_start_time\",\"orderId\":1,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"2023-08-31T18:55:00.739Z\",\"value\":\"2023-08-31T18:55:00.739Z\",\"type\":\"datetime\"}},{\"question\":\"API Type of the Cosmos DB account\",\"controlId\":\"api_type\",\"orderId\":2,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"Table\",\"value\":\"tables\",\"type\":\"string\"}},{\"question\":\"Table name\",\"controlId\":\"collection_name_table\",\"orderId\":11,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"Select Table Name\",\"value\":\"dont_know_answer\",\"type\":\"string\"}},{\"question\":\"Provide additional details about the issue you're facing\",\"controlId\":\"problem_description\",\"orderId\":12,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"test ticket, please ignore and close\",\"value\":\"test ticket, please ignore and close\",\"type\":\"string\"}}]}"), + // Require24X7Response: to.Ptr(false), + // SecondaryConsent: []*armsupport.SecondaryConsent{ + // { + // Type: to.Ptr("VirtualMachine"), + // UserConsent: to.Ptr(armsupport.UserConsentYes), + // }}, + // ServiceDisplayName: to.Ptr("Virtual Machine running Linux"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_service_guid"), + // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-12T17:36:18.000Z"); return t}()), + // SLAMinutes: to.Ptr[int32](240), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T21:36:18.000Z"); return t}()), + // }, + // Severity: to.Ptr(armsupport.SeverityLevelModerate), + // Status: to.Ptr("Updating"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("119120321001170"), + // TechnicalTicketDetails: &armsupport.TechnicalTicketDetails{ + // ResourceID: to.Ptr("/subscriptions/subid/resourceGroups/test/providers/Microsoft.Compute/virtualMachines/testserver"), + // }, + // Title: to.Ptr("my title"), + // }, + // }, + // { + // Name: to.Ptr("testticket2"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/testticket2"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("This is a test - please ignore"), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("USA"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-12T21:36:18.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Add or Edit VAT, TAX ID, or PO Number"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/problemClassification_guid"), + // Require24X7Response: to.Ptr(false), + // ServiceDisplayName: to.Ptr("Subscription management"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid"), + // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-12T17:36:18.000Z"); return t}()), + // SLAMinutes: to.Ptr[int32](240), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T21:36:18.000Z"); return t}()), + // }, + // Severity: to.Ptr(armsupport.SeverityLevelMinimal), + // Status: to.Ptr("Updating"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("118032014183771"), + // Title: to.Ptr("Test - please ignore"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListSupportTicketsBySubscription.json func ExampleTicketsClient_NewListPager_listSupportTicketsForASubscription() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -185,6 +318,7 @@ func ExampleTicketsClient_NewListPager_listSupportTicketsForASubscription() { // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/testticket"), // Properties: &armsupport.TicketDetailsProperties{ // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), // ContactDetails: &armsupport.ContactProfile{ // Country: to.Ptr("usa"), // FirstName: to.Ptr("abc"), @@ -195,10 +329,17 @@ func ExampleTicketsClient_NewListPager_listSupportTicketsForASubscription() { // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("Connectivity / Cannot connect to virtual machine by using RDP or SSH"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_service_guid/problemClassifications/problemClassification_guid"), + // ProblemScopingQuestions: to.Ptr("{\"articleId\":\"076846c1-4c0b-4b21-91c6-1a30246b3867\",\"scopingDetails\":[{\"question\":\"When did the problem begin?\",\"controlId\":\"problem_start_time\",\"orderId\":1,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"2023-08-31T18:55:00.739Z\",\"value\":\"2023-08-31T18:55:00.739Z\",\"type\":\"datetime\"}},{\"question\":\"API Type of the Cosmos DB account\",\"controlId\":\"api_type\",\"orderId\":2,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"Table\",\"value\":\"tables\",\"type\":\"string\"}},{\"question\":\"Table name\",\"controlId\":\"collection_name_table\",\"orderId\":11,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"Select Table Name\",\"value\":\"dont_know_answer\",\"type\":\"string\"}},{\"question\":\"Provide additional details about the issue you're facing\",\"controlId\":\"problem_description\",\"orderId\":12,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"test ticket, please ignore and close\",\"value\":\"test ticket, please ignore and close\",\"type\":\"string\"}}]}"), // Require24X7Response: to.Ptr(false), + // SecondaryConsent: []*armsupport.SecondaryConsent{ + // { + // Type: to.Ptr("VirtualMachine"), + // UserConsent: to.Ptr(armsupport.UserConsentYes), + // }}, // ServiceDisplayName: to.Ptr("Virtual Machine running Linux"), // ServiceID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_service_guid"), // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ @@ -211,6 +352,8 @@ func ExampleTicketsClient_NewListPager_listSupportTicketsForASubscription() { // SupportEngineer: &armsupport.Engineer{ // EmailAddress: to.Ptr("xyz@contoso.com"), // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("119120321001170"), // TechnicalTicketDetails: &armsupport.TechnicalTicketDetails{ @@ -235,6 +378,7 @@ func ExampleTicketsClient_NewListPager_listSupportTicketsForASubscription() { // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("Add or Edit VAT, TAX ID, or PO Number"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/problemClassification_guid"), @@ -251,6 +395,8 @@ func ExampleTicketsClient_NewListPager_listSupportTicketsForASubscription() { // SupportEngineer: &armsupport.Engineer{ // EmailAddress: to.Ptr("xyz@contoso.com"), // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("118032014183771"), // Title: to.Ptr("Test - please ignore"), @@ -260,7 +406,7 @@ func ExampleTicketsClient_NewListPager_listSupportTicketsForASubscription() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/ListSupportTicketsInOpenStateBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListSupportTicketsInOpenStateBySubscription.json func ExampleTicketsClient_NewListPager_listSupportTicketsInOpenStateForASubscription() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -292,6 +438,7 @@ func ExampleTicketsClient_NewListPager_listSupportTicketsInOpenStateForASubscrip // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/testticket"), // Properties: &armsupport.TicketDetailsProperties{ // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), // ContactDetails: &armsupport.ContactProfile{ // Country: to.Ptr("usa"), // FirstName: to.Ptr("abc"), @@ -302,10 +449,17 @@ func ExampleTicketsClient_NewListPager_listSupportTicketsInOpenStateForASubscrip // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("Connectivity / Cannot connect to virtual machine by using RDP or SSH"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_service_guid/problemClassifications/problemClassification_guid"), + // ProblemScopingQuestions: to.Ptr("{\"articleId\":\"076846c1-4c0b-4b21-91c6-1a30246b3867\",\"scopingDetails\":[{\"question\":\"When did the problem begin?\",\"controlId\":\"problem_start_time\",\"orderId\":1,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"2023-08-31T18:55:00.739Z\",\"value\":\"2023-08-31T18:55:00.739Z\",\"type\":\"datetime\"}},{\"question\":\"API Type of the Cosmos DB account\",\"controlId\":\"api_type\",\"orderId\":2,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"Table\",\"value\":\"tables\",\"type\":\"string\"}},{\"question\":\"Table name\",\"controlId\":\"collection_name_table\",\"orderId\":11,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"Select Table Name\",\"value\":\"dont_know_answer\",\"type\":\"string\"}},{\"question\":\"Provide additional details about the issue you're facing\",\"controlId\":\"problem_description\",\"orderId\":12,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"test ticket, please ignore and close\",\"value\":\"test ticket, please ignore and close\",\"type\":\"string\"}}]}"), // Require24X7Response: to.Ptr(false), + // SecondaryConsent: []*armsupport.SecondaryConsent{ + // { + // Type: to.Ptr("VirtualMachine"), + // UserConsent: to.Ptr(armsupport.UserConsentYes), + // }}, // ServiceDisplayName: to.Ptr("Virtual Machine running Linux"), // ServiceID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_service_guid"), // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ @@ -318,6 +472,8 @@ func ExampleTicketsClient_NewListPager_listSupportTicketsInOpenStateForASubscrip // SupportEngineer: &armsupport.Engineer{ // EmailAddress: to.Ptr("xyz@contoso.com"), // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("119120321001170"), // TechnicalTicketDetails: &armsupport.TechnicalTicketDetails{ @@ -342,6 +498,7 @@ func ExampleTicketsClient_NewListPager_listSupportTicketsInOpenStateForASubscrip // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("Add or Edit VAT, TAX ID, or PO Number"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/problemClassification_guid"), @@ -358,6 +515,8 @@ func ExampleTicketsClient_NewListPager_listSupportTicketsInOpenStateForASubscrip // SupportEngineer: &armsupport.Engineer{ // EmailAddress: to.Ptr("xyz@contoso.com"), // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("118032014183771"), // Title: to.Ptr("Test - please ignore"), @@ -367,7 +526,345 @@ func ExampleTicketsClient_NewListPager_listSupportTicketsInOpenStateForASubscrip } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/GetSubscriptionSupportTicketDetails.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListSupportTicketsInUpdatingStateBySubscription.json +func ExampleTicketsClient_NewListPager_listSupportTicketsInUpdatingStateForASubscription() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewTicketsClient().NewListPager(&armsupport.TicketsClientListOptions{Top: nil, + Filter: to.Ptr("status eq 'Updating'"), + }) + 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.TicketsListResult = armsupport.TicketsListResult{ + // Value: []*armsupport.TicketDetails{ + // { + // Name: to.Ptr("testticket"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/testticket"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("usa"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Connectivity / Cannot connect to virtual machine by using RDP or SSH"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_service_guid/problemClassifications/problemClassification_guid"), + // ProblemScopingQuestions: to.Ptr("{\"articleId\":\"076846c1-4c0b-4b21-91c6-1a30246b3867\",\"scopingDetails\":[{\"question\":\"When did the problem begin?\",\"controlId\":\"problem_start_time\",\"orderId\":1,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"2023-08-31T18:55:00.739Z\",\"value\":\"2023-08-31T18:55:00.739Z\",\"type\":\"datetime\"}},{\"question\":\"API Type of the Cosmos DB account\",\"controlId\":\"api_type\",\"orderId\":2,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"Table\",\"value\":\"tables\",\"type\":\"string\"}},{\"question\":\"Table name\",\"controlId\":\"collection_name_table\",\"orderId\":11,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"Select Table Name\",\"value\":\"dont_know_answer\",\"type\":\"string\"}},{\"question\":\"Provide additional details about the issue you're facing\",\"controlId\":\"problem_description\",\"orderId\":12,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"test ticket, please ignore and close\",\"value\":\"test ticket, please ignore and close\",\"type\":\"string\"}}]}"), + // Require24X7Response: to.Ptr(false), + // SecondaryConsent: []*armsupport.SecondaryConsent{ + // { + // Type: to.Ptr("VirtualMachine"), + // UserConsent: to.Ptr(armsupport.UserConsentYes), + // }}, + // ServiceDisplayName: to.Ptr("Virtual Machine running Linux"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_service_guid"), + // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-21T17:36:18.000Z"); return t}()), + // SLAMinutes: to.Ptr[int32](240), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // }, + // Severity: to.Ptr(armsupport.SeverityLevelModerate), + // Status: to.Ptr("Updating"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("119120321001170"), + // TechnicalTicketDetails: &armsupport.TechnicalTicketDetails{ + // ResourceID: to.Ptr("/subscriptions/subid/resourceGroups/test/providers/Microsoft.Compute/virtualMachines/testserver"), + // }, + // Title: to.Ptr("my title"), + // }, + // }, + // { + // Name: to.Ptr("testticket2"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/testticket2"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("This is a test - please ignore"), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("USA"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Add or Edit VAT, TAX ID, or PO Number"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/problemClassification_guid"), + // Require24X7Response: to.Ptr(false), + // ServiceDisplayName: to.Ptr("Subscription management"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid"), + // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-21T17:36:18.000Z"); return t}()), + // SLAMinutes: to.Ptr[int32](240), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // }, + // Severity: to.Ptr(armsupport.SeverityLevelMinimal), + // Status: to.Ptr("Updating"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("118032014183771"), + // Title: to.Ptr("Test - please ignore"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListSupportTicketsProblemClassificationIdEqualsForSubscription.json +func ExampleTicketsClient_NewListPager_listSupportTicketsWithACertainProblemClassificationIdForASubscription() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewTicketsClient().NewListPager(&armsupport.TicketsClientListOptions{Top: nil, + Filter: to.Ptr("ProblemClassificationId eq 'compute_vm_problemClassification_guid'"), + }) + 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.TicketsListResult = armsupport.TicketsListResult{ + // Value: []*armsupport.TicketDetails{ + // { + // Name: to.Ptr("testTicket1"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/testTicket1"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("usa"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-04T21:52:10.000Z"); return t}()), + // EnrollmentID: to.Ptr(""), + // FileWorkspaceName: to.Ptr("testTicket1"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-12T23:05:19.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Compute-VM (cores-vCPUs) subscription limit increases"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/service_guid/problemClassifications/compute_vm_problemClassification_guid"), + // Require24X7Response: to.Ptr(false), + // ServiceDisplayName: to.Ptr("service_displayName"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/service_guid"), + // Severity: to.Ptr(armsupport.SeverityLevelMinimal), + // Status: to.Ptr("Open"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("2205060010000072"), + // Title: to.Ptr("my title"), + // }, + // }, + // { + // Name: to.Ptr("testTicket2"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/testTicket2"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("This is a test - please ignore"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("USA"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-04T21:38:42.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("testTicket2"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-04T21:39:14.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Compute-VM (cores-vCPUs) subscription limit increases"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/service_guid/problemClassifications/compute_vm_problemClassification_guid"), + // Require24X7Response: to.Ptr(false), + // ServiceDisplayName: to.Ptr("service_displayName"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/service_guid"), + // Severity: to.Ptr(armsupport.SeverityLevelMinimal), + // Status: to.Ptr("Open"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("2205040010000077"), + // Title: to.Ptr("Test - please ignore"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListSupportTicketsServiceIdEqualsForSubscription.json +func ExampleTicketsClient_NewListPager_listSupportTicketsWithACertainServiceIdForASubscription() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewTicketsClient().NewListPager(&armsupport.TicketsClientListOptions{Top: nil, + Filter: to.Ptr("ServiceId eq 'vm_windows_service_guid'"), + }) + 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.TicketsListResult = armsupport.TicketsListResult{ + // Value: []*armsupport.TicketDetails{ + // { + // Name: to.Ptr("testticket1"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("usa"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-04T21:52:10.000Z"); return t}()), + // EnrollmentID: to.Ptr(""), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-12T23:05:19.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("problemClassification_displayName"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/vm_windows_service_guid/problemClassifications/problemClassification_guid"), + // ProblemScopingQuestions: to.Ptr("{\"articleId\":\"076846c1-4c0b-4b21-91c6-1a30246b3867\",\"scopingDetails\":[{\"question\":\"When did the problem begin?\",\"controlId\":\"problem_start_time\",\"orderId\":1,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"2023-08-31T18:55:00.739Z\",\"value\":\"2023-08-31T18:55:00.739Z\",\"type\":\"datetime\"}},{\"question\":\"API Type of the Cosmos DB account\",\"controlId\":\"api_type\",\"orderId\":2,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"Table\",\"value\":\"tables\",\"type\":\"string\"}},{\"question\":\"Table name\",\"controlId\":\"collection_name_table\",\"orderId\":11,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"Select Table Name\",\"value\":\"dont_know_answer\",\"type\":\"string\"}},{\"question\":\"Provide additional details about the issue you're facing\",\"controlId\":\"problem_description\",\"orderId\":12,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"test ticket, please ignore and close\",\"value\":\"test ticket, please ignore and close\",\"type\":\"string\"}}]}"), + // Require24X7Response: to.Ptr(false), + // SecondaryConsent: []*armsupport.SecondaryConsent{ + // { + // Type: to.Ptr("VirtualMachine"), + // UserConsent: to.Ptr(armsupport.UserConsentYes), + // }}, + // ServiceDisplayName: to.Ptr("Virtual Machine running Windows"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/vm_windows_service_guid"), + // Severity: to.Ptr(armsupport.SeverityLevelMinimal), + // Status: to.Ptr("Open"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("2205040010000082"), + // Title: to.Ptr("my title"), + // }, + // }, + // { + // Name: to.Ptr("testticket2"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("This is a test - please ignore"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("USA"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-04T21:38:42.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-04T21:39:14.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("problemClassification_displayName"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/vm_windows_service_guid/problemClassifications/problemClassification_guid"), + // ProblemScopingQuestions: to.Ptr("{\"articleId\":\"076846c1-4c0b-4b21-91c6-1a30246b3867\",\"scopingDetails\":[{\"question\":\"When did the problem begin?\",\"controlId\":\"problem_start_time\",\"orderId\":1,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"2023-08-31T18:55:00.739Z\",\"value\":\"2023-08-31T18:55:00.739Z\",\"type\":\"datetime\"}},{\"question\":\"API Type of the Cosmos DB account\",\"controlId\":\"api_type\",\"orderId\":2,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"Table\",\"value\":\"tables\",\"type\":\"string\"}},{\"question\":\"Table name\",\"controlId\":\"collection_name_table\",\"orderId\":11,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"Select Table Name\",\"value\":\"dont_know_answer\",\"type\":\"string\"}},{\"question\":\"Provide additional details about the issue you're facing\",\"controlId\":\"problem_description\",\"orderId\":12,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"test ticket, please ignore and close\",\"value\":\"test ticket, please ignore and close\",\"type\":\"string\"}}]}"), + // Require24X7Response: to.Ptr(false), + // SecondaryConsent: []*armsupport.SecondaryConsent{ + // { + // Type: to.Ptr("VirtualMachine"), + // UserConsent: to.Ptr(armsupport.UserConsentYes), + // }}, + // ServiceDisplayName: to.Ptr("Virtual Machine running Windows"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/vm_windows_service_guid"), + // Severity: to.Ptr(armsupport.SeverityLevelMinimal), + // Status: to.Ptr("Open"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("2205040010000080"), + // Title: to.Ptr("Test - please ignore"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/GetSubscriptionSupportTicketDetails.json func ExampleTicketsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -401,6 +898,7 @@ func ExampleTicketsClient_Get() { // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("Add or Edit VAT, TAX ID, or PO Number"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/problemClassification_guid"), @@ -417,6 +915,8 @@ func ExampleTicketsClient_Get() { // SupportEngineer: &armsupport.Engineer{ // EmailAddress: to.Ptr("xyz@contoso.com"), // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("118032014183770"), // Title: to.Ptr("Test - please ignore"), @@ -424,7 +924,73 @@ func ExampleTicketsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/UpdateContactDetailsOfSupportTicketForSubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/UpdateAdvancedDiagnosticConsentOfSupportTicketForSubscription.json +func ExampleTicketsClient_Update_updateAdvancedDiagnosticConsentOfASupportTicket() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewTicketsClient().Update(ctx, "testticket", armsupport.UpdateSupportTicket{ + AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + }, 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.TicketDetails = armsupport.TicketDetails{ + // Name: to.Ptr("testticket"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/testticket"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("This is a test - please ignore"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + // ContactDetails: &armsupport.ContactProfile{ + // AdditionalEmailAddresses: []*string{ + // to.Ptr("tname@contoso.com"), + // to.Ptr("teamtest@contoso.com")}, + // Country: to.Ptr("USA"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("test.name@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Add or Edit VAT, TAX ID, or PO Number"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/problemClassification_guid"), + // Require24X7Response: to.Ptr(false), + // ServiceDisplayName: to.Ptr("Subscription management"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid"), + // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-21T17:36:18.000Z"); return t}()), + // SLAMinutes: to.Ptr[int32](240), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // }, + // Severity: to.Ptr(armsupport.SeverityLevelCritical), + // Status: to.Ptr("Open"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("118032014183770"), + // Title: to.Ptr("Test - please ignore"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/UpdateContactDetailsOfSupportTicketForSubscription.json func ExampleTicketsClient_Update_updateContactDetailsOfASupportTicket() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -476,6 +1042,7 @@ func ExampleTicketsClient_Update_updateContactDetailsOfASupportTicket() { // PrimaryEmailAddress: to.Ptr("test.name@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("Add or Edit VAT, TAX ID, or PO Number"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/problemClassification_guid"), @@ -492,6 +1059,8 @@ func ExampleTicketsClient_Update_updateContactDetailsOfASupportTicket() { // SupportEngineer: &armsupport.Engineer{ // EmailAddress: to.Ptr("xyz@contoso.com"), // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("118032014183770"), // Title: to.Ptr("Test - please ignore"), @@ -499,7 +1068,7 @@ func ExampleTicketsClient_Update_updateContactDetailsOfASupportTicket() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/UpdateSeverityOfSupportTicketForSubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/UpdateSeverityOfSupportTicketForSubscription.json func ExampleTicketsClient_Update_updateSeverityOfASupportTicket() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -538,6 +1107,7 @@ func ExampleTicketsClient_Update_updateSeverityOfASupportTicket() { // PrimaryEmailAddress: to.Ptr("test.name@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("Add or Edit VAT, TAX ID, or PO Number"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/problemClassification_guid"), @@ -554,6 +1124,8 @@ func ExampleTicketsClient_Update_updateSeverityOfASupportTicket() { // SupportEngineer: &armsupport.Engineer{ // EmailAddress: to.Ptr("xyz@contoso.com"), // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("118032014183770"), // Title: to.Ptr("Test - please ignore"), @@ -561,7 +1133,7 @@ func ExampleTicketsClient_Update_updateSeverityOfASupportTicket() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/UpdateStatusOfSupportTicketForSubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/UpdateStatusOfSupportTicketForSubscription.json func ExampleTicketsClient_Update_updateStatusOfASupportTicket() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -600,6 +1172,7 @@ func ExampleTicketsClient_Update_updateStatusOfASupportTicket() { // PrimaryEmailAddress: to.Ptr("test.name@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("Add or Edit VAT, TAX ID, or PO Number"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/problemClassification_guid"), @@ -615,6 +1188,8 @@ func ExampleTicketsClient_Update_updateStatusOfASupportTicket() { // Status: to.Ptr("Closed"), // SupportEngineer: &armsupport.Engineer{ // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("118032014183770"), // Title: to.Ptr("Test - please ignore"), @@ -622,7 +1197,7 @@ func ExampleTicketsClient_Update_updateStatusOfASupportTicket() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/CreateBillingSupportTicketForSubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateBillingSupportTicketForSubscription.json func ExampleTicketsClient_BeginCreate_createATicketForBillingRelatedIssues() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -645,9 +1220,11 @@ func ExampleTicketsClient_BeginCreate_createATicketForBillingRelatedIssues() { PreferredTimeZone: to.Ptr("Pacific Standard Time"), PrimaryEmailAddress: to.Ptr("abc@contoso.com"), }, + FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/billing_service_guid/problemClassifications/billing_problemClassification_guid"), ServiceID: to.Ptr("/providers/Microsoft.Support/services/billing_service_guid"), Severity: to.Ptr(armsupport.SeverityLevelModerate), + SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), Title: to.Ptr("my title"), }, }, nil) @@ -677,6 +1254,7 @@ func ExampleTicketsClient_BeginCreate_createATicketForBillingRelatedIssues() { // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("Refund request"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/billing_service_guid/problemClassifications/billing_problemClassification_guid"), @@ -692,6 +1270,8 @@ func ExampleTicketsClient_BeginCreate_createATicketForBillingRelatedIssues() { // Status: to.Ptr("Open"), // SupportEngineer: &armsupport.Engineer{ // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("119120321001170"), // Title: to.Ptr("my title"), @@ -699,7 +1279,7 @@ func ExampleTicketsClient_BeginCreate_createATicketForBillingRelatedIssues() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/CreateSubMgmtSupportTicketForSubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateSubMgmtSupportTicketForSubscription.json func ExampleTicketsClient_BeginCreate_createATicketForSubscriptionManagementRelatedIssues() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -722,9 +1302,11 @@ func ExampleTicketsClient_BeginCreate_createATicketForSubscriptionManagementRela PreferredTimeZone: to.Ptr("Pacific Standard Time"), PrimaryEmailAddress: to.Ptr("abc@contoso.com"), }, + FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/subscription_management_problemClassification_guid"), ServiceID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid"), Severity: to.Ptr(armsupport.SeverityLevelModerate), + SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), Title: to.Ptr("my title"), }, }, nil) @@ -754,6 +1336,7 @@ func ExampleTicketsClient_BeginCreate_createATicketForSubscriptionManagementRela // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("Transfer ownership of my subscription"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/subscription_management_problemClassification_guid"), @@ -769,6 +1352,8 @@ func ExampleTicketsClient_BeginCreate_createATicketForSubscriptionManagementRela // Status: to.Ptr("Open"), // SupportEngineer: &armsupport.Engineer{ // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("119120321001170"), // Title: to.Ptr("my title"), @@ -776,7 +1361,7 @@ func ExampleTicketsClient_BeginCreate_createATicketForSubscriptionManagementRela // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/CreateTechnicalSupportTicketForSubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateTechnicalSupportTicketForSubscription.json func ExampleTicketsClient_BeginCreate_createATicketForTechnicalIssueRelatedToASpecificResource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -789,7 +1374,8 @@ func ExampleTicketsClient_BeginCreate_createATicketForTechnicalIssueRelatedToASp } poller, err := clientFactory.NewTicketsClient().BeginCreate(ctx, "testticket", armsupport.TicketDetails{ Properties: &armsupport.TicketDetailsProperties{ - Description: to.Ptr("my description"), + Description: to.Ptr("my description"), + AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), ContactDetails: &armsupport.ContactProfile{ Country: to.Ptr("usa"), FirstName: to.Ptr("abc"), @@ -799,9 +1385,17 @@ func ExampleTicketsClient_BeginCreate_createATicketForTechnicalIssueRelatedToASp PreferredTimeZone: to.Ptr("Pacific Standard Time"), PrimaryEmailAddress: to.Ptr("abc@contoso.com"), }, + FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_running_linux_service_guid/problemClassifications/problemClassification_guid"), - ServiceID: to.Ptr("/providers/Microsoft.Support/services/cddd3eb5-1830-b494-44fd-782f691479dc"), - Severity: to.Ptr(armsupport.SeverityLevelModerate), + ProblemScopingQuestions: to.Ptr("{\"articleId\":\"076846c1-4c0b-4b21-91c6-1a30246b3867\",\"scopingDetails\":[{\"question\":\"When did the problem begin?\",\"controlId\":\"problem_start_time\",\"orderId\":1,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"2023-08-31T18:55:00.739Z\",\"value\":\"2023-08-31T18:55:00.739Z\",\"type\":\"datetime\"}},{\"question\":\"API Type of the Cosmos DB account\",\"controlId\":\"api_type\",\"orderId\":2,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"Table\",\"value\":\"tables\",\"type\":\"string\"}},{\"question\":\"Table name\",\"controlId\":\"collection_name_table\",\"orderId\":11,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"Select Table Name\",\"value\":\"dont_know_answer\",\"type\":\"string\"}},{\"question\":\"Provide additional details about the issue you're facing\",\"controlId\":\"problem_description\",\"orderId\":12,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"test ticket, please ignore and close\",\"value\":\"test ticket, please ignore and close\",\"type\":\"string\"}}]}"), + SecondaryConsent: []*armsupport.SecondaryConsent{ + { + Type: to.Ptr("virtualmachinerunninglinuxservice"), + UserConsent: to.Ptr(armsupport.UserConsentYes), + }}, + ServiceID: to.Ptr("/providers/Microsoft.Support/services/cddd3eb5-1830-b494-44fd-782f691479dc"), + Severity: to.Ptr(armsupport.SeverityLevelModerate), + SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), TechnicalTicketDetails: &armsupport.TechnicalTicketDetails{ ResourceID: to.Ptr("/subscriptions/subid/resourceGroups/test/providers/Microsoft.Compute/virtualMachines/testserver"), }, @@ -824,6 +1418,7 @@ func ExampleTicketsClient_BeginCreate_createATicketForTechnicalIssueRelatedToASp // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/testticket"), // Properties: &armsupport.TicketDetailsProperties{ // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), // ContactDetails: &armsupport.ContactProfile{ // Country: to.Ptr("usa"), // FirstName: to.Ptr("abc"), @@ -834,10 +1429,17 @@ func ExampleTicketsClient_BeginCreate_createATicketForTechnicalIssueRelatedToASp // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("Connectivity / Cannot connect to virtual machine by using RDP or SSH"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_running_linux_service_guid/problemClassifications/problemClassification_guid"), + // ProblemScopingQuestions: to.Ptr("{\"articleId\":\"076846c1-4c0b-4b21-91c6-1a30246b3867\",\"scopingDetails\":[{\"question\":\"When did the problem begin?\",\"controlId\":\"problem_start_time\",\"orderId\":1,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"2023-08-31T18:55:00.739Z\",\"value\":\"2023-08-31T18:55:00.739Z\",\"type\":\"datetime\"}},{\"question\":\"API Type of the Cosmos DB account\",\"controlId\":\"api_type\",\"orderId\":2,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"Table\",\"value\":\"tables\",\"type\":\"string\"}},{\"question\":\"Table name\",\"controlId\":\"collection_name_table\",\"orderId\":11,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"Select Table Name\",\"value\":\"dont_know_answer\",\"type\":\"string\"}},{\"question\":\"Provide additional details about the issue you're facing\",\"controlId\":\"problem_description\",\"orderId\":12,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"test ticket, please ignore and close\",\"value\":\"test ticket, please ignore and close\",\"type\":\"string\"}}]}"), // Require24X7Response: to.Ptr(false), + // SecondaryConsent: []*armsupport.SecondaryConsent{ + // { + // Type: to.Ptr("virtualmachinerunninglinuxservice"), + // UserConsent: to.Ptr(armsupport.UserConsentYes), + // }}, // ServiceDisplayName: to.Ptr("Virtual Machine running Linux"), // ServiceID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_running_linux_service_guid"), // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ @@ -849,6 +1451,8 @@ func ExampleTicketsClient_BeginCreate_createATicketForTechnicalIssueRelatedToASp // Status: to.Ptr("Open"), // SupportEngineer: &armsupport.Engineer{ // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("119120321001170"), // TechnicalTicketDetails: &armsupport.TechnicalTicketDetails{ @@ -859,7 +1463,7 @@ func ExampleTicketsClient_BeginCreate_createATicketForTechnicalIssueRelatedToASp // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/CreateBatchQuotaTicketForSpecificBatchAccountForActiveJobs.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateBatchQuotaTicketForSpecificBatchAccountForActiveJobs.json func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForActiveJobsAndJobSchedulesForABatchAccount() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -872,7 +1476,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForActi } poller, err := clientFactory.NewTicketsClient().BeginCreate(ctx, "testticket", armsupport.TicketDetails{ Properties: &armsupport.TicketDetailsProperties{ - Description: to.Ptr("my description"), + Description: to.Ptr("my description"), + AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), ContactDetails: &armsupport.ContactProfile{ Country: to.Ptr("usa"), FirstName: to.Ptr("abc"), @@ -892,9 +1497,10 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForActi Region: to.Ptr("EastUS"), }}, }, - ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), - Severity: to.Ptr(armsupport.SeverityLevelModerate), - Title: to.Ptr("my title"), + ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), + Severity: to.Ptr(armsupport.SeverityLevelModerate), + SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + Title: to.Ptr("my title"), }, }, nil) if err != nil { @@ -913,6 +1519,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForActi // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/testticket"), // Properties: &armsupport.TicketDetailsProperties{ // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), // ContactDetails: &armsupport.ContactProfile{ // Country: to.Ptr("usa"), // FirstName: to.Ptr("abc"), @@ -923,6 +1530,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForActi // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("testticket"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("Batch"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/batch_problemClassification_guid"), @@ -947,6 +1555,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForActi // Status: to.Ptr("Open"), // SupportEngineer: &armsupport.Engineer{ // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("119120321001170"), // Title: to.Ptr("my title"), @@ -954,7 +1564,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForActi // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/CreateSqlManagedInstanceQuotaTicket.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateSqlManagedInstanceQuotaTicket.json func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForAzureSqlManagedInstance() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -967,7 +1577,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForAzur } poller, err := clientFactory.NewTicketsClient().BeginCreate(ctx, "testticket", armsupport.TicketDetails{ Properties: &armsupport.TicketDetailsProperties{ - Description: to.Ptr("my description"), + Description: to.Ptr("my description"), + AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), ContactDetails: &armsupport.ContactProfile{ Country: to.Ptr("usa"), FirstName: to.Ptr("abc"), @@ -991,9 +1602,10 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForAzur Region: to.Ptr("EastUS"), }}, }, - ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), - Severity: to.Ptr(armsupport.SeverityLevelModerate), - Title: to.Ptr("my title"), + ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), + Severity: to.Ptr(armsupport.SeverityLevelModerate), + SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + Title: to.Ptr("my title"), }, }, nil) if err != nil { @@ -1012,6 +1624,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForAzur // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/testticket"), // Properties: &armsupport.TicketDetailsProperties{ // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), // ContactDetails: &armsupport.ContactProfile{ // Country: to.Ptr("usa"), // FirstName: to.Ptr("abc"), @@ -1022,6 +1635,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForAzur // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("testticket"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("SQL Database Managed Instance"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/sql_datawarehouse_problemClassification_guid"), @@ -1050,6 +1664,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForAzur // Status: to.Ptr("Open"), // SupportEngineer: &armsupport.Engineer{ // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("119120321001170"), // Title: to.Ptr("my title"), @@ -1057,7 +1673,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForAzur // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/CreateBatchQuotaTicketForSubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateBatchQuotaTicketForSubscription.json func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForBatchAccountsForASubscription() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1070,7 +1686,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForBatc } poller, err := clientFactory.NewTicketsClient().BeginCreate(ctx, "testticket", armsupport.TicketDetails{ Properties: &armsupport.TicketDetailsProperties{ - Description: to.Ptr("my description"), + Description: to.Ptr("my description"), + AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), ContactDetails: &armsupport.ContactProfile{ Country: to.Ptr("usa"), FirstName: to.Ptr("abc"), @@ -1090,9 +1707,10 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForBatc Region: to.Ptr("EastUS"), }}, }, - ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), - Severity: to.Ptr(armsupport.SeverityLevelModerate), - Title: to.Ptr("my title"), + ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), + Severity: to.Ptr(armsupport.SeverityLevelModerate), + SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + Title: to.Ptr("my title"), }, }, nil) if err != nil { @@ -1111,6 +1729,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForBatc // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/testticket"), // Properties: &armsupport.TicketDetailsProperties{ // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), // ContactDetails: &armsupport.ContactProfile{ // Country: to.Ptr("usa"), // FirstName: to.Ptr("abc"), @@ -1121,6 +1740,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForBatc // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("testticket"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("Batch"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/batch_problemClassification_guid"), @@ -1145,6 +1765,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForBatc // Status: to.Ptr("Open"), // SupportEngineer: &armsupport.Engineer{ // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("119120321001170"), // Title: to.Ptr("my title"), @@ -1152,7 +1774,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForBatc // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/CreateCoresQuotaTicketForSubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateCoresQuotaTicketForSubscription.json func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForComputeVmCores() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1165,7 +1787,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForComp } poller, err := clientFactory.NewTicketsClient().BeginCreate(ctx, "testticket", armsupport.TicketDetails{ Properties: &armsupport.TicketDetailsProperties{ - Description: to.Ptr("my description"), + Description: to.Ptr("my description"), + AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), ContactDetails: &armsupport.ContactProfile{ Country: to.Ptr("usa"), FirstName: to.Ptr("abc"), @@ -1184,9 +1807,10 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForComp Region: to.Ptr("EastUS"), }}, }, - ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), - Severity: to.Ptr(armsupport.SeverityLevelModerate), - Title: to.Ptr("my title"), + ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), + Severity: to.Ptr(armsupport.SeverityLevelModerate), + SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + Title: to.Ptr("my title"), }, }, nil) if err != nil { @@ -1205,6 +1829,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForComp // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/testticket"), // Properties: &armsupport.TicketDetailsProperties{ // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), // ContactDetails: &armsupport.ContactProfile{ // Country: to.Ptr("usa"), // FirstName: to.Ptr("abc"), @@ -1215,6 +1840,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForComp // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("testticket"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("Compute-VM (cores-vCPUs) subscription limit increases"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/cores_problemClassification_guid"), @@ -1238,6 +1864,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForComp // Status: to.Ptr("Open"), // SupportEngineer: &armsupport.Engineer{ // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("119120321001170"), // Title: to.Ptr("my title"), @@ -1245,7 +1873,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForComp // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/CreateSqlDatawarehouseQuotaTicketForDTUs.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateSqlDatawarehouseQuotaTicketForDTUs.json func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForDtUsForAzureSynapseAnalytics() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1258,7 +1886,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForDtUs } poller, err := clientFactory.NewTicketsClient().BeginCreate(ctx, "testticket", armsupport.TicketDetails{ Properties: &armsupport.TicketDetailsProperties{ - Description: to.Ptr("my description"), + Description: to.Ptr("my description"), + AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), ContactDetails: &armsupport.ContactProfile{ Country: to.Ptr("usa"), FirstName: to.Ptr("abc"), @@ -1278,9 +1907,10 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForDtUs Region: to.Ptr("EastUS"), }}, }, - ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), - Severity: to.Ptr(armsupport.SeverityLevelModerate), - Title: to.Ptr("my title"), + ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), + Severity: to.Ptr(armsupport.SeverityLevelModerate), + SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + Title: to.Ptr("my title"), }, }, nil) if err != nil { @@ -1299,6 +1929,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForDtUs // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/testticket"), // Properties: &armsupport.TicketDetailsProperties{ // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), // ContactDetails: &armsupport.ContactProfile{ // Country: to.Ptr("usa"), // FirstName: to.Ptr("abc"), @@ -1309,6 +1940,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForDtUs // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("testticket"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("SQL Data Warehouse"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/sql_datawarehouse_problemClassification_guid"), @@ -1333,6 +1965,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForDtUs // Status: to.Ptr("Open"), // SupportEngineer: &armsupport.Engineer{ // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("119120321001170"), // Title: to.Ptr("my title"), @@ -1340,7 +1974,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForDtUs // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/CreateSqlDatabaseQuotaTicketForDTUs.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateSqlDatabaseQuotaTicketForDTUs.json func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForDtUsForSqlDatabase() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1353,7 +1987,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForDtUs } poller, err := clientFactory.NewTicketsClient().BeginCreate(ctx, "testticket", armsupport.TicketDetails{ Properties: &armsupport.TicketDetailsProperties{ - Description: to.Ptr("my description"), + Description: to.Ptr("my description"), + AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), ContactDetails: &armsupport.ContactProfile{ Country: to.Ptr("usa"), FirstName: to.Ptr("abc"), @@ -1373,9 +2008,10 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForDtUs Region: to.Ptr("EastUS"), }}, }, - ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), - Severity: to.Ptr(armsupport.SeverityLevelModerate), - Title: to.Ptr("my title"), + ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), + Severity: to.Ptr(armsupport.SeverityLevelModerate), + SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + Title: to.Ptr("my title"), }, }, nil) if err != nil { @@ -1394,6 +2030,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForDtUs // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/testticket"), // Properties: &armsupport.TicketDetailsProperties{ // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), // ContactDetails: &armsupport.ContactProfile{ // Country: to.Ptr("usa"), // FirstName: to.Ptr("abc"), @@ -1404,6 +2041,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForDtUs // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("testticket"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("SQL database"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/sql_database_problemClassification_guid"), @@ -1428,6 +2066,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForDtUs // Status: to.Ptr("Open"), // SupportEngineer: &armsupport.Engineer{ // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("119120321001170"), // Title: to.Ptr("my title"), @@ -1435,7 +2075,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForDtUs // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/CreateMachineLearningQuotaTicketForLowPriorityCores.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateMachineLearningQuotaTicketForLowPriorityCores.json func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForLowPriorityCoresForMachineLearningService() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1448,7 +2088,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForLowP } poller, err := clientFactory.NewTicketsClient().BeginCreate(ctx, "testticket", armsupport.TicketDetails{ Properties: &armsupport.TicketDetailsProperties{ - Description: to.Ptr("my description"), + Description: to.Ptr("my description"), + AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), ContactDetails: &armsupport.ContactProfile{ Country: to.Ptr("usa"), FirstName: to.Ptr("abc"), @@ -1468,9 +2109,10 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForLowP Region: to.Ptr("EastUS"), }}, }, - ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), - Severity: to.Ptr(armsupport.SeverityLevelModerate), - Title: to.Ptr("my title"), + ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), + Severity: to.Ptr(armsupport.SeverityLevelModerate), + SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + Title: to.Ptr("my title"), }, }, nil) if err != nil { @@ -1489,6 +2131,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForLowP // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/testticket"), // Properties: &armsupport.TicketDetailsProperties{ // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), // ContactDetails: &armsupport.ContactProfile{ // Country: to.Ptr("usa"), // FirstName: to.Ptr("abc"), @@ -1499,6 +2142,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForLowP // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("testticket"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("Machine Learning service"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/machine_learning_service_problemClassification_guid"), @@ -1523,6 +2167,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForLowP // Status: to.Ptr("Open"), // SupportEngineer: &armsupport.Engineer{ // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("119120321001170"), // Title: to.Ptr("my title"), @@ -1530,7 +2176,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForLowP // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/CreateBatchQuotaTicketForSpecificBatchAccountForLowPriorityCores.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateBatchQuotaTicketForSpecificBatchAccountForLowPriorityCores.json func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForLowPriorityCoresForABatchAccount() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1543,7 +2189,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForLowP } poller, err := clientFactory.NewTicketsClient().BeginCreate(ctx, "testticket", armsupport.TicketDetails{ Properties: &armsupport.TicketDetailsProperties{ - Description: to.Ptr("my description"), + Description: to.Ptr("my description"), + AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), ContactDetails: &armsupport.ContactProfile{ Country: to.Ptr("usa"), FirstName: to.Ptr("abc"), @@ -1563,9 +2210,10 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForLowP Region: to.Ptr("EastUS"), }}, }, - ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), - Severity: to.Ptr(armsupport.SeverityLevelModerate), - Title: to.Ptr("my title"), + ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), + Severity: to.Ptr(armsupport.SeverityLevelModerate), + SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + Title: to.Ptr("my title"), }, }, nil) if err != nil { @@ -1584,6 +2232,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForLowP // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/testticket"), // Properties: &armsupport.TicketDetailsProperties{ // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), // ContactDetails: &armsupport.ContactProfile{ // Country: to.Ptr("usa"), // FirstName: to.Ptr("abc"), @@ -1594,6 +2243,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForLowP // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("testticket"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("Batch"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/batch_problemClassification_guid"), @@ -1618,6 +2268,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForLowP // Status: to.Ptr("Open"), // SupportEngineer: &armsupport.Engineer{ // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("119120321001170"), // Title: to.Ptr("my title"), @@ -1625,7 +2277,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForLowP // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/CreateBatchQuotaTicketForSpecificBatchAccountForPools.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateBatchQuotaTicketForSpecificBatchAccountForPools.json func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForPoolsForABatchAccount() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1638,7 +2290,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForPool } poller, err := clientFactory.NewTicketsClient().BeginCreate(ctx, "testticket", armsupport.TicketDetails{ Properties: &armsupport.TicketDetailsProperties{ - Description: to.Ptr("my description"), + Description: to.Ptr("my description"), + AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), ContactDetails: &armsupport.ContactProfile{ Country: to.Ptr("usa"), FirstName: to.Ptr("abc"), @@ -1658,9 +2311,10 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForPool Region: to.Ptr("EastUS"), }}, }, - ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), - Severity: to.Ptr(armsupport.SeverityLevelModerate), - Title: to.Ptr("my title"), + ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), + Severity: to.Ptr(armsupport.SeverityLevelModerate), + SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + Title: to.Ptr("my title"), }, }, nil) if err != nil { @@ -1679,6 +2333,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForPool // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/testticket"), // Properties: &armsupport.TicketDetailsProperties{ // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), // ContactDetails: &armsupport.ContactProfile{ // Country: to.Ptr("usa"), // FirstName: to.Ptr("abc"), @@ -1689,6 +2344,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForPool // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("testticket"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("Batch"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/batch_problemClassification_guid"), @@ -1713,6 +2369,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForPool // Status: to.Ptr("Open"), // SupportEngineer: &armsupport.Engineer{ // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("119120321001170"), // Title: to.Ptr("my title"), @@ -1720,7 +2378,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForPool // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/CreateSqlDatawarehouseQuotaTicketForServers.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateSqlDatawarehouseQuotaTicketForServers.json func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForServersForAzureSynapseAnalytics() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1733,7 +2391,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForServ } poller, err := clientFactory.NewTicketsClient().BeginCreate(ctx, "testticket", armsupport.TicketDetails{ Properties: &armsupport.TicketDetailsProperties{ - Description: to.Ptr("my description"), + Description: to.Ptr("my description"), + AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), ContactDetails: &armsupport.ContactProfile{ Country: to.Ptr("usa"), FirstName: to.Ptr("abc"), @@ -1753,9 +2412,10 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForServ Region: to.Ptr("EastUS"), }}, }, - ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), - Severity: to.Ptr(armsupport.SeverityLevelModerate), - Title: to.Ptr("my title"), + ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), + Severity: to.Ptr(armsupport.SeverityLevelModerate), + SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + Title: to.Ptr("my title"), }, }, nil) if err != nil { @@ -1774,6 +2434,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForServ // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/testticket"), // Properties: &armsupport.TicketDetailsProperties{ // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), // ContactDetails: &armsupport.ContactProfile{ // Country: to.Ptr("usa"), // FirstName: to.Ptr("abc"), @@ -1784,6 +2445,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForServ // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("testticket"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("SQL Data Warehouse"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/sql_datawarehouse_problemClassification_guid"), @@ -1808,6 +2470,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForServ // Status: to.Ptr("Open"), // SupportEngineer: &armsupport.Engineer{ // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("119120321001170"), // Title: to.Ptr("my title"), @@ -1815,7 +2479,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForServ // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/CreateSqlDatabaseQuotaTicketForServers.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateSqlDatabaseQuotaTicketForServers.json func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForServersForSqlDatabase() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1828,7 +2492,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForServ } poller, err := clientFactory.NewTicketsClient().BeginCreate(ctx, "testticket", armsupport.TicketDetails{ Properties: &armsupport.TicketDetailsProperties{ - Description: to.Ptr("my description"), + Description: to.Ptr("my description"), + AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), ContactDetails: &armsupport.ContactProfile{ Country: to.Ptr("usa"), FirstName: to.Ptr("abc"), @@ -1848,9 +2513,10 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForServ Region: to.Ptr("EastUS"), }}, }, - ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), - Severity: to.Ptr(armsupport.SeverityLevelModerate), - Title: to.Ptr("my title"), + ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), + Severity: to.Ptr(armsupport.SeverityLevelModerate), + SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + Title: to.Ptr("my title"), }, }, nil) if err != nil { @@ -1869,6 +2535,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForServ // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/testticket"), // Properties: &armsupport.TicketDetailsProperties{ // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), // ContactDetails: &armsupport.ContactProfile{ // Country: to.Ptr("usa"), // FirstName: to.Ptr("abc"), @@ -1879,6 +2546,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForServ // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("testticket"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("SQL database"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/sql_database_problemClassification_guid"), @@ -1903,6 +2571,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForServ // Status: to.Ptr("Open"), // SupportEngineer: &armsupport.Engineer{ // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("119120321001170"), // Title: to.Ptr("my title"), @@ -1910,7 +2580,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForServ // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/CreateGenericQuotaTicket.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateGenericQuotaTicket.json func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForServicesThatDoNotRequireAdditionalDetailsInTheQuotaTicketDetailsObject() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1980,6 +2650,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForServ // Status: to.Ptr("Open"), // SupportEngineer: &armsupport.Engineer{ // }, + // SupportPlanDisplayName: to.Ptr("Premier"), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("119120321001170"), // Title: to.Ptr("my title"), @@ -1987,7 +2658,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForServ // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/CreateMachineLearningQuotaTicketForDedicatedCores.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateMachineLearningQuotaTicketForDedicatedCores.json func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForSpecificVmFamilyCoresForMachineLearningService() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2000,7 +2671,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForSpec } poller, err := clientFactory.NewTicketsClient().BeginCreate(ctx, "testticket", armsupport.TicketDetails{ Properties: &armsupport.TicketDetailsProperties{ - Description: to.Ptr("my description"), + Description: to.Ptr("my description"), + AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), ContactDetails: &armsupport.ContactProfile{ Country: to.Ptr("usa"), FirstName: to.Ptr("abc"), @@ -2020,9 +2692,10 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForSpec Region: to.Ptr("EastUS"), }}, }, - ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), - Severity: to.Ptr(armsupport.SeverityLevelModerate), - Title: to.Ptr("my title"), + ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), + Severity: to.Ptr(armsupport.SeverityLevelModerate), + SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + Title: to.Ptr("my title"), }, }, nil) if err != nil { @@ -2041,6 +2714,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForSpec // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/testticket"), // Properties: &armsupport.TicketDetailsProperties{ // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), // ContactDetails: &armsupport.ContactProfile{ // Country: to.Ptr("usa"), // FirstName: to.Ptr("abc"), @@ -2051,6 +2725,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForSpec // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("testticket"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("Machine Learning service"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/machine_learning_service_problemClassification_guid"), @@ -2075,6 +2750,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForSpec // Status: to.Ptr("Open"), // SupportEngineer: &armsupport.Engineer{ // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("119120321001170"), // Title: to.Ptr("my title"), @@ -2082,7 +2759,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForSpec // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/support/resource-manager/Microsoft.Support/stable/2020-04-01/examples/CreateBatchQuotaTicketForSpecificBatchAccountForDedicatedCores.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateBatchQuotaTicketForSpecificBatchAccountForDedicatedCores.json func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForSpecificVmFamilyCoresForABatchAccount() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2095,7 +2772,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForSpec } poller, err := clientFactory.NewTicketsClient().BeginCreate(ctx, "testticket", armsupport.TicketDetails{ Properties: &armsupport.TicketDetailsProperties{ - Description: to.Ptr("my description"), + Description: to.Ptr("my description"), + AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), ContactDetails: &armsupport.ContactProfile{ Country: to.Ptr("usa"), FirstName: to.Ptr("abc"), @@ -2115,9 +2793,10 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForSpec Region: to.Ptr("EastUS"), }}, }, - ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), - Severity: to.Ptr(armsupport.SeverityLevelModerate), - Title: to.Ptr("my title"), + ServiceID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid"), + Severity: to.Ptr(armsupport.SeverityLevelModerate), + SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + Title: to.Ptr("my title"), }, }, nil) if err != nil { @@ -2136,6 +2815,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForSpec // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Support/supportTickets/testticket"), // Properties: &armsupport.TicketDetailsProperties{ // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), // ContactDetails: &armsupport.ContactProfile{ // Country: to.Ptr("usa"), // FirstName: to.Ptr("abc"), @@ -2146,6 +2826,7 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForSpec // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), // }, // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("testticket"), // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), // ProblemClassificationDisplayName: to.Ptr("Batch"), // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/batch_problemClassification_guid"), @@ -2170,6 +2851,8 @@ func ExampleTicketsClient_BeginCreate_createATicketToRequestQuotaIncreaseForSpec // Status: to.Ptr("Open"), // SupportEngineer: &armsupport.Engineer{ // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), // SupportPlanType: to.Ptr("Premier"), // SupportTicketID: to.Ptr("119120321001170"), // Title: to.Ptr("my title"), diff --git a/sdk/resourcemanager/support/armsupport/ticketsnosubscription_client.go b/sdk/resourcemanager/support/armsupport/ticketsnosubscription_client.go new file mode 100644 index 000000000000..d1bf00250a22 --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/ticketsnosubscription_client.go @@ -0,0 +1,373 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsupport + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// TicketsNoSubscriptionClient contains the methods for the SupportTicketsNoSubscription group. +// Don't use this type directly, use NewTicketsNoSubscriptionClient() instead. +type TicketsNoSubscriptionClient struct { + internal *arm.Client +} + +// NewTicketsNoSubscriptionClient creates a new instance of TicketsNoSubscriptionClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewTicketsNoSubscriptionClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*TicketsNoSubscriptionClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TicketsNoSubscriptionClient{ + internal: cl, + } + return client, nil +} + +// CheckNameAvailability - Check the availability of a resource name. This API should be used to check the uniqueness of the +// name for support ticket creation for the selected subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-01-preview +// - checkNameAvailabilityInput - Input to check. +// - options - TicketsNoSubscriptionClientCheckNameAvailabilityOptions contains the optional parameters for the TicketsNoSubscriptionClient.CheckNameAvailability +// method. +func (client *TicketsNoSubscriptionClient) CheckNameAvailability(ctx context.Context, checkNameAvailabilityInput CheckNameAvailabilityInput, options *TicketsNoSubscriptionClientCheckNameAvailabilityOptions) (TicketsNoSubscriptionClientCheckNameAvailabilityResponse, error) { + var err error + const operationName = "TicketsNoSubscriptionClient.CheckNameAvailability" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.checkNameAvailabilityCreateRequest(ctx, checkNameAvailabilityInput, options) + if err != nil { + return TicketsNoSubscriptionClientCheckNameAvailabilityResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TicketsNoSubscriptionClientCheckNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TicketsNoSubscriptionClientCheckNameAvailabilityResponse{}, err + } + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err +} + +// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. +func (client *TicketsNoSubscriptionClient) checkNameAvailabilityCreateRequest(ctx context.Context, checkNameAvailabilityInput CheckNameAvailabilityInput, options *TicketsNoSubscriptionClientCheckNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Support/checkNameAvailability" + 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", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, checkNameAvailabilityInput); err != nil { + return nil, err + } + return req, nil +} + +// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. +func (client *TicketsNoSubscriptionClient) checkNameAvailabilityHandleResponse(resp *http.Response) (TicketsNoSubscriptionClientCheckNameAvailabilityResponse, error) { + result := TicketsNoSubscriptionClientCheckNameAvailabilityResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityOutput); err != nil { + return TicketsNoSubscriptionClientCheckNameAvailabilityResponse{}, err + } + return result, nil +} + +// BeginCreate - Creates a new support ticket for Billing, and Subscription Management issues. Learn the prerequisites [https://aka.ms/supportAPI] +// required to create a support ticket. +// Always call the Services and ProblemClassifications API to get the most recent set of services and problem categories required +// for support ticket creation. +// Adding attachments is not currently supported via the API. To add a file to an existing support ticket, visit the Manage +// support ticket [https://portal.azure.com/#blade/MicrosoftAzure +// Support/HelpAndSupportBlade/managesupportrequest] page in the Azure portal, select the support ticket, and use the file +// upload control to add a new file. +// Providing consent to share diagnostic information with Azure support is currently not supported via the API. The Azure +// support engineer working on your ticket will reach out to you for consent if your +// issue requires gathering diagnostic information from your Azure resources. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-01-preview +// - supportTicketName - Support ticket name. +// - createSupportTicketParameters - Support ticket request payload. +// - options - TicketsNoSubscriptionClientBeginCreateOptions contains the optional parameters for the TicketsNoSubscriptionClient.BeginCreate +// method. +func (client *TicketsNoSubscriptionClient) BeginCreate(ctx context.Context, supportTicketName string, createSupportTicketParameters TicketDetails, options *TicketsNoSubscriptionClientBeginCreateOptions) (*runtime.Poller[TicketsNoSubscriptionClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, supportTicketName, createSupportTicketParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TicketsNoSubscriptionClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[TicketsNoSubscriptionClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Creates a new support ticket for Billing, and Subscription Management issues. Learn the prerequisites [https://aka.ms/supportAPI] +// required to create a support ticket. +// Always call the Services and ProblemClassifications API to get the most recent set of services and problem categories required +// for support ticket creation. +// Adding attachments is not currently supported via the API. To add a file to an existing support ticket, visit the Manage +// support ticket [https://portal.azure.com/#blade/MicrosoftAzure +// Support/HelpAndSupportBlade/managesupportrequest] page in the Azure portal, select the support ticket, and use the file +// upload control to add a new file. +// Providing consent to share diagnostic information with Azure support is currently not supported via the API. The Azure +// support engineer working on your ticket will reach out to you for consent if your +// issue requires gathering diagnostic information from your Azure resources. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-01-preview +func (client *TicketsNoSubscriptionClient) create(ctx context.Context, supportTicketName string, createSupportTicketParameters TicketDetails, options *TicketsNoSubscriptionClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "TicketsNoSubscriptionClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, supportTicketName, createSupportTicketParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *TicketsNoSubscriptionClient) createCreateRequest(ctx context.Context, supportTicketName string, createSupportTicketParameters TicketDetails, options *TicketsNoSubscriptionClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Support/supportTickets/{supportTicketName}" + if supportTicketName == "" { + return nil, errors.New("parameter supportTicketName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{supportTicketName}", url.PathEscape(supportTicketName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, createSupportTicketParameters); err != nil { + return nil, err + } + return req, nil +} + +// Get - Gets details for a specific support ticket. Support ticket data is available for 18 months after ticket creation. +// If a ticket was created more than 18 months ago, a request for data might cause an +// error. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-01-preview +// - supportTicketName - Support ticket name. +// - options - TicketsNoSubscriptionClientGetOptions contains the optional parameters for the TicketsNoSubscriptionClient.Get +// method. +func (client *TicketsNoSubscriptionClient) Get(ctx context.Context, supportTicketName string, options *TicketsNoSubscriptionClientGetOptions) (TicketsNoSubscriptionClientGetResponse, error) { + var err error + const operationName = "TicketsNoSubscriptionClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, supportTicketName, options) + if err != nil { + return TicketsNoSubscriptionClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TicketsNoSubscriptionClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TicketsNoSubscriptionClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *TicketsNoSubscriptionClient) getCreateRequest(ctx context.Context, supportTicketName string, options *TicketsNoSubscriptionClientGetOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Support/supportTickets/{supportTicketName}" + if supportTicketName == "" { + return nil, errors.New("parameter supportTicketName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{supportTicketName}", url.PathEscape(supportTicketName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *TicketsNoSubscriptionClient) getHandleResponse(resp *http.Response) (TicketsNoSubscriptionClientGetResponse, error) { + result := TicketsNoSubscriptionClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TicketDetails); err != nil { + return TicketsNoSubscriptionClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all the support tickets. +// You can also filter the support tickets by Status, CreatedDate, , ServiceId, and ProblemClassificationId using the $filter +// parameter. Output will be a paged result with nextLink, using which you can +// retrieve the next set of support tickets. +// Support ticket data is available for 18 months after ticket creation. If a ticket was created more than 18 months ago, +// a request for data might cause an error. +// +// Generated from API version 2022-09-01-preview +// - options - TicketsNoSubscriptionClientListOptions contains the optional parameters for the TicketsNoSubscriptionClient.NewListPager +// method. +func (client *TicketsNoSubscriptionClient) NewListPager(options *TicketsNoSubscriptionClientListOptions) *runtime.Pager[TicketsNoSubscriptionClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[TicketsNoSubscriptionClientListResponse]{ + More: func(page TicketsNoSubscriptionClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *TicketsNoSubscriptionClientListResponse) (TicketsNoSubscriptionClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TicketsNoSubscriptionClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return TicketsNoSubscriptionClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *TicketsNoSubscriptionClient) listCreateRequest(ctx context.Context, options *TicketsNoSubscriptionClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Support/supportTickets" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + reqQP.Set("api-version", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *TicketsNoSubscriptionClient) listHandleResponse(resp *http.Response) (TicketsNoSubscriptionClientListResponse, error) { + result := TicketsNoSubscriptionClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TicketsListResult); err != nil { + return TicketsNoSubscriptionClientListResponse{}, err + } + return result, nil +} + +// Update - This API allows you to update the severity level, ticket status, and your contact information in the support ticket. +// Note: The severity levels cannot be changed if a support ticket is actively being worked upon by an Azure support engineer. +// In such a case, contact your support engineer to request severity update by +// adding a new communication using the Communications API. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-01-preview +// - supportTicketName - Support ticket name. +// - updateSupportTicket - UpdateSupportTicket object. +// - options - TicketsNoSubscriptionClientUpdateOptions contains the optional parameters for the TicketsNoSubscriptionClient.Update +// method. +func (client *TicketsNoSubscriptionClient) Update(ctx context.Context, supportTicketName string, updateSupportTicket UpdateSupportTicket, options *TicketsNoSubscriptionClientUpdateOptions) (TicketsNoSubscriptionClientUpdateResponse, error) { + var err error + const operationName = "TicketsNoSubscriptionClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, supportTicketName, updateSupportTicket, options) + if err != nil { + return TicketsNoSubscriptionClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TicketsNoSubscriptionClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TicketsNoSubscriptionClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *TicketsNoSubscriptionClient) updateCreateRequest(ctx context.Context, supportTicketName string, updateSupportTicket UpdateSupportTicket, options *TicketsNoSubscriptionClientUpdateOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Support/supportTickets/{supportTicketName}" + if supportTicketName == "" { + return nil, errors.New("parameter supportTicketName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{supportTicketName}", url.PathEscape(supportTicketName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, updateSupportTicket); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *TicketsNoSubscriptionClient) updateHandleResponse(resp *http.Response) (TicketsNoSubscriptionClientUpdateResponse, error) { + result := TicketsNoSubscriptionClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TicketDetails); err != nil { + return TicketsNoSubscriptionClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/support/armsupport/ticketsnosubscription_client_example_test.go b/sdk/resourcemanager/support/armsupport/ticketsnosubscription_client_example_test.go new file mode 100644 index 000000000000..cb0091566ce0 --- /dev/null +++ b/sdk/resourcemanager/support/armsupport/ticketsnosubscription_client_example_test.go @@ -0,0 +1,1453 @@ +//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 armsupport_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/support/armsupport/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CheckNameAvailability.json +func ExampleTicketsNoSubscriptionClient_CheckNameAvailability() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewTicketsNoSubscriptionClient().CheckNameAvailability(ctx, armsupport.CheckNameAvailabilityInput{ + Name: to.Ptr("sampleName"), + Type: to.Ptr(armsupport.TypeMicrosoftSupportSupportTickets), + }, 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.CheckNameAvailabilityOutput = armsupport.CheckNameAvailabilityOutput{ + // Message: to.Ptr("Name not available"), + // NameAvailable: to.Ptr(false), + // Reason: to.Ptr("Name is already in use"), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListSupportTicketsCreatedOnOrAfterAndInOpenState.json +func ExampleTicketsNoSubscriptionClient_NewListPager_listSupportTicketsCreatedOnOrAfterACertainDateAndInOpenStateForASubscription() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewTicketsNoSubscriptionClient().NewListPager(&armsupport.TicketsNoSubscriptionClientListOptions{Top: nil, + Filter: to.Ptr("createdDate ge 2020-03-10T22:08:51Z and status eq 'Open'"), + }) + 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.TicketsListResult = armsupport.TicketsListResult{ + // Value: []*armsupport.TicketDetails{ + // { + // Name: to.Ptr("testticket"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("usa"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-12T21:36:23.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Connectivity / Cannot connect to virtual machine by using RDP or SSH"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_service_guid/problemClassifications/problemClassification_guid"), + // ProblemScopingQuestions: to.Ptr("{\"articleId\":\"076846c1-4c0b-4b21-91c6-1a30246b3867\",\"scopingDetails\":[{\"question\":\"When did the problem begin?\",\"controlId\":\"problem_start_time\",\"orderId\":1,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"2023-08-31T18:55:00.739Z\",\"value\":\"2023-08-31T18:55:00.739Z\",\"type\":\"datetime\"}},{\"question\":\"API Type of the Cosmos DB account\",\"controlId\":\"api_type\",\"orderId\":2,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"Table\",\"value\":\"tables\",\"type\":\"string\"}},{\"question\":\"Table name\",\"controlId\":\"collection_name_table\",\"orderId\":11,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"Select Table Name\",\"value\":\"dont_know_answer\",\"type\":\"string\"}},{\"question\":\"Provide additional details about the issue you're facing\",\"controlId\":\"problem_description\",\"orderId\":12,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"test ticket, please ignore and close\",\"value\":\"test ticket, please ignore and close\",\"type\":\"string\"}}]}"), + // Require24X7Response: to.Ptr(false), + // SecondaryConsent: []*armsupport.SecondaryConsent{ + // { + // Type: to.Ptr("VirtualMachine"), + // UserConsent: to.Ptr(armsupport.UserConsentYes), + // }}, + // ServiceDisplayName: to.Ptr("Virtual Machine running Linux"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_service_guid"), + // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-12T17:36:18.000Z"); return t}()), + // SLAMinutes: to.Ptr[int32](240), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T21:36:18.000Z"); return t}()), + // }, + // Severity: to.Ptr(armsupport.SeverityLevelModerate), + // Status: to.Ptr("Open"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("119120321001170"), + // Title: to.Ptr("my title"), + // }, + // }, + // { + // Name: to.Ptr("testticket2"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket2"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("This is a test - please ignore"), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("USA"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-12T21:36:18.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Add or Edit VAT, TAX ID, or PO Number"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/problemClassification_guid"), + // Require24X7Response: to.Ptr(false), + // ServiceDisplayName: to.Ptr("Subscription management"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid"), + // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-12T17:36:18.000Z"); return t}()), + // SLAMinutes: to.Ptr[int32](240), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T21:36:18.000Z"); return t}()), + // }, + // Severity: to.Ptr(armsupport.SeverityLevelMinimal), + // Status: to.Ptr("Open"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("118032014183771"), + // Title: to.Ptr("Test - please ignore"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListSupportTicketsCreatedOnOrAfterAndInUpdatingState.json +func ExampleTicketsNoSubscriptionClient_NewListPager_listSupportTicketsCreatedOnOrAfterACertainDateAndInUpdatingStateForASubscription() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewTicketsNoSubscriptionClient().NewListPager(&armsupport.TicketsNoSubscriptionClientListOptions{Top: nil, + Filter: to.Ptr("createdDate ge 2020-03-10T22:08:51Z and status eq 'Updating'"), + }) + 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.TicketsListResult = armsupport.TicketsListResult{ + // Value: []*armsupport.TicketDetails{ + // { + // Name: to.Ptr("testticket"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("usa"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-12T21:36:23.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Connectivity / Cannot connect to virtual machine by using RDP or SSH"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_service_guid/problemClassifications/problemClassification_guid"), + // ProblemScopingQuestions: to.Ptr("{\"articleId\":\"076846c1-4c0b-4b21-91c6-1a30246b3867\",\"scopingDetails\":[{\"question\":\"When did the problem begin?\",\"controlId\":\"problem_start_time\",\"orderId\":1,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"2023-08-31T18:55:00.739Z\",\"value\":\"2023-08-31T18:55:00.739Z\",\"type\":\"datetime\"}},{\"question\":\"API Type of the Cosmos DB account\",\"controlId\":\"api_type\",\"orderId\":2,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"Table\",\"value\":\"tables\",\"type\":\"string\"}},{\"question\":\"Table name\",\"controlId\":\"collection_name_table\",\"orderId\":11,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"Select Table Name\",\"value\":\"dont_know_answer\",\"type\":\"string\"}},{\"question\":\"Provide additional details about the issue you're facing\",\"controlId\":\"problem_description\",\"orderId\":12,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"test ticket, please ignore and close\",\"value\":\"test ticket, please ignore and close\",\"type\":\"string\"}}]}"), + // Require24X7Response: to.Ptr(false), + // SecondaryConsent: []*armsupport.SecondaryConsent{ + // { + // Type: to.Ptr("VirtualMachine"), + // UserConsent: to.Ptr(armsupport.UserConsentYes), + // }}, + // ServiceDisplayName: to.Ptr("Virtual Machine running Linux"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_service_guid"), + // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-12T17:36:18.000Z"); return t}()), + // SLAMinutes: to.Ptr[int32](240), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T21:36:18.000Z"); return t}()), + // }, + // Severity: to.Ptr(armsupport.SeverityLevelModerate), + // Status: to.Ptr("Updating"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("119120321001170"), + // Title: to.Ptr("my title"), + // }, + // }, + // { + // Name: to.Ptr("testticket2"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket2"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("This is a test - please ignore"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("USA"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-12T21:36:18.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Add or Edit VAT, TAX ID, or PO Number"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/problemClassification_guid"), + // ProblemScopingQuestions: to.Ptr("{\"articleId\":\"076846c1-4c0b-4b21-91c6-1a30246b3867\",\"scopingDetails\":[{\"question\":\"When did the problem begin?\",\"controlId\":\"problem_start_time\",\"orderId\":1,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"2023-08-31T18:55:00.739Z\",\"value\":\"2023-08-31T18:55:00.739Z\",\"type\":\"datetime\"}},{\"question\":\"API Type of the Cosmos DB account\",\"controlId\":\"api_type\",\"orderId\":2,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"Table\",\"value\":\"tables\",\"type\":\"string\"}},{\"question\":\"Table name\",\"controlId\":\"collection_name_table\",\"orderId\":11,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"Select Table Name\",\"value\":\"dont_know_answer\",\"type\":\"string\"}},{\"question\":\"Provide additional details about the issue you're facing\",\"controlId\":\"problem_description\",\"orderId\":12,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"test ticket, please ignore and close\",\"value\":\"test ticket, please ignore and close\",\"type\":\"string\"}}]}"), + // Require24X7Response: to.Ptr(false), + // SecondaryConsent: []*armsupport.SecondaryConsent{ + // { + // Type: to.Ptr("VirtualMachine"), + // UserConsent: to.Ptr(armsupport.UserConsentYes), + // }}, + // ServiceDisplayName: to.Ptr("Subscription management"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid"), + // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-12T17:36:18.000Z"); return t}()), + // SLAMinutes: to.Ptr[int32](240), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-11T21:36:18.000Z"); return t}()), + // }, + // Severity: to.Ptr(armsupport.SeverityLevelMinimal), + // Status: to.Ptr("Updating"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("118032014183771"), + // Title: to.Ptr("Test - please ignore"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListSupportTickets.json +func ExampleTicketsNoSubscriptionClient_NewListPager_listSupportTicketsForASubscription() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewTicketsNoSubscriptionClient().NewListPager(&armsupport.TicketsNoSubscriptionClientListOptions{Top: nil, + Filter: 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.TicketsListResult = armsupport.TicketsListResult{ + // Value: []*armsupport.TicketDetails{ + // { + // Name: to.Ptr("testticket"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("usa"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Connectivity / Cannot connect to virtual machine by using RDP or SSH"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_service_guid/problemClassifications/problemClassification_guid"), + // ProblemScopingQuestions: to.Ptr("{\"articleId\":\"076846c1-4c0b-4b21-91c6-1a30246b3867\",\"scopingDetails\":[{\"question\":\"When did the problem begin?\",\"controlId\":\"problem_start_time\",\"orderId\":1,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"2023-08-31T18:55:00.739Z\",\"value\":\"2023-08-31T18:55:00.739Z\",\"type\":\"datetime\"}},{\"question\":\"API Type of the Cosmos DB account\",\"controlId\":\"api_type\",\"orderId\":2,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"Table\",\"value\":\"tables\",\"type\":\"string\"}},{\"question\":\"Table name\",\"controlId\":\"collection_name_table\",\"orderId\":11,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"Select Table Name\",\"value\":\"dont_know_answer\",\"type\":\"string\"}},{\"question\":\"Provide additional details about the issue you're facing\",\"controlId\":\"problem_description\",\"orderId\":12,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"test ticket, please ignore and close\",\"value\":\"test ticket, please ignore and close\",\"type\":\"string\"}}]}"), + // Require24X7Response: to.Ptr(false), + // SecondaryConsent: []*armsupport.SecondaryConsent{ + // { + // Type: to.Ptr("VirtualMachine"), + // UserConsent: to.Ptr(armsupport.UserConsentYes), + // }}, + // ServiceDisplayName: to.Ptr("Virtual Machine running Linux"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_service_guid"), + // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-21T17:36:18.000Z"); return t}()), + // SLAMinutes: to.Ptr[int32](240), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // }, + // Severity: to.Ptr(armsupport.SeverityLevelModerate), + // Status: to.Ptr("Open"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("119120321001170"), + // Title: to.Ptr("my title"), + // }, + // }, + // { + // Name: to.Ptr("testticket2"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket2"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("This is a test - please ignore"), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("USA"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Add or Edit VAT, TAX ID, or PO Number"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/problemClassification_guid"), + // Require24X7Response: to.Ptr(false), + // ServiceDisplayName: to.Ptr("Subscription management"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid"), + // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-21T17:36:18.000Z"); return t}()), + // SLAMinutes: to.Ptr[int32](240), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // }, + // Severity: to.Ptr(armsupport.SeverityLevelMinimal), + // Status: to.Ptr("Open"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("118032014183771"), + // Title: to.Ptr("Test - please ignore"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListSupportTicketsInOpenState.json +func ExampleTicketsNoSubscriptionClient_NewListPager_listSupportTicketsInOpenStateForASubscription() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewTicketsNoSubscriptionClient().NewListPager(&armsupport.TicketsNoSubscriptionClientListOptions{Top: nil, + Filter: to.Ptr("status eq 'Open'"), + }) + 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.TicketsListResult = armsupport.TicketsListResult{ + // Value: []*armsupport.TicketDetails{ + // { + // Name: to.Ptr("testticket"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("usa"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Connectivity / Cannot connect to virtual machine by using RDP or SSH"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_service_guid/problemClassifications/problemClassification_guid"), + // ProblemScopingQuestions: to.Ptr("{\"articleId\":\"076846c1-4c0b-4b21-91c6-1a30246b3867\",\"scopingDetails\":[{\"question\":\"When did the problem begin?\",\"controlId\":\"problem_start_time\",\"orderId\":1,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"2023-08-31T18:55:00.739Z\",\"value\":\"2023-08-31T18:55:00.739Z\",\"type\":\"datetime\"}},{\"question\":\"API Type of the Cosmos DB account\",\"controlId\":\"api_type\",\"orderId\":2,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"Table\",\"value\":\"tables\",\"type\":\"string\"}},{\"question\":\"Table name\",\"controlId\":\"collection_name_table\",\"orderId\":11,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"Select Table Name\",\"value\":\"dont_know_answer\",\"type\":\"string\"}},{\"question\":\"Provide additional details about the issue you're facing\",\"controlId\":\"problem_description\",\"orderId\":12,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"test ticket, please ignore and close\",\"value\":\"test ticket, please ignore and close\",\"type\":\"string\"}}]}"), + // Require24X7Response: to.Ptr(false), + // SecondaryConsent: []*armsupport.SecondaryConsent{ + // { + // Type: to.Ptr("VirtualMachine"), + // UserConsent: to.Ptr(armsupport.UserConsentYes), + // }}, + // ServiceDisplayName: to.Ptr("Virtual Machine running Linux"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_service_guid"), + // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-21T17:36:18.000Z"); return t}()), + // SLAMinutes: to.Ptr[int32](240), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // }, + // Severity: to.Ptr(armsupport.SeverityLevelModerate), + // Status: to.Ptr("Open"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("119120321001170"), + // Title: to.Ptr("my title"), + // }, + // }, + // { + // Name: to.Ptr("testticket2"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket2"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("This is a test - please ignore"), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("USA"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Add or Edit VAT, TAX ID, or PO Number"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/problemClassification_guid"), + // Require24X7Response: to.Ptr(false), + // ServiceDisplayName: to.Ptr("Subscription management"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid"), + // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-21T17:36:18.000Z"); return t}()), + // SLAMinutes: to.Ptr[int32](240), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // }, + // Severity: to.Ptr(armsupport.SeverityLevelMinimal), + // Status: to.Ptr("Open"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("118032014183771"), + // Title: to.Ptr("Test - please ignore"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListSupportTicketsInUpdatingState.json +func ExampleTicketsNoSubscriptionClient_NewListPager_listSupportTicketsInUpdatingStateForASubscription() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewTicketsNoSubscriptionClient().NewListPager(&armsupport.TicketsNoSubscriptionClientListOptions{Top: nil, + Filter: to.Ptr("status eq 'Updating'"), + }) + 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.TicketsListResult = armsupport.TicketsListResult{ + // Value: []*armsupport.TicketDetails{ + // { + // Name: to.Ptr("testticket"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("usa"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Connectivity / Cannot connect to virtual machine by using RDP or SSH"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_service_guid/problemClassifications/problemClassification_guid"), + // ProblemScopingQuestions: to.Ptr("{\"articleId\":\"076846c1-4c0b-4b21-91c6-1a30246b3867\",\"scopingDetails\":[{\"question\":\"When did the problem begin?\",\"controlId\":\"problem_start_time\",\"orderId\":1,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"2023-08-31T18:55:00.739Z\",\"value\":\"2023-08-31T18:55:00.739Z\",\"type\":\"datetime\"}},{\"question\":\"API Type of the Cosmos DB account\",\"controlId\":\"api_type\",\"orderId\":2,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"Table\",\"value\":\"tables\",\"type\":\"string\"}},{\"question\":\"Table name\",\"controlId\":\"collection_name_table\",\"orderId\":11,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"Select Table Name\",\"value\":\"dont_know_answer\",\"type\":\"string\"}},{\"question\":\"Provide additional details about the issue you're facing\",\"controlId\":\"problem_description\",\"orderId\":12,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"test ticket, please ignore and close\",\"value\":\"test ticket, please ignore and close\",\"type\":\"string\"}}]}"), + // Require24X7Response: to.Ptr(false), + // SecondaryConsent: []*armsupport.SecondaryConsent{ + // { + // Type: to.Ptr("VirtualMachine"), + // UserConsent: to.Ptr(armsupport.UserConsentYes), + // }}, + // ServiceDisplayName: to.Ptr("Virtual Machine running Linux"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_service_guid"), + // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-21T17:36:18.000Z"); return t}()), + // SLAMinutes: to.Ptr[int32](240), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // }, + // Severity: to.Ptr(armsupport.SeverityLevelModerate), + // Status: to.Ptr("Updating"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("119120321001170"), + // Title: to.Ptr("my title"), + // }, + // }, + // { + // Name: to.Ptr("testticket2"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket2"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("This is a test - please ignore"), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("USA"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Add or Edit VAT, TAX ID, or PO Number"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/problemClassification_guid"), + // Require24X7Response: to.Ptr(false), + // ServiceDisplayName: to.Ptr("Subscription management"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid"), + // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-21T17:36:18.000Z"); return t}()), + // SLAMinutes: to.Ptr[int32](240), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // }, + // Severity: to.Ptr(armsupport.SeverityLevelMinimal), + // Status: to.Ptr("Updating"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("118032014183771"), + // Title: to.Ptr("Test - please ignore"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListSupportTicketsProblemClassificationIdEquals.json +func ExampleTicketsNoSubscriptionClient_NewListPager_listSupportTicketsWithACertainProblemClassificationIdForASubscription() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewTicketsNoSubscriptionClient().NewListPager(&armsupport.TicketsNoSubscriptionClientListOptions{Top: nil, + Filter: to.Ptr("ProblemClassificationId eq 'compute_vm_problemClassification_guid'"), + }) + 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.TicketsListResult = armsupport.TicketsListResult{ + // Value: []*armsupport.TicketDetails{ + // { + // Name: to.Ptr("testTicket1"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testTicket1"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("usa"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-04T21:52:10.000Z"); return t}()), + // EnrollmentID: to.Ptr(""), + // FileWorkspaceName: to.Ptr("testTicket1"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-12T23:05:19.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Compute-VM (cores-vCPUs) subscription limit increases"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/service_guid/problemClassifications/compute_vm_problemClassification_guid"), + // Require24X7Response: to.Ptr(false), + // ServiceDisplayName: to.Ptr("service_displayName"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/service_guid"), + // Severity: to.Ptr(armsupport.SeverityLevelMinimal), + // Status: to.Ptr("Open"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("2205060010000072"), + // Title: to.Ptr("my title"), + // }, + // }, + // { + // Name: to.Ptr("testTicket2"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testTicket2"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("This is a test - please ignore"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("USA"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-04T21:38:42.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("testTicket2"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-04T21:39:14.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Compute-VM (cores-vCPUs) subscription limit increases"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/service_guid/problemClassifications/compute_vm_problemClassification_guid"), + // Require24X7Response: to.Ptr(false), + // ServiceDisplayName: to.Ptr("service_displayName"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/service_guid"), + // Severity: to.Ptr(armsupport.SeverityLevelMinimal), + // Status: to.Ptr("Open"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("2205040010000077"), + // Title: to.Ptr("Test - please ignore"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/ListSupportTicketsServiceIdEquals.json +func ExampleTicketsNoSubscriptionClient_NewListPager_listSupportTicketsWithACertainServiceIdForASubscription() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewTicketsNoSubscriptionClient().NewListPager(&armsupport.TicketsNoSubscriptionClientListOptions{Top: nil, + Filter: to.Ptr("ServiceId eq 'vm_windows_service_guid'"), + }) + 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.TicketsListResult = armsupport.TicketsListResult{ + // Value: []*armsupport.TicketDetails{ + // { + // Name: to.Ptr("testticket1"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("usa"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-04T21:52:10.000Z"); return t}()), + // EnrollmentID: to.Ptr(""), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-12T23:05:19.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("problemClassification_displayName"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/vm_windows_service_guid/problemClassifications/problemClassification_guid"), + // ProblemScopingQuestions: to.Ptr("{\"articleId\":\"076846c1-4c0b-4b21-91c6-1a30246b3867\",\"scopingDetails\":[{\"question\":\"When did the problem begin?\",\"controlId\":\"problem_start_time\",\"orderId\":1,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"2023-08-31T18:55:00.739Z\",\"value\":\"2023-08-31T18:55:00.739Z\",\"type\":\"datetime\"}},{\"question\":\"API Type of the Cosmos DB account\",\"controlId\":\"api_type\",\"orderId\":2,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"Table\",\"value\":\"tables\",\"type\":\"string\"}},{\"question\":\"Table name\",\"controlId\":\"collection_name_table\",\"orderId\":11,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"Select Table Name\",\"value\":\"dont_know_answer\",\"type\":\"string\"}},{\"question\":\"Provide additional details about the issue you're facing\",\"controlId\":\"problem_description\",\"orderId\":12,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"test ticket, please ignore and close\",\"value\":\"test ticket, please ignore and close\",\"type\":\"string\"}}]}"), + // Require24X7Response: to.Ptr(false), + // SecondaryConsent: []*armsupport.SecondaryConsent{ + // { + // Type: to.Ptr("VirtualMachine"), + // UserConsent: to.Ptr(armsupport.UserConsentYes), + // }}, + // ServiceDisplayName: to.Ptr("Virtual Machine running Windows"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/vm_windows_service_guid"), + // Severity: to.Ptr(armsupport.SeverityLevelMinimal), + // Status: to.Ptr("Open"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("2205040010000082"), + // Title: to.Ptr("my title"), + // }, + // }, + // { + // Name: to.Ptr("testticket2"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("This is a test - please ignore"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("USA"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-04T21:38:42.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-04T21:39:14.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("problemClassification_displayName"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/vm_windows_service_guid/problemClassifications/problemClassification_guid"), + // ProblemScopingQuestions: to.Ptr("{\"articleId\":\"076846c1-4c0b-4b21-91c6-1a30246b3867\",\"scopingDetails\":[{\"question\":\"When did the problem begin?\",\"controlId\":\"problem_start_time\",\"orderId\":1,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"2023-08-31T18:55:00.739Z\",\"value\":\"2023-08-31T18:55:00.739Z\",\"type\":\"datetime\"}},{\"question\":\"API Type of the Cosmos DB account\",\"controlId\":\"api_type\",\"orderId\":2,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"Table\",\"value\":\"tables\",\"type\":\"string\"}},{\"question\":\"Table name\",\"controlId\":\"collection_name_table\",\"orderId\":11,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"Select Table Name\",\"value\":\"dont_know_answer\",\"type\":\"string\"}},{\"question\":\"Provide additional details about the issue you're facing\",\"controlId\":\"problem_description\",\"orderId\":12,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"test ticket, please ignore and close\",\"value\":\"test ticket, please ignore and close\",\"type\":\"string\"}}]}"), + // Require24X7Response: to.Ptr(false), + // SecondaryConsent: []*armsupport.SecondaryConsent{ + // { + // Type: to.Ptr("VirtualMachine"), + // UserConsent: to.Ptr(armsupport.UserConsentYes), + // }}, + // ServiceDisplayName: to.Ptr("Virtual Machine running Windows"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/vm_windows_service_guid"), + // Severity: to.Ptr(armsupport.SeverityLevelMinimal), + // Status: to.Ptr("Open"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("2205040010000080"), + // Title: to.Ptr("Test - please ignore"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/GetSupportTicketDetails.json +func ExampleTicketsNoSubscriptionClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewTicketsNoSubscriptionClient().Get(ctx, "testticket", 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.TicketDetails = armsupport.TicketDetails{ + // Name: to.Ptr("testticket"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("This is a test - please ignore"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("USA"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Add or Edit VAT, TAX ID, or PO Number"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/problemClassification_guid"), + // Require24X7Response: to.Ptr(false), + // ServiceDisplayName: to.Ptr("Subscription management"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid"), + // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-21T17:36:18.000Z"); return t}()), + // SLAMinutes: to.Ptr[int32](240), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // }, + // Severity: to.Ptr(armsupport.SeverityLevelMinimal), + // Status: to.Ptr("Open"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("118032014183770"), + // Title: to.Ptr("Test - please ignore"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/UpdateAdvancedDiagnosticConsentOfSupportTicket.json +func ExampleTicketsNoSubscriptionClient_Update_updateAdvancedDiagnosticConsentOfASupportTicket() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewTicketsNoSubscriptionClient().Update(ctx, "testticket", armsupport.UpdateSupportTicket{ + AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + }, 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.TicketDetails = armsupport.TicketDetails{ + // Name: to.Ptr("testticket"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("This is a test - please ignore"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + // ContactDetails: &armsupport.ContactProfile{ + // AdditionalEmailAddresses: []*string{ + // to.Ptr("tname@contoso.com"), + // to.Ptr("teamtest@contoso.com")}, + // Country: to.Ptr("USA"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("test.name@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Add or Edit VAT, TAX ID, or PO Number"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/problemClassification_guid"), + // Require24X7Response: to.Ptr(false), + // ServiceDisplayName: to.Ptr("Subscription management"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid"), + // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-21T17:36:18.000Z"); return t}()), + // SLAMinutes: to.Ptr[int32](240), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // }, + // Severity: to.Ptr(armsupport.SeverityLevelCritical), + // Status: to.Ptr("Open"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("118032014183770"), + // Title: to.Ptr("Test - please ignore"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/UpdateContactDetailsOfSupportTicket.json +func ExampleTicketsNoSubscriptionClient_Update_updateContactDetailsOfASupportTicket() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewTicketsNoSubscriptionClient().Update(ctx, "testticket", armsupport.UpdateSupportTicket{ + ContactDetails: &armsupport.UpdateContactProfile{ + AdditionalEmailAddresses: []*string{ + to.Ptr("tname@contoso.com"), + to.Ptr("teamtest@contoso.com")}, + Country: to.Ptr("USA"), + FirstName: to.Ptr("first name"), + LastName: to.Ptr("last name"), + PhoneNumber: to.Ptr("123-456-7890"), + PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + PreferredSupportLanguage: to.Ptr("en-US"), + PreferredTimeZone: to.Ptr("Pacific Standard Time"), + PrimaryEmailAddress: to.Ptr("test.name@contoso.com"), + }, + }, 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.TicketDetails = armsupport.TicketDetails{ + // Name: to.Ptr("testticket"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("This is a test - please ignore"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + // ContactDetails: &armsupport.ContactProfile{ + // AdditionalEmailAddresses: []*string{ + // to.Ptr("tname@contoso.com"), + // to.Ptr("teamtest@contoso.com")}, + // Country: to.Ptr("USA"), + // FirstName: to.Ptr("first name"), + // LastName: to.Ptr("last name"), + // PhoneNumber: to.Ptr("123-456-7890"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("test.name@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Add or Edit VAT, TAX ID, or PO Number"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/problemClassification_guid"), + // Require24X7Response: to.Ptr(false), + // ServiceDisplayName: to.Ptr("Subscription management"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid"), + // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-21T17:36:18.000Z"); return t}()), + // SLAMinutes: to.Ptr[int32](240), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // }, + // Severity: to.Ptr(armsupport.SeverityLevelCritical), + // Status: to.Ptr("Open"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("118032014183770"), + // Title: to.Ptr("Test - please ignore"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/UpdateSeverityOfSupportTicket.json +func ExampleTicketsNoSubscriptionClient_Update_updateSeverityOfASupportTicket() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewTicketsNoSubscriptionClient().Update(ctx, "testticket", armsupport.UpdateSupportTicket{ + Severity: to.Ptr(armsupport.SeverityLevelCritical), + }, 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.TicketDetails = armsupport.TicketDetails{ + // Name: to.Ptr("testticket"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("This is a test - please ignore"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + // ContactDetails: &armsupport.ContactProfile{ + // AdditionalEmailAddresses: []*string{ + // to.Ptr("tname@contoso.com"), + // to.Ptr("teamtest@contoso.com")}, + // Country: to.Ptr("USA"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("test.name@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Add or Edit VAT, TAX ID, or PO Number"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/problemClassification_guid"), + // Require24X7Response: to.Ptr(false), + // ServiceDisplayName: to.Ptr("Subscription management"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid"), + // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-21T17:36:18.000Z"); return t}()), + // SLAMinutes: to.Ptr[int32](240), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // }, + // Severity: to.Ptr(armsupport.SeverityLevelCritical), + // Status: to.Ptr("Open"), + // SupportEngineer: &armsupport.Engineer{ + // EmailAddress: to.Ptr("xyz@contoso.com"), + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("118032014183770"), + // Title: to.Ptr("Test - please ignore"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/UpdateStatusOfSupportTicket.json +func ExampleTicketsNoSubscriptionClient_Update_updateStatusOfASupportTicket() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewTicketsNoSubscriptionClient().Update(ctx, "testticket", armsupport.UpdateSupportTicket{ + Status: to.Ptr(armsupport.StatusClosed), + }, 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.TicketDetails = armsupport.TicketDetails{ + // Name: to.Ptr("testticket"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("This is a test - please ignore"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + // ContactDetails: &armsupport.ContactProfile{ + // AdditionalEmailAddresses: []*string{ + // to.Ptr("tname@contoso.com"), + // to.Ptr("teamtest@contoso.com")}, + // Country: to.Ptr("USA"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("test.name@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Add or Edit VAT, TAX ID, or PO Number"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/problemClassification_guid"), + // Require24X7Response: to.Ptr(false), + // ServiceDisplayName: to.Ptr("Subscription management"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid"), + // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-21T17:36:18.000Z"); return t}()), + // SLAMinutes: to.Ptr[int32](240), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // }, + // Severity: to.Ptr(armsupport.SeverityLevelCritical), + // Status: to.Ptr("Closed"), + // SupportEngineer: &armsupport.Engineer{ + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("118032014183770"), + // Title: to.Ptr("Test - please ignore"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateBillingSupportTicket.json +func ExampleTicketsNoSubscriptionClient_BeginCreate_createATicketForBillingRelatedIssues() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewTicketsNoSubscriptionClient().BeginCreate(ctx, "testticket", armsupport.TicketDetails{ + Properties: &armsupport.TicketDetailsProperties{ + Description: to.Ptr("my description"), + ContactDetails: &armsupport.ContactProfile{ + Country: to.Ptr("usa"), + FirstName: to.Ptr("abc"), + LastName: to.Ptr("xyz"), + PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + PreferredSupportLanguage: to.Ptr("en-US"), + PreferredTimeZone: to.Ptr("Pacific Standard Time"), + PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + }, + FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/billing_service_guid/problemClassifications/billing_problemClassification_guid"), + ServiceID: to.Ptr("/providers/Microsoft.Support/services/billing_service_guid"), + Severity: to.Ptr(armsupport.SeverityLevelModerate), + SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + Title: to.Ptr("my title"), + }, + }, 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.TicketDetails = armsupport.TicketDetails{ + // Name: to.Ptr("testticket"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("my description"), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("usa"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Refund request"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/billing_service_guid/problemClassifications/billing_problemClassification_guid"), + // Require24X7Response: to.Ptr(false), + // ServiceDisplayName: to.Ptr("Billing"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/billing_service_guid"), + // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-21T17:36:18.000Z"); return t}()), + // SLAMinutes: to.Ptr[int32](240), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // }, + // Severity: to.Ptr(armsupport.SeverityLevelModerate), + // Status: to.Ptr("Open"), + // SupportEngineer: &armsupport.Engineer{ + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("119120321001170"), + // Title: to.Ptr("my title"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateSubMgmtSupportTicket.json +func ExampleTicketsNoSubscriptionClient_BeginCreate_createATicketForSubscriptionManagementRelatedIssues() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewTicketsNoSubscriptionClient().BeginCreate(ctx, "testticket", armsupport.TicketDetails{ + Properties: &armsupport.TicketDetailsProperties{ + Description: to.Ptr("my description"), + ContactDetails: &armsupport.ContactProfile{ + Country: to.Ptr("usa"), + FirstName: to.Ptr("abc"), + LastName: to.Ptr("xyz"), + PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + PreferredSupportLanguage: to.Ptr("en-US"), + PreferredTimeZone: to.Ptr("Pacific Standard Time"), + PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + }, + FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/subscription_management_problemClassification_guid"), + ServiceID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid"), + Severity: to.Ptr(armsupport.SeverityLevelModerate), + SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + Title: to.Ptr("my title"), + }, + }, 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.TicketDetails = armsupport.TicketDetails{ + // Name: to.Ptr("testticket"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("my description"), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("usa"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Transfer ownership of my subscription"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/subscription_management_problemClassification_guid"), + // Require24X7Response: to.Ptr(false), + // ServiceDisplayName: to.Ptr("Subscription management"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/subscription_management_service_guid"), + // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-21T17:36:18.000Z"); return t}()), + // SLAMinutes: to.Ptr[int32](240), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // }, + // Severity: to.Ptr(armsupport.SeverityLevelModerate), + // Status: to.Ptr("Open"), + // SupportEngineer: &armsupport.Engineer{ + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("119120321001170"), + // Title: to.Ptr("my title"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/examples/CreateTechnicalSupportTicket.json +func ExampleTicketsNoSubscriptionClient_BeginCreate_createATicketForTechnicalIssueRelatedToASpecificResource() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armsupport.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewTicketsNoSubscriptionClient().BeginCreate(ctx, "testticket", armsupport.TicketDetails{ + Properties: &armsupport.TicketDetailsProperties{ + Description: to.Ptr("my description"), + AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + ContactDetails: &armsupport.ContactProfile{ + Country: to.Ptr("usa"), + FirstName: to.Ptr("abc"), + LastName: to.Ptr("xyz"), + PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + PreferredSupportLanguage: to.Ptr("en-US"), + PreferredTimeZone: to.Ptr("Pacific Standard Time"), + PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + }, + FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_running_linux_service_guid/problemClassifications/problemClassification_guid"), + ProblemScopingQuestions: to.Ptr("{\"articleId\":\"076846c1-4c0b-4b21-91c6-1a30246b3867\",\"scopingDetails\":[{\"question\":\"When did the problem begin?\",\"controlId\":\"problem_start_time\",\"orderId\":1,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"2023-08-31T18:55:00.739Z\",\"value\":\"2023-08-31T18:55:00.739Z\",\"type\":\"datetime\"}},{\"question\":\"API Type of the Cosmos DB account\",\"controlId\":\"api_type\",\"orderId\":2,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"Table\",\"value\":\"tables\",\"type\":\"string\"}},{\"question\":\"Table name\",\"controlId\":\"collection_name_table\",\"orderId\":11,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"Select Table Name\",\"value\":\"dont_know_answer\",\"type\":\"string\"}},{\"question\":\"Provide additional details about the issue you're facing\",\"controlId\":\"problem_description\",\"orderId\":12,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"test ticket, please ignore and close\",\"value\":\"test ticket, please ignore and close\",\"type\":\"string\"}}]}"), + SecondaryConsent: []*armsupport.SecondaryConsent{ + { + Type: to.Ptr("virtualmachinerunninglinuxservice"), + UserConsent: to.Ptr(armsupport.UserConsentYes), + }}, + ServiceID: to.Ptr("/providers/Microsoft.Support/services/cddd3eb5-1830-b494-44fd-782f691479dc"), + Severity: to.Ptr(armsupport.SeverityLevelModerate), + SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + Title: to.Ptr("my title"), + }, + }, 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.TicketDetails = armsupport.TicketDetails{ + // Name: to.Ptr("testticket"), + // Type: to.Ptr("Microsoft.Support/supportTickets"), + // ID: to.Ptr("/providers/Microsoft.Support/supportTickets/testticket"), + // Properties: &armsupport.TicketDetailsProperties{ + // Description: to.Ptr("my description"), + // AdvancedDiagnosticConsent: to.Ptr(armsupport.ConsentYes), + // ContactDetails: &armsupport.ContactProfile{ + // Country: to.Ptr("usa"), + // FirstName: to.Ptr("abc"), + // LastName: to.Ptr("xyz"), + // PreferredContactMethod: to.Ptr(armsupport.PreferredContactMethodEmail), + // PreferredSupportLanguage: to.Ptr("en-US"), + // PreferredTimeZone: to.Ptr("Pacific Standard Time"), + // PrimaryEmailAddress: to.Ptr("abc@contoso.com"), + // }, + // CreatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // FileWorkspaceName: to.Ptr("6f16735c-1530836f-e9970f1a-2e49-47b7-96cd-9746b83aa066"), + // ModifiedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:23.000Z"); return t}()), + // ProblemClassificationDisplayName: to.Ptr("Connectivity / Cannot connect to virtual machine by using RDP or SSH"), + // ProblemClassificationID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_running_linux_service_guid/problemClassifications/problemClassification_guid"), + // ProblemScopingQuestions: to.Ptr("{\"articleId\":\"076846c1-4c0b-4b21-91c6-1a30246b3867\",\"scopingDetails\":[{\"question\":\"When did the problem begin?\",\"controlId\":\"problem_start_time\",\"orderId\":1,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"2023-08-31T18:55:00.739Z\",\"value\":\"2023-08-31T18:55:00.739Z\",\"type\":\"datetime\"}},{\"question\":\"API Type of the Cosmos DB account\",\"controlId\":\"api_type\",\"orderId\":2,\"inputType\":\"static\",\"answer\":{\"displayValue\":\"Table\",\"value\":\"tables\",\"type\":\"string\"}},{\"question\":\"Table name\",\"controlId\":\"collection_name_table\",\"orderId\":11,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"Select Table Name\",\"value\":\"dont_know_answer\",\"type\":\"string\"}},{\"question\":\"Provide additional details about the issue you're facing\",\"controlId\":\"problem_description\",\"orderId\":12,\"inputType\":\"nonstatic\",\"answer\":{\"displayValue\":\"test ticket, please ignore and close\",\"value\":\"test ticket, please ignore and close\",\"type\":\"string\"}}]}"), + // Require24X7Response: to.Ptr(false), + // SecondaryConsent: []*armsupport.SecondaryConsent{ + // { + // Type: to.Ptr("virtualmachinerunninglinuxservice"), + // UserConsent: to.Ptr(armsupport.UserConsentYes), + // }}, + // ServiceDisplayName: to.Ptr("Virtual Machine running Linux"), + // ServiceID: to.Ptr("/providers/Microsoft.Support/services/virtual_machine_running_linux_service_guid"), + // ServiceLevelAgreement: &armsupport.ServiceLevelAgreement{ + // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-21T17:36:18.000Z"); return t}()), + // SLAMinutes: to.Ptr[int32](240), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-20T21:36:18.000Z"); return t}()), + // }, + // Severity: to.Ptr(armsupport.SeverityLevelModerate), + // Status: to.Ptr("Open"), + // SupportEngineer: &armsupport.Engineer{ + // }, + // SupportPlanDisplayName: to.Ptr("Premier"), + // SupportPlanID: to.Ptr("U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw="), + // SupportPlanType: to.Ptr("Premier"), + // SupportTicketID: to.Ptr("119120321001170"), + // Title: to.Ptr("my title"), + // }, + // } +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md b/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md index 266928696517..6f83c76516ab 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md @@ -1,5 +1,28 @@ # Release History +## 1.3.0-beta.1 (2023-11-30) +### Features Added + +- New enum type `ServiceKind` with values `ServiceKindSocketIO`, `ServiceKindWebPubSub` +- New function `*Client.ListReplicaSKUs(context.Context, string, string, string, *ClientListReplicaSKUsOptions) (ClientListReplicaSKUsResponse, error)` +- New function `*ClientFactory.NewReplicasClient() *ReplicasClient` +- New function `NewReplicasClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ReplicasClient, error)` +- New function `*ReplicasClient.BeginCreateOrUpdate(context.Context, string, string, string, Replica, *ReplicasClientBeginCreateOrUpdateOptions) (*runtime.Poller[ReplicasClientCreateOrUpdateResponse], error)` +- New function `*ReplicasClient.Delete(context.Context, string, string, string, *ReplicasClientDeleteOptions) (ReplicasClientDeleteResponse, error)` +- New function `*ReplicasClient.Get(context.Context, string, string, string, *ReplicasClientGetOptions) (ReplicasClientGetResponse, error)` +- New function `*ReplicasClient.NewListPager(string, string, *ReplicasClientListOptions) *runtime.Pager[ReplicasClientListResponse]` +- New function `*ReplicasClient.BeginRestart(context.Context, string, string, string, *ReplicasClientBeginRestartOptions) (*runtime.Poller[ReplicasClientRestartResponse], error)` +- New function `*ReplicasClient.BeginUpdate(context.Context, string, string, string, Replica, *ReplicasClientBeginUpdateOptions) (*runtime.Poller[ReplicasClientUpdateResponse], error)` +- New struct `IPRule` +- New struct `Replica` +- New struct `ReplicaList` +- New struct `ReplicaProperties` +- New field `IPRules` in struct `NetworkACLs` +- New field `SystemData` in struct `PrivateLinkResource` +- New field `RegionEndpointEnabled`, `ResourceStopped` in struct `Properties` +- New field `Kind` in struct `ResourceInfo` + + ## 1.2.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/assets.json b/sdk/resourcemanager/webpubsub/armwebpubsub/assets.json index adeaed5a8c89..a4d5505a52c4 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/assets.json +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "go", "TagPrefix": "go/resourcemanager/webpubsub/armwebpubsub", - "Tag": "go/resourcemanager/webpubsub/armwebpubsub_e6a0527503" + "Tag": "go/resourcemanager/webpubsub/armwebpubsub_b9f481d511" } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/autorest.md b/sdk/resourcemanager/webpubsub/armwebpubsub/autorest.md index da7a61821624..f09f9a303265 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/autorest.md +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/autorest.md @@ -5,8 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.2.0 +module-version: 1.3.0-beta.1 +tag: package-2023-08-01-preview ``` \ No newline at end of file diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/client.go index 2755b2bc8b3d..98d448631e70 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/client.go @@ -28,8 +28,7 @@ type Client struct { } // NewClient creates a new instance of Client with the specified values. -// - subscriptionID - Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) { @@ -47,7 +46,7 @@ func NewClient(subscriptionID string, credential azcore.TokenCredential, options // CheckNameAvailability - Checks that the resource name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview // - location - the region // - parameters - Parameters supplied to the operation. // - options - ClientCheckNameAvailabilityOptions contains the optional parameters for the Client.CheckNameAvailability method. @@ -89,7 +88,7 @@ func (client *Client) checkNameAvailabilityCreateRequest(ctx context.Context, lo return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -110,9 +109,8 @@ func (client *Client) checkNameAvailabilityHandleResponse(resp *http.Response) ( // BeginCreateOrUpdate - Create or update a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - parameters - Parameters for the create or update operation // - options - ClientBeginCreateOrUpdateOptions contains the optional parameters for the Client.BeginCreateOrUpdate method. @@ -123,7 +121,8 @@ func (client *Client) BeginCreateOrUpdate(ctx context.Context, resourceGroupName return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -136,7 +135,7 @@ func (client *Client) BeginCreateOrUpdate(ctx context.Context, resourceGroupName // CreateOrUpdate - Create or update a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview func (client *Client) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceInfo, options *ClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "Client.BeginCreateOrUpdate" @@ -178,7 +177,7 @@ func (client *Client) createOrUpdateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -190,9 +189,8 @@ func (client *Client) createOrUpdateCreateRequest(ctx context.Context, resourceG // BeginDelete - Operation to delete a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - ClientBeginDeleteOptions contains the optional parameters for the Client.BeginDelete method. func (client *Client) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginDeleteOptions) (*runtime.Poller[ClientDeleteResponse], error) { @@ -216,7 +214,7 @@ func (client *Client) BeginDelete(ctx context.Context, resourceGroupName string, // Delete - Operation to delete a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview func (client *Client) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "Client.BeginDelete" @@ -258,7 +256,7 @@ func (client *Client) deleteCreateRequest(ctx context.Context, resourceGroupName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,9 +265,8 @@ func (client *Client) deleteCreateRequest(ctx context.Context, resourceGroupName // Get - Get the resource and its properties. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - ClientGetOptions contains the optional parameters for the Client.Get method. func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string, options *ClientGetOptions) (ClientGetResponse, error) { @@ -314,7 +311,7 @@ func (client *Client) getCreateRequest(ctx context.Context, resourceGroupName st return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -331,9 +328,8 @@ func (client *Client) getHandleResponse(resp *http.Response) (ClientGetResponse, // NewListByResourceGroupPager - Handles requests to list all resources in a resource group. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ClientListByResourceGroupOptions contains the optional parameters for the Client.NewListByResourceGroupPager // method. func (client *Client) NewListByResourceGroupPager(resourceGroupName string, options *ClientListByResourceGroupOptions) *runtime.Pager[ClientListByResourceGroupResponse] { @@ -375,7 +371,7 @@ func (client *Client) listByResourceGroupCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -392,7 +388,7 @@ func (client *Client) listByResourceGroupHandleResponse(resp *http.Response) (Cl // NewListBySubscriptionPager - Handles requests to list all resources in a subscription. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview // - options - ClientListBySubscriptionOptions contains the optional parameters for the Client.NewListBySubscriptionPager method. func (client *Client) NewListBySubscriptionPager(options *ClientListBySubscriptionOptions) *runtime.Pager[ClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[ClientListBySubscriptionResponse]{ @@ -429,7 +425,7 @@ func (client *Client) listBySubscriptionCreateRequest(ctx context.Context, optio return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -447,9 +443,8 @@ func (client *Client) listBySubscriptionHandleResponse(resp *http.Response) (Cli // ListKeys - Get the access keys of the resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - ClientListKeysOptions contains the optional parameters for the Client.ListKeys method. func (client *Client) ListKeys(ctx context.Context, resourceGroupName string, resourceName string, options *ClientListKeysOptions) (ClientListKeysResponse, error) { @@ -494,7 +489,7 @@ func (client *Client) listKeysCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -509,12 +504,80 @@ func (client *Client) listKeysHandleResponse(resp *http.Response) (ClientListKey return result, nil } +// ListReplicaSKUs - List all available skus of the replica resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - replicaName - The name of the replica. +// - options - ClientListReplicaSKUsOptions contains the optional parameters for the Client.ListReplicaSKUs method. +func (client *Client) ListReplicaSKUs(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ClientListReplicaSKUsOptions) (ClientListReplicaSKUsResponse, error) { + var err error + const operationName = "Client.ListReplicaSKUs" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listReplicaSKUsCreateRequest(ctx, resourceGroupName, resourceName, replicaName, options) + if err != nil { + return ClientListReplicaSKUsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClientListReplicaSKUsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientListReplicaSKUsResponse{}, err + } + resp, err := client.listReplicaSKUsHandleResponse(httpResp) + return resp, err +} + +// listReplicaSKUsCreateRequest creates the ListReplicaSKUs request. +func (client *Client) listReplicaSKUsCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ClientListReplicaSKUsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}/skus" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if replicaName == "" { + return nil, errors.New("parameter replicaName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicaName}", url.PathEscape(replicaName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listReplicaSKUsHandleResponse handles the ListReplicaSKUs response. +func (client *Client) listReplicaSKUsHandleResponse(resp *http.Response) (ClientListReplicaSKUsResponse, error) { + result := ClientListReplicaSKUsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SKUList); err != nil { + return ClientListReplicaSKUsResponse{}, err + } + return result, nil +} + // ListSKUs - List all available skus of the resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - ClientListSKUsOptions contains the optional parameters for the Client.ListSKUs method. func (client *Client) ListSKUs(ctx context.Context, resourceGroupName string, resourceName string, options *ClientListSKUsOptions) (ClientListSKUsResponse, error) { @@ -559,7 +622,7 @@ func (client *Client) listSKUsCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -578,9 +641,8 @@ func (client *Client) listSKUsHandleResponse(resp *http.Response) (ClientListSKU // same time. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - parameters - Parameter that describes the Regenerate Key Operation. // - options - ClientBeginRegenerateKeyOptions contains the optional parameters for the Client.BeginRegenerateKey method. @@ -591,7 +653,7 @@ func (client *Client) BeginRegenerateKey(ctx context.Context, resourceGroupName return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientRegenerateKeyResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + FinalStateVia: runtime.FinalStateViaLocation, Tracer: client.internal.Tracer(), }) return poller, err @@ -606,7 +668,7 @@ func (client *Client) BeginRegenerateKey(ctx context.Context, resourceGroupName // time. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview func (client *Client) regenerateKey(ctx context.Context, resourceGroupName string, resourceName string, parameters RegenerateKeyParameters, options *ClientBeginRegenerateKeyOptions) (*http.Response, error) { var err error const operationName = "Client.BeginRegenerateKey" @@ -621,7 +683,7 @@ func (client *Client) regenerateKey(ctx context.Context, resourceGroupName strin if err != nil { return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { err = runtime.NewResponseError(httpResp) return nil, err } @@ -648,7 +710,7 @@ func (client *Client) regenerateKeyCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -660,9 +722,8 @@ func (client *Client) regenerateKeyCreateRequest(ctx context.Context, resourceGr // BeginRestart - Operation to restart a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - ClientBeginRestartOptions contains the optional parameters for the Client.BeginRestart method. func (client *Client) BeginRestart(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginRestartOptions) (*runtime.Poller[ClientRestartResponse], error) { @@ -672,7 +733,7 @@ func (client *Client) BeginRestart(ctx context.Context, resourceGroupName string return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientRestartResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + FinalStateVia: runtime.FinalStateViaLocation, Tracer: client.internal.Tracer(), }) return poller, err @@ -686,7 +747,7 @@ func (client *Client) BeginRestart(ctx context.Context, resourceGroupName string // Restart - Operation to restart a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview func (client *Client) restart(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginRestartOptions) (*http.Response, error) { var err error const operationName = "Client.BeginRestart" @@ -728,7 +789,7 @@ func (client *Client) restartCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -737,9 +798,8 @@ func (client *Client) restartCreateRequest(ctx context.Context, resourceGroupNam // BeginUpdate - Operation to update an exiting resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - parameters - Parameters for the update operation // - options - ClientBeginUpdateOptions contains the optional parameters for the Client.BeginUpdate method. @@ -750,7 +810,8 @@ func (client *Client) BeginUpdate(ctx context.Context, resourceGroupName string, return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientUpdateResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -763,7 +824,7 @@ func (client *Client) BeginUpdate(ctx context.Context, resourceGroupName string, // Update - Operation to update an exiting resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview func (client *Client) update(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceInfo, options *ClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "Client.BeginUpdate" @@ -805,7 +866,7 @@ func (client *Client) updateCreateRequest(ctx context.Context, resourceGroupName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-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/webpubsub/armwebpubsub/client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/client_example_test.go index d5bc337d6af2..f90c38fb8810 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/client_example_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSub_CheckNameAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_CheckNameAvailability.json func ExampleClient_CheckNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -46,7 +46,7 @@ func ExampleClient_CheckNameAvailability() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSub_ListBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_ListBySubscription.json func ExampleClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -74,6 +74,14 @@ func ExampleClient_NewListBySubscriptionPager() { // Name: to.Ptr("myWebPubSubService"), // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService"), + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, // Location: to.Ptr("eastus"), // Tags: map[string]*string{ // "key1": to.Ptr("value1"), @@ -83,6 +91,7 @@ func ExampleClient_NewListBySubscriptionPager() { // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), // }, + // Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), // Properties: &armwebpubsub.Properties{ // DisableAADAuth: to.Ptr(false), // DisableLocalAuth: to.Ptr(false), @@ -98,6 +107,19 @@ func ExampleClient_NewListBySubscriptionPager() { // }, // NetworkACLs: &armwebpubsub.NetworkACLs{ // DefaultAction: to.Ptr(armwebpubsub.ACLActionDeny), + // IPRules: []*armwebpubsub.IPRule{ + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("123.456.789.123/24"), + // }, + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("123.456.789.123"), + // }, + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("AppService"), + // }}, // PrivateEndpoints: []*armwebpubsub.PrivateEndpointACL{ // { // Allow: []*armwebpubsub.WebPubSubRequestType{ @@ -114,6 +136,14 @@ func ExampleClient_NewListBySubscriptionPager() { // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, // Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ // PrivateEndpoint: &armwebpubsub.PrivateEndpoint{ // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), @@ -124,18 +154,11 @@ func ExampleClient_NewListBySubscriptionPager() { // }, // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), // }, - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, // }}, // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), // PublicNetworkAccess: to.Ptr("Enabled"), // PublicPort: to.Ptr[int32](443), + // RegionEndpointEnabled: to.Ptr("Enabled"), // ResourceLogConfiguration: &armwebpubsub.ResourceLogConfiguration{ // Categories: []*armwebpubsub.ResourceLogCategory{ // { @@ -143,6 +166,7 @@ func ExampleClient_NewListBySubscriptionPager() { // Enabled: to.Ptr("true"), // }}, // }, + // ResourceStopped: to.Ptr("false"), // ServerPort: to.Ptr[int32](443), // TLS: &armwebpubsub.TLSSettings{ // ClientCertEnabled: to.Ptr(true), @@ -155,20 +179,12 @@ func ExampleClient_NewListBySubscriptionPager() { // Size: to.Ptr("P1"), // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), // }, - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, // }}, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSub_ListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_ListByResourceGroup.json func ExampleClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -196,6 +212,14 @@ func ExampleClient_NewListByResourceGroupPager() { // Name: to.Ptr("myWebPubSubService"), // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService"), + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, // Location: to.Ptr("eastus"), // Tags: map[string]*string{ // "key1": to.Ptr("value1"), @@ -205,6 +229,7 @@ func ExampleClient_NewListByResourceGroupPager() { // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), // }, + // Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), // Properties: &armwebpubsub.Properties{ // DisableAADAuth: to.Ptr(false), // DisableLocalAuth: to.Ptr(false), @@ -220,6 +245,19 @@ func ExampleClient_NewListByResourceGroupPager() { // }, // NetworkACLs: &armwebpubsub.NetworkACLs{ // DefaultAction: to.Ptr(armwebpubsub.ACLActionDeny), + // IPRules: []*armwebpubsub.IPRule{ + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("123.456.789.123/24"), + // }, + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("123.456.789.123"), + // }, + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("AppService"), + // }}, // PrivateEndpoints: []*armwebpubsub.PrivateEndpointACL{ // { // Allow: []*armwebpubsub.WebPubSubRequestType{ @@ -236,6 +274,14 @@ func ExampleClient_NewListByResourceGroupPager() { // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, // Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ // PrivateEndpoint: &armwebpubsub.PrivateEndpoint{ // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), @@ -246,18 +292,11 @@ func ExampleClient_NewListByResourceGroupPager() { // }, // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), // }, - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, // }}, // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), // PublicNetworkAccess: to.Ptr("Enabled"), // PublicPort: to.Ptr[int32](443), + // RegionEndpointEnabled: to.Ptr("Enabled"), // ResourceLogConfiguration: &armwebpubsub.ResourceLogConfiguration{ // Categories: []*armwebpubsub.ResourceLogCategory{ // { @@ -265,6 +304,7 @@ func ExampleClient_NewListByResourceGroupPager() { // Enabled: to.Ptr("true"), // }}, // }, + // ResourceStopped: to.Ptr("false"), // ServerPort: to.Ptr[int32](443), // TLS: &armwebpubsub.TLSSettings{ // ClientCertEnabled: to.Ptr(true), @@ -277,20 +317,12 @@ func ExampleClient_NewListByResourceGroupPager() { // Size: to.Ptr("P1"), // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), // }, - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, // }}, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSub_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_Get.json func ExampleClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -312,6 +344,14 @@ func ExampleClient_Get() { // Name: to.Ptr("myWebPubSubService"), // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService"), + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, // Location: to.Ptr("eastus"), // Tags: map[string]*string{ // "key1": to.Ptr("value1"), @@ -321,6 +361,7 @@ func ExampleClient_Get() { // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), // }, + // Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), // Properties: &armwebpubsub.Properties{ // DisableAADAuth: to.Ptr(false), // DisableLocalAuth: to.Ptr(false), @@ -336,6 +377,19 @@ func ExampleClient_Get() { // }, // NetworkACLs: &armwebpubsub.NetworkACLs{ // DefaultAction: to.Ptr(armwebpubsub.ACLActionDeny), + // IPRules: []*armwebpubsub.IPRule{ + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("123.456.789.123/24"), + // }, + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("123.456.789.123"), + // }, + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("AppService"), + // }}, // PrivateEndpoints: []*armwebpubsub.PrivateEndpointACL{ // { // Allow: []*armwebpubsub.WebPubSubRequestType{ @@ -352,6 +406,14 @@ func ExampleClient_Get() { // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, // Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ // PrivateEndpoint: &armwebpubsub.PrivateEndpoint{ // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), @@ -362,18 +424,11 @@ func ExampleClient_Get() { // }, // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), // }, - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, // }}, // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), // PublicNetworkAccess: to.Ptr("Enabled"), // PublicPort: to.Ptr[int32](443), + // RegionEndpointEnabled: to.Ptr("Enabled"), // ResourceLogConfiguration: &armwebpubsub.ResourceLogConfiguration{ // Categories: []*armwebpubsub.ResourceLogCategory{ // { @@ -381,6 +436,7 @@ func ExampleClient_Get() { // Enabled: to.Ptr("true"), // }}, // }, + // ResourceStopped: to.Ptr("false"), // ServerPort: to.Ptr[int32](443), // TLS: &armwebpubsub.TLSSettings{ // ClientCertEnabled: to.Ptr(true), @@ -393,18 +449,10 @@ func ExampleClient_Get() { // Size: to.Ptr("P1"), // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), // }, - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSub_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_CreateOrUpdate.json func ExampleClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -423,6 +471,7 @@ func ExampleClient_BeginCreateOrUpdate() { Identity: &armwebpubsub.ManagedIdentity{ Type: to.Ptr(armwebpubsub.ManagedIdentityTypeSystemAssigned), }, + Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), Properties: &armwebpubsub.Properties{ DisableAADAuth: to.Ptr(false), DisableLocalAuth: to.Ptr(false), @@ -472,6 +521,14 @@ func ExampleClient_BeginCreateOrUpdate() { // Name: to.Ptr("myWebPubSubService"), // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService"), + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, // Location: to.Ptr("eastus"), // Tags: map[string]*string{ // "key1": to.Ptr("value1"), @@ -481,6 +538,7 @@ func ExampleClient_BeginCreateOrUpdate() { // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), // }, + // Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), // Properties: &armwebpubsub.Properties{ // DisableAADAuth: to.Ptr(false), // DisableLocalAuth: to.Ptr(false), @@ -496,6 +554,19 @@ func ExampleClient_BeginCreateOrUpdate() { // }, // NetworkACLs: &armwebpubsub.NetworkACLs{ // DefaultAction: to.Ptr(armwebpubsub.ACLActionDeny), + // IPRules: []*armwebpubsub.IPRule{ + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("123.456.789.123/24"), + // }, + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("123.456.789.123"), + // }, + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("AppService"), + // }}, // PrivateEndpoints: []*armwebpubsub.PrivateEndpointACL{ // { // Allow: []*armwebpubsub.WebPubSubRequestType{ @@ -512,6 +583,14 @@ func ExampleClient_BeginCreateOrUpdate() { // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, // Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ // PrivateEndpoint: &armwebpubsub.PrivateEndpoint{ // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), @@ -522,18 +601,11 @@ func ExampleClient_BeginCreateOrUpdate() { // }, // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), // }, - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, // }}, // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), // PublicNetworkAccess: to.Ptr("Enabled"), // PublicPort: to.Ptr[int32](443), + // RegionEndpointEnabled: to.Ptr("Enabled"), // ResourceLogConfiguration: &armwebpubsub.ResourceLogConfiguration{ // Categories: []*armwebpubsub.ResourceLogCategory{ // { @@ -541,6 +613,7 @@ func ExampleClient_BeginCreateOrUpdate() { // Enabled: to.Ptr("true"), // }}, // }, + // ResourceStopped: to.Ptr("false"), // ServerPort: to.Ptr[int32](443), // TLS: &armwebpubsub.TLSSettings{ // ClientCertEnabled: to.Ptr(true), @@ -553,18 +626,10 @@ func ExampleClient_BeginCreateOrUpdate() { // Size: to.Ptr("P1"), // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), // }, - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSub_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_Delete.json func ExampleClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -585,7 +650,7 @@ func ExampleClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSub_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_Update.json func ExampleClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -604,6 +669,7 @@ func ExampleClient_BeginUpdate() { Identity: &armwebpubsub.ManagedIdentity{ Type: to.Ptr(armwebpubsub.ManagedIdentityTypeSystemAssigned), }, + Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), Properties: &armwebpubsub.Properties{ DisableAADAuth: to.Ptr(false), DisableLocalAuth: to.Ptr(false), @@ -653,6 +719,14 @@ func ExampleClient_BeginUpdate() { // Name: to.Ptr("myWebPubSubService"), // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService"), + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, // Location: to.Ptr("eastus"), // Tags: map[string]*string{ // "key1": to.Ptr("value1"), @@ -662,6 +736,7 @@ func ExampleClient_BeginUpdate() { // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), // }, + // Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), // Properties: &armwebpubsub.Properties{ // DisableAADAuth: to.Ptr(false), // DisableLocalAuth: to.Ptr(false), @@ -677,6 +752,19 @@ func ExampleClient_BeginUpdate() { // }, // NetworkACLs: &armwebpubsub.NetworkACLs{ // DefaultAction: to.Ptr(armwebpubsub.ACLActionDeny), + // IPRules: []*armwebpubsub.IPRule{ + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("123.456.789.123/24"), + // }, + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("123.456.789.123"), + // }, + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("AppService"), + // }}, // PrivateEndpoints: []*armwebpubsub.PrivateEndpointACL{ // { // Allow: []*armwebpubsub.WebPubSubRequestType{ @@ -693,6 +781,14 @@ func ExampleClient_BeginUpdate() { // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, // Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ // PrivateEndpoint: &armwebpubsub.PrivateEndpoint{ // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), @@ -703,18 +799,11 @@ func ExampleClient_BeginUpdate() { // }, // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), // }, - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, // }}, // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), // PublicNetworkAccess: to.Ptr("Enabled"), // PublicPort: to.Ptr[int32](443), + // RegionEndpointEnabled: to.Ptr("Enabled"), // ResourceLogConfiguration: &armwebpubsub.ResourceLogConfiguration{ // Categories: []*armwebpubsub.ResourceLogCategory{ // { @@ -722,6 +811,7 @@ func ExampleClient_BeginUpdate() { // Enabled: to.Ptr("true"), // }}, // }, + // ResourceStopped: to.Ptr("false"), // ServerPort: to.Ptr[int32](443), // TLS: &armwebpubsub.TLSSettings{ // ClientCertEnabled: to.Ptr(true), @@ -734,18 +824,10 @@ func ExampleClient_BeginUpdate() { // Size: to.Ptr("P1"), // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), // }, - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSub_ListKeys.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_ListKeys.json func ExampleClient_ListKeys() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -767,7 +849,7 @@ func ExampleClient_ListKeys() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSub_RegenerateKey.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_RegenerateKey.json func ExampleClient_BeginRegenerateKey() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -784,13 +866,122 @@ func ExampleClient_BeginRegenerateKey() { if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + 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.Keys = armwebpubsub.Keys{ + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSub_Restart.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_ListReplicaSkus.json +func ExampleClient_ListReplicaSKUs() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewClient().ListReplicaSKUs(ctx, "myResourceGroup", "myWebPubSubService", "myWebPubSubService-eastus", 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.SKUList = armwebpubsub.SKUList{ + // Value: []*armwebpubsub.SKU{ + // { + // Capacity: &armwebpubsub.SKUCapacity{ + // Default: to.Ptr[int32](1), + // AllowedValues: []*int32{ + // to.Ptr[int32](1)}, + // Maximum: to.Ptr[int32](1), + // Minimum: to.Ptr[int32](0), + // ScaleType: to.Ptr(armwebpubsub.ScaleTypeManual), + // }, + // ResourceType: to.Ptr("Microsoft.SignalRService/WebPubSub/replicas"), + // SKU: &armwebpubsub.ResourceSKU{ + // Name: to.Ptr("Free_F1"), + // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierFree), + // }, + // }, + // { + // Capacity: &armwebpubsub.SKUCapacity{ + // Default: to.Ptr[int32](1), + // AllowedValues: []*int32{ + // to.Ptr[int32](1), + // to.Ptr[int32](2), + // to.Ptr[int32](3), + // to.Ptr[int32](4), + // to.Ptr[int32](5), + // to.Ptr[int32](6), + // to.Ptr[int32](7), + // to.Ptr[int32](8), + // to.Ptr[int32](9), + // to.Ptr[int32](10), + // to.Ptr[int32](20), + // to.Ptr[int32](30), + // to.Ptr[int32](40), + // to.Ptr[int32](50), + // to.Ptr[int32](60), + // to.Ptr[int32](70), + // to.Ptr[int32](80), + // to.Ptr[int32](90), + // to.Ptr[int32](100)}, + // Maximum: to.Ptr[int32](100), + // Minimum: to.Ptr[int32](0), + // ScaleType: to.Ptr(armwebpubsub.ScaleTypeManual), + // }, + // ResourceType: to.Ptr("Microsoft.SignalRService/WebPubSub/replicas"), + // SKU: &armwebpubsub.ResourceSKU{ + // Name: to.Ptr("Standard_S1"), + // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierStandard), + // }, + // }, + // { + // Capacity: &armwebpubsub.SKUCapacity{ + // Default: to.Ptr[int32](1), + // AllowedValues: []*int32{ + // to.Ptr[int32](1), + // to.Ptr[int32](2), + // to.Ptr[int32](3), + // to.Ptr[int32](4), + // to.Ptr[int32](5), + // to.Ptr[int32](6), + // to.Ptr[int32](7), + // to.Ptr[int32](8), + // to.Ptr[int32](9), + // to.Ptr[int32](10), + // to.Ptr[int32](20), + // to.Ptr[int32](30), + // to.Ptr[int32](40), + // to.Ptr[int32](50), + // to.Ptr[int32](60), + // to.Ptr[int32](70), + // to.Ptr[int32](80), + // to.Ptr[int32](90), + // to.Ptr[int32](100)}, + // Maximum: to.Ptr[int32](100), + // Minimum: to.Ptr[int32](0), + // ScaleType: to.Ptr(armwebpubsub.ScaleTypeAutomatic), + // }, + // ResourceType: to.Ptr("Microsoft.SignalRService/WebPubSub/replicas"), + // SKU: &armwebpubsub.ResourceSKU{ + // Name: to.Ptr("Premium_P1"), + // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierStandard), + // }, + // }}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_Restart.json func ExampleClient_BeginRestart() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -811,7 +1002,7 @@ func ExampleClient_BeginRestart() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSub_ListSkus.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_ListSkus.json func ExampleClient_ListSKUs() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -835,7 +1026,6 @@ func ExampleClient_ListSKUs() { // Capacity: &armwebpubsub.SKUCapacity{ // Default: to.Ptr[int32](1), // AllowedValues: []*int32{ - // to.Ptr[int32](0), // to.Ptr[int32](1)}, // Maximum: to.Ptr[int32](1), // Minimum: to.Ptr[int32](0), @@ -851,23 +1041,67 @@ func ExampleClient_ListSKUs() { // Capacity: &armwebpubsub.SKUCapacity{ // Default: to.Ptr[int32](1), // AllowedValues: []*int32{ - // to.Ptr[int32](0), // to.Ptr[int32](1), // to.Ptr[int32](2), + // to.Ptr[int32](3), + // to.Ptr[int32](4), // to.Ptr[int32](5), + // to.Ptr[int32](6), + // to.Ptr[int32](7), + // to.Ptr[int32](8), + // to.Ptr[int32](9), // to.Ptr[int32](10), // to.Ptr[int32](20), + // to.Ptr[int32](30), + // to.Ptr[int32](40), // to.Ptr[int32](50), + // to.Ptr[int32](60), + // to.Ptr[int32](70), + // to.Ptr[int32](80), + // to.Ptr[int32](90), // to.Ptr[int32](100)}, // Maximum: to.Ptr[int32](100), // Minimum: to.Ptr[int32](0), - // ScaleType: to.Ptr(armwebpubsub.ScaleTypeAutomatic), + // ScaleType: to.Ptr(armwebpubsub.ScaleTypeManual), // }, // ResourceType: to.Ptr("Microsoft.SignalRService/WebPubSub"), // SKU: &armwebpubsub.ResourceSKU{ // Name: to.Ptr("Standard_S1"), // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierStandard), // }, - // }}, - // } + // }, + // { + // Capacity: &armwebpubsub.SKUCapacity{ + // Default: to.Ptr[int32](1), + // AllowedValues: []*int32{ + // to.Ptr[int32](1), + // to.Ptr[int32](2), + // to.Ptr[int32](3), + // to.Ptr[int32](4), + // to.Ptr[int32](5), + // to.Ptr[int32](6), + // to.Ptr[int32](7), + // to.Ptr[int32](8), + // to.Ptr[int32](9), + // to.Ptr[int32](10), + // to.Ptr[int32](20), + // to.Ptr[int32](30), + // to.Ptr[int32](40), + // to.Ptr[int32](50), + // to.Ptr[int32](60), + // to.Ptr[int32](70), + // to.Ptr[int32](80), + // to.Ptr[int32](90), + // to.Ptr[int32](100)}, + // Maximum: to.Ptr[int32](100), + // Minimum: to.Ptr[int32](0), + // ScaleType: to.Ptr(armwebpubsub.ScaleTypeAutomatic), + // }, + // ResourceType: to.Ptr("Microsoft.SignalRService/WebPubSub/replicas"), + // SKU: &armwebpubsub.ResourceSKU{ + // Name: to.Ptr("Premium_P1"), + // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierStandard), + // }, + // }}, + // } } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/client_factory.go b/sdk/resourcemanager/webpubsub/armwebpubsub/client_factory.go index f0cedd210ec9..c4a9c7117c83 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/client_factory.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/client_factory.go @@ -23,8 +23,7 @@ type ClientFactory struct { // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. -// - subscriptionID - Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - 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) { @@ -80,6 +79,12 @@ func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesCli return subClient } +// NewReplicasClient creates a new instance of ReplicasClient. +func (c *ClientFactory) NewReplicasClient() *ReplicasClient { + subClient, _ := NewReplicasClient(c.subscriptionID, c.credential, c.options) + return subClient +} + // NewSharedPrivateLinkResourcesClient creates a new instance of SharedPrivateLinkResourcesClient. func (c *ClientFactory) NewSharedPrivateLinkResourcesClient() *SharedPrivateLinkResourcesClient { subClient, _ := NewSharedPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/constants.go b/sdk/resourcemanager/webpubsub/armwebpubsub/constants.go index b6ecba643888..2d3e2a43ec0e 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/constants.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/constants.go @@ -10,7 +10,7 @@ package armwebpubsub const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" - moduleVersion = "v1.2.0" + moduleVersion = "v1.3.0-beta.1" ) // ACLAction - Azure Networking ACL Action. @@ -180,6 +180,22 @@ func PossibleScaleTypeValues() []ScaleType { } } +// ServiceKind - The kind of the service +type ServiceKind string + +const ( + ServiceKindSocketIO ServiceKind = "SocketIO" + ServiceKindWebPubSub ServiceKind = "WebPubSub" +) + +// PossibleServiceKindValues returns the possible values for the ServiceKind const type. +func PossibleServiceKindValues() []ServiceKind { + return []ServiceKind{ + ServiceKindSocketIO, + ServiceKindWebPubSub, + } +} + // SharedPrivateLinkResourceStatus - Status of the shared private link resource type SharedPrivateLinkResourceStatus string diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client.go index f2efecb653b9..fe1954564d12 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client.go @@ -28,8 +28,7 @@ type CustomCertificatesClient struct { } // NewCustomCertificatesClient creates a new instance of CustomCertificatesClient with the specified values. -// - subscriptionID - Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewCustomCertificatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CustomCertificatesClient, error) { @@ -47,9 +46,8 @@ func NewCustomCertificatesClient(subscriptionID string, credential azcore.TokenC // BeginCreateOrUpdate - Create or update a custom certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - certificateName - Custom certificate name // - options - CustomCertificatesClientBeginCreateOrUpdateOptions contains the optional parameters for the CustomCertificatesClient.BeginCreateOrUpdate @@ -61,7 +59,8 @@ func (client *CustomCertificatesClient) BeginCreateOrUpdate(ctx context.Context, return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CustomCertificatesClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -74,7 +73,7 @@ func (client *CustomCertificatesClient) BeginCreateOrUpdate(ctx context.Context, // CreateOrUpdate - Create or update a custom certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview func (client *CustomCertificatesClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, parameters CustomCertificate, options *CustomCertificatesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "CustomCertificatesClient.BeginCreateOrUpdate" @@ -120,7 +119,7 @@ func (client *CustomCertificatesClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -132,9 +131,8 @@ func (client *CustomCertificatesClient) createOrUpdateCreateRequest(ctx context. // Delete - Delete a custom certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - certificateName - Custom certificate name // - options - CustomCertificatesClientDeleteOptions contains the optional parameters for the CustomCertificatesClient.Delete @@ -184,7 +182,7 @@ func (client *CustomCertificatesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -193,9 +191,8 @@ func (client *CustomCertificatesClient) deleteCreateRequest(ctx context.Context, // Get - Get a custom certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - certificateName - Custom certificate name // - options - CustomCertificatesClientGetOptions contains the optional parameters for the CustomCertificatesClient.Get method. @@ -245,7 +242,7 @@ func (client *CustomCertificatesClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -262,9 +259,8 @@ func (client *CustomCertificatesClient) getHandleResponse(resp *http.Response) ( // NewListPager - List all custom certificates. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - CustomCertificatesClientListOptions contains the optional parameters for the CustomCertificatesClient.NewListPager // method. @@ -311,7 +307,7 @@ func (client *CustomCertificatesClient) listCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client_example_test.go index f96c659bdd17..270fd9ed9e81 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client_example_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSubCustomCertificates_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubCustomCertificates_List.json func ExampleCustomCertificatesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -57,7 +57,7 @@ func ExampleCustomCertificatesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSubCustomCertificates_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubCustomCertificates_Get.json func ExampleCustomCertificatesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -88,7 +88,7 @@ func ExampleCustomCertificatesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSubCustomCertificates_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubCustomCertificates_CreateOrUpdate.json func ExampleCustomCertificatesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -129,7 +129,7 @@ func ExampleCustomCertificatesClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSubCustomCertificates_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubCustomCertificates_Delete.json func ExampleCustomCertificatesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client.go index 4376724f21d1..0da420194967 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client.go @@ -28,8 +28,7 @@ type CustomDomainsClient struct { } // NewCustomDomainsClient creates a new instance of CustomDomainsClient with the specified values. -// - subscriptionID - Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewCustomDomainsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CustomDomainsClient, error) { @@ -47,9 +46,8 @@ func NewCustomDomainsClient(subscriptionID string, credential azcore.TokenCreden // BeginCreateOrUpdate - Create or update a custom domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - name - Custom domain name. // - options - CustomDomainsClientBeginCreateOrUpdateOptions contains the optional parameters for the CustomDomainsClient.BeginCreateOrUpdate @@ -61,7 +59,8 @@ func (client *CustomDomainsClient) BeginCreateOrUpdate(ctx context.Context, reso return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CustomDomainsClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -74,7 +73,7 @@ func (client *CustomDomainsClient) BeginCreateOrUpdate(ctx context.Context, reso // CreateOrUpdate - Create or update a custom domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview func (client *CustomDomainsClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, name string, parameters CustomDomain, options *CustomDomainsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "CustomDomainsClient.BeginCreateOrUpdate" @@ -120,7 +119,7 @@ func (client *CustomDomainsClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -132,9 +131,8 @@ func (client *CustomDomainsClient) createOrUpdateCreateRequest(ctx context.Conte // BeginDelete - Delete a custom domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - name - Custom domain name. // - options - CustomDomainsClientBeginDeleteOptions contains the optional parameters for the CustomDomainsClient.BeginDelete @@ -160,7 +158,7 @@ func (client *CustomDomainsClient) BeginDelete(ctx context.Context, resourceGrou // Delete - Delete a custom domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview func (client *CustomDomainsClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, name string, options *CustomDomainsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CustomDomainsClient.BeginDelete" @@ -206,7 +204,7 @@ func (client *CustomDomainsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -215,9 +213,8 @@ func (client *CustomDomainsClient) deleteCreateRequest(ctx context.Context, reso // Get - Get a custom domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - name - Custom domain name. // - options - CustomDomainsClientGetOptions contains the optional parameters for the CustomDomainsClient.Get method. @@ -267,7 +264,7 @@ func (client *CustomDomainsClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -284,9 +281,8 @@ func (client *CustomDomainsClient) getHandleResponse(resp *http.Response) (Custo // NewListPager - List all custom domains. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - CustomDomainsClientListOptions contains the optional parameters for the CustomDomainsClient.NewListPager method. func (client *CustomDomainsClient) NewListPager(resourceGroupName string, resourceName string, options *CustomDomainsClientListOptions) *runtime.Pager[CustomDomainsClientListResponse] { @@ -332,7 +328,7 @@ func (client *CustomDomainsClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client_example_test.go index 4287bb9ec3b6..32106f13bb94 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client_example_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSubCustomDomains_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubCustomDomains_List.json func ExampleCustomDomainsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -57,7 +57,7 @@ func ExampleCustomDomainsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSubCustomDomains_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubCustomDomains_Get.json func ExampleCustomDomainsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -88,7 +88,7 @@ func ExampleCustomDomainsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSubCustomDomains_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubCustomDomains_CreateOrUpdate.json func ExampleCustomDomainsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -116,7 +116,7 @@ func ExampleCustomDomainsClient_BeginCreateOrUpdate() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSubCustomDomains_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubCustomDomains_Delete.json func ExampleCustomDomainsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/replicas_server.go b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/replicas_server.go new file mode 100644 index 000000000000..b84d57ddeb96 --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/replicas_server.go @@ -0,0 +1,375 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" + "net/http" + "net/url" + "regexp" +) + +// ReplicasServer is a fake server for instances of the armwebpubsub.ReplicasClient type. +type ReplicasServer struct { + // BeginCreateOrUpdate is the fake for method ReplicasClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters armwebpubsub.Replica, options *armwebpubsub.ReplicasClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armwebpubsub.ReplicasClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method ReplicasClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *armwebpubsub.ReplicasClientDeleteOptions) (resp azfake.Responder[armwebpubsub.ReplicasClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ReplicasClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *armwebpubsub.ReplicasClientGetOptions) (resp azfake.Responder[armwebpubsub.ReplicasClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method ReplicasClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, resourceName string, options *armwebpubsub.ReplicasClientListOptions) (resp azfake.PagerResponder[armwebpubsub.ReplicasClientListResponse]) + + // BeginRestart is the fake for method ReplicasClient.BeginRestart + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginRestart func(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *armwebpubsub.ReplicasClientBeginRestartOptions) (resp azfake.PollerResponder[armwebpubsub.ReplicasClientRestartResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method ReplicasClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters armwebpubsub.Replica, options *armwebpubsub.ReplicasClientBeginUpdateOptions) (resp azfake.PollerResponder[armwebpubsub.ReplicasClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewReplicasServerTransport creates a new instance of ReplicasServerTransport with the provided implementation. +// The returned ReplicasServerTransport instance is connected to an instance of armwebpubsub.ReplicasClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewReplicasServerTransport(srv *ReplicasServer) *ReplicasServerTransport { + return &ReplicasServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armwebpubsub.ReplicasClientCreateOrUpdateResponse]](), + newListPager: newTracker[azfake.PagerResponder[armwebpubsub.ReplicasClientListResponse]](), + beginRestart: newTracker[azfake.PollerResponder[armwebpubsub.ReplicasClientRestartResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armwebpubsub.ReplicasClientUpdateResponse]](), + } +} + +// ReplicasServerTransport connects instances of armwebpubsub.ReplicasClient to instances of ReplicasServer. +// Don't use this type directly, use NewReplicasServerTransport instead. +type ReplicasServerTransport struct { + srv *ReplicasServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armwebpubsub.ReplicasClientCreateOrUpdateResponse]] + newListPager *tracker[azfake.PagerResponder[armwebpubsub.ReplicasClientListResponse]] + beginRestart *tracker[azfake.PollerResponder[armwebpubsub.ReplicasClientRestartResponse]] + beginUpdate *tracker[azfake.PollerResponder[armwebpubsub.ReplicasClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for ReplicasServerTransport. +func (r *ReplicasServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ReplicasClient.BeginCreateOrUpdate": + resp, err = r.dispatchBeginCreateOrUpdate(req) + case "ReplicasClient.Delete": + resp, err = r.dispatchDelete(req) + case "ReplicasClient.Get": + resp, err = r.dispatchGet(req) + case "ReplicasClient.NewListPager": + resp, err = r.dispatchNewListPager(req) + case "ReplicasClient.BeginRestart": + resp, err = r.dispatchBeginRestart(req) + case "ReplicasClient.BeginUpdate": + resp, err = r.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (r *ReplicasServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if r.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := r.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armwebpubsub.Replica](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + replicaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("replicaName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, resourceNameParam, replicaNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + r.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + r.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + r.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (r *ReplicasServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if r.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + replicaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("replicaName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.Delete(req.Context(), resourceGroupNameParam, resourceNameParam, replicaNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (r *ReplicasServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if r.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + replicaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("replicaName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.Get(req.Context(), resourceGroupNameParam, resourceNameParam, replicaNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Replica, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (r *ReplicasServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if r.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := r.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + resp := r.srv.NewListPager(resourceGroupNameParam, resourceNameParam, nil) + newListPager = &resp + r.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armwebpubsub.ReplicasClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + r.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + r.newListPager.remove(req) + } + return resp, nil +} + +func (r *ReplicasServerTransport) dispatchBeginRestart(req *http.Request) (*http.Response, error) { + if r.srv.BeginRestart == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginRestart not implemented")} + } + beginRestart := r.beginRestart.get(req) + if beginRestart == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/restart` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + replicaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("replicaName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.BeginRestart(req.Context(), resourceGroupNameParam, resourceNameParam, replicaNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginRestart = &respr + r.beginRestart.add(req, beginRestart) + } + + resp, err := server.PollerResponderNext(beginRestart, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + r.beginRestart.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginRestart) { + r.beginRestart.remove(req) + } + + return resp, nil +} + +func (r *ReplicasServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if r.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := r.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armwebpubsub.Replica](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + replicaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("replicaName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.BeginUpdate(req.Context(), resourceGroupNameParam, resourceNameParam, replicaNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + r.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + r.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + r.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/server.go b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/server.go index 6d58ae19807c..044a35bfb09c 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/server.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/server.go @@ -52,12 +52,16 @@ type Server struct { // HTTP status codes to indicate success: http.StatusOK ListKeys func(ctx context.Context, resourceGroupName string, resourceName string, options *armwebpubsub.ClientListKeysOptions) (resp azfake.Responder[armwebpubsub.ClientListKeysResponse], errResp azfake.ErrorResponder) + // ListReplicaSKUs is the fake for method Client.ListReplicaSKUs + // HTTP status codes to indicate success: http.StatusOK + ListReplicaSKUs func(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *armwebpubsub.ClientListReplicaSKUsOptions) (resp azfake.Responder[armwebpubsub.ClientListReplicaSKUsResponse], errResp azfake.ErrorResponder) + // ListSKUs is the fake for method Client.ListSKUs // HTTP status codes to indicate success: http.StatusOK ListSKUs func(ctx context.Context, resourceGroupName string, resourceName string, options *armwebpubsub.ClientListSKUsOptions) (resp azfake.Responder[armwebpubsub.ClientListSKUsResponse], errResp azfake.ErrorResponder) // BeginRegenerateKey is the fake for method Client.BeginRegenerateKey - // HTTP status codes to indicate success: http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginRegenerateKey func(ctx context.Context, resourceGroupName string, resourceName string, parameters armwebpubsub.RegenerateKeyParameters, options *armwebpubsub.ClientBeginRegenerateKeyOptions) (resp azfake.PollerResponder[armwebpubsub.ClientRegenerateKeyResponse], errResp azfake.ErrorResponder) // BeginRestart is the fake for method Client.BeginRestart @@ -124,6 +128,8 @@ func (s *ServerTransport) Do(req *http.Request) (*http.Response, error) { resp, err = s.dispatchNewListBySubscriptionPager(req) case "Client.ListKeys": resp, err = s.dispatchListKeys(req) + case "Client.ListReplicaSKUs": + resp, err = s.dispatchListReplicaSKUs(req) case "Client.ListSKUs": resp, err = s.dispatchListSKUs(req) case "Client.BeginRegenerateKey": @@ -404,6 +410,43 @@ func (s *ServerTransport) dispatchListKeys(req *http.Request) (*http.Response, e return resp, nil } +func (s *ServerTransport) dispatchListReplicaSKUs(req *http.Request) (*http.Response, error) { + if s.srv.ListReplicaSKUs == nil { + return nil, &nonRetriableError{errors.New("fake for method ListReplicaSKUs not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/skus` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + replicaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("replicaName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.ListReplicaSKUs(req.Context(), resourceGroupNameParam, resourceNameParam, replicaNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SKUList, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (s *ServerTransport) dispatchListSKUs(req *http.Request) (*http.Response, error) { if s.srv.ListSKUs == nil { return nil, &nonRetriableError{errors.New("fake for method ListSKUs not implemented")} @@ -474,9 +517,9 @@ func (s *ServerTransport) dispatchBeginRegenerateKey(req *http.Request) (*http.R return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { s.beginRegenerateKey.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } if !server.PollerResponderMore(beginRegenerateKey) { s.beginRegenerateKey.remove(req) diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/server_factory.go b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/server_factory.go index 90c8688538b1..a4d983504f7d 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/server_factory.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/server_factory.go @@ -26,6 +26,7 @@ type ServerFactory struct { OperationsServer OperationsServer PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer PrivateLinkResourcesServer PrivateLinkResourcesServer + ReplicasServer ReplicasServer SharedPrivateLinkResourcesServer SharedPrivateLinkResourcesServer UsagesServer UsagesServer } @@ -51,6 +52,7 @@ type ServerFactoryTransport struct { trOperationsServer *OperationsServerTransport trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport trPrivateLinkResourcesServer *PrivateLinkResourcesServerTransport + trReplicasServer *ReplicasServerTransport trSharedPrivateLinkResourcesServer *SharedPrivateLinkResourcesServerTransport trUsagesServer *UsagesServerTransport } @@ -97,6 +99,9 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewPrivateLinkResourcesServerTransport(&s.srv.PrivateLinkResourcesServer) }) resp, err = s.trPrivateLinkResourcesServer.Do(req) + case "ReplicasClient": + initServer(s, &s.trReplicasServer, func() *ReplicasServerTransport { return NewReplicasServerTransport(&s.srv.ReplicasServer) }) + resp, err = s.trReplicasServer.Do(req) case "SharedPrivateLinkResourcesClient": initServer(s, &s.trSharedPrivateLinkResourcesServer, func() *SharedPrivateLinkResourcesServerTransport { return NewSharedPrivateLinkResourcesServerTransport(&s.srv.SharedPrivateLinkResourcesServer) diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client.go index aedb149ebd4c..cc0d32e15bee 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client.go @@ -28,8 +28,7 @@ type HubsClient struct { } // NewHubsClient creates a new instance of HubsClient with the specified values. -// - subscriptionID - Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewHubsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HubsClient, error) { @@ -47,10 +46,9 @@ func NewHubsClient(subscriptionID string, credential azcore.TokenCredential, opt // BeginCreateOrUpdate - Create or update a hub setting. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview // - hubName - The hub name. -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - parameters - The resource of WebPubSubHub and its properties // - options - HubsClientBeginCreateOrUpdateOptions contains the optional parameters for the HubsClient.BeginCreateOrUpdate @@ -62,7 +60,8 @@ func (client *HubsClient) BeginCreateOrUpdate(ctx context.Context, hubName strin return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HubsClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -75,7 +74,7 @@ func (client *HubsClient) BeginCreateOrUpdate(ctx context.Context, hubName strin // CreateOrUpdate - Create or update a hub setting. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview func (client *HubsClient) createOrUpdate(ctx context.Context, hubName string, resourceGroupName string, resourceName string, parameters Hub, options *HubsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "HubsClient.BeginCreateOrUpdate" @@ -121,7 +120,7 @@ func (client *HubsClient) createOrUpdateCreateRequest(ctx context.Context, hubNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -133,10 +132,9 @@ func (client *HubsClient) createOrUpdateCreateRequest(ctx context.Context, hubNa // BeginDelete - Delete a hub setting. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview // - hubName - The hub name. -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - HubsClientBeginDeleteOptions contains the optional parameters for the HubsClient.BeginDelete method. func (client *HubsClient) BeginDelete(ctx context.Context, hubName string, resourceGroupName string, resourceName string, options *HubsClientBeginDeleteOptions) (*runtime.Poller[HubsClientDeleteResponse], error) { @@ -160,7 +158,7 @@ func (client *HubsClient) BeginDelete(ctx context.Context, hubName string, resou // Delete - Delete a hub setting. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview func (client *HubsClient) deleteOperation(ctx context.Context, hubName string, resourceGroupName string, resourceName string, options *HubsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "HubsClient.BeginDelete" @@ -206,7 +204,7 @@ func (client *HubsClient) deleteCreateRequest(ctx context.Context, hubName strin return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -215,10 +213,9 @@ func (client *HubsClient) deleteCreateRequest(ctx context.Context, hubName strin // Get - Get a hub setting. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview // - hubName - The hub name. -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - HubsClientGetOptions contains the optional parameters for the HubsClient.Get method. func (client *HubsClient) Get(ctx context.Context, hubName string, resourceGroupName string, resourceName string, options *HubsClientGetOptions) (HubsClientGetResponse, error) { @@ -267,7 +264,7 @@ func (client *HubsClient) getCreateRequest(ctx context.Context, hubName string, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -284,9 +281,8 @@ func (client *HubsClient) getHandleResponse(resp *http.Response) (HubsClientGetR // NewListPager - List hub settings. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - HubsClientListOptions contains the optional parameters for the HubsClient.NewListPager method. func (client *HubsClient) NewListPager(resourceGroupName string, resourceName string, options *HubsClientListOptions) *runtime.Pager[HubsClientListResponse] { @@ -332,7 +328,7 @@ func (client *HubsClient) listCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client_example_test.go index db142b617b0a..40cd291ecd4a 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client_example_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSubHubs_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubHubs_List.json func ExampleHubsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -83,7 +83,7 @@ func ExampleHubsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSubHubs_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubHubs_Get.json func ExampleHubsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -140,7 +140,7 @@ func ExampleHubsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSubHubs_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubHubs_CreateOrUpdate.json func ExampleHubsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -234,7 +234,7 @@ func ExampleHubsClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSubHubs_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubHubs_Delete.json func ExampleHubsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/models.go b/sdk/resourcemanager/webpubsub/armwebpubsub/models.go index d8721e0cf18f..ba4a5ea91789 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/models.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/models.go @@ -15,16 +15,16 @@ type CustomCertificate struct { // REQUIRED; Custom certificate properties. Properties *CustomCertificateProperties - // READ-ONLY; Fully qualified resource Id for the resource. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; The name of the resource. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -57,16 +57,16 @@ type CustomDomain struct { // REQUIRED; Properties of a custom domain. Properties *CustomDomainProperties - // READ-ONLY; Fully qualified resource Id for the resource. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; The name of the resource. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -199,16 +199,16 @@ type Hub struct { // REQUIRED; Properties of a hub. Properties *HubProperties - // READ-ONLY; Fully qualified resource Id for the resource. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; The name of the resource. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -238,6 +238,15 @@ type HubProperties struct { EventListeners []*EventListener } +// IPRule - An IP rule +type IPRule struct { + // Azure Networking ACL Action. + Action *ACLAction + + // An IP or CIDR or ServiceTag + Value *string +} + // Keys - A class represents the access keys of the resource. type Keys struct { // Connection string constructed via the primaryKey @@ -351,7 +360,8 @@ type NameAvailabilityParameters struct { // REQUIRED; The resource name to validate. e.g."my-resource-name" Name *string - // REQUIRED; The resource type. Can be "Microsoft.SignalRService/SignalR" or "Microsoft.SignalRService/webPubSub" + // REQUIRED; The resource type. Can be "Microsoft.SignalRService/SignalR", "Microsoft.SignalRService/WebPubSub", "Microsoft.SignalRService/SignalR/replicas" + // or "Microsoft.SignalRService/WebPubSub/replicas" Type *string } @@ -369,6 +379,9 @@ type NetworkACLs struct { // Azure Networking ACL Action. DefaultAction *ACLAction + // IP rules for filtering public traffic + IPRules []*IPRule + // ACLs for requests from private endpoints PrivateEndpoints []*PrivateEndpointACL @@ -448,16 +461,16 @@ type PrivateEndpointConnection struct { // Private endpoint connection properties Properties *PrivateEndpointConnectionProperties - // READ-ONLY; Fully qualified resource Id for the resource. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; The name of the resource. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -491,13 +504,16 @@ type PrivateLinkResource struct { // Private link resource properties Properties *PrivateLinkResourceProperties - // READ-ONLY; Fully qualified resource Id for the resource. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; The name of the resource. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -556,9 +572,18 @@ type Properties struct { // network ACLs. PublicNetworkAccess *string + // Enable or disable the regional endpoint. Default to "Enabled". When it's Disabled, new connections will not be routed to + // this endpoint, however existing connections will not be affected. This property + // is replica specific. Disable the regional endpoint without replica is not allowed. + RegionEndpointEnabled *string + // Resource log configuration of a Microsoft.SignalRService resource. ResourceLogConfiguration *ResourceLogConfiguration + // Stop or start the resource. Default to "false". When it's true, the data plane of the resource is shutdown. When it's false, + // the data plane of the resource is started. + ResourceStopped *string + // TLS settings for the resource TLS *TLSSettings @@ -596,13 +621,62 @@ type RegenerateKeyParameters struct { KeyType *KeyType } +// Replica - A class represent a replica resource. +type Replica struct { + // REQUIRED; The geo-location where the resource lives + Location *string + Properties *ReplicaProperties + + // The billing information of the resource. + SKU *ResourceSKU + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +type ReplicaList struct { + // The URL the client should use to fetch the next page (per server side paging). It's null for now, added for future use. + NextLink *string + + // List of the replica + Value []*Replica +} + +type ReplicaProperties struct { + // Enable or disable the regional endpoint. Default to "Enabled". When it's Disabled, new connections will not be routed to + // this endpoint, however existing connections will not be affected. + RegionEndpointEnabled *string + + // Stop or start the resource. Default to "false". When it's true, the data plane of the resource is shutdown. When it's false, + // the data plane of the resource is started. + ResourceStopped *string + + // READ-ONLY; Provisioning state of the resource. + ProvisioningState *ProvisioningState +} + // ResourceInfo - A class represent a resource. type ResourceInfo struct { + // REQUIRED; The geo-location where the resource lives + Location *string + // A class represent managed identities used for request and response Identity *ManagedIdentity - // The GEO location of the resource. e.g. West US | East US | North Central US | South Central US. - Location *string + // The kind of the service + Kind *ServiceKind // A class that describes the properties of the resource Properties *Properties @@ -610,19 +684,19 @@ type ResourceInfo struct { // The billing information of the resource. SKU *ResourceSKU - // Tags of the service which is a list of key value pairs that describe the resource. + // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource Id for the resource. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; The name of the resource. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -754,16 +828,16 @@ type SharedPrivateLinkResource struct { // Describes the properties of an existing Shared Private Link Resource Properties *SharedPrivateLinkResourceProperties - // READ-ONLY; Fully qualified resource Id for the resource. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; The name of the resource. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -854,7 +928,8 @@ type SystemData struct { // TLSSettings - TLS settings for the resource type TLSSettings struct { - // Request client certificate during TLS handshake if enabled + // Request client certificate during TLS handshake if enabled. Not supported for free tier. Any input will be ignored for + // free tier. ClientCertEnabled *bool } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/models_serde.go b/sdk/resourcemanager/webpubsub/armwebpubsub/models_serde.go index a1293468e910..d84b2b6b6d10 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/models_serde.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/models_serde.go @@ -579,6 +579,37 @@ func (h *HubProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type IPRule. +func (i IPRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "action", i.Action) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPRule. +func (i *IPRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &i.Action) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Keys. func (k Keys) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -933,6 +964,7 @@ func (n *NetworkACL) UnmarshalJSON(data []byte) error { func (n NetworkACLs) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "defaultAction", n.DefaultAction) + populate(objectMap, "ipRules", n.IPRules) populate(objectMap, "privateEndpoints", n.PrivateEndpoints) populate(objectMap, "publicNetwork", n.PublicNetwork) return json.Marshal(objectMap) @@ -950,6 +982,9 @@ func (n *NetworkACLs) UnmarshalJSON(data []byte) error { case "defaultAction": err = unpopulate(val, "DefaultAction", &n.DefaultAction) delete(rawMsg, key) + case "ipRules": + err = unpopulate(val, "IPRules", &n.IPRules) + delete(rawMsg, key) case "privateEndpoints": err = unpopulate(val, "PrivateEndpoints", &n.PrivateEndpoints) delete(rawMsg, key) @@ -1285,6 +1320,7 @@ func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } @@ -1307,6 +1343,9 @@ func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) @@ -1437,7 +1476,9 @@ func (p Properties) MarshalJSON() ([]byte, error) { populate(objectMap, "provisioningState", p.ProvisioningState) populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) populate(objectMap, "publicPort", p.PublicPort) + populate(objectMap, "regionEndpointEnabled", p.RegionEndpointEnabled) populate(objectMap, "resourceLogConfiguration", p.ResourceLogConfiguration) + populate(objectMap, "resourceStopped", p.ResourceStopped) populate(objectMap, "serverPort", p.ServerPort) populate(objectMap, "sharedPrivateLinkResources", p.SharedPrivateLinkResources) populate(objectMap, "tls", p.TLS) @@ -1487,9 +1528,15 @@ func (p *Properties) UnmarshalJSON(data []byte) error { case "publicPort": err = unpopulate(val, "PublicPort", &p.PublicPort) delete(rawMsg, key) + case "regionEndpointEnabled": + err = unpopulate(val, "RegionEndpointEnabled", &p.RegionEndpointEnabled) + delete(rawMsg, key) case "resourceLogConfiguration": err = unpopulate(val, "ResourceLogConfiguration", &p.ResourceLogConfiguration) delete(rawMsg, key) + case "resourceStopped": + err = unpopulate(val, "ResourceStopped", &p.ResourceStopped) + delete(rawMsg, key) case "serverPort": err = unpopulate(val, "ServerPort", &p.ServerPort) delete(rawMsg, key) @@ -1537,11 +1584,133 @@ func (r *RegenerateKeyParameters) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Replica. +func (r Replica) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "sku", r.SKU) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Replica. +func (r *Replica) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &r.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReplicaList. +func (r ReplicaList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicaList. +func (r *ReplicaList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReplicaProperties. +func (r ReplicaProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "regionEndpointEnabled", r.RegionEndpointEnabled) + populate(objectMap, "resourceStopped", r.ResourceStopped) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicaProperties. +func (r *ReplicaProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "regionEndpointEnabled": + err = unpopulate(val, "RegionEndpointEnabled", &r.RegionEndpointEnabled) + delete(rawMsg, key) + case "resourceStopped": + err = unpopulate(val, "ResourceStopped", &r.ResourceStopped) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ResourceInfo. func (r ResourceInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "identity", r.Identity) + populate(objectMap, "kind", r.Kind) populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) populate(objectMap, "properties", r.Properties) @@ -1567,6 +1736,9 @@ func (r *ResourceInfo) UnmarshalJSON(data []byte) error { case "identity": err = unpopulate(val, "Identity", &r.Identity) delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &r.Kind) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &r.Location) delete(rawMsg, key) diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client.go index 4ee0b6caa040..acf165c13863 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available REST API operations of the Microsoft.SignalRService provider. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-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", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client_example_test.go index 6bc26a3e64b6..b854869dfded 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client_example_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/Operations_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/Operations_List.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/options.go b/sdk/resourcemanager/webpubsub/armwebpubsub/options.go index db6d57a9d757..e789b76f6b82 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/options.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/options.go @@ -63,6 +63,11 @@ type ClientListKeysOptions struct { // placeholder for future optional parameters } +// ClientListReplicaSKUsOptions contains the optional parameters for the Client.ListReplicaSKUs method. +type ClientListReplicaSKUsOptions struct { + // placeholder for future optional parameters +} + // ClientListSKUsOptions contains the optional parameters for the Client.ListSKUs method. type ClientListSKUsOptions struct { // placeholder for future optional parameters @@ -171,6 +176,39 @@ type PrivateLinkResourcesClientListOptions struct { // placeholder for future optional parameters } +// ReplicasClientBeginCreateOrUpdateOptions contains the optional parameters for the ReplicasClient.BeginCreateOrUpdate method. +type ReplicasClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ReplicasClientBeginRestartOptions contains the optional parameters for the ReplicasClient.BeginRestart method. +type ReplicasClientBeginRestartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ReplicasClientBeginUpdateOptions contains the optional parameters for the ReplicasClient.BeginUpdate method. +type ReplicasClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ReplicasClientDeleteOptions contains the optional parameters for the ReplicasClient.Delete method. +type ReplicasClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ReplicasClientGetOptions contains the optional parameters for the ReplicasClient.Get method. +type ReplicasClientGetOptions struct { + // placeholder for future optional parameters +} + +// ReplicasClientListOptions contains the optional parameters for the ReplicasClient.NewListPager method. +type ReplicasClientListOptions struct { + // placeholder for future optional parameters +} + // SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginCreateOrUpdate // method. type SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions struct { diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client.go index 5180d8392a76..60bfa08fa12d 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client.go @@ -28,8 +28,7 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -// - subscriptionID - Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { @@ -47,10 +46,9 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginDelete - Delete the specified private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - privateEndpointConnectionName - The name of the private endpoint connection -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete // method. @@ -75,7 +73,7 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Delete the specified private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginDelete" @@ -121,7 +119,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -130,10 +128,9 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Get the specified private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - privateEndpointConnectionName - The name of the private endpoint connection -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get // method. @@ -183,7 +180,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -200,9 +197,8 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListPager - List private endpoint connections // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager // method. @@ -249,7 +245,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,10 +263,9 @@ func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Re // Update - Update the state of specified private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 -// - privateEndpointConnectionName - The name of the private endpoint connection -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - parameters - The resource of private endpoint and its properties // - options - PrivateEndpointConnectionsClientUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Update @@ -321,7 +316,7 @@ func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-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/webpubsub/armwebpubsub/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client_example_test.go index aaf02946e814..d3d6876bb40d 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client_example_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSubPrivateEndpointConnections_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubPrivateEndpointConnections_List.json func ExamplePrivateEndpointConnectionsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -46,6 +46,14 @@ func ExamplePrivateEndpointConnectionsClient_NewListPager() { // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, // Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ // GroupIDs: []*string{ // to.Ptr("webpubsub")}, @@ -58,20 +66,12 @@ func ExamplePrivateEndpointConnectionsClient_NewListPager() { // }, // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), // }, - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, // }}, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSubPrivateEndpointConnections_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubPrivateEndpointConnections_Get.json func ExamplePrivateEndpointConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -93,6 +93,14 @@ func ExamplePrivateEndpointConnectionsClient_Get() { // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, // Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ // GroupIDs: []*string{ // to.Ptr("webpubsub")}, @@ -105,18 +113,10 @@ func ExamplePrivateEndpointConnectionsClient_Get() { // }, // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), // }, - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSubPrivateEndpointConnections_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubPrivateEndpointConnections_Update.json func ExamplePrivateEndpointConnectionsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -129,9 +129,7 @@ func ExamplePrivateEndpointConnectionsClient_Update() { } res, err := clientFactory.NewPrivateEndpointConnectionsClient().Update(ctx, "mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e", "myResourceGroup", "myWebPubSubService", armwebpubsub.PrivateEndpointConnection{ Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ - PrivateEndpoint: &armwebpubsub.PrivateEndpoint{ - ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - }, + PrivateEndpoint: &armwebpubsub.PrivateEndpoint{}, PrivateLinkServiceConnectionState: &armwebpubsub.PrivateLinkServiceConnectionState{ ActionsRequired: to.Ptr("None"), Status: to.Ptr(armwebpubsub.PrivateLinkServiceConnectionStatusApproved), @@ -148,6 +146,14 @@ func ExamplePrivateEndpointConnectionsClient_Update() { // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, // Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ // GroupIDs: []*string{ // to.Ptr("webpubsub")}, @@ -160,18 +166,10 @@ func ExamplePrivateEndpointConnectionsClient_Update() { // }, // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), // }, - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSubPrivateEndpointConnections_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubPrivateEndpointConnections_Delete.json func ExamplePrivateEndpointConnectionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client.go index e7735bd7ce9f..edd567bb495c 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client.go @@ -28,8 +28,7 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -// - subscriptionID - Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { @@ -46,9 +45,8 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // NewListPager - Get the private link resources that need to be created for a resource. // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListPager // method. @@ -95,7 +93,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client_example_test.go index f65a3c71ca78..e90fbab0b076 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client_example_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSubPrivateLinkResources_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubPrivateLinkResources_List.json func ExamplePrivateLinkResourcesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -59,6 +59,22 @@ func ExamplePrivateLinkResourcesClient_NewListPager() { // Description: to.Ptr("Azure App Service can be used as an upstream"), // GroupID: to.Ptr("sites"), // }, + // }, + // { + // Name: to.Ptr("vault"), + // Properties: &armwebpubsub.ShareablePrivateLinkResourceProperties{ + // Type: to.Ptr("Microsoft.KeyVault/vaults"), + // Description: to.Ptr("Azure Key Vault can be used as credentials store"), + // GroupID: to.Ptr("vault"), + // }, + // }, + // { + // Name: to.Ptr("table"), + // Properties: &armwebpubsub.ShareablePrivateLinkResourceProperties{ + // Type: to.Ptr("Microsoft.Storage/storageAccounts"), + // Description: to.Ptr("Azure Storage Table can be used as message store"), + // GroupID: to.Ptr("table"), + // }, // }}, // }, // }}, diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client.go new file mode 100644 index 000000000000..814fc9094237 --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client.go @@ -0,0 +1,488 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armwebpubsub + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ReplicasClient contains the methods for the WebPubSubReplicas group. +// Don't use this type directly, use NewReplicasClient() instead. +type ReplicasClient struct { + internal *arm.Client + subscriptionID string +} + +// NewReplicasClient creates a new instance of ReplicasClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicasClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicasClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ReplicasClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update a replica. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - replicaName - The name of the replica. +// - parameters - Parameters for the create or update operation +// - options - ReplicasClientBeginCreateOrUpdateOptions contains the optional parameters for the ReplicasClient.BeginCreateOrUpdate +// method. +func (client *ReplicasClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, options *ReplicasClientBeginCreateOrUpdateOptions) (*runtime.Poller[ReplicasClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, replicaName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicasClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ReplicasClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create or update a replica. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-01-preview +func (client *ReplicasClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, options *ReplicasClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ReplicasClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, replicaName, 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.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ReplicasClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, options *ReplicasClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if replicaName == "" { + return nil, errors.New("parameter replicaName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicaName}", url.PathEscape(replicaName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-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 +} + +// Delete - Operation to delete a replica. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - replicaName - The name of the replica. +// - options - ReplicasClientDeleteOptions contains the optional parameters for the ReplicasClient.Delete method. +func (client *ReplicasClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientDeleteOptions) (ReplicasClientDeleteResponse, error) { + var err error + const operationName = "ReplicasClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, replicaName, options) + if err != nil { + return ReplicasClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ReplicasClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ReplicasClientDeleteResponse{}, err + } + return ReplicasClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ReplicasClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if replicaName == "" { + return nil, errors.New("parameter replicaName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicaName}", url.PathEscape(replicaName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the replica and its properties. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - replicaName - The name of the replica. +// - options - ReplicasClientGetOptions contains the optional parameters for the ReplicasClient.Get method. +func (client *ReplicasClient) Get(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientGetOptions) (ReplicasClientGetResponse, error) { + var err error + const operationName = "ReplicasClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, replicaName, options) + if err != nil { + return ReplicasClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ReplicasClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ReplicasClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ReplicasClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if replicaName == "" { + return nil, errors.New("parameter replicaName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicaName}", url.PathEscape(replicaName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ReplicasClient) getHandleResponse(resp *http.Response) (ReplicasClientGetResponse, error) { + result := ReplicasClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Replica); err != nil { + return ReplicasClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all replicas belong to this resource +// +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - options - ReplicasClientListOptions contains the optional parameters for the ReplicasClient.NewListPager method. +func (client *ReplicasClient) NewListPager(resourceGroupName string, resourceName string, options *ReplicasClientListOptions) *runtime.Pager[ReplicasClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ReplicasClientListResponse]{ + More: func(page ReplicasClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ReplicasClientListResponse) (ReplicasClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ReplicasClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, resourceName, options) + }, nil) + if err != nil { + return ReplicasClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ReplicasClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ReplicasClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ReplicasClient) listHandleResponse(resp *http.Response) (ReplicasClientListResponse, error) { + result := ReplicasClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ReplicaList); err != nil { + return ReplicasClientListResponse{}, err + } + return result, nil +} + +// BeginRestart - Operation to restart a replica. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - replicaName - The name of the replica. +// - options - ReplicasClientBeginRestartOptions contains the optional parameters for the ReplicasClient.BeginRestart method. +func (client *ReplicasClient) BeginRestart(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientBeginRestartOptions) (*runtime.Poller[ReplicasClientRestartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.restart(ctx, resourceGroupName, resourceName, replicaName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicasClientRestartResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ReplicasClientRestartResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Restart - Operation to restart a replica. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-01-preview +func (client *ReplicasClient) restart(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientBeginRestartOptions) (*http.Response, error) { + var err error + const operationName = "ReplicasClient.BeginRestart" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.restartCreateRequest(ctx, resourceGroupName, resourceName, replicaName, 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, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// restartCreateRequest creates the Restart request. +func (client *ReplicasClient) restartCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientBeginRestartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}/restart" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if replicaName == "" { + return nil, errors.New("parameter replicaName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicaName}", url.PathEscape(replicaName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginUpdate - Operation to update an exiting replica. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - replicaName - The name of the replica. +// - parameters - Parameters for the update operation +// - options - ReplicasClientBeginUpdateOptions contains the optional parameters for the ReplicasClient.BeginUpdate method. +func (client *ReplicasClient) BeginUpdate(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, options *ReplicasClientBeginUpdateOptions) (*runtime.Poller[ReplicasClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, resourceName, replicaName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicasClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ReplicasClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Operation to update an exiting replica. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-01-preview +func (client *ReplicasClient) update(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, options *ReplicasClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ReplicasClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, replicaName, 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.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *ReplicasClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, options *ReplicasClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if replicaName == "" { + return nil, errors.New("parameter replicaName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicaName}", url.PathEscape(replicaName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-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 +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client_example_test.go new file mode 100644 index 000000000000..946baebb13bd --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client_example_test.go @@ -0,0 +1,291 @@ +//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 armwebpubsub_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/webpubsub/armwebpubsub" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubReplicas_List.json +func ExampleReplicasClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewReplicasClient().NewListPager("myResourceGroup", "myWebPubSubService", 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.ReplicaList = armwebpubsub.ReplicaList{ + // Value: []*armwebpubsub.Replica{ + // { + // Name: to.Ptr("myWebPubSubService-eastus"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/replicas/myWebPubSubService-eastus"), + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // }, + // Properties: &armwebpubsub.ReplicaProperties{ + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // RegionEndpointEnabled: to.Ptr("Enabled"), + // ResourceStopped: to.Ptr("false"), + // }, + // SKU: &armwebpubsub.ResourceSKU{ + // Name: to.Ptr("Premium_P1"), + // Capacity: to.Ptr[int32](1), + // Size: to.Ptr("P1"), + // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubReplicas_Get.json +func ExampleReplicasClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewReplicasClient().Get(ctx, "myResourceGroup", "myWebPubSubService", "myWebPubSubService-eastus", 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.Replica = armwebpubsub.Replica{ + // Name: to.Ptr("myWebPubSubService-eastus"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/replicas/myWebPubSubService-eastus"), + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // }, + // Properties: &armwebpubsub.ReplicaProperties{ + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // RegionEndpointEnabled: to.Ptr("Enabled"), + // ResourceStopped: to.Ptr("false"), + // }, + // SKU: &armwebpubsub.ResourceSKU{ + // Name: to.Ptr("Premium_P1"), + // Capacity: to.Ptr[int32](1), + // Size: to.Ptr("P1"), + // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubReplicas_CreateOrUpdate.json +func ExampleReplicasClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewReplicasClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myWebPubSubService", "myWebPubSubService-eastus", armwebpubsub.Replica{ + Location: to.Ptr("eastus"), + Tags: map[string]*string{ + "key1": to.Ptr("value1"), + }, + Properties: &armwebpubsub.ReplicaProperties{ + ResourceStopped: to.Ptr("false"), + }, + SKU: &armwebpubsub.ResourceSKU{ + Name: to.Ptr("Premium_P1"), + Capacity: to.Ptr[int32](1), + Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), + }, + }, 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.Replica = armwebpubsub.Replica{ + // Name: to.Ptr("myWebPubSubService-eastus"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/replicas/myWebPubSubService-eastus"), + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // }, + // Properties: &armwebpubsub.ReplicaProperties{ + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // RegionEndpointEnabled: to.Ptr("Enabled"), + // ResourceStopped: to.Ptr("false"), + // }, + // SKU: &armwebpubsub.ResourceSKU{ + // Name: to.Ptr("Premium_P1"), + // Capacity: to.Ptr[int32](1), + // Size: to.Ptr("P1"), + // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubReplicas_Delete.json +func ExampleReplicasClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewReplicasClient().Delete(ctx, "myResourceGroup", "myWebPubSubService", "myWebPubSubService-eastus", 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubReplicas_Update.json +func ExampleReplicasClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewReplicasClient().BeginUpdate(ctx, "myResourceGroup", "myWebPubSubService", "myWebPubSubService-eastus", armwebpubsub.Replica{ + Location: to.Ptr("eastus"), + Tags: map[string]*string{ + "key1": to.Ptr("value1"), + }, + Properties: &armwebpubsub.ReplicaProperties{ + ResourceStopped: to.Ptr("false"), + }, + SKU: &armwebpubsub.ResourceSKU{ + Name: to.Ptr("Premium_P1"), + Capacity: to.Ptr[int32](1), + Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), + }, + }, 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.Replica = armwebpubsub.Replica{ + // Name: to.Ptr("myWebPubSubService-eastus"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/replicas/myWebPubSubService-eastus"), + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // }, + // Properties: &armwebpubsub.ReplicaProperties{ + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // RegionEndpointEnabled: to.Ptr("Enabled"), + // ResourceStopped: to.Ptr("false"), + // }, + // SKU: &armwebpubsub.ResourceSKU{ + // Name: to.Ptr("Premium_P1"), + // Capacity: to.Ptr[int32](1), + // Size: to.Ptr("P1"), + // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubReplicas_Restart.json +func ExampleReplicasClient_BeginRestart() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewReplicasClient().BeginRestart(ctx, "myResourceGroup", "myWebPubSubService", "myWebPubSubService-eastus", 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/webpubsub/armwebpubsub/response_types.go b/sdk/resourcemanager/webpubsub/armwebpubsub/response_types.go index a030eb0c8f5c..349cd83b310b 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/response_types.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/response_types.go @@ -49,6 +49,12 @@ type ClientListKeysResponse struct { Keys } +// ClientListReplicaSKUsResponse contains the response from method Client.ListReplicaSKUs. +type ClientListReplicaSKUsResponse struct { + // The list skus operation response + SKUList +} + // ClientListSKUsResponse contains the response from method Client.ListSKUs. type ClientListSKUsResponse struct { // The list skus operation response @@ -176,6 +182,39 @@ type PrivateLinkResourcesClientListResponse struct { PrivateLinkResourceList } +// ReplicasClientCreateOrUpdateResponse contains the response from method ReplicasClient.BeginCreateOrUpdate. +type ReplicasClientCreateOrUpdateResponse struct { + // A class represent a replica resource. + Replica +} + +// ReplicasClientDeleteResponse contains the response from method ReplicasClient.Delete. +type ReplicasClientDeleteResponse struct { + // placeholder for future response values +} + +// ReplicasClientGetResponse contains the response from method ReplicasClient.Get. +type ReplicasClientGetResponse struct { + // A class represent a replica resource. + Replica +} + +// ReplicasClientListResponse contains the response from method ReplicasClient.NewListPager. +type ReplicasClientListResponse struct { + ReplicaList +} + +// ReplicasClientRestartResponse contains the response from method ReplicasClient.BeginRestart. +type ReplicasClientRestartResponse struct { + // placeholder for future response values +} + +// ReplicasClientUpdateResponse contains the response from method ReplicasClient.BeginUpdate. +type ReplicasClientUpdateResponse struct { + // A class represent a replica resource. + Replica +} + // SharedPrivateLinkResourcesClientCreateOrUpdateResponse contains the response from method SharedPrivateLinkResourcesClient.BeginCreateOrUpdate. type SharedPrivateLinkResourcesClientCreateOrUpdateResponse struct { // Describes a Shared Private Link Resource diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client.go index 9ceeafbefc8f..b0bdf2eefe0a 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client.go @@ -28,8 +28,7 @@ type SharedPrivateLinkResourcesClient struct { } // NewSharedPrivateLinkResourcesClient creates a new instance of SharedPrivateLinkResourcesClient with the specified values. -// - subscriptionID - Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewSharedPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SharedPrivateLinkResourcesClient, error) { @@ -47,10 +46,9 @@ func NewSharedPrivateLinkResourcesClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Create or update a shared private link resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview // - sharedPrivateLinkResourceName - The name of the shared private link resource -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - parameters - The shared private link resource // - options - SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginCreateOrUpdate @@ -62,7 +60,8 @@ func (client *SharedPrivateLinkResourcesClient) BeginCreateOrUpdate(ctx context. return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SharedPrivateLinkResourcesClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -75,7 +74,7 @@ func (client *SharedPrivateLinkResourcesClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Create or update a shared private link resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview func (client *SharedPrivateLinkResourcesClient) createOrUpdate(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, parameters SharedPrivateLinkResource, options *SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "SharedPrivateLinkResourcesClient.BeginCreateOrUpdate" @@ -121,7 +120,7 @@ func (client *SharedPrivateLinkResourcesClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -133,10 +132,9 @@ func (client *SharedPrivateLinkResourcesClient) createOrUpdateCreateRequest(ctx // BeginDelete - Delete the specified shared private link resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview // - sharedPrivateLinkResourceName - The name of the shared private link resource -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - SharedPrivateLinkResourcesClientBeginDeleteOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginDelete // method. @@ -161,7 +159,7 @@ func (client *SharedPrivateLinkResourcesClient) BeginDelete(ctx context.Context, // Delete - Delete the specified shared private link resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview func (client *SharedPrivateLinkResourcesClient) deleteOperation(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *SharedPrivateLinkResourcesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "SharedPrivateLinkResourcesClient.BeginDelete" @@ -207,7 +205,7 @@ func (client *SharedPrivateLinkResourcesClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -216,10 +214,9 @@ func (client *SharedPrivateLinkResourcesClient) deleteCreateRequest(ctx context. // Get - Get the specified shared private link resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview // - sharedPrivateLinkResourceName - The name of the shared private link resource -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - SharedPrivateLinkResourcesClientGetOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.Get // method. @@ -269,7 +266,7 @@ func (client *SharedPrivateLinkResourcesClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -286,9 +283,8 @@ func (client *SharedPrivateLinkResourcesClient) getHandleResponse(resp *http.Res // NewListPager - List shared private link resources // -// Generated from API version 2023-02-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. +// Generated from API version 2023-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - SharedPrivateLinkResourcesClientListOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.NewListPager // method. @@ -335,7 +331,7 @@ func (client *SharedPrivateLinkResourcesClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client_example_test.go index 27fd50f69825..971feb70880b 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client_example_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSubSharedPrivateLinkResources_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubSharedPrivateLinkResources_List.json func ExampleSharedPrivateLinkResourcesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -58,7 +58,7 @@ func ExampleSharedPrivateLinkResourcesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSubSharedPrivateLinkResources_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubSharedPrivateLinkResources_Get.json func ExampleSharedPrivateLinkResourcesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -90,7 +90,7 @@ func ExampleSharedPrivateLinkResourcesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSubSharedPrivateLinkResources_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubSharedPrivateLinkResources_CreateOrUpdate.json func ExampleSharedPrivateLinkResourcesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -132,7 +132,7 @@ func ExampleSharedPrivateLinkResourcesClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/WebPubSubSharedPrivateLinkResources_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubSharedPrivateLinkResources_Delete.json func ExampleSharedPrivateLinkResourcesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client.go index 1bcaa1de4aaf..be44390702f8 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client.go @@ -28,8 +28,7 @@ type UsagesClient struct { } // NewUsagesClient creates a new instance of UsagesClient with the specified values. -// - subscriptionID - Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UsagesClient, error) { @@ -46,7 +45,7 @@ func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, o // NewListPager - List resource usage quotas by location. // -// Generated from API version 2023-02-01 +// Generated from API version 2023-08-01-preview // - location - the location like "eastus" // - options - UsagesClientListOptions contains the optional parameters for the UsagesClient.NewListPager method. func (client *UsagesClient) NewListPager(location string, options *UsagesClientListOptions) *runtime.Pager[UsagesClientListResponse] { @@ -88,7 +87,7 @@ func (client *UsagesClient) listCreateRequest(ctx context.Context, location stri return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client_example_test.go index 6f131d6e1944..718c679e51d2 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client_example_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/Usages_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/Usages_List.json func ExampleUsagesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil {