diff --git a/sdk/resourcemanager/healthbot/armhealthbot/CHANGELOG.md b/sdk/resourcemanager/healthbot/armhealthbot/CHANGELOG.md index 54a3b6392a0b..9e26f7317370 100644 --- a/sdk/resourcemanager/healthbot/armhealthbot/CHANGELOG.md +++ b/sdk/resourcemanager/healthbot/armhealthbot/CHANGELOG.md @@ -1,5 +1,33 @@ # Release History +## 2.0.0 (2025-12-30) +### Breaking Changes + +- Type of `SystemData.CreatedByType` has been changed from `*IdentityType` to `*CreatedByType` +- Type of `SystemData.LastModifiedByType` has been changed from `*IdentityType` to `*CreatedByType` +- `SKUNameS1` from enum `SKUName` has been removed +- Enum `IdentityType` has been removed +- Operation `*BotsClient.Update` has been changed to LRO, use `*BotsClient.BeginUpdate` instead. +- Struct `Error` has been removed +- Struct `ErrorAdditionalInfo` has been removed +- Struct `ErrorError` has been removed +- Struct `Resource` has been removed +- Struct `TrackedResource` has been removed +- Struct `ValidationResult` has been removed + +### Features Added + +- New value `SKUNameC1`, `SKUNamePES` added to enum type `SKUName` +- New enum type `CreatedByType` with values `CreatedByTypeApplication`, `CreatedByTypeKey`, `CreatedByTypeManagedIdentity`, `CreatedByTypeUser` +- New function `*BotsClient.ListSecrets(ctx context.Context, resourceGroupName string, botName string, options *BotsClientListSecretsOptions) (BotsClientListSecretsResponse, error)` +- New function `*BotsClient.RegenerateAPIJwtSecret(ctx context.Context, resourceGroupName string, botName string, options *BotsClientRegenerateAPIJwtSecretOptions) (BotsClientRegenerateAPIJwtSecretResponse, error)` +- New struct `Key` +- New struct `KeyVaultProperties` +- New struct `KeysResponse` +- New field `AccessControlMethod`, `KeyVaultProperties` in struct `Properties` +- New field `Properties` in struct `UpdateParameters` + + ## 1.2.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/healthbot/armhealthbot/README.md b/sdk/resourcemanager/healthbot/armhealthbot/README.md index c5bba01ca516..4e6702ab861d 100644 --- a/sdk/resourcemanager/healthbot/armhealthbot/README.md +++ b/sdk/resourcemanager/healthbot/armhealthbot/README.md @@ -18,7 +18,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Health Bot module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthbot/armhealthbot +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthbot/armhealthbot/v2 ``` ## Authorization diff --git a/sdk/resourcemanager/healthbot/armhealthbot/autorest.md b/sdk/resourcemanager/healthbot/armhealthbot/autorest.md deleted file mode 100644 index 1148e46585bf..000000000000 --- a/sdk/resourcemanager/healthbot/armhealthbot/autorest.md +++ /dev/null @@ -1,13 +0,0 @@ -### AutoRest Configuration - -> see https://aka.ms/autorest - -``` yaml -azure-arm: true -require: -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/healthbot/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/healthbot/resource-manager/readme.go.md -license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.2.0 - -``` \ No newline at end of file diff --git a/sdk/resourcemanager/healthbot/armhealthbot/bots_client.go b/sdk/resourcemanager/healthbot/armhealthbot/bots_client.go index dfad884a5ecd..513878f07634 100644 --- a/sdk/resourcemanager/healthbot/armhealthbot/bots_client.go +++ b/sdk/resourcemanager/healthbot/armhealthbot/bots_client.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armhealthbot @@ -25,9 +24,9 @@ type BotsClient struct { } // NewBotsClient creates a new instance of BotsClient with the specified values. -// - subscriptionID - Azure Subscription ID. +// - 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. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewBotsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BotsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -43,8 +42,8 @@ func NewBotsClient(subscriptionID string, credential azcore.TokenCredential, opt // BeginCreate - Create a new Azure Health Bot. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-10 -// - resourceGroupName - The name of the Bot resource group in the user subscription. +// Generated from API version 2025-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - botName - The name of the Bot resource. // - parameters - The parameters to provide for the created Azure Health Bot. // - options - BotsClientBeginCreateOptions contains the optional parameters for the BotsClient.BeginCreate method. @@ -55,8 +54,7 @@ func (client *BotsClient) BeginCreate(ctx context.Context, resourceGroupName str return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BotsClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -69,7 +67,7 @@ func (client *BotsClient) BeginCreate(ctx context.Context, resourceGroupName str // Create - Create a new Azure Health Bot. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-10 +// Generated from API version 2025-11-01 func (client *BotsClient) create(ctx context.Context, resourceGroupName string, botName string, parameters HealthBot, options *BotsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "BotsClient.BeginCreate" @@ -92,7 +90,7 @@ func (client *BotsClient) create(ctx context.Context, resourceGroupName string, } // createCreateRequest creates the Create request. -func (client *BotsClient) createCreateRequest(ctx context.Context, resourceGroupName string, botName string, parameters HealthBot, options *BotsClientBeginCreateOptions) (*policy.Request, error) { +func (client *BotsClient) createCreateRequest(ctx context.Context, resourceGroupName string, botName string, parameters HealthBot, _ *BotsClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -111,9 +109,10 @@ func (client *BotsClient) createCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-10") + reqQP.Set("api-version", "2025-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -123,8 +122,8 @@ func (client *BotsClient) createCreateRequest(ctx context.Context, resourceGroup // BeginDelete - Delete a HealthBot. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-10 -// - resourceGroupName - The name of the Bot resource group in the user subscription. +// Generated from API version 2025-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - botName - The name of the Bot resource. // - options - BotsClientBeginDeleteOptions contains the optional parameters for the BotsClient.BeginDelete method. func (client *BotsClient) BeginDelete(ctx context.Context, resourceGroupName string, botName string, options *BotsClientBeginDeleteOptions) (*runtime.Poller[BotsClientDeleteResponse], error) { @@ -147,7 +146,7 @@ func (client *BotsClient) BeginDelete(ctx context.Context, resourceGroupName str // Delete - Delete a HealthBot. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-10 +// Generated from API version 2025-11-01 func (client *BotsClient) deleteOperation(ctx context.Context, resourceGroupName string, botName string, options *BotsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "BotsClient.BeginDelete" @@ -170,7 +169,7 @@ func (client *BotsClient) deleteOperation(ctx context.Context, resourceGroupName } // deleteCreateRequest creates the Delete request. -func (client *BotsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, botName string, options *BotsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *BotsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, botName string, _ *BotsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -189,17 +188,16 @@ func (client *BotsClient) deleteCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-10") + reqQP.Set("api-version", "2025-11-01") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Get a HealthBot. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-10 -// - resourceGroupName - The name of the Bot resource group in the user subscription. +// Generated from API version 2025-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - botName - The name of the Bot resource. // - options - BotsClientGetOptions contains the optional parameters for the BotsClient.Get method. func (client *BotsClient) Get(ctx context.Context, resourceGroupName string, botName string, options *BotsClientGetOptions) (BotsClientGetResponse, error) { @@ -225,7 +223,7 @@ func (client *BotsClient) Get(ctx context.Context, resourceGroupName string, bot } // getCreateRequest creates the Get request. -func (client *BotsClient) getCreateRequest(ctx context.Context, resourceGroupName string, botName string, options *BotsClientGetOptions) (*policy.Request, error) { +func (client *BotsClient) getCreateRequest(ctx context.Context, resourceGroupName string, botName string, _ *BotsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -244,7 +242,7 @@ func (client *BotsClient) getCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-10") + reqQP.Set("api-version", "2025-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -261,7 +259,7 @@ func (client *BotsClient) getHandleResponse(resp *http.Response) (BotsClientGetR // NewListPager - Returns all the resources of a particular type belonging to a subscription. // -// Generated from API version 2021-06-10 +// Generated from API version 2025-11-01 // - options - BotsClientListOptions contains the optional parameters for the BotsClient.NewListPager method. func (client *BotsClient) NewListPager(options *BotsClientListOptions) *runtime.Pager[BotsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[BotsClientListResponse]{ @@ -287,7 +285,7 @@ func (client *BotsClient) NewListPager(options *BotsClientListOptions) *runtime. } // listCreateRequest creates the List request. -func (client *BotsClient) listCreateRequest(ctx context.Context, options *BotsClientListOptions) (*policy.Request, error) { +func (client *BotsClient) listCreateRequest(ctx context.Context, _ *BotsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HealthBot/healthBots" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -298,7 +296,7 @@ func (client *BotsClient) listCreateRequest(ctx context.Context, options *BotsCl return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-10") + reqQP.Set("api-version", "2025-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -315,8 +313,8 @@ func (client *BotsClient) listHandleResponse(resp *http.Response) (BotsClientLis // NewListByResourceGroupPager - Returns all the resources of a particular type belonging to a resource group // -// Generated from API version 2021-06-10 -// - resourceGroupName - The name of the Bot resource group in the user subscription. +// Generated from API version 2025-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - BotsClientListByResourceGroupOptions contains the optional parameters for the BotsClient.NewListByResourceGroupPager // method. func (client *BotsClient) NewListByResourceGroupPager(resourceGroupName string, options *BotsClientListByResourceGroupOptions) *runtime.Pager[BotsClientListByResourceGroupResponse] { @@ -343,22 +341,22 @@ func (client *BotsClient) NewListByResourceGroupPager(resourceGroupName string, } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *BotsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *BotsClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *BotsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *BotsClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-10") + reqQP.Set("api-version", "2025-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -373,38 +371,187 @@ func (client *BotsClient) listByResourceGroupHandleResponse(resp *http.Response) return result, nil } -// Update - Patch a HealthBot. +// ListSecrets - List all secrets of a HealthBot. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - botName - The name of the Bot resource. +// - options - BotsClientListSecretsOptions contains the optional parameters for the BotsClient.ListSecrets method. +func (client *BotsClient) ListSecrets(ctx context.Context, resourceGroupName string, botName string, options *BotsClientListSecretsOptions) (BotsClientListSecretsResponse, error) { + var err error + const operationName = "BotsClient.ListSecrets" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listSecretsCreateRequest(ctx, resourceGroupName, botName, options) + if err != nil { + return BotsClientListSecretsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BotsClientListSecretsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BotsClientListSecretsResponse{}, err + } + resp, err := client.listSecretsHandleResponse(httpResp) + return resp, err +} + +// listSecretsCreateRequest creates the ListSecrets request. +func (client *BotsClient) listSecretsCreateRequest(ctx context.Context, resourceGroupName string, botName string, _ *BotsClientListSecretsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}/listSecrets" + 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 botName == "" { + return nil, errors.New("parameter botName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{botName}", url.PathEscape(botName)) + 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", "2025-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listSecretsHandleResponse handles the ListSecrets response. +func (client *BotsClient) listSecretsHandleResponse(resp *http.Response) (BotsClientListSecretsResponse, error) { + result := BotsClientListSecretsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.KeysResponse); err != nil { + return BotsClientListSecretsResponse{}, err + } + return result, nil +} + +// RegenerateAPIJwtSecret - Regenerate the API JWT Secret of a HealthBot. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - botName - The name of the Bot resource. +// - options - BotsClientRegenerateAPIJwtSecretOptions contains the optional parameters for the BotsClient.RegenerateAPIJwtSecret +// method. +func (client *BotsClient) RegenerateAPIJwtSecret(ctx context.Context, resourceGroupName string, botName string, options *BotsClientRegenerateAPIJwtSecretOptions) (BotsClientRegenerateAPIJwtSecretResponse, error) { + var err error + const operationName = "BotsClient.RegenerateAPIJwtSecret" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.regenerateAPIJwtSecretCreateRequest(ctx, resourceGroupName, botName, options) + if err != nil { + return BotsClientRegenerateAPIJwtSecretResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BotsClientRegenerateAPIJwtSecretResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BotsClientRegenerateAPIJwtSecretResponse{}, err + } + resp, err := client.regenerateAPIJwtSecretHandleResponse(httpResp) + return resp, err +} + +// regenerateAPIJwtSecretCreateRequest creates the RegenerateAPIJwtSecret request. +func (client *BotsClient) regenerateAPIJwtSecretCreateRequest(ctx context.Context, resourceGroupName string, botName string, _ *BotsClientRegenerateAPIJwtSecretOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}/regenerateApiJwtSecret" + 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 botName == "" { + return nil, errors.New("parameter botName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{botName}", url.PathEscape(botName)) + 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", "2025-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// regenerateAPIJwtSecretHandleResponse handles the RegenerateAPIJwtSecret response. +func (client *BotsClient) regenerateAPIJwtSecretHandleResponse(resp *http.Response) (BotsClientRegenerateAPIJwtSecretResponse, error) { + result := BotsClientRegenerateAPIJwtSecretResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Key); err != nil { + return BotsClientRegenerateAPIJwtSecretResponse{}, err + } + return result, nil +} + +// BeginUpdate - Patch a HealthBot. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-10 -// - resourceGroupName - The name of the Bot resource group in the user subscription. +// Generated from API version 2025-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - botName - The name of the Bot resource. // - parameters - The parameters to provide for the required Azure Health Bot. -// - options - BotsClientUpdateOptions contains the optional parameters for the BotsClient.Update method. -func (client *BotsClient) Update(ctx context.Context, resourceGroupName string, botName string, parameters UpdateParameters, options *BotsClientUpdateOptions) (BotsClientUpdateResponse, error) { +// - options - BotsClientBeginUpdateOptions contains the optional parameters for the BotsClient.BeginUpdate method. +func (client *BotsClient) BeginUpdate(ctx context.Context, resourceGroupName string, botName string, parameters UpdateParameters, options *BotsClientBeginUpdateOptions) (*runtime.Poller[BotsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, botName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BotsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BotsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Patch a HealthBot. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-11-01 +func (client *BotsClient) update(ctx context.Context, resourceGroupName string, botName string, parameters UpdateParameters, options *BotsClientBeginUpdateOptions) (*http.Response, error) { var err error - const operationName = "BotsClient.Update" + const operationName = "BotsClient.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, botName, parameters, options) if err != nil { - return BotsClientUpdateResponse{}, err + return nil, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return BotsClientUpdateResponse{}, err + return nil, err } if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { err = runtime.NewResponseError(httpResp) - return BotsClientUpdateResponse{}, err + return nil, err } - resp, err := client.updateHandleResponse(httpResp) - return resp, err + return httpResp, nil } // updateCreateRequest creates the Update request. -func (client *BotsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, botName string, parameters UpdateParameters, options *BotsClientUpdateOptions) (*policy.Request, error) { +func (client *BotsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, botName string, parameters UpdateParameters, _ *BotsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -423,20 +570,12 @@ func (client *BotsClient) updateCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-10") + reqQP.Set("api-version", "2025-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } return req, nil } - -// updateHandleResponse handles the Update response. -func (client *BotsClient) updateHandleResponse(resp *http.Response) (BotsClientUpdateResponse, error) { - result := BotsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.HealthBot); err != nil { - return BotsClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/healthbot/armhealthbot/bots_client_example_test.go b/sdk/resourcemanager/healthbot/armhealthbot/bots_client_example_test.go index 2f9d27634726..531038f925d7 100644 --- a/sdk/resourcemanager/healthbot/armhealthbot/bots_client_example_test.go +++ b/sdk/resourcemanager/healthbot/armhealthbot/bots_client_example_test.go @@ -1,33 +1,29 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armhealthbot_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/healthbot/armhealthbot" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthbot/armhealthbot/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ResourceCreationPut.json +// Generated from example definition: 2025-11-01/ResourceCreationPut.json func ExampleBotsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armhealthbot.NewClientFactory("", cred, nil) + clientFactory, err := armhealthbot.NewClientFactory("subid", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewBotsClient().BeginCreate(ctx, "healthbotClient", "samplebotname", armhealthbot.HealthBot{ - Location: to.Ptr("East US"), Identity: &armhealthbot.Identity{ Type: to.Ptr(armhealthbot.ResourceIdentityTypeSystemAssignedUserAssigned), UserAssignedIdentities: map[string]*armhealthbot.UserAssignedIdentity{ @@ -35,6 +31,7 @@ func ExampleBotsClient_BeginCreate() { "/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.managedidentity/userassignedidentities/my-mi2": {}, }, }, + Location: to.Ptr("East US"), SKU: &armhealthbot.SKU{ Name: to.Ptr(armhealthbot.SKUNameF0), }, @@ -49,178 +46,132 @@ func ExampleBotsClient_BeginCreate() { // 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.HealthBot = armhealthbot.HealthBot{ - // Name: to.Ptr("samplebotname"), - // Type: to.Ptr("Microsoft.HealthBot/healthBots"), - // ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.HealthBot/healthBots/samplebotname"), - // SystemData: &armhealthbot.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-05T17:18:19.123Z"); return t}()), - // CreatedBy: to.Ptr("jack@outlook.com"), - // CreatedByType: to.Ptr(armhealthbot.IdentityTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-06T17:18:19.123Z"); return t}()), - // LastModifiedBy: to.Ptr("ryan@outlook.com"), - // LastModifiedByType: to.Ptr(armhealthbot.IdentityTypeUser), - // }, - // Location: to.Ptr("East US"), - // Identity: &armhealthbot.Identity{ - // Type: to.Ptr(armhealthbot.ResourceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("principalId"), - // TenantID: to.Ptr("tenantId"), - // UserAssignedIdentities: map[string]*armhealthbot.UserAssignedIdentity{ - // "/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.managedidentity/userassignedidentities/my-mi": &armhealthbot.UserAssignedIdentity{ - // }, - // "/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.managedidentity/userassignedidentities/my-mi2": &armhealthbot.UserAssignedIdentity{ + // res = armhealthbot.BotsClientCreateResponse{ + // HealthBot: &armhealthbot.HealthBot{ + // Name: to.Ptr("samplebotname"), + // Type: to.Ptr("Microsoft.HealthBot/healthBots"), + // ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.HealthBot/healthBots/samplebotname"), + // Identity: &armhealthbot.Identity{ + // Type: to.Ptr(armhealthbot.ResourceIdentityTypeSystemAssignedUserAssigned), + // PrincipalID: to.Ptr("principalId"), + // TenantID: to.Ptr("tenantId"), + // UserAssignedIdentities: map[string]*armhealthbot.UserAssignedIdentity{ + // "/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.managedidentity/userassignedidentities/my-mi": &armhealthbot.UserAssignedIdentity{ + // }, + // "/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.managedidentity/userassignedidentities/my-mi2": &armhealthbot.UserAssignedIdentity{ + // }, // }, // }, - // }, - // Properties: &armhealthbot.Properties{ - // BotManagementPortalLink: to.Ptr("https://us.healthbot.microsoft.com/account/contoso"), - // }, - // SKU: &armhealthbot.SKU{ - // Name: to.Ptr(armhealthbot.SKUNameF0), + // Location: to.Ptr("East US"), + // Properties: &armhealthbot.Properties{ + // BotManagementPortalLink: to.Ptr("https://us.healthbot.microsoft.com/account/contoso"), + // }, + // SKU: &armhealthbot.SKU{ + // Name: to.Ptr(armhealthbot.SKUNameF0), + // }, + // SystemData: &armhealthbot.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-05T17:18:19.1234567Z"); return t}()), + // CreatedBy: to.Ptr("jack@outlook.com"), + // CreatedByType: to.Ptr(armhealthbot.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-06T17:18:19.1234567Z"); return t}()), + // LastModifiedBy: to.Ptr("ryan@outlook.com"), + // LastModifiedByType: to.Ptr(armhealthbot.CreatedByTypeUser), + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ResourceInfoGet.json -func ExampleBotsClient_Get() { +// Generated from example definition: 2025-11-01/ResourceDeletionDelete.json +func ExampleBotsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armhealthbot.NewClientFactory("", cred, nil) + clientFactory, err := armhealthbot.NewClientFactory("subid", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewBotsClient().Get(ctx, "healthbotClient", "samplebotname", nil) + poller, err := clientFactory.NewBotsClient().BeginDelete(ctx, "healthbotClient", "samplebotname", 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.HealthBot = armhealthbot.HealthBot{ - // Name: to.Ptr("samplebotname"), - // Type: to.Ptr("Microsoft.HealthBot/healthBots"), - // ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.HealthBot/healthBots/samplebotname"), - // SystemData: &armhealthbot.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-05T17:18:19.123Z"); return t}()), - // CreatedBy: to.Ptr("jack@outlook.com"), - // CreatedByType: to.Ptr(armhealthbot.IdentityTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-06T17:18:19.123Z"); return t}()), - // LastModifiedBy: to.Ptr("ryan@outlook.com"), - // LastModifiedByType: to.Ptr(armhealthbot.IdentityTypeUser), - // }, - // Location: to.Ptr("East US"), - // Identity: &armhealthbot.Identity{ - // Type: to.Ptr(armhealthbot.ResourceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("principalId"), - // TenantID: to.Ptr("tenantId"), - // UserAssignedIdentities: map[string]*armhealthbot.UserAssignedIdentity{ - // "/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.managedidentity/userassignedidentities/my-mi": &armhealthbot.UserAssignedIdentity{ - // }, - // "/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.managedidentity/userassignedidentities/my-mi2": &armhealthbot.UserAssignedIdentity{ - // }, - // }, - // }, - // Properties: &armhealthbot.Properties{ - // BotManagementPortalLink: to.Ptr("https://us.healthbot.microsoft.com/account/contoso"), - // }, - // SKU: &armhealthbot.SKU{ - // Name: to.Ptr(armhealthbot.SKUNameF0), - // }, + // res = armhealthbot.BotsClientDeleteResponse{ // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ResourceUpdatePatch.json -func ExampleBotsClient_Update() { +// Generated from example definition: 2025-11-01/ResourceInfoGet.json +func ExampleBotsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armhealthbot.NewClientFactory("", cred, nil) + clientFactory, err := armhealthbot.NewClientFactory("subid", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewBotsClient().Update(ctx, "healthbotClient", "samplebotname", armhealthbot.UpdateParameters{ - SKU: &armhealthbot.SKU{ - Name: to.Ptr(armhealthbot.SKUNameF0), - }, - }, nil) + res, err := clientFactory.NewBotsClient().Get(ctx, "healthbotClient", "samplebotname", 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.HealthBot = armhealthbot.HealthBot{ - // Name: to.Ptr("samplebotname"), - // Type: to.Ptr("Microsoft.HealthBot/healthBots"), - // ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.HealthBot/healthBots/samplebotname"), - // SystemData: &armhealthbot.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-05T17:18:19.123Z"); return t}()), - // CreatedBy: to.Ptr("jack@outlook.com"), - // CreatedByType: to.Ptr(armhealthbot.IdentityTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-06T17:18:19.123Z"); return t}()), - // LastModifiedBy: to.Ptr("ryan@outlook.com"), - // LastModifiedByType: to.Ptr(armhealthbot.IdentityTypeUser), - // }, - // Location: to.Ptr("East US"), - // Identity: &armhealthbot.Identity{ - // Type: to.Ptr(armhealthbot.ResourceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("principalId"), - // TenantID: to.Ptr("tenantId"), - // UserAssignedIdentities: map[string]*armhealthbot.UserAssignedIdentity{ - // "/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.managedidentity/userassignedidentities/my-mi": &armhealthbot.UserAssignedIdentity{ - // }, - // "/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.managedidentity/userassignedidentities/my-mi2": &armhealthbot.UserAssignedIdentity{ + // res = armhealthbot.BotsClientGetResponse{ + // HealthBot: &armhealthbot.HealthBot{ + // Name: to.Ptr("samplebotname"), + // Type: to.Ptr("Microsoft.HealthBot/healthBots"), + // ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.HealthBot/healthBots/samplebotname"), + // Identity: &armhealthbot.Identity{ + // Type: to.Ptr(armhealthbot.ResourceIdentityTypeSystemAssignedUserAssigned), + // PrincipalID: to.Ptr("principalId"), + // TenantID: to.Ptr("tenantId"), + // UserAssignedIdentities: map[string]*armhealthbot.UserAssignedIdentity{ + // "/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.managedidentity/userassignedidentities/my-mi": &armhealthbot.UserAssignedIdentity{ + // }, + // "/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.managedidentity/userassignedidentities/my-mi2": &armhealthbot.UserAssignedIdentity{ + // }, // }, // }, - // }, - // Properties: &armhealthbot.Properties{ - // BotManagementPortalLink: to.Ptr("https://us.healthbot.microsoft.com/account/contoso"), - // }, - // SKU: &armhealthbot.SKU{ - // Name: to.Ptr(armhealthbot.SKUNameF0), + // Location: to.Ptr("East US"), + // Properties: &armhealthbot.Properties{ + // BotManagementPortalLink: to.Ptr("https://us.healthbot.microsoft.com/account/contoso"), + // }, + // SKU: &armhealthbot.SKU{ + // Name: to.Ptr(armhealthbot.SKUNameF0), + // }, + // SystemData: &armhealthbot.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-05T17:18:19.1234567Z"); return t}()), + // CreatedBy: to.Ptr("jack@outlook.com"), + // CreatedByType: to.Ptr(armhealthbot.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-06T17:18:19.1234567Z"); return t}()), + // LastModifiedBy: to.Ptr("ryan@outlook.com"), + // LastModifiedByType: to.Ptr(armhealthbot.CreatedByTypeUser), + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ResourceDeletionDelete.json -func ExampleBotsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhealthbot.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBotsClient().BeginDelete(ctx, "healthbotClient", "samplebotname", 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/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ListBotsByResourceGroup.json -func ExampleBotsClient_NewListByResourceGroupPager() { +// Generated from example definition: 2025-11-01/ListBotsBySubscription.json +func ExampleBotsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armhealthbot.NewClientFactory("", cred, nil) + clientFactory, err := armhealthbot.NewClientFactory("subscription-id", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewBotsClient().NewListByResourceGroupPager("OneResourceGroupName", nil) + pager := clientFactory.NewBotsClient().NewListPager(nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -231,75 +182,58 @@ func ExampleBotsClient_NewListByResourceGroupPager() { _ = 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.BotResponseList = armhealthbot.BotResponseList{ - // Value: []*armhealthbot.HealthBot{ - // { - // Name: to.Ptr("samplebotname"), - // Type: to.Ptr("Microsoft.HealthBot/healthBots"), - // ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.HealthBot/healthBots/samplebotname"), - // SystemData: &armhealthbot.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-05T17:18:19.123Z"); return t}()), - // CreatedBy: to.Ptr("jack@outlook.com"), - // CreatedByType: to.Ptr(armhealthbot.IdentityTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-06T17:18:19.123Z"); return t}()), - // LastModifiedBy: to.Ptr("ryan@outlook.com"), - // LastModifiedByType: to.Ptr(armhealthbot.IdentityTypeUser), - // }, - // Location: to.Ptr("East US"), - // Properties: &armhealthbot.Properties{ - // BotManagementPortalLink: to.Ptr("https://us.healthbot.microsoft.com/account/samplebotname-1yhd91k"), - // }, - // SKU: &armhealthbot.SKU{ - // Name: to.Ptr(armhealthbot.SKUNameF0), - // }, - // }, - // { - // Name: to.Ptr("samplebotname2"), - // Type: to.Ptr("Microsoft.HealthBot/healthBots"), - // ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.HealthBot/healthBots/samplebotname2"), - // SystemData: &armhealthbot.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-05T17:18:19.123Z"); return t}()), - // CreatedBy: to.Ptr("jack@outlook.com"), - // CreatedByType: to.Ptr(armhealthbot.IdentityTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-06T17:18:19.123Z"); return t}()), - // LastModifiedBy: to.Ptr("ryan@outlook.com"), - // LastModifiedByType: to.Ptr(armhealthbot.IdentityTypeUser), - // }, - // Location: to.Ptr("East US"), - // Identity: &armhealthbot.Identity{ - // Type: to.Ptr(armhealthbot.ResourceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("principalId"), - // TenantID: to.Ptr("tenantId"), - // UserAssignedIdentities: map[string]*armhealthbot.UserAssignedIdentity{ - // "/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.managedidentity/userassignedidentities/my-mi": &armhealthbot.UserAssignedIdentity{ - // }, - // "/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.managedidentity/userassignedidentities/my-mi2": &armhealthbot.UserAssignedIdentity{ + // page = armhealthbot.BotsClientListResponse{ + // BotResponseList: armhealthbot.BotResponseList{ + // Value: []*armhealthbot.HealthBot{ + // { + // Name: to.Ptr("samplebotname2"), + // Type: to.Ptr("Microsoft.HealthBot/healthBots"), + // ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.HealthBot/healthBots/samplebotname2"), + // Identity: &armhealthbot.Identity{ + // Type: to.Ptr(armhealthbot.ResourceIdentityTypeSystemAssignedUserAssigned), + // PrincipalID: to.Ptr("principalId"), + // TenantID: to.Ptr("tenantId"), + // UserAssignedIdentities: map[string]*armhealthbot.UserAssignedIdentity{ + // "/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.managedidentity/userassignedidentities/my-mi": &armhealthbot.UserAssignedIdentity{ + // }, + // "/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.managedidentity/userassignedidentities/my-mi2": &armhealthbot.UserAssignedIdentity{ + // }, // }, // }, + // Location: to.Ptr("East US"), + // Properties: &armhealthbot.Properties{ + // BotManagementPortalLink: to.Ptr("https://us.healthbot.microsoft.com/account/samplebotname2-hdi1osc"), + // }, + // SKU: &armhealthbot.SKU{ + // Name: to.Ptr(armhealthbot.SKUNameC1), + // }, + // SystemData: &armhealthbot.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-05T17:18:19.1234567Z"); return t}()), + // CreatedBy: to.Ptr("jack@outlook.com"), + // CreatedByType: to.Ptr(armhealthbot.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-06T17:18:19.1234567Z"); return t}()), + // LastModifiedBy: to.Ptr("ryan@outlook.com"), + // LastModifiedByType: to.Ptr(armhealthbot.CreatedByTypeUser), + // }, // }, - // Properties: &armhealthbot.Properties{ - // BotManagementPortalLink: to.Ptr("https://us.healthbot.microsoft.com/account/samplebotname2-hdi1osc"), - // }, - // SKU: &armhealthbot.SKU{ - // Name: to.Ptr(armhealthbot.SKUNameS1), - // }, - // }}, + // }, + // }, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/ListBotsBySubscription.json -func ExampleBotsClient_NewListPager() { +// Generated from example definition: 2025-11-01/ListBotsByResourceGroup.json +func ExampleBotsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armhealthbot.NewClientFactory("", cred, nil) + clientFactory, err := armhealthbot.NewClientFactory("subscription-id", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewBotsClient().NewListPager(nil) + pager := clientFactory.NewBotsClient().NewListByResourceGroupPager("OneResourceGroupName", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -310,39 +244,187 @@ func ExampleBotsClient_NewListPager() { _ = 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.BotResponseList = armhealthbot.BotResponseList{ - // Value: []*armhealthbot.HealthBot{ - // { - // Name: to.Ptr("samplebotname2"), - // Type: to.Ptr("Microsoft.HealthBot/healthBots"), - // ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.HealthBot/healthBots/samplebotname2"), - // SystemData: &armhealthbot.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-05T17:18:19.123Z"); return t}()), - // CreatedBy: to.Ptr("jack@outlook.com"), - // CreatedByType: to.Ptr(armhealthbot.IdentityTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-06T17:18:19.123Z"); return t}()), - // LastModifiedBy: to.Ptr("ryan@outlook.com"), - // LastModifiedByType: to.Ptr(armhealthbot.IdentityTypeUser), + // page = armhealthbot.BotsClientListByResourceGroupResponse{ + // BotResponseList: armhealthbot.BotResponseList{ + // Value: []*armhealthbot.HealthBot{ + // { + // Name: to.Ptr("samplebotname"), + // Type: to.Ptr("Microsoft.HealthBot/healthBots"), + // ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.HealthBot/healthBots/samplebotname"), + // Location: to.Ptr("East US"), + // Properties: &armhealthbot.Properties{ + // BotManagementPortalLink: to.Ptr("https://us.healthbot.microsoft.com/account/samplebotname-1yhd91k"), + // }, + // SKU: &armhealthbot.SKU{ + // Name: to.Ptr(armhealthbot.SKUNameF0), + // }, + // SystemData: &armhealthbot.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-05T17:18:19.1234567Z"); return t}()), + // CreatedBy: to.Ptr("jack@outlook.com"), + // CreatedByType: to.Ptr(armhealthbot.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-06T17:18:19.1234567Z"); return t}()), + // LastModifiedBy: to.Ptr("ryan@outlook.com"), + // LastModifiedByType: to.Ptr(armhealthbot.CreatedByTypeUser), + // }, // }, - // Location: to.Ptr("East US"), - // Identity: &armhealthbot.Identity{ - // Type: to.Ptr(armhealthbot.ResourceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("principalId"), - // TenantID: to.Ptr("tenantId"), - // UserAssignedIdentities: map[string]*armhealthbot.UserAssignedIdentity{ - // "/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.managedidentity/userassignedidentities/my-mi": &armhealthbot.UserAssignedIdentity{ - // }, - // "/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.managedidentity/userassignedidentities/my-mi2": &armhealthbot.UserAssignedIdentity{ + // { + // Name: to.Ptr("samplebotname2"), + // Type: to.Ptr("Microsoft.HealthBot/healthBots"), + // ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.HealthBot/healthBots/samplebotname2"), + // Identity: &armhealthbot.Identity{ + // Type: to.Ptr(armhealthbot.ResourceIdentityTypeSystemAssignedUserAssigned), + // PrincipalID: to.Ptr("principalId"), + // TenantID: to.Ptr("tenantId"), + // UserAssignedIdentities: map[string]*armhealthbot.UserAssignedIdentity{ + // "/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.managedidentity/userassignedidentities/my-mi": &armhealthbot.UserAssignedIdentity{ + // }, + // "/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.managedidentity/userassignedidentities/my-mi2": &armhealthbot.UserAssignedIdentity{ + // }, // }, // }, + // Location: to.Ptr("East US"), + // Properties: &armhealthbot.Properties{ + // BotManagementPortalLink: to.Ptr("https://us.healthbot.microsoft.com/account/samplebotname2-hdi1osc"), + // }, + // SKU: &armhealthbot.SKU{ + // Name: to.Ptr(armhealthbot.SKUNameC1), + // }, + // SystemData: &armhealthbot.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-05T17:18:19.1234567Z"); return t}()), + // CreatedBy: to.Ptr("jack@outlook.com"), + // CreatedByType: to.Ptr(armhealthbot.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-06T17:18:19.1234567Z"); return t}()), + // LastModifiedBy: to.Ptr("ryan@outlook.com"), + // LastModifiedByType: to.Ptr(armhealthbot.CreatedByTypeUser), + // }, // }, - // Properties: &armhealthbot.Properties{ - // BotManagementPortalLink: to.Ptr("https://us.healthbot.microsoft.com/account/samplebotname2-hdi1osc"), - // }, - // SKU: &armhealthbot.SKU{ - // Name: to.Ptr(armhealthbot.SKUNameS1), - // }, - // }}, + // }, + // }, // } } } + +// Generated from example definition: 2025-11-01/ListSecrets.json +func ExampleBotsClient_ListSecrets() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhealthbot.NewClientFactory("subid", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewBotsClient().ListSecrets(ctx, "healthbotClient", "samplebotname", 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 = armhealthbot.BotsClientListSecretsResponse{ + // KeysResponse: &armhealthbot.KeysResponse{ + // Secrets: []*armhealthbot.Key{ + // { + // KeyName: to.Ptr("APP_SECRET"), + // Value: to.Ptr("XXXXX"), + // }, + // { + // KeyName: to.Ptr("WEBCHAT_SECRET"), + // Value: to.Ptr("XXXXX"), + // }, + // { + // KeyName: to.Ptr("API_JWT_SECRET"), + // Value: to.Ptr("XXXXX"), + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2025-11-01/RegenerateApiJwtSecret.json +func ExampleBotsClient_RegenerateAPIJwtSecret() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhealthbot.NewClientFactory("subid", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewBotsClient().RegenerateAPIJwtSecret(ctx, "healthbotClient", "samplebotname", 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 = armhealthbot.BotsClientRegenerateAPIJwtSecretResponse{ + // Key: &armhealthbot.Key{ + // KeyName: to.Ptr("API_JWT_SECRET"), + // Value: to.Ptr("XXXXX"), + // }, + // } +} + +// Generated from example definition: 2025-11-01/ResourceUpdatePatch.json +func ExampleBotsClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armhealthbot.NewClientFactory("subid", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewBotsClient().BeginUpdate(ctx, "healthbotClient", "samplebotname", armhealthbot.UpdateParameters{ + SKU: &armhealthbot.SKU{ + Name: to.Ptr(armhealthbot.SKUNameF0), + }, + }, 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 = armhealthbot.BotsClientUpdateResponse{ + // HealthBot: &armhealthbot.HealthBot{ + // Name: to.Ptr("samplebotname"), + // Type: to.Ptr("Microsoft.HealthBot/healthBots"), + // ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.HealthBot/healthBots/samplebotname"), + // Identity: &armhealthbot.Identity{ + // Type: to.Ptr(armhealthbot.ResourceIdentityTypeSystemAssignedUserAssigned), + // PrincipalID: to.Ptr("principalId"), + // TenantID: to.Ptr("tenantId"), + // UserAssignedIdentities: map[string]*armhealthbot.UserAssignedIdentity{ + // "/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.managedidentity/userassignedidentities/my-mi": &armhealthbot.UserAssignedIdentity{ + // }, + // "/subscriptions/subscription-id/resourcegroups/myrg/providers/microsoft.managedidentity/userassignedidentities/my-mi2": &armhealthbot.UserAssignedIdentity{ + // }, + // }, + // }, + // Location: to.Ptr("East US"), + // Properties: &armhealthbot.Properties{ + // BotManagementPortalLink: to.Ptr("https://us.healthbot.microsoft.com/account/contoso"), + // }, + // SKU: &armhealthbot.SKU{ + // Name: to.Ptr(armhealthbot.SKUNameF0), + // }, + // SystemData: &armhealthbot.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-05T17:18:19.1234567Z"); return t}()), + // CreatedBy: to.Ptr("jack@outlook.com"), + // CreatedByType: to.Ptr(armhealthbot.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-06T17:18:19.1234567Z"); return t}()), + // LastModifiedBy: to.Ptr("ryan@outlook.com"), + // LastModifiedByType: to.Ptr(armhealthbot.CreatedByTypeUser), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/healthbot/armhealthbot/build.go b/sdk/resourcemanager/healthbot/armhealthbot/build.go deleted file mode 100644 index 437a5dbd6468..000000000000 --- a/sdk/resourcemanager/healthbot/armhealthbot/build.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -// This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/healthbot/armhealthbot - -package armhealthbot diff --git a/sdk/resourcemanager/healthbot/armhealthbot/client_factory.go b/sdk/resourcemanager/healthbot/armhealthbot/client_factory.go index d162b3fcf5f9..9e7938c5e779 100644 --- a/sdk/resourcemanager/healthbot/armhealthbot/client_factory.go +++ b/sdk/resourcemanager/healthbot/armhealthbot/client_factory.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armhealthbot @@ -14,34 +13,36 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { subscriptionID string - credential azcore.TokenCredential - options *arm.ClientOptions + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. -// - subscriptionID - Azure Subscription ID. +// - 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) { - _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - subscriptionID: subscriptionID, credential: credential, - options: options.Clone(), + subscriptionID: subscriptionID, + internal: internal, }, nil } // NewBotsClient creates a new instance of BotsClient. func (c *ClientFactory) NewBotsClient() *BotsClient { - subClient, _ := NewBotsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &BotsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient + return &OperationsClient{ + internal: c.internal, + } } diff --git a/sdk/resourcemanager/healthbot/armhealthbot/constants.go b/sdk/resourcemanager/healthbot/armhealthbot/constants.go index 47c5593d352e..4315d55b5502 100644 --- a/sdk/resourcemanager/healthbot/armhealthbot/constants.go +++ b/sdk/resourcemanager/healthbot/armhealthbot/constants.go @@ -1,38 +1,35 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armhealthbot -const ( - moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthbot/armhealthbot" - moduleVersion = "v1.2.0" -) - -// IdentityType - The type of identity that creates/modifies resources -type IdentityType string +// CreatedByType - The kind of entity that created the resource. +type CreatedByType string const ( - IdentityTypeApplication IdentityType = "Application" - IdentityTypeKey IdentityType = "Key" - IdentityTypeManagedIdentity IdentityType = "ManagedIdentity" - IdentityTypeUser IdentityType = "User" + // CreatedByTypeApplication - The entity was created by an application. + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey - The entity was created by a key. + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity - The entity was created by a managed identity. + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" ) -// PossibleIdentityTypeValues returns the possible values for the IdentityType const type. -func PossibleIdentityTypeValues() []IdentityType { - return []IdentityType{ - IdentityTypeApplication, - IdentityTypeKey, - IdentityTypeManagedIdentity, - IdentityTypeUser, +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, } } // ResourceIdentityType - The identity type. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity -// and a set of user assigned identities. The type 'None' will remove any identities from the Azure -// Health Bot +// and a set of user assigned identities. The type 'None' will remove any identities from the Azure Health Bot type ResourceIdentityType string const ( @@ -56,16 +53,18 @@ func PossibleResourceIdentityTypeValues() []ResourceIdentityType { type SKUName string const ( - SKUNameC0 SKUName = "C0" - SKUNameF0 SKUName = "F0" - SKUNameS1 SKUName = "S1" + SKUNameC0 SKUName = "C0" + SKUNameC1 SKUName = "C1" + SKUNameF0 SKUName = "F0" + SKUNamePES SKUName = "PES" ) // PossibleSKUNameValues returns the possible values for the SKUName const type. func PossibleSKUNameValues() []SKUName { return []SKUName{ SKUNameC0, + SKUNameC1, SKUNameF0, - SKUNameS1, + SKUNamePES, } } diff --git a/sdk/resourcemanager/healthbot/armhealthbot/fake/bots_server.go b/sdk/resourcemanager/healthbot/armhealthbot/fake/bots_server.go index 9b06e7568be1..fae0edfe0e1b 100644 --- a/sdk/resourcemanager/healthbot/armhealthbot/fake/bots_server.go +++ b/sdk/resourcemanager/healthbot/armhealthbot/fake/bots_server.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -13,7 +12,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/healthbot/armhealthbot" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthbot/armhealthbot/v2" "net/http" "net/url" "regexp" @@ -41,9 +40,17 @@ type BotsServer struct { // HTTP status codes to indicate success: http.StatusOK NewListByResourceGroupPager func(resourceGroupName string, options *armhealthbot.BotsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armhealthbot.BotsClientListByResourceGroupResponse]) - // Update is the fake for method BotsClient.Update + // ListSecrets is the fake for method BotsClient.ListSecrets + // HTTP status codes to indicate success: http.StatusOK + ListSecrets func(ctx context.Context, resourceGroupName string, botName string, options *armhealthbot.BotsClientListSecretsOptions) (resp azfake.Responder[armhealthbot.BotsClientListSecretsResponse], errResp azfake.ErrorResponder) + + // RegenerateAPIJwtSecret is the fake for method BotsClient.RegenerateAPIJwtSecret + // HTTP status codes to indicate success: http.StatusOK + RegenerateAPIJwtSecret func(ctx context.Context, resourceGroupName string, botName string, options *armhealthbot.BotsClientRegenerateAPIJwtSecretOptions) (resp azfake.Responder[armhealthbot.BotsClientRegenerateAPIJwtSecretResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method BotsClient.BeginUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Update func(ctx context.Context, resourceGroupName string, botName string, parameters armhealthbot.UpdateParameters, options *armhealthbot.BotsClientUpdateOptions) (resp azfake.Responder[armhealthbot.BotsClientUpdateResponse], errResp azfake.ErrorResponder) + BeginUpdate func(ctx context.Context, resourceGroupName string, botName string, parameters armhealthbot.UpdateParameters, options *armhealthbot.BotsClientBeginUpdateOptions) (resp azfake.PollerResponder[armhealthbot.BotsClientUpdateResponse], errResp azfake.ErrorResponder) } // NewBotsServerTransport creates a new instance of BotsServerTransport with the provided implementation. @@ -56,6 +63,7 @@ func NewBotsServerTransport(srv *BotsServer) *BotsServerTransport { beginDelete: newTracker[azfake.PollerResponder[armhealthbot.BotsClientDeleteResponse]](), newListPager: newTracker[azfake.PagerResponder[armhealthbot.BotsClientListResponse]](), newListByResourceGroupPager: newTracker[azfake.PagerResponder[armhealthbot.BotsClientListByResourceGroupResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armhealthbot.BotsClientUpdateResponse]](), } } @@ -67,6 +75,7 @@ type BotsServerTransport struct { beginDelete *tracker[azfake.PollerResponder[armhealthbot.BotsClientDeleteResponse]] newListPager *tracker[azfake.PagerResponder[armhealthbot.BotsClientListResponse]] newListByResourceGroupPager *tracker[azfake.PagerResponder[armhealthbot.BotsClientListByResourceGroupResponse]] + beginUpdate *tracker[azfake.PollerResponder[armhealthbot.BotsClientUpdateResponse]] } // Do implements the policy.Transporter interface for BotsServerTransport. @@ -77,31 +86,54 @@ func (b *BotsServerTransport) Do(req *http.Request) (*http.Response, error) { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return b.dispatchToMethodFake(req, method) +} - switch method { - case "BotsClient.BeginCreate": - resp, err = b.dispatchBeginCreate(req) - case "BotsClient.BeginDelete": - resp, err = b.dispatchBeginDelete(req) - case "BotsClient.Get": - resp, err = b.dispatchGet(req) - case "BotsClient.NewListPager": - resp, err = b.dispatchNewListPager(req) - case "BotsClient.NewListByResourceGroupPager": - resp, err = b.dispatchNewListByResourceGroupPager(req) - case "BotsClient.Update": - resp, err = b.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (b *BotsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if botsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = botsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "BotsClient.BeginCreate": + res.resp, res.err = b.dispatchBeginCreate(req) + case "BotsClient.BeginDelete": + res.resp, res.err = b.dispatchBeginDelete(req) + case "BotsClient.Get": + res.resp, res.err = b.dispatchGet(req) + case "BotsClient.NewListPager": + res.resp, res.err = b.dispatchNewListPager(req) + case "BotsClient.NewListByResourceGroupPager": + res.resp, res.err = b.dispatchNewListByResourceGroupPager(req) + case "BotsClient.ListSecrets": + res.resp, res.err = b.dispatchListSecrets(req) + case "BotsClient.RegenerateAPIJwtSecret": + res.resp, res.err = b.dispatchRegenerateAPIJwtSecret(req) + case "BotsClient.BeginUpdate": + res.resp, res.err = b.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (b *BotsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -113,7 +145,7 @@ func (b *BotsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Resp const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthBot/healthBots/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armhealthbot.HealthBot](req) @@ -161,7 +193,7 @@ func (b *BotsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Resp const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthBot/healthBots/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -203,7 +235,7 @@ func (b *BotsServerTransport) dispatchGet(req *http.Request) (*http.Response, er const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthBot/healthBots/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -238,7 +270,7 @@ func (b *BotsServerTransport) dispatchNewListPager(req *http.Request) (*http.Res const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthBot/healthBots` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := b.srv.NewListPager(nil) @@ -271,7 +303,7 @@ func (b *BotsServerTransport) dispatchNewListByResourceGroupPager(req *http.Requ const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthBot/healthBots` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -299,20 +331,49 @@ func (b *BotsServerTransport) dispatchNewListByResourceGroupPager(req *http.Requ return resp, nil } -func (b *BotsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if b.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} +func (b *BotsServerTransport) dispatchListSecrets(req *http.Request) (*http.Response, error) { + if b.srv.ListSecrets == nil { + return nil, &nonRetriableError{errors.New("fake for method ListSecrets not implemented")} } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthBot/healthBots/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthBot/healthBots/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listSecrets` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - body, err := server.UnmarshalRequestAsJSON[armhealthbot.UpdateParameters](req) + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) if err != nil { return nil, err } + botNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("botName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.ListSecrets(req.Context(), resourceGroupNameParam, botNameParam, 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).KeysResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (b *BotsServerTransport) dispatchRegenerateAPIJwtSecret(req *http.Request) (*http.Response, error) { + if b.srv.RegenerateAPIJwtSecret == nil { + return nil, &nonRetriableError{errors.New("fake for method RegenerateAPIJwtSecret not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthBot/healthBots/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/regenerateApiJwtSecret` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 @@ -321,17 +382,71 @@ func (b *BotsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, if err != nil { return nil, err } - respr, errRespr := b.srv.Update(req.Context(), resourceGroupNameParam, botNameParam, body, nil) + respr, errRespr := b.srv.RegenerateAPIJwtSecret(req.Context(), resourceGroupNameParam, botNameParam, 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)} + 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).HealthBot, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Key, req) if err != nil { return nil, err } return resp, nil } + +func (b *BotsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if b.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := b.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthBot/healthBots/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armhealthbot.UpdateParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + botNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("botName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.BeginUpdate(req.Context(), resourceGroupNameParam, botNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + b.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + b.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + b.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to BotsServerTransport +var botsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/healthbot/armhealthbot/fake/internal.go b/sdk/resourcemanager/healthbot/armhealthbot/fake/internal.go index a56f57fc156d..7425b6a669e2 100644 --- a/sdk/resourcemanager/healthbot/armhealthbot/fake/internal.go +++ b/sdk/resourcemanager/healthbot/armhealthbot/fake/internal.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -11,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/healthbot/armhealthbot/fake/operations_server.go b/sdk/resourcemanager/healthbot/armhealthbot/fake/operations_server.go index 39672dcc6085..c7471ebbe4ff 100644 --- a/sdk/resourcemanager/healthbot/armhealthbot/fake/operations_server.go +++ b/sdk/resourcemanager/healthbot/armhealthbot/fake/operations_server.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -12,7 +11,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/healthbot/armhealthbot" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthbot/armhealthbot/v2" "net/http" ) @@ -48,21 +47,40 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return o.dispatchToMethodFake(req, method) +} - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -91,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/healthbot/armhealthbot/fake/server_factory.go b/sdk/resourcemanager/healthbot/armhealthbot/fake/server_factory.go index 4db85fa51848..bbb54cf28305 100644 --- a/sdk/resourcemanager/healthbot/armhealthbot/fake/server_factory.go +++ b/sdk/resourcemanager/healthbot/armhealthbot/fake/server_factory.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,7 +15,10 @@ import ( // ServerFactory is a fake server for instances of the armhealthbot.ClientFactory type. type ServerFactory struct { - BotsServer BotsServer + // BotsServer contains the fakes for client BotsClient + BotsServer BotsServer + + // OperationsServer contains the fakes for client OperationsClient OperationsServer OperationsServer } diff --git a/sdk/resourcemanager/healthbot/armhealthbot/fake/time_rfc3339.go b/sdk/resourcemanager/healthbot/armhealthbot/fake/time_rfc3339.go deleted file mode 100644 index b98c0b0402be..000000000000 --- a/sdk/resourcemanager/healthbot/armhealthbot/fake/time_rfc3339.go +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "regexp" - "strings" - "time" -) - -// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) - -const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` -) - -type dateTimeRFC3339 time.Time - -func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t dateTimeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { - layout = dateTimeJSON - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { - layout = time.RFC3339Nano - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = dateTimeRFC3339(p) - return err -} - -func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateTimeRFC3339)(t) -} - -func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { - return nil - } - var aux dateTimeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/healthbot/armhealthbot/go.mod b/sdk/resourcemanager/healthbot/armhealthbot/go.mod index 94013696e231..52db550d2ad9 100644 --- a/sdk/resourcemanager/healthbot/armhealthbot/go.mod +++ b/sdk/resourcemanager/healthbot/armhealthbot/go.mod @@ -1,4 +1,4 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthbot/armhealthbot +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthbot/armhealthbot/v2 go 1.24.0 @@ -14,8 +14,8 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.45.0 // indirect - golang.org/x/net v0.47.0 // indirect - golang.org/x/sys v0.38.0 // indirect - golang.org/x/text v0.31.0 // indirect + golang.org/x/crypto v0.46.0 // indirect + golang.org/x/net v0.48.0 // indirect + golang.org/x/sys v0.39.0 // indirect + golang.org/x/text v0.32.0 // indirect ) diff --git a/sdk/resourcemanager/healthbot/armhealthbot/go.sum b/sdk/resourcemanager/healthbot/armhealthbot/go.sum index 5d2c5e78eb37..0802a4a10167 100644 --- a/sdk/resourcemanager/healthbot/armhealthbot/go.sum +++ b/sdk/resourcemanager/healthbot/armhealthbot/go.sum @@ -26,14 +26,14 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q= -golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4= -golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= -golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= +golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU= +golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0= +golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU= +golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= -golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= -golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM= -golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM= +golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= +golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU= +golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/healthbot/armhealthbot/models.go b/sdk/resourcemanager/healthbot/armhealthbot/models.go index 49a9e658f717..fc16ea1272e7 100644 --- a/sdk/resourcemanager/healthbot/armhealthbot/models.go +++ b/sdk/resourcemanager/healthbot/armhealthbot/models.go @@ -1,61 +1,28 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armhealthbot import "time" -// AvailableOperations - Available operations of the service +// AvailableOperations - Available operations of the service. type AvailableOperations struct { - // URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - NextLink *string - - // Collection of available operation details + // REQUIRED; Collection of available operation details. Value []*OperationDetail + + // URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string } // BotResponseList - The list of Azure Health Bot operation response. type BotResponseList struct { - // READ-ONLY; The link used to get the next page of bot service resources. - NextLink *string - - // READ-ONLY; Gets the list of Azure Health Bot results and their properties. + // READ-ONLY; The HealthBot items on this page Value []*HealthBot -} - -// Error - The resource management error response. -type Error struct { - // The error object. - Error *ErrorError -} - -// 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 -} - -// ErrorError - The error object. -type ErrorError struct { - // READ-ONLY; The error additional info. - AdditionalInfo []*ErrorAdditionalInfo - - // READ-ONLY; The error code. - Code *string - // READ-ONLY; The error details. - Details []*Error - - // READ-ONLY; The error message. - Message *string - - // READ-ONLY; The error target. - Target *string + // The link to the next page of items + NextLink *string } // HealthBot - Azure Health Bot resource definition @@ -75,24 +42,23 @@ type HealthBot struct { // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource Id for the resource. + // 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; 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. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // Identity for the resource. type Identity struct { // The identity type. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user - // assigned identities. The type 'None' will remove any identities from the Azure - // Health Bot + // assigned identities. The type 'None' will remove any identities from the Azure Health Bot Type *ResourceIdentityType // The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource @@ -107,6 +73,36 @@ type Identity struct { TenantID *string } +// Key - An entry of HealthBotKeysResponse +type Key struct { + // The name of the key. + KeyName *string + + // The value of the key. + Value *string +} + +// KeyVaultProperties - Properties of the key vault. +type KeyVaultProperties struct { + // REQUIRED; The name of the key vault key. + KeyName *string + + // REQUIRED; The Uri of the key vault. + KeyVaultURI *string + + // The version of the key vault key. + KeyVersion *string + + // The user assigned identity (ARM resource id) that has access to the key. + UserIdentity *string +} + +// KeysResponse - Health Bot Keys Response. +type KeysResponse struct { + // Array of Azure Health Bot Secrets. + Secrets []*Key +} + // OperationDetail - Operation detail payload type OperationDetail struct { // Display of the operation @@ -141,9 +137,15 @@ type OperationDisplay struct { } // Properties - The properties of a Azure Health Bot. The Health Bot Service is a cloud platform that empowers developers -// in Healthcare organizations to build and deploy their compliant, AI-powered virtual health -// assistants and health bots, that help them improve processes and reduce costs. +// in Healthcare organizations to build and deploy their compliant, AI-powered virtual health assistants and health bots, +// that help them improve processes and reduce costs. type Properties struct { + // KeyVault properties for the resource encryption. + KeyVaultProperties *KeyVaultProperties + + // READ-ONLY; The access control method for the Azure Health Bot resource. + AccessControlMethod *string + // READ-ONLY; The link. BotManagementPortalLink *string @@ -151,37 +153,22 @@ type Properties struct { ProvisioningState *string } -// Resource - The resource model definition for a ARM tracked top level resource -type Resource struct { - // READ-ONLY; Fully qualified resource Id for the resource. - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; Metadata pertaining to creation and last modification of the resource - SystemData *SystemData - - // READ-ONLY; The type of the resource. - Type *string -} - // SKU - The resource model definition representing SKU type SKU struct { // REQUIRED; The name of the Azure Health Bot SKU Name *SKUName } -// SystemData - Read only system data +// SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { - // The timestamp of resource creation (UTC) + // 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 *IdentityType + // The type of identity that created the resource. + CreatedByType *CreatedByType // The timestamp of resource last modification (UTC) LastModifiedAt *time.Time @@ -189,29 +176,8 @@ type SystemData struct { // The identity that last modified the resource. LastModifiedBy *string - // The type of identity that last modified the resource - LastModifiedByType *IdentityType -} - -// TrackedResource - The resource model definition for a ARM tracked top level resource -type TrackedResource struct { - // REQUIRED; The geo-location where the resource lives - Location *string - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Fully qualified resource Id for the resource. - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; Metadata pertaining to creation and last modification of the resource - SystemData *SystemData - - // READ-ONLY; The type of the resource. - Type *string + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType } // UpdateParameters - Parameters for updating a Azure Health Bot. @@ -220,6 +186,9 @@ type UpdateParameters struct { Identity *Identity Location *string + // Properties of Azure Health Bot. + Properties *Properties + // SKU of the Azure Health Bot. SKU *SKU @@ -235,9 +204,3 @@ type UserAssignedIdentity struct { // READ-ONLY; The principal ID of user assigned identity. PrincipalID *string } - -// ValidationResult - The response returned from validation process -type ValidationResult struct { - // The status code of the response validation. - Status *string -} diff --git a/sdk/resourcemanager/healthbot/armhealthbot/models_serde.go b/sdk/resourcemanager/healthbot/armhealthbot/models_serde.go index 7c85f8c29538..e4d94d4c629f 100644 --- a/sdk/resourcemanager/healthbot/armhealthbot/models_serde.go +++ b/sdk/resourcemanager/healthbot/armhealthbot/models_serde.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armhealthbot @@ -74,107 +73,6 @@ func (b *BotResponseList) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Error. -func (e Error) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Error. -func (e *Error) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type 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 ErrorError. -func (e ErrorError) 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 ErrorError. -func (e *ErrorError) UnmarshalJSON(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 HealthBot. func (h HealthBot) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -273,6 +171,103 @@ func (i *Identity) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Key. +func (k Key) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "keyName", k.KeyName) + populate(objectMap, "value", k.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Key. +func (k *Key) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "keyName": + err = unpopulate(val, "KeyName", &k.KeyName) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &k.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeyVaultProperties. +func (k KeyVaultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "keyName", k.KeyName) + populate(objectMap, "keyVaultUri", k.KeyVaultURI) + populate(objectMap, "keyVersion", k.KeyVersion) + populate(objectMap, "userIdentity", k.UserIdentity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultProperties. +func (k *KeyVaultProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "keyName": + err = unpopulate(val, "KeyName", &k.KeyName) + delete(rawMsg, key) + case "keyVaultUri": + err = unpopulate(val, "KeyVaultURI", &k.KeyVaultURI) + delete(rawMsg, key) + case "keyVersion": + err = unpopulate(val, "KeyVersion", &k.KeyVersion) + delete(rawMsg, key) + case "userIdentity": + err = unpopulate(val, "UserIdentity", &k.UserIdentity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeysResponse. +func (k KeysResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "secrets", k.Secrets) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeysResponse. +func (k *KeysResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "secrets": + err = unpopulate(val, "Secrets", &k.Secrets) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type OperationDetail. func (o OperationDetail) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -358,7 +353,9 @@ func (o *OperationDisplay) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Properties. func (p Properties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "accessControlMethod", p.AccessControlMethod) populate(objectMap, "botManagementPortalLink", p.BotManagementPortalLink) + populate(objectMap, "keyVaultProperties", p.KeyVaultProperties) populate(objectMap, "provisioningState", p.ProvisioningState) return json.Marshal(objectMap) } @@ -372,9 +369,15 @@ func (p *Properties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "accessControlMethod": + err = unpopulate(val, "AccessControlMethod", &p.AccessControlMethod) + delete(rawMsg, key) case "botManagementPortalLink": err = unpopulate(val, "BotManagementPortalLink", &p.BotManagementPortalLink) delete(rawMsg, key) + case "keyVaultProperties": + err = unpopulate(val, "KeyVaultProperties", &p.KeyVaultProperties) + delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) delete(rawMsg, key) @@ -386,45 +389,6 @@ func (p *Properties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "systemData", r.SystemData) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. -func (r *Resource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &r.SystemData) - 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 SKU. func (s SKU) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -499,58 +463,12 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "systemData", t.SystemData) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. -func (t *TrackedResource) UnmarshalJSON(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 "location": - err = unpopulate(val, "Location", &t.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &t.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &t.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type UpdateParameters. func (u UpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "identity", u.Identity) populate(objectMap, "location", u.Location) + populate(objectMap, "properties", u.Properties) populate(objectMap, "sku", u.SKU) populate(objectMap, "tags", u.Tags) return json.Marshal(objectMap) @@ -571,6 +489,9 @@ func (u *UpdateParameters) UnmarshalJSON(data []byte) error { case "location": err = unpopulate(val, "Location", &u.Location) delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &u.Properties) + delete(rawMsg, key) case "sku": err = unpopulate(val, "SKU", &u.SKU) delete(rawMsg, key) @@ -616,33 +537,6 @@ func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ValidationResult. -func (v ValidationResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "status", v.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ValidationResult. -func (v *ValidationResult) UnmarshalJSON(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 "status": - err = unpopulate(val, "Status", &v.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - } - return nil -} - func populate(m map[string]any, k string, v any) { if v == nil { return @@ -664,7 +558,7 @@ func populateAny(m map[string]any, k string, v any) { } func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/sdk/resourcemanager/healthbot/armhealthbot/operations_client.go b/sdk/resourcemanager/healthbot/armhealthbot/operations_client.go index 2022d784b39c..7dc12b4be761 100644 --- a/sdk/resourcemanager/healthbot/armhealthbot/operations_client.go +++ b/sdk/resourcemanager/healthbot/armhealthbot/operations_client.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armhealthbot @@ -14,7 +13,10 @@ import ( "net/http" ) -// OperationsClient contains the methods for the Operations group. +// OperationsClient - This is the interface that implements the standard Azure Resource Manager operation that returns +// all supported RP operations. You should have exactly one declaration for each +// Azure Resource Manager service. It implements +// GET "/providers/Microsoft.ContosoProviderHub/operations" // Don't use this type directly, use NewOperationsClient() instead. type OperationsClient struct { internal *arm.Client @@ -22,7 +24,7 @@ type OperationsClient struct { // NewOperationsClient creates a new instance of OperationsClient with the specified values. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -36,7 +38,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all the available Azure Health Bot operations. // -// Generated from API version 2021-06-10 +// Generated from API version 2025-11-01 // - 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]{ @@ -62,14 +64,14 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.HealthBot/operations" 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-06-10") + reqQP.Set("api-version", "2025-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/healthbot/armhealthbot/operations_client_example_test.go b/sdk/resourcemanager/healthbot/armhealthbot/operations_client_example_test.go index b89d333e7050..0c970542e26e 100644 --- a/sdk/resourcemanager/healthbot/armhealthbot/operations_client_example_test.go +++ b/sdk/resourcemanager/healthbot/armhealthbot/operations_client_example_test.go @@ -1,27 +1,24 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armhealthbot_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthbot/armhealthbot" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthbot/armhealthbot/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/healthbot/resource-manager/Microsoft.HealthBot/stable/2021-06-10/examples/GetOperations.json +// Generated from example definition: 2025-11-01/GetOperations.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 := armhealthbot.NewClientFactory("", cred, nil) + clientFactory, err := armhealthbot.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -36,38 +33,41 @@ func ExampleOperationsClient_NewListPager() { _ = 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.AvailableOperations = armhealthbot.AvailableOperations{ - // Value: []*armhealthbot.OperationDetail{ - // { - // Name: to.Ptr("Microsoft.Healthbot/healthbots/read"), - // Display: &armhealthbot.OperationDisplay{ - // Description: to.Ptr("Read Azure Health Bot"), - // Operation: to.Ptr("Read Azure Health Bot"), - // Provider: to.Ptr("Azure Health Bot"), - // Resource: to.Ptr("Azure Health Bot"), + // page = armhealthbot.OperationsClientListResponse{ + // AvailableOperations: armhealthbot.AvailableOperations{ + // Value: []*armhealthbot.OperationDetail{ + // { + // Name: to.Ptr("Microsoft.Healthbot/healthbots/read"), + // Display: &armhealthbot.OperationDisplay{ + // Description: to.Ptr("Read Azure Health Bot"), + // Operation: to.Ptr("Read Azure Health Bot"), + // Provider: to.Ptr("Azure Health Bot"), + // Resource: to.Ptr("Azure Health Bot"), + // }, + // Origin: to.Ptr("user,system"), // }, - // Origin: to.Ptr("user,system"), - // }, - // { - // Name: to.Ptr("Microsoft.Healthbot/healthbots/write"), - // Display: &armhealthbot.OperationDisplay{ - // Description: to.Ptr("Writes Azure Health Bot"), - // Operation: to.Ptr("Write Azure Health Bot"), - // Provider: to.Ptr("Azure Health Bot"), - // Resource: to.Ptr("Azure Health Bot"), + // { + // Name: to.Ptr("Microsoft.Healthbot/healthbots/write"), + // Display: &armhealthbot.OperationDisplay{ + // Description: to.Ptr("Writes Azure Health Bot"), + // Operation: to.Ptr("Write Azure Health Bot"), + // Provider: to.Ptr("Azure Health Bot"), + // Resource: to.Ptr("Azure Health Bot"), + // }, + // Origin: to.Ptr("user,system"), // }, - // Origin: to.Ptr("user,system"), - // }, - // { - // Name: to.Ptr("Microsoft.Healthbot/healthbots/delete"), - // Display: &armhealthbot.OperationDisplay{ - // Description: to.Ptr("Deletes Azure Health Bot"), - // Operation: to.Ptr("Delete Azure Health Bot"), - // Provider: to.Ptr("Azure Health Bot"), - // Resource: to.Ptr("Azure Health Bot"), + // { + // Name: to.Ptr("Microsoft.Healthbot/healthbots/delete"), + // Display: &armhealthbot.OperationDisplay{ + // Description: to.Ptr("Deletes Azure Health Bot"), + // Operation: to.Ptr("Delete Azure Health Bot"), + // Provider: to.Ptr("Azure Health Bot"), + // Resource: to.Ptr("Azure Health Bot"), + // }, + // Origin: to.Ptr("user,system"), // }, - // Origin: to.Ptr("user,system"), - // }}, + // }, + // }, // } } } diff --git a/sdk/resourcemanager/healthbot/armhealthbot/options.go b/sdk/resourcemanager/healthbot/armhealthbot/options.go index f0787a06b912..bcec8b0dc20e 100644 --- a/sdk/resourcemanager/healthbot/armhealthbot/options.go +++ b/sdk/resourcemanager/healthbot/armhealthbot/options.go @@ -1,19 +1,24 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armhealthbot // BotsClientBeginCreateOptions contains the optional parameters for the BotsClient.BeginCreate method. type BotsClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // BotsClientBeginDeleteOptions contains the optional parameters for the BotsClient.BeginDelete method. type BotsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// BotsClientBeginUpdateOptions contains the optional parameters for the BotsClient.BeginUpdate method. +type BotsClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -32,8 +37,13 @@ type BotsClientListOptions struct { // placeholder for future optional parameters } -// BotsClientUpdateOptions contains the optional parameters for the BotsClient.Update method. -type BotsClientUpdateOptions struct { +// BotsClientListSecretsOptions contains the optional parameters for the BotsClient.ListSecrets method. +type BotsClientListSecretsOptions struct { + // placeholder for future optional parameters +} + +// BotsClientRegenerateAPIJwtSecretOptions contains the optional parameters for the BotsClient.RegenerateAPIJwtSecret method. +type BotsClientRegenerateAPIJwtSecretOptions struct { // placeholder for future optional parameters } diff --git a/sdk/resourcemanager/healthbot/armhealthbot/response_types.go b/sdk/resourcemanager/healthbot/armhealthbot/responses.go similarity index 73% rename from sdk/resourcemanager/healthbot/armhealthbot/response_types.go rename to sdk/resourcemanager/healthbot/armhealthbot/responses.go index dec7277ff43c..b1de8a98ea0f 100644 --- a/sdk/resourcemanager/healthbot/armhealthbot/response_types.go +++ b/sdk/resourcemanager/healthbot/armhealthbot/responses.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armhealthbot @@ -34,7 +33,19 @@ type BotsClientListResponse struct { BotResponseList } -// BotsClientUpdateResponse contains the response from method BotsClient.Update. +// BotsClientListSecretsResponse contains the response from method BotsClient.ListSecrets. +type BotsClientListSecretsResponse struct { + // Health Bot Keys Response. + KeysResponse +} + +// BotsClientRegenerateAPIJwtSecretResponse contains the response from method BotsClient.RegenerateAPIJwtSecret. +type BotsClientRegenerateAPIJwtSecretResponse struct { + // An entry of HealthBotKeysResponse + Key +} + +// BotsClientUpdateResponse contains the response from method BotsClient.BeginUpdate. type BotsClientUpdateResponse struct { // Azure Health Bot resource definition HealthBot @@ -42,6 +53,6 @@ type BotsClientUpdateResponse struct { // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { - // Available operations of the service + // Available operations of the service. AvailableOperations } diff --git a/sdk/resourcemanager/healthbot/armhealthbot/testdata/_metadata.json b/sdk/resourcemanager/healthbot/armhealthbot/testdata/_metadata.json new file mode 100644 index 000000000000..49ad5ef65641 --- /dev/null +++ b/sdk/resourcemanager/healthbot/armhealthbot/testdata/_metadata.json @@ -0,0 +1,4 @@ +{ + "apiVersion": "2025-11-01", + "emitterVersion": "0.8.8" +} \ No newline at end of file diff --git a/sdk/resourcemanager/healthbot/armhealthbot/time_rfc3339.go b/sdk/resourcemanager/healthbot/armhealthbot/time_rfc3339.go index 9a38c747e3fe..f2213a7816ab 100644 --- a/sdk/resourcemanager/healthbot/armhealthbot/time_rfc3339.go +++ b/sdk/resourcemanager/healthbot/armhealthbot/time_rfc3339.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armhealthbot @@ -16,12 +15,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -37,17 +40,36 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -58,6 +80,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -71,7 +97,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/healthbot/armhealthbot/tsp-location.yaml b/sdk/resourcemanager/healthbot/armhealthbot/tsp-location.yaml new file mode 100644 index 000000000000..b62929a743c6 --- /dev/null +++ b/sdk/resourcemanager/healthbot/armhealthbot/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/healthbot/HealthBot.Management +commit: 16c5a93d4e3e6d4cec95c969991fd65cb3458327 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/resourcemanager/healthbot/armhealthbot/version.go b/sdk/resourcemanager/healthbot/armhealthbot/version.go new file mode 100644 index 000000000000..3ee25fd7b962 --- /dev/null +++ b/sdk/resourcemanager/healthbot/armhealthbot/version.go @@ -0,0 +1,10 @@ +// 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) Go Code Generator. + +package armhealthbot + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthbot/armhealthbot/v2" + moduleVersion = "v2.0.0" +)