[Release] sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/0.1.0 TypeSpec (#23318)

* [Release] sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/0.1.0 generation from spec commit: 925b1febaaebc3e1d602c765168e8ddabc7153a5

* update README.md

* update examples link
This commit is contained in:
Peng Jiahui 2024-08-15 11:39:06 +08:00 коммит произвёл GitHub
Родитель 36517988a9
Коммит 2532a53cfb
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
29 изменённых файлов: 4724 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,8 @@
# Release History
## 0.1.0 (2024-08-15)
### Other Changes
The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html).
To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt).

Просмотреть файл

@ -0,0 +1,21 @@
MIT License
Copyright (c) Microsoft Corporation. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Просмотреть файл

@ -0,0 +1,92 @@
# Azure HealthDataAIServices Module for Go
[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices)
The `armhealthdataaiservices` module provides operations for working with Azure HealthDataAIServices.
[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices)
# Getting started
## Prerequisites
- an [Azure subscription](https://azure.microsoft.com/free/)
- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).)
## Install the package
This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management.
Install the Azure HealthDataAIServices module:
```sh
go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices
```
## Authorization
When creating a client, you will need to provide a credential for authenticating with Azure HealthDataAIServices. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more.
```go
cred, err := azidentity.NewDefaultAzureCredential(nil)
```
For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity).
## Client Factory
Azure HealthDataAIServices module consists of one or more clients. We provide a client factory which could be used to create any client in this module.
```go
clientFactory, err := armhealthdataaiservices.NewClientFactory(<subscription ID>, cred, nil)
```
You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore).
```go
options := arm.ClientOptions {
ClientOptions: azcore.ClientOptions {
Cloud: cloud.AzureChina,
},
}
clientFactory, err := armhealthdataaiservices.NewClientFactory(<subscription ID>, cred, &options)
```
## Clients
A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory.
```go
client := clientFactory.NewDeidServicesClient()
```
## Fakes
The fake package contains types used for constructing in-memory fake servers used in unit tests.
This allows writing tests to cover various success/error conditions without the need for connecting to a live service.
Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes.
## Provide Feedback
If you encounter bugs or have suggestions, please
[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `HealthDataAIServices` label.
# Contributing
This project welcomes contributions and suggestions. Most contributions require
you to agree to a Contributor License Agreement (CLA) declaring that you have
the right to, and actually do, grant us the rights to use your contribution.
For details, visit [https://cla.microsoft.com](https://cla.microsoft.com).
When you submit a pull request, a CLA-bot will automatically determine whether
you need to provide a CLA and decorate the PR appropriately (e.g., label,
comment). Simply follow the instructions provided by the bot. You will only
need to do this once across all repos using our CLA.
This project has adopted the
[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information, see the
[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any
additional questions or comments.

Просмотреть файл

@ -0,0 +1,28 @@
# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file.
trigger:
branches:
include:
- main
- feature/*
- hotfix/*
- release/*
paths:
include:
- sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/
pr:
branches:
include:
- main
- feature/*
- hotfix/*
- release/*
paths:
include:
- sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/
extends:
template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml
parameters:
IncludeRelease: true
ServiceDirectory: 'resourcemanager/healthdataaiservices/armhealthdataaiservices'

Просмотреть файл

@ -0,0 +1,64 @@
// 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. DO NOT EDIT.
package armhealthdataaiservices
import (
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
)
// ClientFactory is a client factory used to create any client in this module.
// Don't use this type directly, use NewClientFactory instead.
type ClientFactory struct {
subscriptionID string
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 - 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) {
internal, err := arm.NewClient(moduleName, moduleVersion, credential, options)
if err != nil {
return nil, err
}
return &ClientFactory{
subscriptionID: subscriptionID,
internal: internal,
}, nil
}
// NewDeidServicesClient creates a new instance of DeidServicesClient.
func (c *ClientFactory) NewDeidServicesClient() *DeidServicesClient {
return &DeidServicesClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewOperationsClient creates a new instance of OperationsClient.
func (c *ClientFactory) NewOperationsClient() *OperationsClient {
return &OperationsClient{
internal: c.internal,
}
}
// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient.
func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient {
return &PrivateEndpointConnectionsClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewPrivateLinksClient creates a new instance of PrivateLinksClient.
func (c *ClientFactory) NewPrivateLinksClient() *PrivateLinksClient {
return &PrivateLinksClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}

Просмотреть файл

@ -0,0 +1,191 @@
// 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. DO NOT EDIT.
package armhealthdataaiservices
const (
moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices"
moduleVersion = "v0.1.0"
)
// ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.
type ActionType string
const (
// ActionTypeInternal - Actions are for internal-only APIs.
ActionTypeInternal ActionType = "Internal"
)
// PossibleActionTypeValues returns the possible values for the ActionType const type.
func PossibleActionTypeValues() []ActionType {
return []ActionType{
ActionTypeInternal,
}
}
// CreatedByType - The kind of entity that created the resource.
type CreatedByType string
const (
// 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"
)
// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type.
func PossibleCreatedByTypeValues() []CreatedByType {
return []CreatedByType{
CreatedByTypeApplication,
CreatedByTypeKey,
CreatedByTypeManagedIdentity,
CreatedByTypeUser,
}
}
// ManagedServiceIdentityType - Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).
type ManagedServiceIdentityType string
const (
// ManagedServiceIdentityTypeNone - No managed identity.
ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None"
// ManagedServiceIdentityTypeSystemAndUserAssigned - System and user assigned managed identity.
ManagedServiceIdentityTypeSystemAndUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned"
// ManagedServiceIdentityTypeSystemAssigned - System assigned managed identity.
ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned"
// ManagedServiceIdentityTypeUserAssigned - User assigned managed identity.
ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned"
)
// PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type.
func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType {
return []ManagedServiceIdentityType{
ManagedServiceIdentityTypeNone,
ManagedServiceIdentityTypeSystemAndUserAssigned,
ManagedServiceIdentityTypeSystemAssigned,
ManagedServiceIdentityTypeUserAssigned,
}
}
// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default
// value is "user,system"
type Origin string
const (
// OriginSystem - Indicates the operation is initiated by a system.
OriginSystem Origin = "system"
// OriginUser - Indicates the operation is initiated by a user.
OriginUser Origin = "user"
// OriginUserSystem - Indicates the operation is initiated by a user or system.
OriginUserSystem Origin = "user,system"
)
// PossibleOriginValues returns the possible values for the Origin const type.
func PossibleOriginValues() []Origin {
return []Origin{
OriginSystem,
OriginUser,
OriginUserSystem,
}
}
// PrivateEndpointConnectionProvisioningState - The current provisioning state.
type PrivateEndpointConnectionProvisioningState string
const (
// PrivateEndpointConnectionProvisioningStateCreating - Connection is being created
PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating"
// PrivateEndpointConnectionProvisioningStateDeleting - Connection is being deleted
PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting"
// PrivateEndpointConnectionProvisioningStateFailed - Connection provisioning has failed
PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed"
// PrivateEndpointConnectionProvisioningStateSucceeded - Connection has been provisioned
PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded"
)
// PossiblePrivateEndpointConnectionProvisioningStateValues returns the possible values for the PrivateEndpointConnectionProvisioningState const type.
func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState {
return []PrivateEndpointConnectionProvisioningState{
PrivateEndpointConnectionProvisioningStateCreating,
PrivateEndpointConnectionProvisioningStateDeleting,
PrivateEndpointConnectionProvisioningStateFailed,
PrivateEndpointConnectionProvisioningStateSucceeded,
}
}
// PrivateEndpointServiceConnectionStatus - The private endpoint connection status.
type PrivateEndpointServiceConnectionStatus string
const (
// PrivateEndpointServiceConnectionStatusApproved - Connection approved
PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved"
// PrivateEndpointServiceConnectionStatusPending - Connectionaiting for approval or rejection
PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending"
// PrivateEndpointServiceConnectionStatusRejected - Connection Rejected
PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected"
)
// PossiblePrivateEndpointServiceConnectionStatusValues returns the possible values for the PrivateEndpointServiceConnectionStatus const type.
func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus {
return []PrivateEndpointServiceConnectionStatus{
PrivateEndpointServiceConnectionStatusApproved,
PrivateEndpointServiceConnectionStatusPending,
PrivateEndpointServiceConnectionStatusRejected,
}
}
// ProvisioningState - The status of the current operation.
type ProvisioningState string
const (
// ProvisioningStateAccepted - The resource provisioning request has been accepted.
ProvisioningStateAccepted ProvisioningState = "Accepted"
// ProvisioningStateCanceled - Resource creation was canceled.
ProvisioningStateCanceled ProvisioningState = "Canceled"
// ProvisioningStateDeleting - The resource is being deleted.
ProvisioningStateDeleting ProvisioningState = "Deleting"
// ProvisioningStateFailed - Resource creation failed.
ProvisioningStateFailed ProvisioningState = "Failed"
// ProvisioningStateProvisioning - The resource is being provisioned.
ProvisioningStateProvisioning ProvisioningState = "Provisioning"
// ProvisioningStateSucceeded - Resource has been created.
ProvisioningStateSucceeded ProvisioningState = "Succeeded"
// ProvisioningStateUpdating - The resource is being updated.
ProvisioningStateUpdating ProvisioningState = "Updating"
)
// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type.
func PossibleProvisioningStateValues() []ProvisioningState {
return []ProvisioningState{
ProvisioningStateAccepted,
ProvisioningStateCanceled,
ProvisioningStateDeleting,
ProvisioningStateFailed,
ProvisioningStateProvisioning,
ProvisioningStateSucceeded,
ProvisioningStateUpdating,
}
}
// PublicNetworkAccess - State of the public network access.
type PublicNetworkAccess string
const (
// PublicNetworkAccessDisabled - The public network access is disabled
PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled"
// PublicNetworkAccessEnabled - The public network access is enabled
PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled"
)
// PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type.
func PossiblePublicNetworkAccessValues() []PublicNetworkAccess {
return []PublicNetworkAccess{
PublicNetworkAccessDisabled,
PublicNetworkAccessEnabled,
}
}

Просмотреть файл

@ -0,0 +1,457 @@
// 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. DO NOT EDIT.
package armhealthdataaiservices
import (
"context"
"errors"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"net/http"
"net/url"
"strings"
)
// DeidServicesClient contains the methods for the DeidServices group.
// Don't use this type directly, use NewDeidServicesClient() instead.
type DeidServicesClient struct {
internal *arm.Client
subscriptionID string
}
// NewDeidServicesClient creates a new instance of DeidServicesClient with the specified values.
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewDeidServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DeidServicesClient, error) {
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
if err != nil {
return nil, err
}
client := &DeidServicesClient{
subscriptionID: subscriptionID,
internal: cl,
}
return client, nil
}
// BeginCreate - Create a DeidService
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2024-02-28-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - deidServiceName - The name of the deid service
// - resource - Resource create parameters.
// - options - DeidServicesClientBeginCreateOptions contains the optional parameters for the DeidServicesClient.BeginCreate
// method.
func (client *DeidServicesClient) BeginCreate(ctx context.Context, resourceGroupName string, deidServiceName string, resource DeidService, options *DeidServicesClientBeginCreateOptions) (*runtime.Poller[DeidServicesClientCreateResponse], error) {
if options == nil || options.ResumeToken == "" {
resp, err := client.create(ctx, resourceGroupName, deidServiceName, resource, options)
if err != nil {
return nil, err
}
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeidServicesClientCreateResponse]{
Tracer: client.internal.Tracer(),
})
return poller, err
} else {
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeidServicesClientCreateResponse]{
Tracer: client.internal.Tracer(),
})
}
}
// Create - Create a DeidService
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2024-02-28-preview
func (client *DeidServicesClient) create(ctx context.Context, resourceGroupName string, deidServiceName string, resource DeidService, options *DeidServicesClientBeginCreateOptions) (*http.Response, error) {
var err error
const operationName = "DeidServicesClient.BeginCreate"
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
defer func() { endSpan(err) }()
req, err := client.createCreateRequest(ctx, resourceGroupName, deidServiceName, resource, options)
if err != nil {
return nil, err
}
httpResp, err := client.internal.Pipeline().Do(req)
if err != nil {
return nil, err
}
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) {
err = runtime.NewResponseError(httpResp)
return nil, err
}
return httpResp, nil
}
// createCreateRequest creates the Create request.
func (client *DeidServicesClient) createCreateRequest(ctx context.Context, resourceGroupName string, deidServiceName string, resource DeidService, _ *DeidServicesClientBeginCreateOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}"
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 deidServiceName == "" {
return nil, errors.New("parameter deidServiceName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{deidServiceName}", url.PathEscape(deidServiceName))
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2024-02-28-preview")
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, resource); err != nil {
return nil, err
}
return req, nil
}
// BeginDelete - Delete a DeidService
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2024-02-28-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - deidServiceName - The name of the deid service
// - options - DeidServicesClientBeginDeleteOptions contains the optional parameters for the DeidServicesClient.BeginDelete
// method.
func (client *DeidServicesClient) BeginDelete(ctx context.Context, resourceGroupName string, deidServiceName string, options *DeidServicesClientBeginDeleteOptions) (*runtime.Poller[DeidServicesClientDeleteResponse], error) {
if options == nil || options.ResumeToken == "" {
resp, err := client.deleteOperation(ctx, resourceGroupName, deidServiceName, options)
if err != nil {
return nil, err
}
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeidServicesClientDeleteResponse]{
Tracer: client.internal.Tracer(),
})
return poller, err
} else {
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeidServicesClientDeleteResponse]{
Tracer: client.internal.Tracer(),
})
}
}
// Delete - Delete a DeidService
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2024-02-28-preview
func (client *DeidServicesClient) deleteOperation(ctx context.Context, resourceGroupName string, deidServiceName string, options *DeidServicesClientBeginDeleteOptions) (*http.Response, error) {
var err error
const operationName = "DeidServicesClient.BeginDelete"
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
defer func() { endSpan(err) }()
req, err := client.deleteCreateRequest(ctx, resourceGroupName, deidServiceName, options)
if err != nil {
return nil, err
}
httpResp, err := client.internal.Pipeline().Do(req)
if err != nil {
return nil, err
}
if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) {
err = runtime.NewResponseError(httpResp)
return nil, err
}
return httpResp, nil
}
// deleteCreateRequest creates the Delete request.
func (client *DeidServicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, deidServiceName string, _ *DeidServicesClientBeginDeleteOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}"
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 deidServiceName == "" {
return nil, errors.New("parameter deidServiceName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{deidServiceName}", url.PathEscape(deidServiceName))
req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2024-02-28-preview")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
}
// Get - Get a DeidService
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2024-02-28-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - deidServiceName - The name of the deid service
// - options - DeidServicesClientGetOptions contains the optional parameters for the DeidServicesClient.Get method.
func (client *DeidServicesClient) Get(ctx context.Context, resourceGroupName string, deidServiceName string, options *DeidServicesClientGetOptions) (DeidServicesClientGetResponse, error) {
var err error
const operationName = "DeidServicesClient.Get"
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
defer func() { endSpan(err) }()
req, err := client.getCreateRequest(ctx, resourceGroupName, deidServiceName, options)
if err != nil {
return DeidServicesClientGetResponse{}, err
}
httpResp, err := client.internal.Pipeline().Do(req)
if err != nil {
return DeidServicesClientGetResponse{}, err
}
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
err = runtime.NewResponseError(httpResp)
return DeidServicesClientGetResponse{}, err
}
resp, err := client.getHandleResponse(httpResp)
return resp, err
}
// getCreateRequest creates the Get request.
func (client *DeidServicesClient) getCreateRequest(ctx context.Context, resourceGroupName string, deidServiceName string, _ *DeidServicesClientGetOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}"
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 deidServiceName == "" {
return nil, errors.New("parameter deidServiceName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{deidServiceName}", url.PathEscape(deidServiceName))
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", "2024-02-28-preview")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
}
// getHandleResponse handles the Get response.
func (client *DeidServicesClient) getHandleResponse(resp *http.Response) (DeidServicesClientGetResponse, error) {
result := DeidServicesClientGetResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result.DeidService); err != nil {
return DeidServicesClientGetResponse{}, err
}
return result, nil
}
// NewListByResourceGroupPager - List DeidService resources by resource group
//
// Generated from API version 2024-02-28-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - options - DeidServicesClientListByResourceGroupOptions contains the optional parameters for the DeidServicesClient.NewListByResourceGroupPager
// method.
func (client *DeidServicesClient) NewListByResourceGroupPager(resourceGroupName string, options *DeidServicesClientListByResourceGroupOptions) *runtime.Pager[DeidServicesClientListByResourceGroupResponse] {
return runtime.NewPager(runtime.PagingHandler[DeidServicesClientListByResourceGroupResponse]{
More: func(page DeidServicesClientListByResourceGroupResponse) bool {
return page.NextLink != nil && len(*page.NextLink) > 0
},
Fetcher: func(ctx context.Context, page *DeidServicesClientListByResourceGroupResponse) (DeidServicesClientListByResourceGroupResponse, error) {
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeidServicesClient.NewListByResourceGroupPager")
nextLink := ""
if page != nil {
nextLink = *page.NextLink
}
resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options)
}, nil)
if err != nil {
return DeidServicesClientListByResourceGroupResponse{}, err
}
return client.listByResourceGroupHandleResponse(resp)
},
Tracer: client.internal.Tracer(),
})
}
// listByResourceGroupCreateRequest creates the ListByResourceGroup request.
func (client *DeidServicesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *DeidServicesClientListByResourceGroupOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices"
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", "2024-02-28-preview")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
}
// listByResourceGroupHandleResponse handles the ListByResourceGroup response.
func (client *DeidServicesClient) listByResourceGroupHandleResponse(resp *http.Response) (DeidServicesClientListByResourceGroupResponse, error) {
result := DeidServicesClientListByResourceGroupResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result.DeidServiceListResult); err != nil {
return DeidServicesClientListByResourceGroupResponse{}, err
}
return result, nil
}
// NewListBySubscriptionPager - List DeidService resources by subscription ID
//
// Generated from API version 2024-02-28-preview
// - options - DeidServicesClientListBySubscriptionOptions contains the optional parameters for the DeidServicesClient.NewListBySubscriptionPager
// method.
func (client *DeidServicesClient) NewListBySubscriptionPager(options *DeidServicesClientListBySubscriptionOptions) *runtime.Pager[DeidServicesClientListBySubscriptionResponse] {
return runtime.NewPager(runtime.PagingHandler[DeidServicesClientListBySubscriptionResponse]{
More: func(page DeidServicesClientListBySubscriptionResponse) bool {
return page.NextLink != nil && len(*page.NextLink) > 0
},
Fetcher: func(ctx context.Context, page *DeidServicesClientListBySubscriptionResponse) (DeidServicesClientListBySubscriptionResponse, error) {
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeidServicesClient.NewListBySubscriptionPager")
nextLink := ""
if page != nil {
nextLink = *page.NextLink
}
resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
return client.listBySubscriptionCreateRequest(ctx, options)
}, nil)
if err != nil {
return DeidServicesClientListBySubscriptionResponse{}, err
}
return client.listBySubscriptionHandleResponse(resp)
},
Tracer: client.internal.Tracer(),
})
}
// listBySubscriptionCreateRequest creates the ListBySubscription request.
func (client *DeidServicesClient) listBySubscriptionCreateRequest(ctx context.Context, _ *DeidServicesClientListBySubscriptionOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HealthDataAIServices/deidServices"
if client.subscriptionID == "" {
return nil, errors.New("parameter client.subscriptionID cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2024-02-28-preview")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
}
// listBySubscriptionHandleResponse handles the ListBySubscription response.
func (client *DeidServicesClient) listBySubscriptionHandleResponse(resp *http.Response) (DeidServicesClientListBySubscriptionResponse, error) {
result := DeidServicesClientListBySubscriptionResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result.DeidServiceListResult); err != nil {
return DeidServicesClientListBySubscriptionResponse{}, err
}
return result, nil
}
// BeginUpdate - Update a DeidService
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2024-02-28-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - deidServiceName - The name of the deid service
// - properties - The resource properties to be updated.
// - options - DeidServicesClientBeginUpdateOptions contains the optional parameters for the DeidServicesClient.BeginUpdate
// method.
func (client *DeidServicesClient) BeginUpdate(ctx context.Context, resourceGroupName string, deidServiceName string, properties DeidUpdate, options *DeidServicesClientBeginUpdateOptions) (*runtime.Poller[DeidServicesClientUpdateResponse], error) {
if options == nil || options.ResumeToken == "" {
resp, err := client.update(ctx, resourceGroupName, deidServiceName, properties, options)
if err != nil {
return nil, err
}
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeidServicesClientUpdateResponse]{
Tracer: client.internal.Tracer(),
})
return poller, err
} else {
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DeidServicesClientUpdateResponse]{
Tracer: client.internal.Tracer(),
})
}
}
// Update - Update a DeidService
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2024-02-28-preview
func (client *DeidServicesClient) update(ctx context.Context, resourceGroupName string, deidServiceName string, properties DeidUpdate, options *DeidServicesClientBeginUpdateOptions) (*http.Response, error) {
var err error
const operationName = "DeidServicesClient.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, deidServiceName, properties, options)
if err != nil {
return nil, err
}
httpResp, err := client.internal.Pipeline().Do(req)
if err != nil {
return nil, err
}
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) {
err = runtime.NewResponseError(httpResp)
return nil, err
}
return httpResp, nil
}
// updateCreateRequest creates the Update request.
func (client *DeidServicesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, deidServiceName string, properties DeidUpdate, _ *DeidServicesClientBeginUpdateOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}"
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 deidServiceName == "" {
return nil, errors.New("parameter deidServiceName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{deidServiceName}", url.PathEscape(deidServiceName))
req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2024-02-28-preview")
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, properties); err != nil {
return nil, err
}
return req, nil
}

Просмотреть файл

@ -0,0 +1,476 @@
// 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. DO NOT EDIT.
package armhealthdataaiservices_test
import (
"context"
"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/healthdataaiservices/armhealthdataaiservices"
"log"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/DeidServices_Create_MaximumSet_Gen.json
func ExampleDeidServicesClient_BeginCreate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhealthdataaiservices.NewClientFactory("F21BB31B-C214-42C0-ACF0-DACCA05D3011", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDeidServicesClient().BeginCreate(ctx, "rgopenapi", "deidTest", armhealthdataaiservices.DeidService{
Properties: &armhealthdataaiservices.DeidServiceProperties{
PublicNetworkAccess: to.Ptr(armhealthdataaiservices.PublicNetworkAccessEnabled),
},
Identity: &armhealthdataaiservices.ManagedServiceIdentity{
Type: to.Ptr(armhealthdataaiservices.ManagedServiceIdentityTypeNone),
UserAssignedIdentities: map[string]*armhealthdataaiservices.UserAssignedIdentity{},
},
Tags: map[string]*string{},
Location: to.Ptr("qwyhvdwcsjulggagdqxlmazcl"),
}, 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 = armhealthdataaiservices.DeidServicesClientCreateResponse{
// DeidService: &armhealthdataaiservices.DeidService{
// Properties: &armhealthdataaiservices.DeidServiceProperties{
// ProvisioningState: to.Ptr(armhealthdataaiservices.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armhealthdataaiservices.PublicNetworkAccessEnabled),
// PrivateEndpointConnections: []*armhealthdataaiservices.PrivateEndpointConnection{
// {
// Properties: &armhealthdataaiservices.PrivateEndpointConnectionProperties{
// PrivateEndpoint: &armhealthdataaiservices.PrivateEndpoint{
// ID: to.Ptr("gpnxxbbtsysdhhclm"),
// },
// PrivateLinkServiceConnectionState: &armhealthdataaiservices.PrivateLinkServiceConnectionState{
// Status: to.Ptr(armhealthdataaiservices.PrivateEndpointServiceConnectionStatusPending),
// ActionsRequired: to.Ptr("ulb"),
// Description: to.Ptr("ddxuoved"),
// },
// GroupIDs: []*string{
// to.Ptr("xbdyjqg"),
// },
// ProvisioningState: to.Ptr(armhealthdataaiservices.PrivateEndpointConnectionProvisioningStateSucceeded),
// },
// ID: to.Ptr("/subscriptions/F21BB31B-C214-42C0-ACF0-DACCA05D3011/resourceGroups/rgopenapi/providers/Microsoft.HealthDataAIServices/deidServices/nlrthrxaukih/privateEndpointConnections/mdwvqjtwcjcvrh"),
// Name: to.Ptr("mdwvqjtwcjcvrh"),
// Type: to.Ptr("bzxabjlpbwreez"),
// SystemData: &armhealthdataaiservices.SystemData{
// CreatedBy: to.Ptr("p"),
// CreatedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.985Z"); return t}()),
// LastModifiedBy: to.Ptr("pmbozfvwrblbknedeb"),
// LastModifiedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.986Z"); return t}()),
// },
// },
// },
// ServiceURL: to.Ptr("woponotsxaippkvhwmibffywnqcfru"),
// },
// Identity: &armhealthdataaiservices.ManagedServiceIdentity{
// Type: to.Ptr(armhealthdataaiservices.ManagedServiceIdentityTypeNone),
// UserAssignedIdentities: map[string]*armhealthdataaiservices.UserAssignedIdentity{
// },
// PrincipalID: to.Ptr("a82361f4-5320-4a26-8d1b-45832d2164dd"),
// TenantID: to.Ptr("53a6a686-ae15-4a1d-badf-3e7947918893"),
// },
// Tags: map[string]*string{
// },
// Location: to.Ptr("qwyhvdwcsjulggagdqxlmazcl"),
// ID: to.Ptr("/subscriptions/F21BB31B-C214-42C0-ACF0-DACCA05D3011/resourceGroups/rgopenapi/providers/Microsoft.HealthDataAIServices/deidServices/nlrthrxaukih"),
// Name: to.Ptr("nlrthrxaukih"),
// Type: to.Ptr("slyfiibvwlhfdpzjynsywhbfauexk"),
// SystemData: &armhealthdataaiservices.SystemData{
// CreatedBy: to.Ptr("p"),
// CreatedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.985Z"); return t}()),
// LastModifiedBy: to.Ptr("pmbozfvwrblbknedeb"),
// LastModifiedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.986Z"); return t}()),
// },
// },
// }
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/DeidServices_Delete_MaximumSet_Gen.json
func ExampleDeidServicesClient_BeginDelete() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhealthdataaiservices.NewClientFactory("F21BB31B-C214-42C0-ACF0-DACCA05D3011", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDeidServicesClient().BeginDelete(ctx, "rgopenapi", "deidTest", 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/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/DeidServices_Get_MaximumSet_Gen.json
func ExampleDeidServicesClient_Get() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhealthdataaiservices.NewClientFactory("F21BB31B-C214-42C0-ACF0-DACCA05D3011", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewDeidServicesClient().Get(ctx, "rgopenapi", "deidTest", 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 = armhealthdataaiservices.DeidServicesClientGetResponse{
// DeidService: &armhealthdataaiservices.DeidService{
// Properties: &armhealthdataaiservices.DeidServiceProperties{
// ProvisioningState: to.Ptr(armhealthdataaiservices.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armhealthdataaiservices.PublicNetworkAccessEnabled),
// PrivateEndpointConnections: []*armhealthdataaiservices.PrivateEndpointConnection{
// {
// Properties: &armhealthdataaiservices.PrivateEndpointConnectionProperties{
// PrivateEndpoint: &armhealthdataaiservices.PrivateEndpoint{
// ID: to.Ptr("gpnxxbbtsysdhhclm"),
// },
// PrivateLinkServiceConnectionState: &armhealthdataaiservices.PrivateLinkServiceConnectionState{
// Status: to.Ptr(armhealthdataaiservices.PrivateEndpointServiceConnectionStatusPending),
// ActionsRequired: to.Ptr("ulb"),
// Description: to.Ptr("ddxuoved"),
// },
// GroupIDs: []*string{
// to.Ptr("xbdyjqg"),
// },
// ProvisioningState: to.Ptr(armhealthdataaiservices.PrivateEndpointConnectionProvisioningStateSucceeded),
// },
// ID: to.Ptr("/subscriptions/F21BB31B-C214-42C0-ACF0-DACCA05D3011/resourceGroups/rgopenapi/providers/Microsoft.HealthDataAIServices/deidServices/nlrthrxaukih/privateEndpointConnections/mdwvqjtwcjcvrh"),
// Name: to.Ptr("mdwvqjtwcjcvrh"),
// Type: to.Ptr("bzxabjlpbwreez"),
// SystemData: &armhealthdataaiservices.SystemData{
// CreatedBy: to.Ptr("p"),
// CreatedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.985Z"); return t}()),
// LastModifiedBy: to.Ptr("pmbozfvwrblbknedeb"),
// LastModifiedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.986Z"); return t}()),
// },
// },
// },
// ServiceURL: to.Ptr("woponotsxaippkvhwmibffywnqcfru"),
// },
// Identity: &armhealthdataaiservices.ManagedServiceIdentity{
// Type: to.Ptr(armhealthdataaiservices.ManagedServiceIdentityTypeNone),
// UserAssignedIdentities: map[string]*armhealthdataaiservices.UserAssignedIdentity{
// },
// PrincipalID: to.Ptr("a82361f4-5320-4a26-8d1b-45832d2164dd"),
// TenantID: to.Ptr("53a6a686-ae15-4a1d-badf-3e7947918893"),
// },
// Tags: map[string]*string{
// },
// Location: to.Ptr("qwyhvdwcsjulggagdqxlmazcl"),
// ID: to.Ptr("/subscriptions/F21BB31B-C214-42C0-ACF0-DACCA05D3011/resourceGroups/rgopenapi/providers/Microsoft.HealthDataAIServices/deidServices/nlrthrxaukih"),
// Name: to.Ptr("nlrthrxaukih"),
// Type: to.Ptr("slyfiibvwlhfdpzjynsywhbfauexk"),
// SystemData: &armhealthdataaiservices.SystemData{
// CreatedBy: to.Ptr("p"),
// CreatedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.985Z"); return t}()),
// LastModifiedBy: to.Ptr("pmbozfvwrblbknedeb"),
// LastModifiedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.986Z"); return t}()),
// },
// },
// }
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/DeidServices_ListByResourceGroup_MaximumSet_Gen.json
func ExampleDeidServicesClient_NewListByResourceGroupPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhealthdataaiservices.NewClientFactory("F21BB31B-C214-42C0-ACF0-DACCA05D3011", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewDeidServicesClient().NewListByResourceGroupPager("rgopenapi", nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page = armhealthdataaiservices.DeidServicesClientListByResourceGroupResponse{
// DeidServiceListResult: armhealthdataaiservices.DeidServiceListResult{
// Value: []*armhealthdataaiservices.DeidService{
// {
// Properties: &armhealthdataaiservices.DeidServiceProperties{
// ProvisioningState: to.Ptr(armhealthdataaiservices.ProvisioningStateSucceeded),
// ServiceURL: to.Ptr("woponotsxaippkvhwmibffywnqcfru"),
// PrivateEndpointConnections: []*armhealthdataaiservices.PrivateEndpointConnection{
// {
// Properties: &armhealthdataaiservices.PrivateEndpointConnectionProperties{
// GroupIDs: []*string{
// to.Ptr("xbdyjqg"),
// },
// PrivateEndpoint: &armhealthdataaiservices.PrivateEndpoint{
// ID: to.Ptr("gpnxxbbtsysdhhclm"),
// },
// PrivateLinkServiceConnectionState: &armhealthdataaiservices.PrivateLinkServiceConnectionState{
// Status: to.Ptr(armhealthdataaiservices.PrivateEndpointServiceConnectionStatusPending),
// ActionsRequired: to.Ptr("ulb"),
// Description: to.Ptr("ro"),
// },
// ProvisioningState: to.Ptr(armhealthdataaiservices.PrivateEndpointConnectionProvisioningStateSucceeded),
// },
// ID: to.Ptr("/subscriptions/F21BB31B-C214-42C0-ACF0-DACCA05D3011/resourceGroups/rgopenapi/providers/Microsoft.HealthDataAIServices/deidServices/nlrthrxaukih/privateEndpointConnections/mdwvqjtwcjcvrh"),
// Name: to.Ptr("mdwvqjtwcjcvrh"),
// Type: to.Ptr("bzxabjlpbwreez"),
// SystemData: &armhealthdataaiservices.SystemData{
// CreatedBy: to.Ptr("p"),
// CreatedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.985Z"); return t}()),
// LastModifiedBy: to.Ptr("pmbozfvwrblbknedeb"),
// LastModifiedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.986Z"); return t}()),
// },
// },
// },
// PublicNetworkAccess: to.Ptr(armhealthdataaiservices.PublicNetworkAccessEnabled),
// },
// Identity: &armhealthdataaiservices.ManagedServiceIdentity{
// PrincipalID: to.Ptr("a82361f4-5320-4a26-8d1b-45832d2164dd"),
// TenantID: to.Ptr("53a6a686-ae15-4a1d-badf-3e7947918893"),
// Type: to.Ptr(armhealthdataaiservices.ManagedServiceIdentityTypeNone),
// UserAssignedIdentities: map[string]*armhealthdataaiservices.UserAssignedIdentity{
// },
// },
// Tags: map[string]*string{
// },
// Location: to.Ptr("qwyhvdwcsjulggagdqxlmazcl"),
// ID: to.Ptr("/subscriptions/F21BB31B-C214-42C0-ACF0-DACCA05D3011/resourceGroups/rgopenapi/providers/Microsoft.HealthDataAIServices/deidServices/nlrthrxaukih"),
// Name: to.Ptr("nlrthrxaukih"),
// Type: to.Ptr("slyfiibvwlhfdpzjynsywhbfauexk"),
// SystemData: &armhealthdataaiservices.SystemData{
// CreatedBy: to.Ptr("p"),
// CreatedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.985Z"); return t}()),
// LastModifiedBy: to.Ptr("pmbozfvwrblbknedeb"),
// LastModifiedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.986Z"); return t}()),
// },
// },
// },
// NextLink: to.Ptr("https://microsoft.com/a"),
// },
// }
}
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/DeidServices_ListBySubscription_MaximumSet_Gen.json
func ExampleDeidServicesClient_NewListBySubscriptionPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhealthdataaiservices.NewClientFactory("F21BB31B-C214-42C0-ACF0-DACCA05D3011", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewDeidServicesClient().NewListBySubscriptionPager(nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page = armhealthdataaiservices.DeidServicesClientListBySubscriptionResponse{
// DeidServiceListResult: armhealthdataaiservices.DeidServiceListResult{
// Value: []*armhealthdataaiservices.DeidService{
// {
// Properties: &armhealthdataaiservices.DeidServiceProperties{
// ProvisioningState: to.Ptr(armhealthdataaiservices.ProvisioningStateSucceeded),
// ServiceURL: to.Ptr("woponotsxaippkvhwmibffywnqcfru"),
// PrivateEndpointConnections: []*armhealthdataaiservices.PrivateEndpointConnection{
// {
// Properties: &armhealthdataaiservices.PrivateEndpointConnectionProperties{
// GroupIDs: []*string{
// to.Ptr("xbdyjqg"),
// },
// PrivateEndpoint: &armhealthdataaiservices.PrivateEndpoint{
// ID: to.Ptr("gpnxxbbtsysdhhclm"),
// },
// PrivateLinkServiceConnectionState: &armhealthdataaiservices.PrivateLinkServiceConnectionState{
// Status: to.Ptr(armhealthdataaiservices.PrivateEndpointServiceConnectionStatusPending),
// ActionsRequired: to.Ptr("ulb"),
// Description: to.Ptr("ro"),
// },
// ProvisioningState: to.Ptr(armhealthdataaiservices.PrivateEndpointConnectionProvisioningStateSucceeded),
// },
// ID: to.Ptr("/subscriptions/F21BB31B-C214-42C0-ACF0-DACCA05D3011/resourceGroups/rgopenapi/providers/Microsoft.HealthDataAIServices/deidServices/nlrthrxaukih/privateEndpointConnections/mdwvqjtwcjcvrh"),
// Name: to.Ptr("mdwvqjtwcjcvrh"),
// Type: to.Ptr("bzxabjlpbwreez"),
// SystemData: &armhealthdataaiservices.SystemData{
// CreatedBy: to.Ptr("p"),
// CreatedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.985Z"); return t}()),
// LastModifiedBy: to.Ptr("pmbozfvwrblbknedeb"),
// LastModifiedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.986Z"); return t}()),
// },
// },
// },
// PublicNetworkAccess: to.Ptr(armhealthdataaiservices.PublicNetworkAccessEnabled),
// },
// Identity: &armhealthdataaiservices.ManagedServiceIdentity{
// PrincipalID: to.Ptr("a82361f4-5320-4a26-8d1b-45832d2164dd"),
// TenantID: to.Ptr("53a6a686-ae15-4a1d-badf-3e7947918893"),
// Type: to.Ptr(armhealthdataaiservices.ManagedServiceIdentityTypeNone),
// UserAssignedIdentities: map[string]*armhealthdataaiservices.UserAssignedIdentity{
// },
// },
// Tags: map[string]*string{
// },
// Location: to.Ptr("qwyhvdwcsjulggagdqxlmazcl"),
// ID: to.Ptr("/subscriptions/F21BB31B-C214-42C0-ACF0-DACCA05D3011/resourceGroups/rgopenapi/providers/Microsoft.HealthDataAIServices/deidServices/nlrthrxaukih"),
// Name: to.Ptr("nlrthrxaukih"),
// Type: to.Ptr("slyfiibvwlhfdpzjynsywhbfauexk"),
// SystemData: &armhealthdataaiservices.SystemData{
// CreatedBy: to.Ptr("p"),
// CreatedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.985Z"); return t}()),
// LastModifiedBy: to.Ptr("pmbozfvwrblbknedeb"),
// LastModifiedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.986Z"); return t}()),
// },
// },
// },
// NextLink: to.Ptr("https://microsoft.com/a"),
// },
// }
}
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/DeidServices_Update_MaximumSet_Gen.json
func ExampleDeidServicesClient_BeginUpdate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhealthdataaiservices.NewClientFactory("F21BB31B-C214-42C0-ACF0-DACCA05D3011", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDeidServicesClient().BeginUpdate(ctx, "rgopenapi", "deidTest", armhealthdataaiservices.DeidUpdate{
Identity: &armhealthdataaiservices.ManagedServiceIdentityUpdate{
Type: to.Ptr(armhealthdataaiservices.ManagedServiceIdentityTypeNone),
UserAssignedIdentities: map[string]*armhealthdataaiservices.UserAssignedIdentity{},
},
Tags: map[string]*string{},
Properties: &armhealthdataaiservices.DeidPropertiesUpdate{
PublicNetworkAccess: to.Ptr(armhealthdataaiservices.PublicNetworkAccessEnabled),
},
}, 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 = armhealthdataaiservices.DeidServicesClientUpdateResponse{
// DeidService: &armhealthdataaiservices.DeidService{
// Properties: &armhealthdataaiservices.DeidServiceProperties{
// ProvisioningState: to.Ptr(armhealthdataaiservices.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armhealthdataaiservices.PublicNetworkAccessEnabled),
// PrivateEndpointConnections: []*armhealthdataaiservices.PrivateEndpointConnection{
// {
// Properties: &armhealthdataaiservices.PrivateEndpointConnectionProperties{
// PrivateEndpoint: &armhealthdataaiservices.PrivateEndpoint{
// ID: to.Ptr("gpnxxbbtsysdhhclm"),
// },
// PrivateLinkServiceConnectionState: &armhealthdataaiservices.PrivateLinkServiceConnectionState{
// Status: to.Ptr(armhealthdataaiservices.PrivateEndpointServiceConnectionStatusPending),
// ActionsRequired: to.Ptr("ulb"),
// Description: to.Ptr("ddxuoved"),
// },
// GroupIDs: []*string{
// to.Ptr("xbdyjqg"),
// },
// ProvisioningState: to.Ptr(armhealthdataaiservices.PrivateEndpointConnectionProvisioningStateSucceeded),
// },
// ID: to.Ptr("/subscriptions/F21BB31B-C214-42C0-ACF0-DACCA05D3011/resourceGroups/rgopenapi/providers/Microsoft.HealthDataAIServices/deidServices/nlrthrxaukih/privateEndpointConnections/mdwvqjtwcjcvrh"),
// Name: to.Ptr("mdwvqjtwcjcvrh"),
// Type: to.Ptr("bzxabjlpbwreez"),
// SystemData: &armhealthdataaiservices.SystemData{
// CreatedBy: to.Ptr("p"),
// CreatedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.985Z"); return t}()),
// LastModifiedBy: to.Ptr("pmbozfvwrblbknedeb"),
// LastModifiedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.986Z"); return t}()),
// },
// },
// },
// ServiceURL: to.Ptr("woponotsxaippkvhwmibffywnqcfru"),
// },
// Identity: &armhealthdataaiservices.ManagedServiceIdentity{
// Type: to.Ptr(armhealthdataaiservices.ManagedServiceIdentityTypeNone),
// UserAssignedIdentities: map[string]*armhealthdataaiservices.UserAssignedIdentity{
// },
// PrincipalID: to.Ptr("a82361f4-5320-4a26-8d1b-45832d2164dd"),
// TenantID: to.Ptr("53a6a686-ae15-4a1d-badf-3e7947918893"),
// },
// Tags: map[string]*string{
// },
// Location: to.Ptr("qwyhvdwcsjulggagdqxlmazcl"),
// ID: to.Ptr("/subscriptions/F21BB31B-C214-42C0-ACF0-DACCA05D3011/resourceGroups/rgopenapi/providers/Microsoft.HealthDataAIServices/deidServices/nlrthrxaukih"),
// Name: to.Ptr("nlrthrxaukih"),
// Type: to.Ptr("slyfiibvwlhfdpzjynsywhbfauexk"),
// SystemData: &armhealthdataaiservices.SystemData{
// CreatedBy: to.Ptr("p"),
// CreatedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.985Z"); return t}()),
// LastModifiedBy: to.Ptr("pmbozfvwrblbknedeb"),
// LastModifiedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.986Z"); return t}()),
// },
// },
// }
}

Просмотреть файл

@ -0,0 +1,349 @@
// 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. DO NOT EDIT.
package fake
import (
"context"
"errors"
"fmt"
azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices"
"net/http"
"net/url"
"regexp"
)
// DeidServicesServer is a fake server for instances of the armhealthdataaiservices.DeidServicesClient type.
type DeidServicesServer struct {
// BeginCreate is the fake for method DeidServicesClient.BeginCreate
// HTTP status codes to indicate success: http.StatusOK, http.StatusCreated
BeginCreate func(ctx context.Context, resourceGroupName string, deidServiceName string, resource armhealthdataaiservices.DeidService, options *armhealthdataaiservices.DeidServicesClientBeginCreateOptions) (resp azfake.PollerResponder[armhealthdataaiservices.DeidServicesClientCreateResponse], errResp azfake.ErrorResponder)
// BeginDelete is the fake for method DeidServicesClient.BeginDelete
// HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent
BeginDelete func(ctx context.Context, resourceGroupName string, deidServiceName string, options *armhealthdataaiservices.DeidServicesClientBeginDeleteOptions) (resp azfake.PollerResponder[armhealthdataaiservices.DeidServicesClientDeleteResponse], errResp azfake.ErrorResponder)
// Get is the fake for method DeidServicesClient.Get
// HTTP status codes to indicate success: http.StatusOK
Get func(ctx context.Context, resourceGroupName string, deidServiceName string, options *armhealthdataaiservices.DeidServicesClientGetOptions) (resp azfake.Responder[armhealthdataaiservices.DeidServicesClientGetResponse], errResp azfake.ErrorResponder)
// NewListByResourceGroupPager is the fake for method DeidServicesClient.NewListByResourceGroupPager
// HTTP status codes to indicate success: http.StatusOK
NewListByResourceGroupPager func(resourceGroupName string, options *armhealthdataaiservices.DeidServicesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armhealthdataaiservices.DeidServicesClientListByResourceGroupResponse])
// NewListBySubscriptionPager is the fake for method DeidServicesClient.NewListBySubscriptionPager
// HTTP status codes to indicate success: http.StatusOK
NewListBySubscriptionPager func(options *armhealthdataaiservices.DeidServicesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armhealthdataaiservices.DeidServicesClientListBySubscriptionResponse])
// BeginUpdate is the fake for method DeidServicesClient.BeginUpdate
// HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted
BeginUpdate func(ctx context.Context, resourceGroupName string, deidServiceName string, properties armhealthdataaiservices.DeidUpdate, options *armhealthdataaiservices.DeidServicesClientBeginUpdateOptions) (resp azfake.PollerResponder[armhealthdataaiservices.DeidServicesClientUpdateResponse], errResp azfake.ErrorResponder)
}
// NewDeidServicesServerTransport creates a new instance of DeidServicesServerTransport with the provided implementation.
// The returned DeidServicesServerTransport instance is connected to an instance of armhealthdataaiservices.DeidServicesClient via the
// azcore.ClientOptions.Transporter field in the client's constructor parameters.
func NewDeidServicesServerTransport(srv *DeidServicesServer) *DeidServicesServerTransport {
return &DeidServicesServerTransport{
srv: srv,
beginCreate: newTracker[azfake.PollerResponder[armhealthdataaiservices.DeidServicesClientCreateResponse]](),
beginDelete: newTracker[azfake.PollerResponder[armhealthdataaiservices.DeidServicesClientDeleteResponse]](),
newListByResourceGroupPager: newTracker[azfake.PagerResponder[armhealthdataaiservices.DeidServicesClientListByResourceGroupResponse]](),
newListBySubscriptionPager: newTracker[azfake.PagerResponder[armhealthdataaiservices.DeidServicesClientListBySubscriptionResponse]](),
beginUpdate: newTracker[azfake.PollerResponder[armhealthdataaiservices.DeidServicesClientUpdateResponse]](),
}
}
// DeidServicesServerTransport connects instances of armhealthdataaiservices.DeidServicesClient to instances of DeidServicesServer.
// Don't use this type directly, use NewDeidServicesServerTransport instead.
type DeidServicesServerTransport struct {
srv *DeidServicesServer
beginCreate *tracker[azfake.PollerResponder[armhealthdataaiservices.DeidServicesClientCreateResponse]]
beginDelete *tracker[azfake.PollerResponder[armhealthdataaiservices.DeidServicesClientDeleteResponse]]
newListByResourceGroupPager *tracker[azfake.PagerResponder[armhealthdataaiservices.DeidServicesClientListByResourceGroupResponse]]
newListBySubscriptionPager *tracker[azfake.PagerResponder[armhealthdataaiservices.DeidServicesClientListBySubscriptionResponse]]
beginUpdate *tracker[azfake.PollerResponder[armhealthdataaiservices.DeidServicesClientUpdateResponse]]
}
// Do implements the policy.Transporter interface for DeidServicesServerTransport.
func (d *DeidServicesServerTransport) Do(req *http.Request) (*http.Response, error) {
rawMethod := req.Context().Value(runtime.CtxAPINameKey{})
method, ok := rawMethod.(string)
if !ok {
return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")}
}
return d.dispatchToMethodFake(req, method)
}
func (d *DeidServicesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) {
var resp *http.Response
var err error
switch method {
case "DeidServicesClient.BeginCreate":
resp, err = d.dispatchBeginCreate(req)
case "DeidServicesClient.BeginDelete":
resp, err = d.dispatchBeginDelete(req)
case "DeidServicesClient.Get":
resp, err = d.dispatchGet(req)
case "DeidServicesClient.NewListByResourceGroupPager":
resp, err = d.dispatchNewListByResourceGroupPager(req)
case "DeidServicesClient.NewListBySubscriptionPager":
resp, err = d.dispatchNewListBySubscriptionPager(req)
case "DeidServicesClient.BeginUpdate":
resp, err = d.dispatchBeginUpdate(req)
default:
err = fmt.Errorf("unhandled API %s", method)
}
return resp, err
}
func (d *DeidServicesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) {
if d.srv.BeginCreate == nil {
return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")}
}
beginCreate := d.beginCreate.get(req)
if beginCreate == nil {
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices/(?P<deidServiceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
regex := regexp.MustCompile(regexStr)
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
if matches == nil || len(matches) < 3 {
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
}
body, err := server.UnmarshalRequestAsJSON[armhealthdataaiservices.DeidService](req)
if err != nil {
return nil, err
}
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
if err != nil {
return nil, err
}
deidServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deidServiceName")])
if err != nil {
return nil, err
}
respr, errRespr := d.srv.BeginCreate(req.Context(), resourceGroupNameParam, deidServiceNameParam, body, nil)
if respErr := server.GetError(errRespr, req); respErr != nil {
return nil, respErr
}
beginCreate = &respr
d.beginCreate.add(req, beginCreate)
}
resp, err := server.PollerResponderNext(beginCreate, req)
if err != nil {
return nil, err
}
if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) {
d.beginCreate.remove(req)
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)}
}
if !server.PollerResponderMore(beginCreate) {
d.beginCreate.remove(req)
}
return resp, nil
}
func (d *DeidServicesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) {
if d.srv.BeginDelete == nil {
return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")}
}
beginDelete := d.beginDelete.get(req)
if beginDelete == nil {
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices/(?P<deidServiceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
regex := regexp.MustCompile(regexStr)
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
if matches == nil || len(matches) < 3 {
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
}
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
if err != nil {
return nil, err
}
deidServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deidServiceName")])
if err != nil {
return nil, err
}
respr, errRespr := d.srv.BeginDelete(req.Context(), resourceGroupNameParam, deidServiceNameParam, nil)
if respErr := server.GetError(errRespr, req); respErr != nil {
return nil, respErr
}
beginDelete = &respr
d.beginDelete.add(req, beginDelete)
}
resp, err := server.PollerResponderNext(beginDelete, req)
if err != nil {
return nil, err
}
if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) {
d.beginDelete.remove(req)
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)}
}
if !server.PollerResponderMore(beginDelete) {
d.beginDelete.remove(req)
}
return resp, nil
}
func (d *DeidServicesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) {
if d.srv.Get == nil {
return nil, &nonRetriableError{errors.New("fake for method Get not implemented")}
}
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices/(?P<deidServiceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
regex := regexp.MustCompile(regexStr)
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
if matches == nil || len(matches) < 3 {
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
}
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
if err != nil {
return nil, err
}
deidServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deidServiceName")])
if err != nil {
return nil, err
}
respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, deidServiceNameParam, 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).DeidService, req)
if err != nil {
return nil, err
}
return resp, nil
}
func (d *DeidServicesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) {
if d.srv.NewListByResourceGroupPager == nil {
return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")}
}
newListByResourceGroupPager := d.newListByResourceGroupPager.get(req)
if newListByResourceGroupPager == nil {
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices`
regex := regexp.MustCompile(regexStr)
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
if matches == nil || len(matches) < 2 {
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
}
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
if err != nil {
return nil, err
}
resp := d.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil)
newListByResourceGroupPager = &resp
d.newListByResourceGroupPager.add(req, newListByResourceGroupPager)
server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armhealthdataaiservices.DeidServicesClientListByResourceGroupResponse, createLink func() string) {
page.NextLink = to.Ptr(createLink())
})
}
resp, err := server.PagerResponderNext(newListByResourceGroupPager, req)
if err != nil {
return nil, err
}
if !contains([]int{http.StatusOK}, resp.StatusCode) {
d.newListByResourceGroupPager.remove(req)
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
}
if !server.PagerResponderMore(newListByResourceGroupPager) {
d.newListByResourceGroupPager.remove(req)
}
return resp, nil
}
func (d *DeidServicesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) {
if d.srv.NewListBySubscriptionPager == nil {
return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")}
}
newListBySubscriptionPager := d.newListBySubscriptionPager.get(req)
if newListBySubscriptionPager == nil {
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices`
regex := regexp.MustCompile(regexStr)
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
if matches == nil || len(matches) < 1 {
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
}
resp := d.srv.NewListBySubscriptionPager(nil)
newListBySubscriptionPager = &resp
d.newListBySubscriptionPager.add(req, newListBySubscriptionPager)
server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armhealthdataaiservices.DeidServicesClientListBySubscriptionResponse, createLink func() string) {
page.NextLink = to.Ptr(createLink())
})
}
resp, err := server.PagerResponderNext(newListBySubscriptionPager, req)
if err != nil {
return nil, err
}
if !contains([]int{http.StatusOK}, resp.StatusCode) {
d.newListBySubscriptionPager.remove(req)
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
}
if !server.PagerResponderMore(newListBySubscriptionPager) {
d.newListBySubscriptionPager.remove(req)
}
return resp, nil
}
func (d *DeidServicesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) {
if d.srv.BeginUpdate == nil {
return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")}
}
beginUpdate := d.beginUpdate.get(req)
if beginUpdate == nil {
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices/(?P<deidServiceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
regex := regexp.MustCompile(regexStr)
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
if matches == nil || len(matches) < 3 {
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
}
body, err := server.UnmarshalRequestAsJSON[armhealthdataaiservices.DeidUpdate](req)
if err != nil {
return nil, err
}
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
if err != nil {
return nil, err
}
deidServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deidServiceName")])
if err != nil {
return nil, err
}
respr, errRespr := d.srv.BeginUpdate(req.Context(), resourceGroupNameParam, deidServiceNameParam, body, nil)
if respErr := server.GetError(errRespr, req); respErr != nil {
return nil, respErr
}
beginUpdate = &respr
d.beginUpdate.add(req, beginUpdate)
}
resp, err := server.PollerResponderNext(beginUpdate, req)
if err != nil {
return nil, err
}
if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) {
d.beginUpdate.remove(req)
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)}
}
if !server.PollerResponderMore(beginUpdate) {
d.beginUpdate.remove(req)
}
return resp, nil
}

Просмотреть файл

@ -0,0 +1,60 @@
// 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. DO NOT EDIT.
package fake
import (
"github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server"
"net/http"
"sync"
)
type nonRetriableError struct {
error
}
func (nonRetriableError) NonRetriable() {
// marker method
}
func contains[T comparable](s []T, v T) bool {
for _, vv := range s {
if vv == v {
return true
}
}
return false
}
func newTracker[T any]() *tracker[T] {
return &tracker[T]{
items: map[string]*T{},
}
}
type tracker[T any] struct {
items map[string]*T
mu sync.Mutex
}
func (p *tracker[T]) get(req *http.Request) *T {
p.mu.Lock()
defer p.mu.Unlock()
if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok {
return item
}
return nil
}
func (p *tracker[T]) add(req *http.Request, item *T) {
p.mu.Lock()
defer p.mu.Unlock()
p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item
}
func (p *tracker[T]) remove(req *http.Request) {
p.mu.Lock()
defer p.mu.Unlock()
delete(p.items, server.SanitizePagerPollerPath(req.URL.Path))
}

Просмотреть файл

@ -0,0 +1,92 @@
// 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. DO NOT EDIT.
package fake
import (
"errors"
"fmt"
azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices"
"net/http"
)
// OperationsServer is a fake server for instances of the armhealthdataaiservices.OperationsClient type.
type OperationsServer struct {
// NewListPager is the fake for method OperationsClient.NewListPager
// HTTP status codes to indicate success: http.StatusOK
NewListPager func(options *armhealthdataaiservices.OperationsClientListOptions) (resp azfake.PagerResponder[armhealthdataaiservices.OperationsClientListResponse])
}
// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation.
// The returned OperationsServerTransport instance is connected to an instance of armhealthdataaiservices.OperationsClient via the
// azcore.ClientOptions.Transporter field in the client's constructor parameters.
func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport {
return &OperationsServerTransport{
srv: srv,
newListPager: newTracker[azfake.PagerResponder[armhealthdataaiservices.OperationsClientListResponse]](),
}
}
// OperationsServerTransport connects instances of armhealthdataaiservices.OperationsClient to instances of OperationsServer.
// Don't use this type directly, use NewOperationsServerTransport instead.
type OperationsServerTransport struct {
srv *OperationsServer
newListPager *tracker[azfake.PagerResponder[armhealthdataaiservices.OperationsClientListResponse]]
}
// Do implements the policy.Transporter interface for OperationsServerTransport.
func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error) {
rawMethod := req.Context().Value(runtime.CtxAPINameKey{})
method, ok := rawMethod.(string)
if !ok {
return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")}
}
return o.dispatchToMethodFake(req, method)
}
func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) {
var resp *http.Response
var err error
switch method {
case "OperationsClient.NewListPager":
resp, err = o.dispatchNewListPager(req)
default:
err = fmt.Errorf("unhandled API %s", method)
}
return resp, err
}
func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) {
if o.srv.NewListPager == nil {
return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")}
}
newListPager := o.newListPager.get(req)
if newListPager == nil {
resp := o.srv.NewListPager(nil)
newListPager = &resp
o.newListPager.add(req, newListPager)
server.PagerResponderInjectNextLinks(newListPager, req, func(page *armhealthdataaiservices.OperationsClientListResponse, createLink func() string) {
page.NextLink = to.Ptr(createLink())
})
}
resp, err := server.PagerResponderNext(newListPager, req)
if err != nil {
return nil, err
}
if !contains([]int{http.StatusOK}, resp.StatusCode) {
o.newListPager.remove(req)
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
}
if !server.PagerResponderMore(newListPager) {
o.newListPager.remove(req)
}
return resp, nil
}

Просмотреть файл

@ -0,0 +1,268 @@
// 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. DO NOT EDIT.
package fake
import (
"context"
"errors"
"fmt"
azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices"
"net/http"
"net/url"
"regexp"
)
// PrivateEndpointConnectionsServer is a fake server for instances of the armhealthdataaiservices.PrivateEndpointConnectionsClient type.
type PrivateEndpointConnectionsServer struct {
// BeginCreate is the fake for method PrivateEndpointConnectionsClient.BeginCreate
// HTTP status codes to indicate success: http.StatusOK, http.StatusCreated
BeginCreate func(ctx context.Context, resourceGroupName string, deidServiceName string, privateEndpointConnectionName string, resource armhealthdataaiservices.PrivateEndpointConnectionResource, options *armhealthdataaiservices.PrivateEndpointConnectionsClientBeginCreateOptions) (resp azfake.PollerResponder[armhealthdataaiservices.PrivateEndpointConnectionsClientCreateResponse], errResp azfake.ErrorResponder)
// BeginDelete is the fake for method PrivateEndpointConnectionsClient.BeginDelete
// HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent
BeginDelete func(ctx context.Context, resourceGroupName string, deidServiceName string, privateEndpointConnectionName string, options *armhealthdataaiservices.PrivateEndpointConnectionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armhealthdataaiservices.PrivateEndpointConnectionsClientDeleteResponse], errResp azfake.ErrorResponder)
// Get is the fake for method PrivateEndpointConnectionsClient.Get
// HTTP status codes to indicate success: http.StatusOK
Get func(ctx context.Context, resourceGroupName string, deidServiceName string, privateEndpointConnectionName string, options *armhealthdataaiservices.PrivateEndpointConnectionsClientGetOptions) (resp azfake.Responder[armhealthdataaiservices.PrivateEndpointConnectionsClientGetResponse], errResp azfake.ErrorResponder)
// NewListByDeidServicePager is the fake for method PrivateEndpointConnectionsClient.NewListByDeidServicePager
// HTTP status codes to indicate success: http.StatusOK
NewListByDeidServicePager func(resourceGroupName string, deidServiceName string, options *armhealthdataaiservices.PrivateEndpointConnectionsClientListByDeidServiceOptions) (resp azfake.PagerResponder[armhealthdataaiservices.PrivateEndpointConnectionsClientListByDeidServiceResponse])
}
// NewPrivateEndpointConnectionsServerTransport creates a new instance of PrivateEndpointConnectionsServerTransport with the provided implementation.
// The returned PrivateEndpointConnectionsServerTransport instance is connected to an instance of armhealthdataaiservices.PrivateEndpointConnectionsClient via the
// azcore.ClientOptions.Transporter field in the client's constructor parameters.
func NewPrivateEndpointConnectionsServerTransport(srv *PrivateEndpointConnectionsServer) *PrivateEndpointConnectionsServerTransport {
return &PrivateEndpointConnectionsServerTransport{
srv: srv,
beginCreate: newTracker[azfake.PollerResponder[armhealthdataaiservices.PrivateEndpointConnectionsClientCreateResponse]](),
beginDelete: newTracker[azfake.PollerResponder[armhealthdataaiservices.PrivateEndpointConnectionsClientDeleteResponse]](),
newListByDeidServicePager: newTracker[azfake.PagerResponder[armhealthdataaiservices.PrivateEndpointConnectionsClientListByDeidServiceResponse]](),
}
}
// PrivateEndpointConnectionsServerTransport connects instances of armhealthdataaiservices.PrivateEndpointConnectionsClient to instances of PrivateEndpointConnectionsServer.
// Don't use this type directly, use NewPrivateEndpointConnectionsServerTransport instead.
type PrivateEndpointConnectionsServerTransport struct {
srv *PrivateEndpointConnectionsServer
beginCreate *tracker[azfake.PollerResponder[armhealthdataaiservices.PrivateEndpointConnectionsClientCreateResponse]]
beginDelete *tracker[azfake.PollerResponder[armhealthdataaiservices.PrivateEndpointConnectionsClientDeleteResponse]]
newListByDeidServicePager *tracker[azfake.PagerResponder[armhealthdataaiservices.PrivateEndpointConnectionsClientListByDeidServiceResponse]]
}
// Do implements the policy.Transporter interface for PrivateEndpointConnectionsServerTransport.
func (p *PrivateEndpointConnectionsServerTransport) Do(req *http.Request) (*http.Response, error) {
rawMethod := req.Context().Value(runtime.CtxAPINameKey{})
method, ok := rawMethod.(string)
if !ok {
return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")}
}
return p.dispatchToMethodFake(req, method)
}
func (p *PrivateEndpointConnectionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) {
var resp *http.Response
var err error
switch method {
case "PrivateEndpointConnectionsClient.BeginCreate":
resp, err = p.dispatchBeginCreate(req)
case "PrivateEndpointConnectionsClient.BeginDelete":
resp, err = p.dispatchBeginDelete(req)
case "PrivateEndpointConnectionsClient.Get":
resp, err = p.dispatchGet(req)
case "PrivateEndpointConnectionsClient.NewListByDeidServicePager":
resp, err = p.dispatchNewListByDeidServicePager(req)
default:
err = fmt.Errorf("unhandled API %s", method)
}
return resp, err
}
func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) {
if p.srv.BeginCreate == nil {
return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")}
}
beginCreate := p.beginCreate.get(req)
if beginCreate == nil {
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices/(?P<deidServiceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P<privateEndpointConnectionName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
regex := regexp.MustCompile(regexStr)
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
if matches == nil || len(matches) < 4 {
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
}
body, err := server.UnmarshalRequestAsJSON[armhealthdataaiservices.PrivateEndpointConnectionResource](req)
if err != nil {
return nil, err
}
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
if err != nil {
return nil, err
}
deidServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deidServiceName")])
if err != nil {
return nil, err
}
privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")])
if err != nil {
return nil, err
}
respr, errRespr := p.srv.BeginCreate(req.Context(), resourceGroupNameParam, deidServiceNameParam, privateEndpointConnectionNameParam, body, nil)
if respErr := server.GetError(errRespr, req); respErr != nil {
return nil, respErr
}
beginCreate = &respr
p.beginCreate.add(req, beginCreate)
}
resp, err := server.PollerResponderNext(beginCreate, req)
if err != nil {
return nil, err
}
if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) {
p.beginCreate.remove(req)
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)}
}
if !server.PollerResponderMore(beginCreate) {
p.beginCreate.remove(req)
}
return resp, nil
}
func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) {
if p.srv.BeginDelete == nil {
return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")}
}
beginDelete := p.beginDelete.get(req)
if beginDelete == nil {
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices/(?P<deidServiceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P<privateEndpointConnectionName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
regex := regexp.MustCompile(regexStr)
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
if matches == nil || len(matches) < 4 {
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
}
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
if err != nil {
return nil, err
}
deidServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deidServiceName")])
if err != nil {
return nil, err
}
privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")])
if err != nil {
return nil, err
}
respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, deidServiceNameParam, privateEndpointConnectionNameParam, nil)
if respErr := server.GetError(errRespr, req); respErr != nil {
return nil, respErr
}
beginDelete = &respr
p.beginDelete.add(req, beginDelete)
}
resp, err := server.PollerResponderNext(beginDelete, req)
if err != nil {
return nil, err
}
if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) {
p.beginDelete.remove(req)
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)}
}
if !server.PollerResponderMore(beginDelete) {
p.beginDelete.remove(req)
}
return resp, nil
}
func (p *PrivateEndpointConnectionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) {
if p.srv.Get == nil {
return nil, &nonRetriableError{errors.New("fake for method Get not implemented")}
}
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices/(?P<deidServiceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P<privateEndpointConnectionName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
regex := regexp.MustCompile(regexStr)
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
if matches == nil || len(matches) < 4 {
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
}
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
if err != nil {
return nil, err
}
deidServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deidServiceName")])
if err != nil {
return nil, err
}
privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")])
if err != nil {
return nil, err
}
respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, deidServiceNameParam, privateEndpointConnectionNameParam, nil)
if respErr := server.GetError(errRespr, req); respErr != nil {
return nil, respErr
}
respContent := server.GetResponseContent(respr)
if !contains([]int{http.StatusOK}, respContent.HTTPStatus) {
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)}
}
resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnectionResource, req)
if err != nil {
return nil, err
}
return resp, nil
}
func (p *PrivateEndpointConnectionsServerTransport) dispatchNewListByDeidServicePager(req *http.Request) (*http.Response, error) {
if p.srv.NewListByDeidServicePager == nil {
return nil, &nonRetriableError{errors.New("fake for method NewListByDeidServicePager not implemented")}
}
newListByDeidServicePager := p.newListByDeidServicePager.get(req)
if newListByDeidServicePager == nil {
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices/(?P<deidServiceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections`
regex := regexp.MustCompile(regexStr)
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
if matches == nil || len(matches) < 3 {
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
}
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
if err != nil {
return nil, err
}
deidServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deidServiceName")])
if err != nil {
return nil, err
}
resp := p.srv.NewListByDeidServicePager(resourceGroupNameParam, deidServiceNameParam, nil)
newListByDeidServicePager = &resp
p.newListByDeidServicePager.add(req, newListByDeidServicePager)
server.PagerResponderInjectNextLinks(newListByDeidServicePager, req, func(page *armhealthdataaiservices.PrivateEndpointConnectionsClientListByDeidServiceResponse, createLink func() string) {
page.NextLink = to.Ptr(createLink())
})
}
resp, err := server.PagerResponderNext(newListByDeidServicePager, req)
if err != nil {
return nil, err
}
if !contains([]int{http.StatusOK}, resp.StatusCode) {
p.newListByDeidServicePager.remove(req)
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
}
if !server.PagerResponderMore(newListByDeidServicePager) {
p.newListByDeidServicePager.remove(req)
}
return resp, nil
}

Просмотреть файл

@ -0,0 +1,108 @@
// 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. DO NOT EDIT.
package fake
import (
"errors"
"fmt"
azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices"
"net/http"
"net/url"
"regexp"
)
// PrivateLinksServer is a fake server for instances of the armhealthdataaiservices.PrivateLinksClient type.
type PrivateLinksServer struct {
// NewListByDeidServicePager is the fake for method PrivateLinksClient.NewListByDeidServicePager
// HTTP status codes to indicate success: http.StatusOK
NewListByDeidServicePager func(resourceGroupName string, deidServiceName string, options *armhealthdataaiservices.PrivateLinksClientListByDeidServiceOptions) (resp azfake.PagerResponder[armhealthdataaiservices.PrivateLinksClientListByDeidServiceResponse])
}
// NewPrivateLinksServerTransport creates a new instance of PrivateLinksServerTransport with the provided implementation.
// The returned PrivateLinksServerTransport instance is connected to an instance of armhealthdataaiservices.PrivateLinksClient via the
// azcore.ClientOptions.Transporter field in the client's constructor parameters.
func NewPrivateLinksServerTransport(srv *PrivateLinksServer) *PrivateLinksServerTransport {
return &PrivateLinksServerTransport{
srv: srv,
newListByDeidServicePager: newTracker[azfake.PagerResponder[armhealthdataaiservices.PrivateLinksClientListByDeidServiceResponse]](),
}
}
// PrivateLinksServerTransport connects instances of armhealthdataaiservices.PrivateLinksClient to instances of PrivateLinksServer.
// Don't use this type directly, use NewPrivateLinksServerTransport instead.
type PrivateLinksServerTransport struct {
srv *PrivateLinksServer
newListByDeidServicePager *tracker[azfake.PagerResponder[armhealthdataaiservices.PrivateLinksClientListByDeidServiceResponse]]
}
// Do implements the policy.Transporter interface for PrivateLinksServerTransport.
func (p *PrivateLinksServerTransport) Do(req *http.Request) (*http.Response, error) {
rawMethod := req.Context().Value(runtime.CtxAPINameKey{})
method, ok := rawMethod.(string)
if !ok {
return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")}
}
return p.dispatchToMethodFake(req, method)
}
func (p *PrivateLinksServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) {
var resp *http.Response
var err error
switch method {
case "PrivateLinksClient.NewListByDeidServicePager":
resp, err = p.dispatchNewListByDeidServicePager(req)
default:
err = fmt.Errorf("unhandled API %s", method)
}
return resp, err
}
func (p *PrivateLinksServerTransport) dispatchNewListByDeidServicePager(req *http.Request) (*http.Response, error) {
if p.srv.NewListByDeidServicePager == nil {
return nil, &nonRetriableError{errors.New("fake for method NewListByDeidServicePager not implemented")}
}
newListByDeidServicePager := p.newListByDeidServicePager.get(req)
if newListByDeidServicePager == nil {
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices/(?P<deidServiceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources`
regex := regexp.MustCompile(regexStr)
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
if matches == nil || len(matches) < 3 {
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
}
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
if err != nil {
return nil, err
}
deidServiceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deidServiceName")])
if err != nil {
return nil, err
}
resp := p.srv.NewListByDeidServicePager(resourceGroupNameParam, deidServiceNameParam, nil)
newListByDeidServicePager = &resp
p.newListByDeidServicePager.add(req, newListByDeidServicePager)
server.PagerResponderInjectNextLinks(newListByDeidServicePager, req, func(page *armhealthdataaiservices.PrivateLinksClientListByDeidServiceResponse, createLink func() string) {
page.NextLink = to.Ptr(createLink())
})
}
resp, err := server.PagerResponderNext(newListByDeidServicePager, req)
if err != nil {
return nil, err
}
if !contains([]int{http.StatusOK}, resp.StatusCode) {
p.newListByDeidServicePager.remove(req)
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
}
if !server.PagerResponderMore(newListByDeidServicePager) {
p.newListByDeidServicePager.remove(req)
}
return resp, nil
}

Просмотреть файл

@ -0,0 +1,95 @@
// 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. DO NOT EDIT.
package fake
import (
"errors"
"fmt"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"net/http"
"strings"
"sync"
)
// ServerFactory is a fake server for instances of the armhealthdataaiservices.ClientFactory type.
type ServerFactory struct {
// DeidServicesServer contains the fakes for client DeidServicesClient
DeidServicesServer DeidServicesServer
// OperationsServer contains the fakes for client OperationsClient
OperationsServer OperationsServer
// PrivateEndpointConnectionsServer contains the fakes for client PrivateEndpointConnectionsClient
PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer
// PrivateLinksServer contains the fakes for client PrivateLinksClient
PrivateLinksServer PrivateLinksServer
}
// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation.
// The returned ServerFactoryTransport instance is connected to an instance of armhealthdataaiservices.ClientFactory via the
// azcore.ClientOptions.Transporter field in the client's constructor parameters.
func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport {
return &ServerFactoryTransport{
srv: srv,
}
}
// ServerFactoryTransport connects instances of armhealthdataaiservices.ClientFactory to instances of ServerFactory.
// Don't use this type directly, use NewServerFactoryTransport instead.
type ServerFactoryTransport struct {
srv *ServerFactory
trMu sync.Mutex
trDeidServicesServer *DeidServicesServerTransport
trOperationsServer *OperationsServerTransport
trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport
trPrivateLinksServer *PrivateLinksServerTransport
}
// Do implements the policy.Transporter interface for ServerFactoryTransport.
func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) {
rawMethod := req.Context().Value(runtime.CtxAPINameKey{})
method, ok := rawMethod.(string)
if !ok {
return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")}
}
client := method[:strings.Index(method, ".")]
var resp *http.Response
var err error
switch client {
case "DeidServicesClient":
initServer(s, &s.trDeidServicesServer, func() *DeidServicesServerTransport { return NewDeidServicesServerTransport(&s.srv.DeidServicesServer) })
resp, err = s.trDeidServicesServer.Do(req)
case "OperationsClient":
initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) })
resp, err = s.trOperationsServer.Do(req)
case "PrivateEndpointConnectionsClient":
initServer(s, &s.trPrivateEndpointConnectionsServer, func() *PrivateEndpointConnectionsServerTransport {
return NewPrivateEndpointConnectionsServerTransport(&s.srv.PrivateEndpointConnectionsServer)
})
resp, err = s.trPrivateEndpointConnectionsServer.Do(req)
case "PrivateLinksClient":
initServer(s, &s.trPrivateLinksServer, func() *PrivateLinksServerTransport { return NewPrivateLinksServerTransport(&s.srv.PrivateLinksServer) })
resp, err = s.trPrivateLinksServer.Do(req)
default:
err = fmt.Errorf("unhandled client %s", client)
}
if err != nil {
return nil, err
}
return resp, nil
}
func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) {
s.trMu.Lock()
if *dst == nil {
*dst = src()
}
s.trMu.Unlock()
}

Просмотреть файл

@ -0,0 +1,109 @@
// 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. DO NOT EDIT.
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 (
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
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 {
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 {
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))
}
func (t *dateTimeRFC3339) Parse(layout, value string) error {
p, err := time.Parse(layout, strings.ToUpper(value))
*t = dateTimeRFC3339(p)
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
} 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 || 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
}

Просмотреть файл

@ -0,0 +1,21 @@
module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices
go 1.18
require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0
)
require (
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
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.25.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
)

Просмотреть файл

@ -0,0 +1,29 @@
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY=
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU=
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

Просмотреть файл

@ -0,0 +1,298 @@
// 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. DO NOT EDIT.
package armhealthdataaiservices
import "time"
// DeidPropertiesUpdate - The template for adding optional properties.
type DeidPropertiesUpdate struct {
// Gets or sets allow or disallow public network access to resource
PublicNetworkAccess *PublicNetworkAccess
}
// DeidService - A HealthDataAIServicesProviderHub resource
type DeidService struct {
// REQUIRED; The geo-location where the resource lives
Location *string
// READ-ONLY; The name of the deid service
Name *string
// The managed service identities assigned to this resource.
Identity *ManagedServiceIdentity
// The resource-specific properties for this resource.
Properties *DeidServiceProperties
// Resource tags.
Tags map[string]*string
// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Type *string
}
// DeidServiceListResult - The response of a DeidService list operation.
type DeidServiceListResult struct {
// REQUIRED; The DeidService items on this page
Value []*DeidService
// The link to the next page of items
NextLink *string
}
// DeidServiceProperties - Details of the HealthDataAIServices DeidService.
type DeidServiceProperties struct {
// Gets or sets allow or disallow public network access to resource
PublicNetworkAccess *PublicNetworkAccess
// READ-ONLY; List of private endpoint connections.
PrivateEndpointConnections []*PrivateEndpointConnection
// READ-ONLY; The status of the last operation.
ProvisioningState *ProvisioningState
// READ-ONLY; Deid service url.
ServiceURL *string
}
// DeidUpdate - Patch request body for DeidService
type DeidUpdate struct {
// Updatable managed service identity
Identity *ManagedServiceIdentityUpdate
// RP-specific properties
Properties *DeidPropertiesUpdate
// Resource tags.
Tags map[string]*string
}
// ManagedServiceIdentity - Managed service identity (system assigned and/or user assigned identities)
type ManagedServiceIdentity struct {
// REQUIRED; The type of managed identity assigned to this resource.
Type *ManagedServiceIdentityType
// The identities assigned to this resource by the user.
UserAssignedIdentities map[string]*UserAssignedIdentity
// READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned
// identity.
PrincipalID *string
// READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity.
TenantID *string
}
// ManagedServiceIdentityUpdate - The template for adding optional properties.
type ManagedServiceIdentityUpdate struct {
// The type of managed identity assigned to this resource.
Type *ManagedServiceIdentityType
// The identities assigned to this resource by the user.
UserAssignedIdentities map[string]*UserAssignedIdentity
}
// Operation - Details of a REST API operation, returned from the Resource Provider Operations API
type Operation struct {
// Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.
ActionType *ActionType
// READ-ONLY; Localized display information for this particular operation.
Display *OperationDisplay
// READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure
// Resource Manager/control-plane operations.
IsDataAction *bool
// READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write",
// "Microsoft.Compute/virtualMachines/capture/action"
Name *string
// READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default
// value is "user,system"
Origin *Origin
}
// OperationDisplay - Localized display information for and operation.
type OperationDisplay struct {
// READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views.
Description *string
// READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual
// Machine", "Restart Virtual Machine".
Operation *string
// READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft
// Compute".
Provider *string
// READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job
// Schedule Collections".
Resource *string
}
// OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to
// get the next set of results.
type OperationListResult struct {
// REQUIRED; The Operation items on this page
Value []*Operation
// The link to the next page of items
NextLink *string
}
// PrivateEndpoint - The Private Endpoint resource.
type PrivateEndpoint struct {
// READ-ONLY; The resource identifier for private endpoint
ID *string
}
// PrivateEndpointConnection - The private endpoint connection resource
type PrivateEndpointConnection struct {
// The private endpoint connection properties
Properties *PrivateEndpointConnectionProperties
// 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; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Type *string
}
// PrivateEndpointConnectionProperties - Properties of the private endpoint connection.
type PrivateEndpointConnectionProperties struct {
// REQUIRED; A collection of information about the state of the connection between service consumer and provider.
PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState
// The private endpoint resource.
PrivateEndpoint *PrivateEndpoint
// READ-ONLY; The group ids for the private endpoint resource.
GroupIDs []*string
// READ-ONLY; The provisioning state of the private endpoint connection resource.
ProvisioningState *PrivateEndpointConnectionProvisioningState
}
// PrivateEndpointConnectionResource - Holder for private endpoint connections
type PrivateEndpointConnectionResource struct {
// The resource-specific properties for this resource.
Properties *PrivateEndpointConnectionProperties
// READ-ONLY; The name of the private endpoint connection associated with the Azure resource.
Name *string
// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Type *string
}
// PrivateEndpointConnectionResourceListResult - The response of a PrivateEndpointConnectionResource list operation.
type PrivateEndpointConnectionResourceListResult struct {
// REQUIRED; The PrivateEndpointConnectionResource items on this page
Value []*PrivateEndpointConnectionResource
// The link to the next page of items
NextLink *string
}
// PrivateLinkResource - Private Links for DeidService resource
type PrivateLinkResource struct {
// The resource-specific properties for this resource.
Properties *PrivateLinkResourceProperties
// READ-ONLY; The name of the private link associated with the Azure resource.
Name *string
// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
ID *string
// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
SystemData *SystemData
// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
Type *string
}
// PrivateLinkResourceListResult - The response of a PrivateLinkResource list operation.
type PrivateLinkResourceListResult struct {
// REQUIRED; The PrivateLinkResource items on this page
Value []*PrivateLinkResource
// The link to the next page of items
NextLink *string
}
// PrivateLinkResourceProperties - Properties of a private link resource.
type PrivateLinkResourceProperties struct {
// The private link resource private link DNS zone name.
RequiredZoneNames []*string
// READ-ONLY; The private link resource group id.
GroupID *string
// READ-ONLY; The private link resource required member names.
RequiredMembers []*string
}
// PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer
// and provider.
type PrivateLinkServiceConnectionState struct {
// A message indicating if changes on the service provider require any updates on the consumer.
ActionsRequired *string
// The reason for approval/rejection of the connection.
Description *string
// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service.
Status *PrivateEndpointServiceConnectionStatus
}
// SystemData - Metadata pertaining to creation and last modification of the resource.
type SystemData struct {
// The timestamp of resource creation (UTC).
CreatedAt *time.Time
// The identity that created the resource.
CreatedBy *string
// The type of identity that created the resource.
CreatedByType *CreatedByType
// The timestamp of resource last modification (UTC)
LastModifiedAt *time.Time
// The identity that last modified the resource.
LastModifiedBy *string
// The type of identity that last modified the resource.
LastModifiedByType *CreatedByType
}
// UserAssignedIdentity - User assigned identity properties
type UserAssignedIdentity struct {
// READ-ONLY; The client ID of the assigned identity.
ClientID *string
// READ-ONLY; The principal ID of the assigned identity.
PrincipalID *string
}

Просмотреть файл

@ -0,0 +1,807 @@
// 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. DO NOT EDIT.
package armhealthdataaiservices
import (
"encoding/json"
"fmt"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"reflect"
)
// MarshalJSON implements the json.Marshaller interface for type DeidPropertiesUpdate.
func (d DeidPropertiesUpdate) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "publicNetworkAccess", d.PublicNetworkAccess)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type DeidPropertiesUpdate.
func (d *DeidPropertiesUpdate) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "publicNetworkAccess":
err = unpopulate(val, "PublicNetworkAccess", &d.PublicNetworkAccess)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type DeidService.
func (d DeidService) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "id", d.ID)
populate(objectMap, "identity", d.Identity)
populate(objectMap, "location", d.Location)
populate(objectMap, "name", d.Name)
populate(objectMap, "properties", d.Properties)
populate(objectMap, "systemData", d.SystemData)
populate(objectMap, "tags", d.Tags)
populate(objectMap, "type", d.Type)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type DeidService.
func (d *DeidService) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "id":
err = unpopulate(val, "ID", &d.ID)
delete(rawMsg, key)
case "identity":
err = unpopulate(val, "Identity", &d.Identity)
delete(rawMsg, key)
case "location":
err = unpopulate(val, "Location", &d.Location)
delete(rawMsg, key)
case "name":
err = unpopulate(val, "Name", &d.Name)
delete(rawMsg, key)
case "properties":
err = unpopulate(val, "Properties", &d.Properties)
delete(rawMsg, key)
case "systemData":
err = unpopulate(val, "SystemData", &d.SystemData)
delete(rawMsg, key)
case "tags":
err = unpopulate(val, "Tags", &d.Tags)
delete(rawMsg, key)
case "type":
err = unpopulate(val, "Type", &d.Type)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type DeidServiceListResult.
func (d DeidServiceListResult) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "nextLink", d.NextLink)
populate(objectMap, "value", d.Value)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type DeidServiceListResult.
func (d *DeidServiceListResult) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "nextLink":
err = unpopulate(val, "NextLink", &d.NextLink)
delete(rawMsg, key)
case "value":
err = unpopulate(val, "Value", &d.Value)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type DeidServiceProperties.
func (d DeidServiceProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "privateEndpointConnections", d.PrivateEndpointConnections)
populate(objectMap, "provisioningState", d.ProvisioningState)
populate(objectMap, "publicNetworkAccess", d.PublicNetworkAccess)
populate(objectMap, "serviceUrl", d.ServiceURL)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type DeidServiceProperties.
func (d *DeidServiceProperties) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "privateEndpointConnections":
err = unpopulate(val, "PrivateEndpointConnections", &d.PrivateEndpointConnections)
delete(rawMsg, key)
case "provisioningState":
err = unpopulate(val, "ProvisioningState", &d.ProvisioningState)
delete(rawMsg, key)
case "publicNetworkAccess":
err = unpopulate(val, "PublicNetworkAccess", &d.PublicNetworkAccess)
delete(rawMsg, key)
case "serviceUrl":
err = unpopulate(val, "ServiceURL", &d.ServiceURL)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type DeidUpdate.
func (d DeidUpdate) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "identity", d.Identity)
populate(objectMap, "properties", d.Properties)
populate(objectMap, "tags", d.Tags)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type DeidUpdate.
func (d *DeidUpdate) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "identity":
err = unpopulate(val, "Identity", &d.Identity)
delete(rawMsg, key)
case "properties":
err = unpopulate(val, "Properties", &d.Properties)
delete(rawMsg, key)
case "tags":
err = unpopulate(val, "Tags", &d.Tags)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity.
func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "principalId", m.PrincipalID)
populate(objectMap, "tenantId", m.TenantID)
populate(objectMap, "type", m.Type)
populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentity.
func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", m, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "principalId":
err = unpopulate(val, "PrincipalID", &m.PrincipalID)
delete(rawMsg, key)
case "tenantId":
err = unpopulate(val, "TenantID", &m.TenantID)
delete(rawMsg, key)
case "type":
err = unpopulate(val, "Type", &m.Type)
delete(rawMsg, key)
case "userAssignedIdentities":
err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", m, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentityUpdate.
func (m ManagedServiceIdentityUpdate) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "type", m.Type)
populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentityUpdate.
func (m *ManagedServiceIdentityUpdate) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", m, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "type":
err = unpopulate(val, "Type", &m.Type)
delete(rawMsg, key)
case "userAssignedIdentities":
err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", m, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type Operation.
func (o Operation) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "actionType", o.ActionType)
populate(objectMap, "display", o.Display)
populate(objectMap, "isDataAction", o.IsDataAction)
populate(objectMap, "name", o.Name)
populate(objectMap, "origin", o.Origin)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type Operation.
func (o *Operation) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", o, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "actionType":
err = unpopulate(val, "ActionType", &o.ActionType)
delete(rawMsg, key)
case "display":
err = unpopulate(val, "Display", &o.Display)
delete(rawMsg, key)
case "isDataAction":
err = unpopulate(val, "IsDataAction", &o.IsDataAction)
delete(rawMsg, key)
case "name":
err = unpopulate(val, "Name", &o.Name)
delete(rawMsg, key)
case "origin":
err = unpopulate(val, "Origin", &o.Origin)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", o, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type OperationDisplay.
func (o OperationDisplay) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "description", o.Description)
populate(objectMap, "operation", o.Operation)
populate(objectMap, "provider", o.Provider)
populate(objectMap, "resource", o.Resource)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay.
func (o *OperationDisplay) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", o, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "description":
err = unpopulate(val, "Description", &o.Description)
delete(rawMsg, key)
case "operation":
err = unpopulate(val, "Operation", &o.Operation)
delete(rawMsg, key)
case "provider":
err = unpopulate(val, "Provider", &o.Provider)
delete(rawMsg, key)
case "resource":
err = unpopulate(val, "Resource", &o.Resource)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", o, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type OperationListResult.
func (o OperationListResult) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "nextLink", o.NextLink)
populate(objectMap, "value", o.Value)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult.
func (o *OperationListResult) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", o, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "nextLink":
err = unpopulate(val, "NextLink", &o.NextLink)
delete(rawMsg, key)
case "value":
err = unpopulate(val, "Value", &o.Value)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", o, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint.
func (p PrivateEndpoint) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "id", p.ID)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint.
func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", p, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "id":
err = unpopulate(val, "ID", &p.ID)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", p, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection.
func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "id", p.ID)
populate(objectMap, "name", p.Name)
populate(objectMap, "properties", p.Properties)
populate(objectMap, "systemData", p.SystemData)
populate(objectMap, "type", p.Type)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection.
func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", p, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "id":
err = unpopulate(val, "ID", &p.ID)
delete(rawMsg, key)
case "name":
err = unpopulate(val, "Name", &p.Name)
delete(rawMsg, key)
case "properties":
err = unpopulate(val, "Properties", &p.Properties)
delete(rawMsg, key)
case "systemData":
err = unpopulate(val, "SystemData", &p.SystemData)
delete(rawMsg, key)
case "type":
err = unpopulate(val, "Type", &p.Type)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", p, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties.
func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "groupIds", p.GroupIDs)
populate(objectMap, "privateEndpoint", p.PrivateEndpoint)
populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState)
populate(objectMap, "provisioningState", p.ProvisioningState)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties.
func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", p, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "groupIds":
err = unpopulate(val, "GroupIDs", &p.GroupIDs)
delete(rawMsg, key)
case "privateEndpoint":
err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint)
delete(rawMsg, key)
case "privateLinkServiceConnectionState":
err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState)
delete(rawMsg, key)
case "provisioningState":
err = unpopulate(val, "ProvisioningState", &p.ProvisioningState)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", p, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionResource.
func (p PrivateEndpointConnectionResource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "id", p.ID)
populate(objectMap, "name", p.Name)
populate(objectMap, "properties", p.Properties)
populate(objectMap, "systemData", p.SystemData)
populate(objectMap, "type", p.Type)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionResource.
func (p *PrivateEndpointConnectionResource) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", p, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "id":
err = unpopulate(val, "ID", &p.ID)
delete(rawMsg, key)
case "name":
err = unpopulate(val, "Name", &p.Name)
delete(rawMsg, key)
case "properties":
err = unpopulate(val, "Properties", &p.Properties)
delete(rawMsg, key)
case "systemData":
err = unpopulate(val, "SystemData", &p.SystemData)
delete(rawMsg, key)
case "type":
err = unpopulate(val, "Type", &p.Type)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", p, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionResourceListResult.
func (p PrivateEndpointConnectionResourceListResult) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "nextLink", p.NextLink)
populate(objectMap, "value", p.Value)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionResourceListResult.
func (p *PrivateEndpointConnectionResourceListResult) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", p, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "nextLink":
err = unpopulate(val, "NextLink", &p.NextLink)
delete(rawMsg, key)
case "value":
err = unpopulate(val, "Value", &p.Value)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", p, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource.
func (p PrivateLinkResource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "id", p.ID)
populate(objectMap, "name", p.Name)
populate(objectMap, "properties", p.Properties)
populate(objectMap, "systemData", p.SystemData)
populate(objectMap, "type", p.Type)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource.
func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", p, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "id":
err = unpopulate(val, "ID", &p.ID)
delete(rawMsg, key)
case "name":
err = unpopulate(val, "Name", &p.Name)
delete(rawMsg, key)
case "properties":
err = unpopulate(val, "Properties", &p.Properties)
delete(rawMsg, key)
case "systemData":
err = unpopulate(val, "SystemData", &p.SystemData)
delete(rawMsg, key)
case "type":
err = unpopulate(val, "Type", &p.Type)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", p, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult.
func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "nextLink", p.NextLink)
populate(objectMap, "value", p.Value)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult.
func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", p, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "nextLink":
err = unpopulate(val, "NextLink", &p.NextLink)
delete(rawMsg, key)
case "value":
err = unpopulate(val, "Value", &p.Value)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", p, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties.
func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "groupId", p.GroupID)
populate(objectMap, "requiredMembers", p.RequiredMembers)
populate(objectMap, "requiredZoneNames", p.RequiredZoneNames)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties.
func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", p, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "groupId":
err = unpopulate(val, "GroupID", &p.GroupID)
delete(rawMsg, key)
case "requiredMembers":
err = unpopulate(val, "RequiredMembers", &p.RequiredMembers)
delete(rawMsg, key)
case "requiredZoneNames":
err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", p, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState.
func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "actionsRequired", p.ActionsRequired)
populate(objectMap, "description", p.Description)
populate(objectMap, "status", p.Status)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState.
func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", p, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "actionsRequired":
err = unpopulate(val, "ActionsRequired", &p.ActionsRequired)
delete(rawMsg, key)
case "description":
err = unpopulate(val, "Description", &p.Description)
delete(rawMsg, key)
case "status":
err = unpopulate(val, "Status", &p.Status)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", p, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type SystemData.
func (s SystemData) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt)
populate(objectMap, "createdBy", s.CreatedBy)
populate(objectMap, "createdByType", s.CreatedByType)
populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt)
populate(objectMap, "lastModifiedBy", s.LastModifiedBy)
populate(objectMap, "lastModifiedByType", s.LastModifiedByType)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData.
func (s *SystemData) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", s, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "createdAt":
err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt)
delete(rawMsg, key)
case "createdBy":
err = unpopulate(val, "CreatedBy", &s.CreatedBy)
delete(rawMsg, key)
case "createdByType":
err = unpopulate(val, "CreatedByType", &s.CreatedByType)
delete(rawMsg, key)
case "lastModifiedAt":
err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt)
delete(rawMsg, key)
case "lastModifiedBy":
err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy)
delete(rawMsg, key)
case "lastModifiedByType":
err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", s, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity.
func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "clientId", u.ClientID)
populate(objectMap, "principalId", u.PrincipalID)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity.
func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", u, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "clientId":
err = unpopulate(val, "ClientID", &u.ClientID)
delete(rawMsg, key)
case "principalId":
err = unpopulate(val, "PrincipalID", &u.PrincipalID)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", u, err)
}
}
return nil
}
func populate(m map[string]any, k string, v any) {
if v == nil {
return
} else if azcore.IsNullValue(v) {
m[k] = nil
} else if !reflect.ValueOf(v).IsNil() {
m[k] = v
}
}
func unpopulate(data json.RawMessage, fn string, v any) error {
if data == nil || string(data) == "null" {
return nil
}
if err := json.Unmarshal(data, v); err != nil {
return fmt.Errorf("struct field %s: %v", fn, err)
}
return nil
}

Просмотреть файл

@ -0,0 +1,84 @@
// 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. DO NOT EDIT.
package armhealthdataaiservices
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"net/http"
)
// OperationsClient contains the methods for the Operations group.
// Don't use this type directly, use NewOperationsClient() instead.
type OperationsClient struct {
internal *arm.Client
}
// 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.
func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) {
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
if err != nil {
return nil, err
}
client := &OperationsClient{
internal: cl,
}
return client, nil
}
// NewListPager - List the operations for the provider
//
// Generated from API version 2024-02-28-preview
// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.
func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] {
return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{
More: func(page OperationsClientListResponse) bool {
return page.NextLink != nil && len(*page.NextLink) > 0
},
Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) {
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager")
nextLink := ""
if page != nil {
nextLink = *page.NextLink
}
resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
return client.listCreateRequest(ctx, options)
}, nil)
if err != nil {
return OperationsClientListResponse{}, err
}
return client.listHandleResponse(resp)
},
Tracer: client.internal.Tracer(),
})
}
// listCreateRequest creates the List request.
func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) {
urlPath := "/providers/Microsoft.HealthDataAIServices/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", "2024-02-28-preview")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
}
// listHandleResponse handles the List response.
func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) {
result := OperationsClientListResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil {
return OperationsClientListResponse{}, err
}
return result, nil
}

Просмотреть файл

@ -0,0 +1,85 @@
// 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. DO NOT EDIT.
package armhealthdataaiservices_test
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices"
"log"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/Operations_List_MaximumSet_Gen.json
func ExampleOperationsClient_NewListPager_operationsListMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhealthdataaiservices.NewClientFactory("<subscriptionID>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewOperationsClient().NewListPager(nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page = armhealthdataaiservices.OperationsClientListResponse{
// OperationListResult: armhealthdataaiservices.OperationListResult{
// Value: []*armhealthdataaiservices.Operation{
// {
// Name: to.Ptr("vlozcqymdxttexvmhouwzob"),
// IsDataAction: to.Ptr(true),
// Display: &armhealthdataaiservices.OperationDisplay{
// Provider: to.Ptr("hwy"),
// Resource: to.Ptr("yxabgnzjshmqldqthxonpam"),
// Operation: to.Ptr("quwaawjasjgpqhskxoxzx"),
// Description: to.Ptr("ayqiodducsbwvzcgno"),
// },
// Origin: to.Ptr(armhealthdataaiservices.OriginUser),
// ActionType: to.Ptr(armhealthdataaiservices.ActionTypeInternal),
// },
// },
// NextLink: to.Ptr("https://microsoft.com/a"),
// },
// }
}
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/Operations_List_MinimumSet_Gen.json
func ExampleOperationsClient_NewListPager_operationsListMaximumSetGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhealthdataaiservices.NewClientFactory("<subscriptionID>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewOperationsClient().NewListPager(nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page = armhealthdataaiservices.OperationsClientListResponse{
// OperationListResult: armhealthdataaiservices.OperationListResult{
// },
// }
}
}

Просмотреть файл

@ -0,0 +1,77 @@
// 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. DO NOT EDIT.
package armhealthdataaiservices
// DeidServicesClientBeginCreateOptions contains the optional parameters for the DeidServicesClient.BeginCreate method.
type DeidServicesClientBeginCreateOptions struct {
// Resumes the long-running operation from the provided token.
ResumeToken string
}
// DeidServicesClientBeginDeleteOptions contains the optional parameters for the DeidServicesClient.BeginDelete method.
type DeidServicesClientBeginDeleteOptions struct {
// Resumes the long-running operation from the provided token.
ResumeToken string
}
// DeidServicesClientBeginUpdateOptions contains the optional parameters for the DeidServicesClient.BeginUpdate method.
type DeidServicesClientBeginUpdateOptions struct {
// Resumes the long-running operation from the provided token.
ResumeToken string
}
// DeidServicesClientGetOptions contains the optional parameters for the DeidServicesClient.Get method.
type DeidServicesClientGetOptions struct {
// placeholder for future optional parameters
}
// DeidServicesClientListByResourceGroupOptions contains the optional parameters for the DeidServicesClient.NewListByResourceGroupPager
// method.
type DeidServicesClientListByResourceGroupOptions struct {
// placeholder for future optional parameters
}
// DeidServicesClientListBySubscriptionOptions contains the optional parameters for the DeidServicesClient.NewListBySubscriptionPager
// method.
type DeidServicesClientListBySubscriptionOptions struct {
// placeholder for future optional parameters
}
// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.
type OperationsClientListOptions struct {
// placeholder for future optional parameters
}
// PrivateEndpointConnectionsClientBeginCreateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreate
// method.
type PrivateEndpointConnectionsClientBeginCreateOptions struct {
// Resumes the long-running operation from the provided token.
ResumeToken string
}
// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete
// method.
type PrivateEndpointConnectionsClientBeginDeleteOptions struct {
// Resumes the long-running operation from the provided token.
ResumeToken string
}
// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get
// method.
type PrivateEndpointConnectionsClientGetOptions struct {
// placeholder for future optional parameters
}
// PrivateEndpointConnectionsClientListByDeidServiceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByDeidServicePager
// method.
type PrivateEndpointConnectionsClientListByDeidServiceOptions struct {
// placeholder for future optional parameters
}
// PrivateLinksClientListByDeidServiceOptions contains the optional parameters for the PrivateLinksClient.NewListByDeidServicePager
// method.
type PrivateLinksClientListByDeidServiceOptions struct {
// placeholder for future optional parameters
}

Просмотреть файл

@ -0,0 +1,342 @@
// 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. DO NOT EDIT.
package armhealthdataaiservices
import (
"context"
"errors"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"net/http"
"net/url"
"strings"
)
// PrivateEndpointConnectionsClient - Private connection operations
// Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead.
type PrivateEndpointConnectionsClient struct {
internal *arm.Client
subscriptionID string
}
// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values.
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) {
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
if err != nil {
return nil, err
}
client := &PrivateEndpointConnectionsClient{
subscriptionID: subscriptionID,
internal: cl,
}
return client, nil
}
// BeginCreate - Create a Private endpoint connection
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2024-02-28-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - deidServiceName - The name of the deid service
// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource.
// - resource - Resource create parameters.
// - options - PrivateEndpointConnectionsClientBeginCreateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreate
// method.
func (client *PrivateEndpointConnectionsClient) BeginCreate(ctx context.Context, resourceGroupName string, deidServiceName string, privateEndpointConnectionName string, resource PrivateEndpointConnectionResource, options *PrivateEndpointConnectionsClientBeginCreateOptions) (*runtime.Poller[PrivateEndpointConnectionsClientCreateResponse], error) {
if options == nil || options.ResumeToken == "" {
resp, err := client.create(ctx, resourceGroupName, deidServiceName, privateEndpointConnectionName, resource, options)
if err != nil {
return nil, err
}
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientCreateResponse]{
Tracer: client.internal.Tracer(),
})
return poller, err
} else {
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateEndpointConnectionsClientCreateResponse]{
Tracer: client.internal.Tracer(),
})
}
}
// Create - Create a Private endpoint connection
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2024-02-28-preview
func (client *PrivateEndpointConnectionsClient) create(ctx context.Context, resourceGroupName string, deidServiceName string, privateEndpointConnectionName string, resource PrivateEndpointConnectionResource, options *PrivateEndpointConnectionsClientBeginCreateOptions) (*http.Response, error) {
var err error
const operationName = "PrivateEndpointConnectionsClient.BeginCreate"
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
defer func() { endSpan(err) }()
req, err := client.createCreateRequest(ctx, resourceGroupName, deidServiceName, privateEndpointConnectionName, resource, options)
if err != nil {
return nil, err
}
httpResp, err := client.internal.Pipeline().Do(req)
if err != nil {
return nil, err
}
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) {
err = runtime.NewResponseError(httpResp)
return nil, err
}
return httpResp, nil
}
// createCreateRequest creates the Create request.
func (client *PrivateEndpointConnectionsClient) createCreateRequest(ctx context.Context, resourceGroupName string, deidServiceName string, privateEndpointConnectionName string, resource PrivateEndpointConnectionResource, _ *PrivateEndpointConnectionsClientBeginCreateOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections/{privateEndpointConnectionName}"
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 deidServiceName == "" {
return nil, errors.New("parameter deidServiceName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{deidServiceName}", url.PathEscape(deidServiceName))
if privateEndpointConnectionName == "" {
return nil, errors.New("parameter privateEndpointConnectionName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName))
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2024-02-28-preview")
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, resource); err != nil {
return nil, err
}
return req, nil
}
// BeginDelete - Delete the private endpoint connection
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2024-02-28-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - deidServiceName - The name of the deid service
// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource.
// - options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete
// method.
func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, deidServiceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) {
if options == nil || options.ResumeToken == "" {
resp, err := client.deleteOperation(ctx, resourceGroupName, deidServiceName, privateEndpointConnectionName, options)
if err != nil {
return nil, err
}
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{
Tracer: client.internal.Tracer(),
})
return poller, err
} else {
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateEndpointConnectionsClientDeleteResponse]{
Tracer: client.internal.Tracer(),
})
}
}
// Delete - Delete the private endpoint connection
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2024-02-28-preview
func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, deidServiceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) {
var err error
const operationName = "PrivateEndpointConnectionsClient.BeginDelete"
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
defer func() { endSpan(err) }()
req, err := client.deleteCreateRequest(ctx, resourceGroupName, deidServiceName, privateEndpointConnectionName, options)
if err != nil {
return nil, err
}
httpResp, err := client.internal.Pipeline().Do(req)
if err != nil {
return nil, err
}
if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) {
err = runtime.NewResponseError(httpResp)
return nil, err
}
return httpResp, nil
}
// deleteCreateRequest creates the Delete request.
func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, deidServiceName string, privateEndpointConnectionName string, _ *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections/{privateEndpointConnectionName}"
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 deidServiceName == "" {
return nil, errors.New("parameter deidServiceName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{deidServiceName}", url.PathEscape(deidServiceName))
if privateEndpointConnectionName == "" {
return nil, errors.New("parameter privateEndpointConnectionName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName))
req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2024-02-28-preview")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
}
// Get - Get a specific private connection
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2024-02-28-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - deidServiceName - The name of the deid service
// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource.
// - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get
// method.
func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, deidServiceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) {
var err error
const operationName = "PrivateEndpointConnectionsClient.Get"
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
defer func() { endSpan(err) }()
req, err := client.getCreateRequest(ctx, resourceGroupName, deidServiceName, privateEndpointConnectionName, options)
if err != nil {
return PrivateEndpointConnectionsClientGetResponse{}, err
}
httpResp, err := client.internal.Pipeline().Do(req)
if err != nil {
return PrivateEndpointConnectionsClientGetResponse{}, err
}
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
err = runtime.NewResponseError(httpResp)
return PrivateEndpointConnectionsClientGetResponse{}, err
}
resp, err := client.getHandleResponse(httpResp)
return resp, err
}
// getCreateRequest creates the Get request.
func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, deidServiceName string, privateEndpointConnectionName string, _ *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections/{privateEndpointConnectionName}"
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 deidServiceName == "" {
return nil, errors.New("parameter deidServiceName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{deidServiceName}", url.PathEscape(deidServiceName))
if privateEndpointConnectionName == "" {
return nil, errors.New("parameter privateEndpointConnectionName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName))
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", "2024-02-28-preview")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
}
// getHandleResponse handles the Get response.
func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientGetResponse, error) {
result := PrivateEndpointConnectionsClientGetResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionResource); err != nil {
return PrivateEndpointConnectionsClientGetResponse{}, err
}
return result, nil
}
// NewListByDeidServicePager - List private endpoint connections on the given resource
//
// Generated from API version 2024-02-28-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - deidServiceName - The name of the deid service
// - options - PrivateEndpointConnectionsClientListByDeidServiceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByDeidServicePager
// method.
func (client *PrivateEndpointConnectionsClient) NewListByDeidServicePager(resourceGroupName string, deidServiceName string, options *PrivateEndpointConnectionsClientListByDeidServiceOptions) *runtime.Pager[PrivateEndpointConnectionsClientListByDeidServiceResponse] {
return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionsClientListByDeidServiceResponse]{
More: func(page PrivateEndpointConnectionsClientListByDeidServiceResponse) bool {
return page.NextLink != nil && len(*page.NextLink) > 0
},
Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsClientListByDeidServiceResponse) (PrivateEndpointConnectionsClientListByDeidServiceResponse, error) {
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateEndpointConnectionsClient.NewListByDeidServicePager")
nextLink := ""
if page != nil {
nextLink = *page.NextLink
}
resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
return client.listByDeidServiceCreateRequest(ctx, resourceGroupName, deidServiceName, options)
}, nil)
if err != nil {
return PrivateEndpointConnectionsClientListByDeidServiceResponse{}, err
}
return client.listByDeidServiceHandleResponse(resp)
},
Tracer: client.internal.Tracer(),
})
}
// listByDeidServiceCreateRequest creates the ListByDeidService request.
func (client *PrivateEndpointConnectionsClient) listByDeidServiceCreateRequest(ctx context.Context, resourceGroupName string, deidServiceName string, _ *PrivateEndpointConnectionsClientListByDeidServiceOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections"
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 deidServiceName == "" {
return nil, errors.New("parameter deidServiceName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{deidServiceName}", url.PathEscape(deidServiceName))
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", "2024-02-28-preview")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
}
// listByDeidServiceHandleResponse handles the ListByDeidService response.
func (client *PrivateEndpointConnectionsClient) listByDeidServiceHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientListByDeidServiceResponse, error) {
result := PrivateEndpointConnectionsClientListByDeidServiceResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionResourceListResult); err != nil {
return PrivateEndpointConnectionsClientListByDeidServiceResponse{}, err
}
return result, nil
}

Просмотреть файл

@ -0,0 +1,204 @@
// 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. DO NOT EDIT.
package armhealthdataaiservices_test
import (
"context"
"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/healthdataaiservices/armhealthdataaiservices"
"log"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/PrivateEndpointConnections_Create_MaximumSet_Gen.json
func ExamplePrivateEndpointConnectionsClient_BeginCreate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhealthdataaiservices.NewClientFactory("F21BB31B-C214-42C0-ACF0-DACCA05D3011", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginCreate(ctx, "rgopenapi", "deidTest", "kgwgrrpabvrsrrvpcgcnfmyfgyrl", armhealthdataaiservices.PrivateEndpointConnectionResource{
Properties: &armhealthdataaiservices.PrivateEndpointConnectionProperties{
PrivateEndpoint: &armhealthdataaiservices.PrivateEndpoint{},
PrivateLinkServiceConnectionState: &armhealthdataaiservices.PrivateLinkServiceConnectionState{
Status: to.Ptr(armhealthdataaiservices.PrivateEndpointServiceConnectionStatusPending),
ActionsRequired: to.Ptr("ulb"),
Description: to.Ptr("xr"),
},
},
}, 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 = armhealthdataaiservices.PrivateEndpointConnectionsClientCreateResponse{
// PrivateEndpointConnectionResource: &armhealthdataaiservices.PrivateEndpointConnectionResource{
// Properties: &armhealthdataaiservices.PrivateEndpointConnectionProperties{
// PrivateEndpoint: &armhealthdataaiservices.PrivateEndpoint{
// ID: to.Ptr("gpnxxbbtsysdhhclm"),
// },
// PrivateLinkServiceConnectionState: &armhealthdataaiservices.PrivateLinkServiceConnectionState{
// Status: to.Ptr(armhealthdataaiservices.PrivateEndpointServiceConnectionStatusPending),
// ActionsRequired: to.Ptr("ulb"),
// Description: to.Ptr("xr"),
// },
// GroupIDs: []*string{
// to.Ptr("xbdyjqg"),
// },
// ProvisioningState: to.Ptr(armhealthdataaiservices.PrivateEndpointConnectionProvisioningStateSucceeded),
// },
// ID: to.Ptr("/subscriptions/F21BB31B-C214-42C0-ACF0-DACCA05D3011/resourceGroups/rgopenapi/providers/Microsoft.HealthDataAIServices/deidServices/deidTest/privateEndpointConnections/aduyb"),
// Name: to.Ptr("aduyb"),
// Type: to.Ptr("umjjkodjuhccrngl"),
// SystemData: &armhealthdataaiservices.SystemData{
// CreatedBy: to.Ptr("p"),
// CreatedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.985Z"); return t}()),
// LastModifiedBy: to.Ptr("pmbozfvwrblbknedeb"),
// LastModifiedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.986Z"); return t}()),
// },
// },
// }
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/PrivateEndpointConnections_Delete_MaximumSet_Gen.json
func ExamplePrivateEndpointConnectionsClient_BeginDelete() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhealthdataaiservices.NewClientFactory("F21BB31B-C214-42C0-ACF0-DACCA05D3011", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "rgopenapi", "deidTest", "kgwgrrpabvrsrrvpcgcnfmyfgyrl", 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/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/PrivateEndpointConnections_Get_MaximumSet_Gen.json
func ExamplePrivateEndpointConnectionsClient_Get() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhealthdataaiservices.NewClientFactory("F21BB31B-C214-42C0-ACF0-DACCA05D3011", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "rgopenapi", "deidTest", "kgwgrrpabvrsrrvpcgcnfmyfgyrl", 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 = armhealthdataaiservices.PrivateEndpointConnectionsClientGetResponse{
// PrivateEndpointConnectionResource: &armhealthdataaiservices.PrivateEndpointConnectionResource{
// Properties: &armhealthdataaiservices.PrivateEndpointConnectionProperties{
// PrivateEndpoint: &armhealthdataaiservices.PrivateEndpoint{
// ID: to.Ptr("gpnxxbbtsysdhhclm"),
// },
// PrivateLinkServiceConnectionState: &armhealthdataaiservices.PrivateLinkServiceConnectionState{
// Status: to.Ptr(armhealthdataaiservices.PrivateEndpointServiceConnectionStatusPending),
// ActionsRequired: to.Ptr("ulb"),
// Description: to.Ptr("xr"),
// },
// GroupIDs: []*string{
// to.Ptr("xbdyjqg"),
// },
// ProvisioningState: to.Ptr(armhealthdataaiservices.PrivateEndpointConnectionProvisioningStateSucceeded),
// },
// ID: to.Ptr("/subscriptions/F21BB31B-C214-42C0-ACF0-DACCA05D3011/resourceGroups/rgopenapi/providers/Microsoft.HealthDataAIServices/deidServices/deidTest/privateEndpointConnections/aduyb"),
// Name: to.Ptr("aduyb"),
// Type: to.Ptr("umjjkodjuhccrngl"),
// SystemData: &armhealthdataaiservices.SystemData{
// CreatedBy: to.Ptr("p"),
// CreatedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.985Z"); return t}()),
// LastModifiedBy: to.Ptr("pmbozfvwrblbknedeb"),
// LastModifiedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.986Z"); return t}()),
// },
// },
// }
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/PrivateEndpointConnections_ListByDeidService_MaximumSet_Gen.json
func ExamplePrivateEndpointConnectionsClient_NewListByDeidServicePager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhealthdataaiservices.NewClientFactory("F21BB31B-C214-42C0-ACF0-DACCA05D3011", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewPrivateEndpointConnectionsClient().NewListByDeidServicePager("rgopenapi", "deidTest", nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page = armhealthdataaiservices.PrivateEndpointConnectionsClientListByDeidServiceResponse{
// PrivateEndpointConnectionResourceListResult: armhealthdataaiservices.PrivateEndpointConnectionResourceListResult{
// Value: []*armhealthdataaiservices.PrivateEndpointConnectionResource{
// {
// Properties: &armhealthdataaiservices.PrivateEndpointConnectionProperties{
// PrivateEndpoint: &armhealthdataaiservices.PrivateEndpoint{
// ID: to.Ptr("gpnxxbbtsysdhhclm"),
// },
// PrivateLinkServiceConnectionState: &armhealthdataaiservices.PrivateLinkServiceConnectionState{
// Status: to.Ptr(armhealthdataaiservices.PrivateEndpointServiceConnectionStatusPending),
// ActionsRequired: to.Ptr("ulb"),
// Description: to.Ptr("mmvcleuufspfrojjveuith"),
// },
// GroupIDs: []*string{
// to.Ptr("xbdyjqg"),
// },
// ProvisioningState: to.Ptr(armhealthdataaiservices.PrivateEndpointConnectionProvisioningStateSucceeded),
// },
// ID: to.Ptr("/subscriptions/F21BB31B-C214-42C0-ACF0-DACCA05D3011/resourceGroups/rgopenapi/providers/Microsoft.HealthDataAIServices/deidServices/deidTest/privateEndpointConnections/aduyb"),
// Name: to.Ptr("aduyb"),
// Type: to.Ptr("umjjkodjuhccrngl"),
// SystemData: &armhealthdataaiservices.SystemData{
// CreatedBy: to.Ptr("p"),
// CreatedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.985Z"); return t}()),
// LastModifiedBy: to.Ptr("pmbozfvwrblbknedeb"),
// LastModifiedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.986Z"); return t}()),
// },
// },
// },
// NextLink: to.Ptr("https://microsoft.com/a"),
// },
// }
}
}

Просмотреть файл

@ -0,0 +1,105 @@
// 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. DO NOT EDIT.
package armhealthdataaiservices
import (
"context"
"errors"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"net/http"
"net/url"
"strings"
)
// PrivateLinksClient - Operations for private links on DeidService resource
// Don't use this type directly, use NewPrivateLinksClient() instead.
type PrivateLinksClient struct {
internal *arm.Client
subscriptionID string
}
// NewPrivateLinksClient creates a new instance of PrivateLinksClient with the specified values.
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewPrivateLinksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinksClient, error) {
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
if err != nil {
return nil, err
}
client := &PrivateLinksClient{
subscriptionID: subscriptionID,
internal: cl,
}
return client, nil
}
// NewListByDeidServicePager - List private links on the given resource
//
// Generated from API version 2024-02-28-preview
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - deidServiceName - The name of the deid service
// - options - PrivateLinksClientListByDeidServiceOptions contains the optional parameters for the PrivateLinksClient.NewListByDeidServicePager
// method.
func (client *PrivateLinksClient) NewListByDeidServicePager(resourceGroupName string, deidServiceName string, options *PrivateLinksClientListByDeidServiceOptions) *runtime.Pager[PrivateLinksClientListByDeidServiceResponse] {
return runtime.NewPager(runtime.PagingHandler[PrivateLinksClientListByDeidServiceResponse]{
More: func(page PrivateLinksClientListByDeidServiceResponse) bool {
return page.NextLink != nil && len(*page.NextLink) > 0
},
Fetcher: func(ctx context.Context, page *PrivateLinksClientListByDeidServiceResponse) (PrivateLinksClientListByDeidServiceResponse, error) {
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateLinksClient.NewListByDeidServicePager")
nextLink := ""
if page != nil {
nextLink = *page.NextLink
}
resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
return client.listByDeidServiceCreateRequest(ctx, resourceGroupName, deidServiceName, options)
}, nil)
if err != nil {
return PrivateLinksClientListByDeidServiceResponse{}, err
}
return client.listByDeidServiceHandleResponse(resp)
},
Tracer: client.internal.Tracer(),
})
}
// listByDeidServiceCreateRequest creates the ListByDeidService request.
func (client *PrivateLinksClient) listByDeidServiceCreateRequest(ctx context.Context, resourceGroupName string, deidServiceName string, _ *PrivateLinksClientListByDeidServiceOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateLinkResources"
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 deidServiceName == "" {
return nil, errors.New("parameter deidServiceName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{deidServiceName}", url.PathEscape(deidServiceName))
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", "2024-02-28-preview")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
}
// listByDeidServiceHandleResponse handles the ListByDeidService response.
func (client *PrivateLinksClient) listByDeidServiceHandleResponse(resp *http.Response) (PrivateLinksClientListByDeidServiceResponse, error) {
result := PrivateLinksClientListByDeidServiceResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil {
return PrivateLinksClientListByDeidServiceResponse{}, err
}
return result, nil
}

Просмотреть файл

@ -0,0 +1,66 @@
// 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. DO NOT EDIT.
package armhealthdataaiservices_test
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices"
"log"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/925b1febaaebc3e1d602c765168e8ddabc7153a5/specification/healthdataaiservices/HealthDataAIServices.Management/examples/2024-02-28-preview/PrivateLinks_ListByDeidService_MaximumSet_Gen.json
func ExamplePrivateLinksClient_NewListByDeidServicePager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhealthdataaiservices.NewClientFactory("F21BB31B-C214-42C0-ACF0-DACCA05D3011", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewPrivateLinksClient().NewListByDeidServicePager("rgopenapi", "deidTest", nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page = armhealthdataaiservices.PrivateLinksClientListByDeidServiceResponse{
// PrivateLinkResourceListResult: armhealthdataaiservices.PrivateLinkResourceListResult{
// Value: []*armhealthdataaiservices.PrivateLinkResource{
// {
// Properties: &armhealthdataaiservices.PrivateLinkResourceProperties{
// GroupID: to.Ptr("flaloakbdcqjisfhfnkrxmt"),
// RequiredMembers: []*string{
// to.Ptr("wbraaugftjqa"),
// },
// RequiredZoneNames: []*string{
// to.Ptr("ndsmc"),
// },
// },
// ID: to.Ptr("/subscriptions/F21BB31B-C214-42C0-ACF0-DACCA05D3011/resourceGroups/rgopenapi/providers/Microsoft.HealthDataAIServices/deidServices/deidTest/privateLinkResources/rmptbzejhgxhlfpdizsekhsq"),
// Name: to.Ptr("rmptbzejhgxhlfpdizsekhsq"),
// Type: to.Ptr("lplbvyjkvsujegzqr"),
// SystemData: &armhealthdataaiservices.SystemData{
// CreatedBy: to.Ptr("p"),
// CreatedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.985Z"); return t}()),
// LastModifiedBy: to.Ptr("pmbozfvwrblbknedeb"),
// LastModifiedByType: to.Ptr(armhealthdataaiservices.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-13T19:47:24.986Z"); return t}()),
// },
// },
// },
// NextLink: to.Ptr("https://microsoft.com/arzijt"),
// },
// }
}
}

Просмотреть файл

@ -0,0 +1,75 @@
// 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. DO NOT EDIT.
package armhealthdataaiservices
// DeidServicesClientCreateResponse contains the response from method DeidServicesClient.BeginCreate.
type DeidServicesClientCreateResponse struct {
// A HealthDataAIServicesProviderHub resource
DeidService
}
// DeidServicesClientDeleteResponse contains the response from method DeidServicesClient.BeginDelete.
type DeidServicesClientDeleteResponse struct {
// placeholder for future response values
}
// DeidServicesClientGetResponse contains the response from method DeidServicesClient.Get.
type DeidServicesClientGetResponse struct {
// A HealthDataAIServicesProviderHub resource
DeidService
}
// DeidServicesClientListByResourceGroupResponse contains the response from method DeidServicesClient.NewListByResourceGroupPager.
type DeidServicesClientListByResourceGroupResponse struct {
// The response of a DeidService list operation.
DeidServiceListResult
}
// DeidServicesClientListBySubscriptionResponse contains the response from method DeidServicesClient.NewListBySubscriptionPager.
type DeidServicesClientListBySubscriptionResponse struct {
// The response of a DeidService list operation.
DeidServiceListResult
}
// DeidServicesClientUpdateResponse contains the response from method DeidServicesClient.BeginUpdate.
type DeidServicesClientUpdateResponse struct {
// A HealthDataAIServicesProviderHub resource
DeidService
}
// OperationsClientListResponse contains the response from method OperationsClient.NewListPager.
type OperationsClientListResponse struct {
// A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results.
OperationListResult
}
// PrivateEndpointConnectionsClientCreateResponse contains the response from method PrivateEndpointConnectionsClient.BeginCreate.
type PrivateEndpointConnectionsClientCreateResponse struct {
// Holder for private endpoint connections
PrivateEndpointConnectionResource
}
// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.BeginDelete.
type PrivateEndpointConnectionsClientDeleteResponse struct {
// placeholder for future response values
}
// PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get.
type PrivateEndpointConnectionsClientGetResponse struct {
// Holder for private endpoint connections
PrivateEndpointConnectionResource
}
// PrivateEndpointConnectionsClientListByDeidServiceResponse contains the response from method PrivateEndpointConnectionsClient.NewListByDeidServicePager.
type PrivateEndpointConnectionsClientListByDeidServiceResponse struct {
// The response of a PrivateEndpointConnectionResource list operation.
PrivateEndpointConnectionResourceListResult
}
// PrivateLinksClientListByDeidServiceResponse contains the response from method PrivateLinksClient.NewListByDeidServicePager.
type PrivateLinksClientListByDeidServiceResponse struct {
// The response of a PrivateLinkResource list operation.
PrivateLinkResourceListResult
}

Просмотреть файл

@ -0,0 +1,109 @@
// 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. DO NOT EDIT.
package armhealthdataaiservices
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 (
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
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 {
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 {
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))
}
func (t *dateTimeRFC3339) Parse(layout, value string) error {
p, err := time.Parse(layout, strings.ToUpper(value))
*t = dateTimeRFC3339(p)
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
} 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 || 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
}

Просмотреть файл

@ -0,0 +1,4 @@
directory: specification/healthdataaiservices/HealthDataAIServices.Management
commit: 925b1febaaebc3e1d602c765168e8ddabc7153a5
repo: Azure/azure-rest-api-specs
additionalDirectories: