From 817a82aeb5de9f5ec72fe3d690a8e70db535105d Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 9 May 2025 09:26:18 +0000 Subject: [PATCH] CodeGen from PR 34274 in Azure/azure-rest-api-specs Merge f3ee42f20ffab6ee4416d9e26794be2d01e30e63 into 761d8b58e465b26eddb8ad70dda3cde7b4228bdf --- .../dashboard/armdashboard/CHANGELOG.md | 61 ++ .../dashboard/armdashboard/README.md | 4 +- .../dashboard/armdashboard/autorest.md | 13 - .../dashboard/armdashboard/build.go | 7 - .../dashboard/armdashboard/client_factory.go | 62 +- .../dashboard/armdashboard/constants.go | 58 +- .../fake/integrationfabrics_server.go | 353 ++++++++++ .../dashboard/armdashboard/fake/internal.go | 19 +- ...na_server.go => managedgrafanas_server.go} | 314 +++++---- ...=> managedprivateendpointmodels_server.go} | 207 +++--- .../armdashboard/fake/operations_server.go | 57 +- .../fake/privateendpointconnections_server.go | 93 +-- .../fake/privatelinkresources_server.go | 65 +- .../armdashboard/fake/server_factory.go | 62 +- .../armdashboard/fake/time_rfc3339.go | 86 --- .../dashboard/armdashboard/go.mod | 2 +- .../grafana_client_example_test.go | 588 ----------------- .../armdashboard/integrationfabrics_client.go | 425 ++++++++++++ .../integrationfabrics_client_example_test.go | 215 +++++++ ...na_client.go => managedgrafanas_client.go} | 300 +++++---- .../managedgrafanas_client_example_test.go | 604 ++++++++++++++++++ ...=> managedprivateendpointmodels_client.go} | 215 ++----- ...ivateendpointmodels_client_example_test.go | 259 ++++++++ ...gedprivateendpoints_client_example_test.go | 282 -------- .../dashboard/armdashboard/models.go | 212 ++++-- .../dashboard/armdashboard/models_serde.go | 280 +++++++- .../armdashboard/operations_client.go | 14 +- .../operations_client_example_test.go | 43 +- .../dashboard/armdashboard/options.go | 115 ++-- .../privateendpointconnections_client.go | 53 +- ...endpointconnections_client_example_test.go | 121 ++-- .../privatelinkresources_client.go | 20 +- ...rivatelinkresources_client_example_test.go | 115 ++-- .../dashboard/armdashboard/response_types.go | 131 ---- .../dashboard/armdashboard/responses.go | 155 +++++ .../dashboard/armdashboard/time_rfc3339.go | 51 +- .../dashboard/armdashboard/tsp-location.yaml | 4 + 37 files changed, 3591 insertions(+), 2074 deletions(-) delete mode 100644 sdk/resourcemanager/dashboard/armdashboard/autorest.md delete mode 100644 sdk/resourcemanager/dashboard/armdashboard/build.go create mode 100644 sdk/resourcemanager/dashboard/armdashboard/fake/integrationfabrics_server.go rename sdk/resourcemanager/dashboard/armdashboard/fake/{grafana_server.go => managedgrafanas_server.go} (55%) rename sdk/resourcemanager/dashboard/armdashboard/fake/{managedprivateendpoints_server.go => managedprivateendpointmodels_server.go} (62%) delete mode 100644 sdk/resourcemanager/dashboard/armdashboard/fake/time_rfc3339.go delete mode 100644 sdk/resourcemanager/dashboard/armdashboard/grafana_client_example_test.go create mode 100644 sdk/resourcemanager/dashboard/armdashboard/integrationfabrics_client.go create mode 100644 sdk/resourcemanager/dashboard/armdashboard/integrationfabrics_client_example_test.go rename sdk/resourcemanager/dashboard/armdashboard/{grafana_client.go => managedgrafanas_client.go} (56%) create mode 100644 sdk/resourcemanager/dashboard/armdashboard/managedgrafanas_client_example_test.go rename sdk/resourcemanager/dashboard/armdashboard/{managedprivateendpoints_client.go => managedprivateendpointmodels_client.go} (58%) create mode 100644 sdk/resourcemanager/dashboard/armdashboard/managedprivateendpointmodels_client_example_test.go delete mode 100644 sdk/resourcemanager/dashboard/armdashboard/managedprivateendpoints_client_example_test.go delete mode 100644 sdk/resourcemanager/dashboard/armdashboard/response_types.go create mode 100644 sdk/resourcemanager/dashboard/armdashboard/responses.go create mode 100644 sdk/resourcemanager/dashboard/armdashboard/tsp-location.yaml diff --git a/sdk/resourcemanager/dashboard/armdashboard/CHANGELOG.md b/sdk/resourcemanager/dashboard/armdashboard/CHANGELOG.md index b852af4737f5..c1f399911aa6 100644 --- a/sdk/resourcemanager/dashboard/armdashboard/CHANGELOG.md +++ b/sdk/resourcemanager/dashboard/armdashboard/CHANGELOG.md @@ -1,5 +1,66 @@ # Release History +## 2.0.0 (2025-05-09) +### Breaking Changes + +- Function `*PrivateEndpointConnectionsClient.BeginApprove` parameter(s) have been changed from `(context.Context, string, string, string, PrivateEndpointConnection, *PrivateEndpointConnectionsClientBeginApproveOptions)` to `(context.Context, string, string, string, PrivateEndpointConnection, string, *PrivateEndpointConnectionsClientBeginApproveOptions)` +- Function `*ClientFactory.NewGrafanaClient` has been removed +- Function `*ClientFactory.NewManagedPrivateEndpointsClient` has been removed +- Function `NewGrafanaClient` has been removed +- Function `*GrafanaClient.CheckEnterpriseDetails` has been removed +- Function `*GrafanaClient.BeginCreate` has been removed +- Function `*GrafanaClient.BeginDelete` has been removed +- Function `*GrafanaClient.FetchAvailablePlugins` has been removed +- Function `*GrafanaClient.Get` has been removed +- Function `*GrafanaClient.NewListByResourceGroupPager` has been removed +- Function `*GrafanaClient.NewListPager` has been removed +- Function `*GrafanaClient.Update` has been removed +- Function `NewManagedPrivateEndpointsClient` has been removed +- Function `*ManagedPrivateEndpointsClient.BeginCreate` has been removed +- Function `*ManagedPrivateEndpointsClient.BeginDelete` has been removed +- Function `*ManagedPrivateEndpointsClient.Get` has been removed +- Function `*ManagedPrivateEndpointsClient.NewListPager` has been removed +- Function `*ManagedPrivateEndpointsClient.BeginRefresh` has been removed +- Function `*ManagedPrivateEndpointsClient.BeginUpdate` has been removed + +### Features Added + +- New function `*ClientFactory.NewIntegrationFabricsClient() *IntegrationFabricsClient` +- New function `*ClientFactory.NewManagedGrafanasClient() *ManagedGrafanasClient` +- New function `*ClientFactory.NewManagedPrivateEndpointModelsClient() *ManagedPrivateEndpointModelsClient` +- New function `NewIntegrationFabricsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*IntegrationFabricsClient, error)` +- New function `*IntegrationFabricsClient.BeginCreate(context.Context, string, string, string, IntegrationFabric, *IntegrationFabricsClientBeginCreateOptions) (*runtime.Poller[IntegrationFabricsClientCreateResponse], error)` +- New function `*IntegrationFabricsClient.BeginDelete(context.Context, string, string, string, *IntegrationFabricsClientBeginDeleteOptions) (*runtime.Poller[IntegrationFabricsClientDeleteResponse], error)` +- New function `*IntegrationFabricsClient.Get(context.Context, string, string, string, *IntegrationFabricsClientGetOptions) (IntegrationFabricsClientGetResponse, error)` +- New function `*IntegrationFabricsClient.NewListPager(string, string, *IntegrationFabricsClientListOptions) *runtime.Pager[IntegrationFabricsClientListResponse]` +- New function `*IntegrationFabricsClient.BeginUpdate(context.Context, string, string, string, IntegrationFabricUpdateParameters, *IntegrationFabricsClientBeginUpdateOptions) (*runtime.Poller[IntegrationFabricsClientUpdateResponse], error)` +- New function `NewManagedGrafanasClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ManagedGrafanasClient, error)` +- New function `*ManagedGrafanasClient.CheckEnterpriseDetails(context.Context, string, string, *ManagedGrafanasClientCheckEnterpriseDetailsOptions) (ManagedGrafanasClientCheckEnterpriseDetailsResponse, error)` +- New function `*ManagedGrafanasClient.BeginCreate(context.Context, string, string, ManagedGrafana, *ManagedGrafanasClientBeginCreateOptions) (*runtime.Poller[ManagedGrafanasClientCreateResponse], error)` +- New function `*ManagedGrafanasClient.BeginDelete(context.Context, string, string, *ManagedGrafanasClientBeginDeleteOptions) (*runtime.Poller[ManagedGrafanasClientDeleteResponse], error)` +- New function `*ManagedGrafanasClient.FetchAvailablePlugins(context.Context, string, string, *ManagedGrafanasClientFetchAvailablePluginsOptions) (ManagedGrafanasClientFetchAvailablePluginsResponse, error)` +- New function `*ManagedGrafanasClient.Get(context.Context, string, string, *ManagedGrafanasClientGetOptions) (ManagedGrafanasClientGetResponse, error)` +- New function `*ManagedGrafanasClient.NewListByResourceGroupPager(string, *ManagedGrafanasClientListByResourceGroupOptions) *runtime.Pager[ManagedGrafanasClientListByResourceGroupResponse]` +- New function `*ManagedGrafanasClient.NewListPager(*ManagedGrafanasClientListOptions) *runtime.Pager[ManagedGrafanasClientListResponse]` +- New function `*ManagedGrafanasClient.BeginRefresh(context.Context, string, string, *ManagedGrafanasClientBeginRefreshOptions) (*runtime.Poller[ManagedGrafanasClientRefreshResponse], error)` +- New function `*ManagedGrafanasClient.Update(context.Context, string, string, ManagedGrafanaUpdateParameters, *ManagedGrafanasClientUpdateOptions) (ManagedGrafanasClientUpdateResponse, error)` +- New function `NewManagedPrivateEndpointModelsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ManagedPrivateEndpointModelsClient, error)` +- New function `*ManagedPrivateEndpointModelsClient.BeginCreate(context.Context, string, string, string, ManagedPrivateEndpointModel, *ManagedPrivateEndpointModelsClientBeginCreateOptions) (*runtime.Poller[ManagedPrivateEndpointModelsClientCreateResponse], error)` +- New function `*ManagedPrivateEndpointModelsClient.BeginDelete(context.Context, string, string, string, *ManagedPrivateEndpointModelsClientBeginDeleteOptions) (*runtime.Poller[ManagedPrivateEndpointModelsClientDeleteResponse], error)` +- New function `*ManagedPrivateEndpointModelsClient.Get(context.Context, string, string, string, *ManagedPrivateEndpointModelsClientGetOptions) (ManagedPrivateEndpointModelsClientGetResponse, error)` +- New function `*ManagedPrivateEndpointModelsClient.NewListPager(string, string, *ManagedPrivateEndpointModelsClientListOptions) *runtime.Pager[ManagedPrivateEndpointModelsClientListResponse]` +- New function `*ManagedPrivateEndpointModelsClient.BeginUpdate(context.Context, string, string, string, ManagedPrivateEndpointUpdateParameters, *ManagedPrivateEndpointModelsClientBeginUpdateOptions) (*runtime.Poller[ManagedPrivateEndpointModelsClientUpdateResponse], error)` +- New struct `IntegrationFabric` +- New struct `IntegrationFabricListResponse` +- New struct `IntegrationFabricProperties` +- New struct `IntegrationFabricPropertiesUpdateParameters` +- New struct `IntegrationFabricUpdateParameters` +- New struct `Security` +- New struct `Snapshots` +- New struct `Users` +- New field `Security`, `Snapshots`, `Users` in struct `GrafanaConfigurations` + + ## 1.2.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/dashboard/armdashboard/README.md b/sdk/resourcemanager/dashboard/armdashboard/README.md index b3e0a6813ce2..e244354f23d2 100644 --- a/sdk/resourcemanager/dashboard/armdashboard/README.md +++ b/sdk/resourcemanager/dashboard/armdashboard/README.md @@ -18,7 +18,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Dashboard module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard/v2 ``` ## Authorization @@ -55,7 +55,7 @@ clientFactory, err := armdashboard.NewClientFactory(, cred, &op 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.NewGrafanaClient() +client := clientFactory.NewIntegrationFabricsClient() ``` ## Fakes diff --git a/sdk/resourcemanager/dashboard/armdashboard/autorest.md b/sdk/resourcemanager/dashboard/armdashboard/autorest.md deleted file mode 100644 index 133f51f52d50..000000000000 --- a/sdk/resourcemanager/dashboard/armdashboard/autorest.md +++ /dev/null @@ -1,13 +0,0 @@ -### AutoRest Configuration - -> see https://aka.ms/autorest - -``` yaml -azure-arm: true -require: -- https://github.com/Azure/azure-rest-api-specs/blob/78eac0bd58633028293cb1ec1709baa200bed9e2/specification/dashboard/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/78eac0bd58633028293cb1ec1709baa200bed9e2/specification/dashboard/resource-manager/readme.go.md -license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.2.0 -tag: package-2023-09-01 -``` \ No newline at end of file diff --git a/sdk/resourcemanager/dashboard/armdashboard/build.go b/sdk/resourcemanager/dashboard/armdashboard/build.go deleted file mode 100644 index e6246e4149e4..000000000000 --- a/sdk/resourcemanager/dashboard/armdashboard/build.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -// This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired -removeUnreferencedTypes resourcemanager/dashboard/armdashboard - -package armdashboard diff --git a/sdk/resourcemanager/dashboard/armdashboard/client_factory.go b/sdk/resourcemanager/dashboard/armdashboard/client_factory.go index 29ac072fec7d..3c8ce7911be8 100644 --- a/sdk/resourcemanager/dashboard/armdashboard/client_factory.go +++ b/sdk/resourcemanager/dashboard/armdashboard/client_factory.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdashboard @@ -17,52 +13,68 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { subscriptionID string - credential azcore.TokenCredential - options *arm.ClientOptions + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - subscriptionID: subscriptionID, credential: credential, - options: options.Clone(), + subscriptionID: subscriptionID, + internal: internal, }, nil } -// NewGrafanaClient creates a new instance of GrafanaClient. -func (c *ClientFactory) NewGrafanaClient() *GrafanaClient { - subClient, _ := NewGrafanaClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewIntegrationFabricsClient creates a new instance of IntegrationFabricsClient. +func (c *ClientFactory) NewIntegrationFabricsClient() *IntegrationFabricsClient { + return &IntegrationFabricsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewManagedPrivateEndpointsClient creates a new instance of ManagedPrivateEndpointsClient. -func (c *ClientFactory) NewManagedPrivateEndpointsClient() *ManagedPrivateEndpointsClient { - subClient, _ := NewManagedPrivateEndpointsClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewManagedGrafanasClient creates a new instance of ManagedGrafanasClient. +func (c *ClientFactory) NewManagedGrafanasClient() *ManagedGrafanasClient { + return &ManagedGrafanasClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewManagedPrivateEndpointModelsClient creates a new instance of ManagedPrivateEndpointModelsClient. +func (c *ClientFactory) NewManagedPrivateEndpointModelsClient() *ManagedPrivateEndpointModelsClient { + return &ManagedPrivateEndpointModelsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient + return &OperationsClient{ + internal: c.internal, + } } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient. func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { - subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateEndpointConnectionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient. func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { - subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateLinkResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } diff --git a/sdk/resourcemanager/dashboard/armdashboard/constants.go b/sdk/resourcemanager/dashboard/armdashboard/constants.go index 050bb13668d8..40f383309116 100644 --- a/sdk/resourcemanager/dashboard/armdashboard/constants.go +++ b/sdk/resourcemanager/dashboard/armdashboard/constants.go @@ -1,16 +1,12 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdashboard const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard" - moduleVersion = "v1.2.0" + moduleVersion = "v2.0.0" ) type APIKey string @@ -28,10 +24,11 @@ func PossibleAPIKeyValues() []APIKey { } } -// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +// 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" ) @@ -71,14 +68,18 @@ func PossibleAvailablePromotionValues() []AvailablePromotion { } } -// CreatedByType - The type of identity that created the resource. +// CreatedByType - The kind of entity that created the resource. type CreatedByType string const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" + // 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 CreatedByType = "User" + // CreatedByTypeUser - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" ) // PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. @@ -130,10 +131,14 @@ func PossibleManagedPrivateEndpointConnectionStatusValues() []ManagedPrivateEndp type ManagedServiceIdentityType string const ( - ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" - ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + // ManagedServiceIdentityTypeNone - No managed identity. + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + // ManagedServiceIdentityTypeSystemAssigned - System assigned managed identity. + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + // ManagedServiceIdentityTypeSystemAssignedUserAssigned - System and user assigned managed identity. ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" - ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" + // ManagedServiceIdentityTypeUserAssigned - User assigned managed identity. + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" ) // PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. @@ -167,8 +172,11 @@ func PossibleMarketplaceAutoRenewValues() []MarketplaceAutoRenew { type Origin string const ( - OriginSystem Origin = "system" - OriginUser Origin = "user" + // 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" ) @@ -185,9 +193,13 @@ func PossibleOriginValues() []Origin { type PrivateEndpointConnectionProvisioningState string const ( - PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" - PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" - PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + // 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" ) @@ -205,8 +217,11 @@ func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpoin type PrivateEndpointServiceConnectionStatus string const ( + // PrivateEndpointServiceConnectionStatusApproved - Connection approved PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" - PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + // PrivateEndpointServiceConnectionStatusPending - Connection waiting for approval or rejection + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + // PrivateEndpointServiceConnectionStatusRejected - Connection Rejected PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" ) @@ -264,7 +279,8 @@ func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { } } -// StartTLSPolicy - The StartTLSPolicy setting of the SMTP configuration https://pkg.go.dev/github.com/go-mail/mail#StartTLSPolicy +// StartTLSPolicy - The StartTLSPolicy setting of the SMTP configuration +// https://pkg.go.dev/github.com/go-mail/mail#StartTLSPolicy type StartTLSPolicy string const ( diff --git a/sdk/resourcemanager/dashboard/armdashboard/fake/integrationfabrics_server.go b/sdk/resourcemanager/dashboard/armdashboard/fake/integrationfabrics_server.go new file mode 100644 index 000000000000..865c92b1e043 --- /dev/null +++ b/sdk/resourcemanager/dashboard/armdashboard/fake/integrationfabrics_server.go @@ -0,0 +1,353 @@ +// 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/dashboard/armdashboard/v2" + "net/http" + "net/url" + "regexp" +) + +// IntegrationFabricsServer is a fake server for instances of the armdashboard.IntegrationFabricsClient type. +type IntegrationFabricsServer struct { + // BeginCreate is the fake for method IntegrationFabricsClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, workspaceName string, integrationFabricName string, requestBodyParameters armdashboard.IntegrationFabric, options *armdashboard.IntegrationFabricsClientBeginCreateOptions) (resp azfake.PollerResponder[armdashboard.IntegrationFabricsClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method IntegrationFabricsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, workspaceName string, integrationFabricName string, options *armdashboard.IntegrationFabricsClientBeginDeleteOptions) (resp azfake.PollerResponder[armdashboard.IntegrationFabricsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method IntegrationFabricsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, workspaceName string, integrationFabricName string, options *armdashboard.IntegrationFabricsClientGetOptions) (resp azfake.Responder[armdashboard.IntegrationFabricsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method IntegrationFabricsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, workspaceName string, options *armdashboard.IntegrationFabricsClientListOptions) (resp azfake.PagerResponder[armdashboard.IntegrationFabricsClientListResponse]) + + // BeginUpdate is the fake for method IntegrationFabricsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, workspaceName string, integrationFabricName string, requestBodyParameters armdashboard.IntegrationFabricUpdateParameters, options *armdashboard.IntegrationFabricsClientBeginUpdateOptions) (resp azfake.PollerResponder[armdashboard.IntegrationFabricsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewIntegrationFabricsServerTransport creates a new instance of IntegrationFabricsServerTransport with the provided implementation. +// The returned IntegrationFabricsServerTransport instance is connected to an instance of armdashboard.IntegrationFabricsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewIntegrationFabricsServerTransport(srv *IntegrationFabricsServer) *IntegrationFabricsServerTransport { + return &IntegrationFabricsServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armdashboard.IntegrationFabricsClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armdashboard.IntegrationFabricsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armdashboard.IntegrationFabricsClientListResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armdashboard.IntegrationFabricsClientUpdateResponse]](), + } +} + +// IntegrationFabricsServerTransport connects instances of armdashboard.IntegrationFabricsClient to instances of IntegrationFabricsServer. +// Don't use this type directly, use NewIntegrationFabricsServerTransport instead. +type IntegrationFabricsServerTransport struct { + srv *IntegrationFabricsServer + beginCreate *tracker[azfake.PollerResponder[armdashboard.IntegrationFabricsClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armdashboard.IntegrationFabricsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armdashboard.IntegrationFabricsClientListResponse]] + beginUpdate *tracker[azfake.PollerResponder[armdashboard.IntegrationFabricsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for IntegrationFabricsServerTransport. +func (i *IntegrationFabricsServerTransport) 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 i.dispatchToMethodFake(req, method) +} + +func (i *IntegrationFabricsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if integrationFabricsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = integrationFabricsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "IntegrationFabricsClient.BeginCreate": + res.resp, res.err = i.dispatchBeginCreate(req) + case "IntegrationFabricsClient.BeginDelete": + res.resp, res.err = i.dispatchBeginDelete(req) + case "IntegrationFabricsClient.Get": + res.resp, res.err = i.dispatchGet(req) + case "IntegrationFabricsClient.NewListPager": + res.resp, res.err = i.dispatchNewListPager(req) + case "IntegrationFabricsClient.BeginUpdate": + res.resp, res.err = i.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (i *IntegrationFabricsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if i.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := i.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/integrationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdashboard.IntegrationFabric](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + integrationFabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("integrationFabricName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.BeginCreate(req.Context(), resourceGroupNameParam, workspaceNameParam, integrationFabricNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + i.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) { + i.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) { + i.beginCreate.remove(req) + } + + return resp, nil +} + +func (i *IntegrationFabricsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if i.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := i.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/integrationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 5 { + 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 + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + integrationFabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("integrationFabricName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.BeginDelete(req.Context(), resourceGroupNameParam, workspaceNameParam, integrationFabricNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + i.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + i.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + i.beginDelete.remove(req) + } + + return resp, nil +} + +func (i *IntegrationFabricsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if i.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/integrationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 5 { + 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 + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + integrationFabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("integrationFabricName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.Get(req.Context(), resourceGroupNameParam, workspaceNameParam, integrationFabricNameParam, 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).IntegrationFabric, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (i *IntegrationFabricsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if i.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := i.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/integrationFabrics` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + resp := i.srv.NewListPager(resourceGroupNameParam, workspaceNameParam, nil) + newListPager = &resp + i.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armdashboard.IntegrationFabricsClientListResponse, 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) { + i.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + i.newListPager.remove(req) + } + return resp, nil +} + +func (i *IntegrationFabricsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if i.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := i.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/integrationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdashboard.IntegrationFabricUpdateParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + integrationFabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("integrationFabricName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.BeginUpdate(req.Context(), resourceGroupNameParam, workspaceNameParam, integrationFabricNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + i.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) { + i.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) { + i.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to IntegrationFabricsServerTransport +var integrationFabricsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/dashboard/armdashboard/fake/internal.go b/sdk/resourcemanager/dashboard/armdashboard/fake/internal.go index 5f75802a569e..8108b8e5ed77 100644 --- a/sdk/resourcemanager/dashboard/armdashboard/fake/internal.go +++ b/sdk/resourcemanager/dashboard/armdashboard/fake/internal.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -14,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } @@ -31,6 +32,14 @@ func contains[T comparable](s []T, v T) bool { return false } +func getHeaderValue(h http.Header, k string) string { + v := h[k] + if len(v) == 0 { + return "" + } + return v[0] +} + func newTracker[T any]() *tracker[T] { return &tracker[T]{ items: map[string]*T{}, diff --git a/sdk/resourcemanager/dashboard/armdashboard/fake/grafana_server.go b/sdk/resourcemanager/dashboard/armdashboard/fake/managedgrafanas_server.go similarity index 55% rename from sdk/resourcemanager/dashboard/armdashboard/fake/grafana_server.go rename to sdk/resourcemanager/dashboard/armdashboard/fake/managedgrafanas_server.go index abb2f2751c6f..3739bf84e11c 100644 --- a/sdk/resourcemanager/dashboard/armdashboard/fake/grafana_server.go +++ b/sdk/resourcemanager/dashboard/armdashboard/fake/managedgrafanas_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,117 +12,144 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard/v2" "net/http" "net/url" "regexp" ) -// GrafanaServer is a fake server for instances of the armdashboard.GrafanaClient type. -type GrafanaServer struct { - // CheckEnterpriseDetails is the fake for method GrafanaClient.CheckEnterpriseDetails +// ManagedGrafanasServer is a fake server for instances of the armdashboard.ManagedGrafanasClient type. +type ManagedGrafanasServer struct { + // CheckEnterpriseDetails is the fake for method ManagedGrafanasClient.CheckEnterpriseDetails // HTTP status codes to indicate success: http.StatusOK - CheckEnterpriseDetails func(ctx context.Context, resourceGroupName string, workspaceName string, options *armdashboard.GrafanaClientCheckEnterpriseDetailsOptions) (resp azfake.Responder[armdashboard.GrafanaClientCheckEnterpriseDetailsResponse], errResp azfake.ErrorResponder) + CheckEnterpriseDetails func(ctx context.Context, resourceGroupName string, workspaceName string, options *armdashboard.ManagedGrafanasClientCheckEnterpriseDetailsOptions) (resp azfake.Responder[armdashboard.ManagedGrafanasClientCheckEnterpriseDetailsResponse], errResp azfake.ErrorResponder) - // BeginCreate is the fake for method GrafanaClient.BeginCreate + // BeginCreate is the fake for method ManagedGrafanasClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, workspaceName string, requestBodyParameters armdashboard.ManagedGrafana, options *armdashboard.GrafanaClientBeginCreateOptions) (resp azfake.PollerResponder[armdashboard.GrafanaClientCreateResponse], errResp azfake.ErrorResponder) + BeginCreate func(ctx context.Context, resourceGroupName string, workspaceName string, requestBodyParameters armdashboard.ManagedGrafana, options *armdashboard.ManagedGrafanasClientBeginCreateOptions) (resp azfake.PollerResponder[armdashboard.ManagedGrafanasClientCreateResponse], errResp azfake.ErrorResponder) - // BeginDelete is the fake for method GrafanaClient.BeginDelete + // BeginDelete is the fake for method ManagedGrafanasClient.BeginDelete // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, workspaceName string, options *armdashboard.GrafanaClientBeginDeleteOptions) (resp azfake.PollerResponder[armdashboard.GrafanaClientDeleteResponse], errResp azfake.ErrorResponder) + BeginDelete func(ctx context.Context, resourceGroupName string, workspaceName string, options *armdashboard.ManagedGrafanasClientBeginDeleteOptions) (resp azfake.PollerResponder[armdashboard.ManagedGrafanasClientDeleteResponse], errResp azfake.ErrorResponder) - // FetchAvailablePlugins is the fake for method GrafanaClient.FetchAvailablePlugins + // FetchAvailablePlugins is the fake for method ManagedGrafanasClient.FetchAvailablePlugins // HTTP status codes to indicate success: http.StatusOK - FetchAvailablePlugins func(ctx context.Context, resourceGroupName string, workspaceName string, options *armdashboard.GrafanaClientFetchAvailablePluginsOptions) (resp azfake.Responder[armdashboard.GrafanaClientFetchAvailablePluginsResponse], errResp azfake.ErrorResponder) + FetchAvailablePlugins func(ctx context.Context, resourceGroupName string, workspaceName string, options *armdashboard.ManagedGrafanasClientFetchAvailablePluginsOptions) (resp azfake.Responder[armdashboard.ManagedGrafanasClientFetchAvailablePluginsResponse], errResp azfake.ErrorResponder) - // Get is the fake for method GrafanaClient.Get + // Get is the fake for method ManagedGrafanasClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, workspaceName string, options *armdashboard.GrafanaClientGetOptions) (resp azfake.Responder[armdashboard.GrafanaClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, resourceGroupName string, workspaceName string, options *armdashboard.ManagedGrafanasClientGetOptions) (resp azfake.Responder[armdashboard.ManagedGrafanasClientGetResponse], errResp azfake.ErrorResponder) - // NewListPager is the fake for method GrafanaClient.NewListPager + // NewListPager is the fake for method ManagedGrafanasClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armdashboard.GrafanaClientListOptions) (resp azfake.PagerResponder[armdashboard.GrafanaClientListResponse]) + NewListPager func(options *armdashboard.ManagedGrafanasClientListOptions) (resp azfake.PagerResponder[armdashboard.ManagedGrafanasClientListResponse]) - // NewListByResourceGroupPager is the fake for method GrafanaClient.NewListByResourceGroupPager + // NewListByResourceGroupPager is the fake for method ManagedGrafanasClient.NewListByResourceGroupPager // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armdashboard.GrafanaClientListByResourceGroupOptions) (resp azfake.PagerResponder[armdashboard.GrafanaClientListByResourceGroupResponse]) + NewListByResourceGroupPager func(resourceGroupName string, options *armdashboard.ManagedGrafanasClientListByResourceGroupOptions) (resp azfake.PagerResponder[armdashboard.ManagedGrafanasClientListByResourceGroupResponse]) + + // BeginRefresh is the fake for method ManagedGrafanasClient.BeginRefresh + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginRefresh func(ctx context.Context, resourceGroupName string, workspaceName string, options *armdashboard.ManagedGrafanasClientBeginRefreshOptions) (resp azfake.PollerResponder[armdashboard.ManagedGrafanasClientRefreshResponse], errResp azfake.ErrorResponder) - // Update is the fake for method GrafanaClient.Update + // Update is the fake for method ManagedGrafanasClient.Update // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - Update func(ctx context.Context, resourceGroupName string, workspaceName string, requestBodyParameters armdashboard.ManagedGrafanaUpdateParameters, options *armdashboard.GrafanaClientUpdateOptions) (resp azfake.Responder[armdashboard.GrafanaClientUpdateResponse], errResp azfake.ErrorResponder) + Update func(ctx context.Context, resourceGroupName string, workspaceName string, requestBodyParameters armdashboard.ManagedGrafanaUpdateParameters, options *armdashboard.ManagedGrafanasClientUpdateOptions) (resp azfake.Responder[armdashboard.ManagedGrafanasClientUpdateResponse], errResp azfake.ErrorResponder) } -// NewGrafanaServerTransport creates a new instance of GrafanaServerTransport with the provided implementation. -// The returned GrafanaServerTransport instance is connected to an instance of armdashboard.GrafanaClient via the +// NewManagedGrafanasServerTransport creates a new instance of ManagedGrafanasServerTransport with the provided implementation. +// The returned ManagedGrafanasServerTransport instance is connected to an instance of armdashboard.ManagedGrafanasClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewGrafanaServerTransport(srv *GrafanaServer) *GrafanaServerTransport { - return &GrafanaServerTransport{ +func NewManagedGrafanasServerTransport(srv *ManagedGrafanasServer) *ManagedGrafanasServerTransport { + return &ManagedGrafanasServerTransport{ srv: srv, - beginCreate: newTracker[azfake.PollerResponder[armdashboard.GrafanaClientCreateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armdashboard.GrafanaClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armdashboard.GrafanaClientListResponse]](), - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armdashboard.GrafanaClientListByResourceGroupResponse]](), + beginCreate: newTracker[azfake.PollerResponder[armdashboard.ManagedGrafanasClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armdashboard.ManagedGrafanasClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armdashboard.ManagedGrafanasClientListResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armdashboard.ManagedGrafanasClientListByResourceGroupResponse]](), + beginRefresh: newTracker[azfake.PollerResponder[armdashboard.ManagedGrafanasClientRefreshResponse]](), } } -// GrafanaServerTransport connects instances of armdashboard.GrafanaClient to instances of GrafanaServer. -// Don't use this type directly, use NewGrafanaServerTransport instead. -type GrafanaServerTransport struct { - srv *GrafanaServer - beginCreate *tracker[azfake.PollerResponder[armdashboard.GrafanaClientCreateResponse]] - beginDelete *tracker[azfake.PollerResponder[armdashboard.GrafanaClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armdashboard.GrafanaClientListResponse]] - newListByResourceGroupPager *tracker[azfake.PagerResponder[armdashboard.GrafanaClientListByResourceGroupResponse]] +// ManagedGrafanasServerTransport connects instances of armdashboard.ManagedGrafanasClient to instances of ManagedGrafanasServer. +// Don't use this type directly, use NewManagedGrafanasServerTransport instead. +type ManagedGrafanasServerTransport struct { + srv *ManagedGrafanasServer + beginCreate *tracker[azfake.PollerResponder[armdashboard.ManagedGrafanasClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armdashboard.ManagedGrafanasClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armdashboard.ManagedGrafanasClientListResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armdashboard.ManagedGrafanasClientListByResourceGroupResponse]] + beginRefresh *tracker[azfake.PollerResponder[armdashboard.ManagedGrafanasClientRefreshResponse]] } -// Do implements the policy.Transporter interface for GrafanaServerTransport. -func (g *GrafanaServerTransport) Do(req *http.Request) (*http.Response, error) { +// Do implements the policy.Transporter interface for ManagedGrafanasServerTransport. +func (m *ManagedGrafanasServerTransport) Do(req *http.Request) (*http.Response, error) { rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) method, ok := rawMethod.(string) if !ok { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "GrafanaClient.CheckEnterpriseDetails": - resp, err = g.dispatchCheckEnterpriseDetails(req) - case "GrafanaClient.BeginCreate": - resp, err = g.dispatchBeginCreate(req) - case "GrafanaClient.BeginDelete": - resp, err = g.dispatchBeginDelete(req) - case "GrafanaClient.FetchAvailablePlugins": - resp, err = g.dispatchFetchAvailablePlugins(req) - case "GrafanaClient.Get": - resp, err = g.dispatchGet(req) - case "GrafanaClient.NewListPager": - resp, err = g.dispatchNewListPager(req) - case "GrafanaClient.NewListByResourceGroupPager": - resp, err = g.dispatchNewListByResourceGroupPager(req) - case "GrafanaClient.Update": - resp, err = g.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return m.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (m *ManagedGrafanasServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - return resp, nil + go func() { + var intercepted bool + var res result + if managedGrafanasServerTransportInterceptor != nil { + res.resp, res.err, intercepted = managedGrafanasServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ManagedGrafanasClient.CheckEnterpriseDetails": + res.resp, res.err = m.dispatchCheckEnterpriseDetails(req) + case "ManagedGrafanasClient.BeginCreate": + res.resp, res.err = m.dispatchBeginCreate(req) + case "ManagedGrafanasClient.BeginDelete": + res.resp, res.err = m.dispatchBeginDelete(req) + case "ManagedGrafanasClient.FetchAvailablePlugins": + res.resp, res.err = m.dispatchFetchAvailablePlugins(req) + case "ManagedGrafanasClient.Get": + res.resp, res.err = m.dispatchGet(req) + case "ManagedGrafanasClient.NewListPager": + res.resp, res.err = m.dispatchNewListPager(req) + case "ManagedGrafanasClient.NewListByResourceGroupPager": + res.resp, res.err = m.dispatchNewListByResourceGroupPager(req) + case "ManagedGrafanasClient.BeginRefresh": + res.resp, res.err = m.dispatchBeginRefresh(req) + case "ManagedGrafanasClient.Update": + res.resp, res.err = m.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } -func (g *GrafanaServerTransport) dispatchCheckEnterpriseDetails(req *http.Request) (*http.Response, error) { - if g.srv.CheckEnterpriseDetails == nil { +func (m *ManagedGrafanasServerTransport) dispatchCheckEnterpriseDetails(req *http.Request) (*http.Response, error) { + if m.srv.CheckEnterpriseDetails == nil { return nil, &nonRetriableError{errors.New("fake for method CheckEnterpriseDetails not implemented")} } const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/checkEnterpriseDetails` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -137,7 +160,7 @@ func (g *GrafanaServerTransport) dispatchCheckEnterpriseDetails(req *http.Reques if err != nil { return nil, err } - respr, errRespr := g.srv.CheckEnterpriseDetails(req.Context(), resourceGroupNameParam, workspaceNameParam, nil) + respr, errRespr := m.srv.CheckEnterpriseDetails(req.Context(), resourceGroupNameParam, workspaceNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -152,16 +175,16 @@ func (g *GrafanaServerTransport) dispatchCheckEnterpriseDetails(req *http.Reques return resp, nil } -func (g *GrafanaServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if g.srv.BeginCreate == nil { +func (m *ManagedGrafanasServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if m.srv.BeginCreate == nil { return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} } - beginCreate := g.beginCreate.get(req) + beginCreate := m.beginCreate.get(req) if beginCreate == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdashboard.ManagedGrafana](req) @@ -176,12 +199,12 @@ func (g *GrafanaServerTransport) dispatchBeginCreate(req *http.Request) (*http.R if err != nil { return nil, err } - respr, errRespr := g.srv.BeginCreate(req.Context(), resourceGroupNameParam, workspaceNameParam, body, nil) + respr, errRespr := m.srv.BeginCreate(req.Context(), resourceGroupNameParam, workspaceNameParam, body, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } beginCreate = &respr - g.beginCreate.add(req, beginCreate) + m.beginCreate.add(req, beginCreate) } resp, err := server.PollerResponderNext(beginCreate, req) @@ -190,26 +213,26 @@ func (g *GrafanaServerTransport) dispatchBeginCreate(req *http.Request) (*http.R } if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - g.beginCreate.remove(req) + m.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) { - g.beginCreate.remove(req) + m.beginCreate.remove(req) } return resp, nil } -func (g *GrafanaServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if g.srv.BeginDelete == nil { +func (m *ManagedGrafanasServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if m.srv.BeginDelete == nil { return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} } - beginDelete := g.beginDelete.get(req) + beginDelete := m.beginDelete.get(req) if beginDelete == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -220,12 +243,12 @@ func (g *GrafanaServerTransport) dispatchBeginDelete(req *http.Request) (*http.R if err != nil { return nil, err } - respr, errRespr := g.srv.BeginDelete(req.Context(), resourceGroupNameParam, workspaceNameParam, nil) + respr, errRespr := m.srv.BeginDelete(req.Context(), resourceGroupNameParam, workspaceNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } beginDelete = &respr - g.beginDelete.add(req, beginDelete) + m.beginDelete.add(req, beginDelete) } resp, err := server.PollerResponderNext(beginDelete, req) @@ -234,24 +257,24 @@ func (g *GrafanaServerTransport) dispatchBeginDelete(req *http.Request) (*http.R } if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - g.beginDelete.remove(req) + m.beginDelete.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { - g.beginDelete.remove(req) + m.beginDelete.remove(req) } return resp, nil } -func (g *GrafanaServerTransport) dispatchFetchAvailablePlugins(req *http.Request) (*http.Response, error) { - if g.srv.FetchAvailablePlugins == nil { +func (m *ManagedGrafanasServerTransport) dispatchFetchAvailablePlugins(req *http.Request) (*http.Response, error) { + if m.srv.FetchAvailablePlugins == nil { return nil, &nonRetriableError{errors.New("fake for method FetchAvailablePlugins not implemented")} } const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fetchAvailablePlugins` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -262,7 +285,7 @@ func (g *GrafanaServerTransport) dispatchFetchAvailablePlugins(req *http.Request if err != nil { return nil, err } - respr, errRespr := g.srv.FetchAvailablePlugins(req.Context(), resourceGroupNameParam, workspaceNameParam, nil) + respr, errRespr := m.srv.FetchAvailablePlugins(req.Context(), resourceGroupNameParam, workspaceNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -277,14 +300,14 @@ func (g *GrafanaServerTransport) dispatchFetchAvailablePlugins(req *http.Request return resp, nil } -func (g *GrafanaServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if g.srv.Get == nil { +func (m *ManagedGrafanasServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if m.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} } const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -295,7 +318,7 @@ func (g *GrafanaServerTransport) dispatchGet(req *http.Request) (*http.Response, if err != nil { return nil, err } - respr, errRespr := g.srv.Get(req.Context(), resourceGroupNameParam, workspaceNameParam, nil) + respr, errRespr := m.srv.Get(req.Context(), resourceGroupNameParam, workspaceNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -310,22 +333,22 @@ func (g *GrafanaServerTransport) dispatchGet(req *http.Request) (*http.Response, return resp, nil } -func (g *GrafanaServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if g.srv.NewListPager == nil { +func (m *ManagedGrafanasServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} } - newListPager := g.newListPager.get(req) + newListPager := m.newListPager.get(req) if newListPager == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - resp := g.srv.NewListPager(nil) + resp := m.srv.NewListPager(nil) newListPager = &resp - g.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armdashboard.GrafanaClientListResponse, createLink func() string) { + m.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armdashboard.ManagedGrafanasClientListResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -334,35 +357,35 @@ func (g *GrafanaServerTransport) dispatchNewListPager(req *http.Request) (*http. return nil, err } if !contains([]int{http.StatusOK}, resp.StatusCode) { - g.newListPager.remove(req) + m.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } if !server.PagerResponderMore(newListPager) { - g.newListPager.remove(req) + m.newListPager.remove(req) } return resp, nil } -func (g *GrafanaServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if g.srv.NewListByResourceGroupPager == nil { +func (m *ManagedGrafanasServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListByResourceGroupPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} } - newListByResourceGroupPager := g.newListByResourceGroupPager.get(req) + newListByResourceGroupPager := m.newListByResourceGroupPager.get(req) if newListByResourceGroupPager == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) if err != nil { return nil, err } - resp := g.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + resp := m.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) newListByResourceGroupPager = &resp - g.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armdashboard.GrafanaClientListByResourceGroupResponse, createLink func() string) { + m.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armdashboard.ManagedGrafanasClientListByResourceGroupResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -371,23 +394,67 @@ func (g *GrafanaServerTransport) dispatchNewListByResourceGroupPager(req *http.R return nil, err } if !contains([]int{http.StatusOK}, resp.StatusCode) { - g.newListByResourceGroupPager.remove(req) + m.newListByResourceGroupPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } if !server.PagerResponderMore(newListByResourceGroupPager) { - g.newListByResourceGroupPager.remove(req) + m.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (m *ManagedGrafanasServerTransport) dispatchBeginRefresh(req *http.Request) (*http.Response, error) { + if m.srv.BeginRefresh == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginRefresh not implemented")} + } + beginRefresh := m.beginRefresh.get(req) + if beginRefresh == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/refreshManagedPrivateEndpoints` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginRefresh(req.Context(), resourceGroupNameParam, workspaceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginRefresh = &respr + m.beginRefresh.add(req, beginRefresh) + } + + resp, err := server.PollerResponderNext(beginRefresh, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + m.beginRefresh.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginRefresh) { + m.beginRefresh.remove(req) } + return resp, nil } -func (g *GrafanaServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if g.srv.Update == nil { +func (m *ManagedGrafanasServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if m.srv.Update == nil { return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} } const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdashboard.ManagedGrafanaUpdateParameters](req) @@ -402,7 +469,7 @@ func (g *GrafanaServerTransport) dispatchUpdate(req *http.Request) (*http.Respon if err != nil { return nil, err } - respr, errRespr := g.srv.Update(req.Context(), resourceGroupNameParam, workspaceNameParam, body, nil) + respr, errRespr := m.srv.Update(req.Context(), resourceGroupNameParam, workspaceNameParam, body, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -414,8 +481,11 @@ func (g *GrafanaServerTransport) dispatchUpdate(req *http.Request) (*http.Respon if err != nil { return nil, err } - if val := server.GetResponse(respr).AzureAsyncOperation; val != nil { - resp.Header.Set("Azure-AsyncOperation", *val) - } return resp, nil } + +// set this to conditionally intercept incoming requests to ManagedGrafanasServerTransport +var managedGrafanasServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/dashboard/armdashboard/fake/managedprivateendpoints_server.go b/sdk/resourcemanager/dashboard/armdashboard/fake/managedprivateendpointmodels_server.go similarity index 62% rename from sdk/resourcemanager/dashboard/armdashboard/fake/managedprivateendpoints_server.go rename to sdk/resourcemanager/dashboard/armdashboard/fake/managedprivateendpointmodels_server.go index 3f9b236bd1e9..a4f20987afe9 100644 --- a/sdk/resourcemanager/dashboard/armdashboard/fake/managedprivateendpoints_server.go +++ b/sdk/resourcemanager/dashboard/armdashboard/fake/managedprivateendpointmodels_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,100 +12,111 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard/v2" "net/http" "net/url" "regexp" ) -// ManagedPrivateEndpointsServer is a fake server for instances of the armdashboard.ManagedPrivateEndpointsClient type. -type ManagedPrivateEndpointsServer struct { - // BeginCreate is the fake for method ManagedPrivateEndpointsClient.BeginCreate +// ManagedPrivateEndpointModelsServer is a fake server for instances of the armdashboard.ManagedPrivateEndpointModelsClient type. +type ManagedPrivateEndpointModelsServer struct { + // BeginCreate is the fake for method ManagedPrivateEndpointModelsClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, requestBodyParameters armdashboard.ManagedPrivateEndpointModel, options *armdashboard.ManagedPrivateEndpointsClientBeginCreateOptions) (resp azfake.PollerResponder[armdashboard.ManagedPrivateEndpointsClientCreateResponse], errResp azfake.ErrorResponder) + BeginCreate func(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, requestBodyParameters armdashboard.ManagedPrivateEndpointModel, options *armdashboard.ManagedPrivateEndpointModelsClientBeginCreateOptions) (resp azfake.PollerResponder[armdashboard.ManagedPrivateEndpointModelsClientCreateResponse], errResp azfake.ErrorResponder) - // BeginDelete is the fake for method ManagedPrivateEndpointsClient.BeginDelete + // BeginDelete is the fake for method ManagedPrivateEndpointModelsClient.BeginDelete // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, options *armdashboard.ManagedPrivateEndpointsClientBeginDeleteOptions) (resp azfake.PollerResponder[armdashboard.ManagedPrivateEndpointsClientDeleteResponse], errResp azfake.ErrorResponder) + BeginDelete func(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, options *armdashboard.ManagedPrivateEndpointModelsClientBeginDeleteOptions) (resp azfake.PollerResponder[armdashboard.ManagedPrivateEndpointModelsClientDeleteResponse], errResp azfake.ErrorResponder) - // Get is the fake for method ManagedPrivateEndpointsClient.Get + // Get is the fake for method ManagedPrivateEndpointModelsClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, options *armdashboard.ManagedPrivateEndpointsClientGetOptions) (resp azfake.Responder[armdashboard.ManagedPrivateEndpointsClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, options *armdashboard.ManagedPrivateEndpointModelsClientGetOptions) (resp azfake.Responder[armdashboard.ManagedPrivateEndpointModelsClientGetResponse], errResp azfake.ErrorResponder) - // NewListPager is the fake for method ManagedPrivateEndpointsClient.NewListPager + // NewListPager is the fake for method ManagedPrivateEndpointModelsClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, workspaceName string, options *armdashboard.ManagedPrivateEndpointsClientListOptions) (resp azfake.PagerResponder[armdashboard.ManagedPrivateEndpointsClientListResponse]) - - // BeginRefresh is the fake for method ManagedPrivateEndpointsClient.BeginRefresh - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginRefresh func(ctx context.Context, resourceGroupName string, workspaceName string, options *armdashboard.ManagedPrivateEndpointsClientBeginRefreshOptions) (resp azfake.PollerResponder[armdashboard.ManagedPrivateEndpointsClientRefreshResponse], errResp azfake.ErrorResponder) + NewListPager func(resourceGroupName string, workspaceName string, options *armdashboard.ManagedPrivateEndpointModelsClientListOptions) (resp azfake.PagerResponder[armdashboard.ManagedPrivateEndpointModelsClientListResponse]) - // BeginUpdate is the fake for method ManagedPrivateEndpointsClient.BeginUpdate + // BeginUpdate is the fake for method ManagedPrivateEndpointModelsClient.BeginUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, requestBodyParameters armdashboard.ManagedPrivateEndpointUpdateParameters, options *armdashboard.ManagedPrivateEndpointsClientBeginUpdateOptions) (resp azfake.PollerResponder[armdashboard.ManagedPrivateEndpointsClientUpdateResponse], errResp azfake.ErrorResponder) + BeginUpdate func(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, requestBodyParameters armdashboard.ManagedPrivateEndpointUpdateParameters, options *armdashboard.ManagedPrivateEndpointModelsClientBeginUpdateOptions) (resp azfake.PollerResponder[armdashboard.ManagedPrivateEndpointModelsClientUpdateResponse], errResp azfake.ErrorResponder) } -// NewManagedPrivateEndpointsServerTransport creates a new instance of ManagedPrivateEndpointsServerTransport with the provided implementation. -// The returned ManagedPrivateEndpointsServerTransport instance is connected to an instance of armdashboard.ManagedPrivateEndpointsClient via the +// NewManagedPrivateEndpointModelsServerTransport creates a new instance of ManagedPrivateEndpointModelsServerTransport with the provided implementation. +// The returned ManagedPrivateEndpointModelsServerTransport instance is connected to an instance of armdashboard.ManagedPrivateEndpointModelsClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewManagedPrivateEndpointsServerTransport(srv *ManagedPrivateEndpointsServer) *ManagedPrivateEndpointsServerTransport { - return &ManagedPrivateEndpointsServerTransport{ +func NewManagedPrivateEndpointModelsServerTransport(srv *ManagedPrivateEndpointModelsServer) *ManagedPrivateEndpointModelsServerTransport { + return &ManagedPrivateEndpointModelsServerTransport{ srv: srv, - beginCreate: newTracker[azfake.PollerResponder[armdashboard.ManagedPrivateEndpointsClientCreateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armdashboard.ManagedPrivateEndpointsClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armdashboard.ManagedPrivateEndpointsClientListResponse]](), - beginRefresh: newTracker[azfake.PollerResponder[armdashboard.ManagedPrivateEndpointsClientRefreshResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armdashboard.ManagedPrivateEndpointsClientUpdateResponse]](), + beginCreate: newTracker[azfake.PollerResponder[armdashboard.ManagedPrivateEndpointModelsClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armdashboard.ManagedPrivateEndpointModelsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armdashboard.ManagedPrivateEndpointModelsClientListResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armdashboard.ManagedPrivateEndpointModelsClientUpdateResponse]](), } } -// ManagedPrivateEndpointsServerTransport connects instances of armdashboard.ManagedPrivateEndpointsClient to instances of ManagedPrivateEndpointsServer. -// Don't use this type directly, use NewManagedPrivateEndpointsServerTransport instead. -type ManagedPrivateEndpointsServerTransport struct { - srv *ManagedPrivateEndpointsServer - beginCreate *tracker[azfake.PollerResponder[armdashboard.ManagedPrivateEndpointsClientCreateResponse]] - beginDelete *tracker[azfake.PollerResponder[armdashboard.ManagedPrivateEndpointsClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armdashboard.ManagedPrivateEndpointsClientListResponse]] - beginRefresh *tracker[azfake.PollerResponder[armdashboard.ManagedPrivateEndpointsClientRefreshResponse]] - beginUpdate *tracker[azfake.PollerResponder[armdashboard.ManagedPrivateEndpointsClientUpdateResponse]] +// ManagedPrivateEndpointModelsServerTransport connects instances of armdashboard.ManagedPrivateEndpointModelsClient to instances of ManagedPrivateEndpointModelsServer. +// Don't use this type directly, use NewManagedPrivateEndpointModelsServerTransport instead. +type ManagedPrivateEndpointModelsServerTransport struct { + srv *ManagedPrivateEndpointModelsServer + beginCreate *tracker[azfake.PollerResponder[armdashboard.ManagedPrivateEndpointModelsClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armdashboard.ManagedPrivateEndpointModelsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armdashboard.ManagedPrivateEndpointModelsClientListResponse]] + beginUpdate *tracker[azfake.PollerResponder[armdashboard.ManagedPrivateEndpointModelsClientUpdateResponse]] } -// Do implements the policy.Transporter interface for ManagedPrivateEndpointsServerTransport. -func (m *ManagedPrivateEndpointsServerTransport) Do(req *http.Request) (*http.Response, error) { +// Do implements the policy.Transporter interface for ManagedPrivateEndpointModelsServerTransport. +func (m *ManagedPrivateEndpointModelsServerTransport) Do(req *http.Request) (*http.Response, error) { rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) method, ok := rawMethod.(string) if !ok { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return m.dispatchToMethodFake(req, method) +} - switch method { - case "ManagedPrivateEndpointsClient.BeginCreate": - resp, err = m.dispatchBeginCreate(req) - case "ManagedPrivateEndpointsClient.BeginDelete": - resp, err = m.dispatchBeginDelete(req) - case "ManagedPrivateEndpointsClient.Get": - resp, err = m.dispatchGet(req) - case "ManagedPrivateEndpointsClient.NewListPager": - resp, err = m.dispatchNewListPager(req) - case "ManagedPrivateEndpointsClient.BeginRefresh": - resp, err = m.dispatchBeginRefresh(req) - case "ManagedPrivateEndpointsClient.BeginUpdate": - resp, err = m.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (m *ManagedPrivateEndpointModelsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if managedPrivateEndpointModelsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = managedPrivateEndpointModelsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ManagedPrivateEndpointModelsClient.BeginCreate": + res.resp, res.err = m.dispatchBeginCreate(req) + case "ManagedPrivateEndpointModelsClient.BeginDelete": + res.resp, res.err = m.dispatchBeginDelete(req) + case "ManagedPrivateEndpointModelsClient.Get": + res.resp, res.err = m.dispatchGet(req) + case "ManagedPrivateEndpointModelsClient.NewListPager": + res.resp, res.err = m.dispatchNewListPager(req) + case "ManagedPrivateEndpointModelsClient.BeginUpdate": + res.resp, res.err = m.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } -func (m *ManagedPrivateEndpointsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { +func (m *ManagedPrivateEndpointModelsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { if m.srv.BeginCreate == nil { return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} } @@ -118,7 +125,7 @@ func (m *ManagedPrivateEndpointsServerTransport) dispatchBeginCreate(req *http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/managedPrivateEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdashboard.ManagedPrivateEndpointModel](req) @@ -161,7 +168,7 @@ func (m *ManagedPrivateEndpointsServerTransport) dispatchBeginCreate(req *http.R return resp, nil } -func (m *ManagedPrivateEndpointsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { +func (m *ManagedPrivateEndpointModelsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { if m.srv.BeginDelete == nil { return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} } @@ -170,7 +177,7 @@ func (m *ManagedPrivateEndpointsServerTransport) dispatchBeginDelete(req *http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/managedPrivateEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -209,14 +216,14 @@ func (m *ManagedPrivateEndpointsServerTransport) dispatchBeginDelete(req *http.R return resp, nil } -func (m *ManagedPrivateEndpointsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { +func (m *ManagedPrivateEndpointModelsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { if m.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} } const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/managedPrivateEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -246,7 +253,7 @@ func (m *ManagedPrivateEndpointsServerTransport) dispatchGet(req *http.Request) return resp, nil } -func (m *ManagedPrivateEndpointsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { +func (m *ManagedPrivateEndpointModelsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { if m.srv.NewListPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} } @@ -255,7 +262,7 @@ func (m *ManagedPrivateEndpointsServerTransport) dispatchNewListPager(req *http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/managedPrivateEndpoints` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -269,7 +276,7 @@ func (m *ManagedPrivateEndpointsServerTransport) dispatchNewListPager(req *http. resp := m.srv.NewListPager(resourceGroupNameParam, workspaceNameParam, nil) newListPager = &resp m.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armdashboard.ManagedPrivateEndpointsClientListResponse, createLink func() string) { + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armdashboard.ManagedPrivateEndpointModelsClientListResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -287,51 +294,7 @@ func (m *ManagedPrivateEndpointsServerTransport) dispatchNewListPager(req *http. return resp, nil } -func (m *ManagedPrivateEndpointsServerTransport) dispatchBeginRefresh(req *http.Request) (*http.Response, error) { - if m.srv.BeginRefresh == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginRefresh not implemented")} - } - beginRefresh := m.beginRefresh.get(req) - if beginRefresh == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/refreshManagedPrivateEndpoints` - 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 - } - workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.BeginRefresh(req.Context(), resourceGroupNameParam, workspaceNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginRefresh = &respr - m.beginRefresh.add(req, beginRefresh) - } - - resp, err := server.PollerResponderNext(beginRefresh, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - m.beginRefresh.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginRefresh) { - m.beginRefresh.remove(req) - } - - return resp, nil -} - -func (m *ManagedPrivateEndpointsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { +func (m *ManagedPrivateEndpointModelsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { if m.srv.BeginUpdate == nil { return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} } @@ -340,7 +303,7 @@ func (m *ManagedPrivateEndpointsServerTransport) dispatchBeginUpdate(req *http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/managedPrivateEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdashboard.ManagedPrivateEndpointUpdateParameters](req) @@ -382,3 +345,9 @@ func (m *ManagedPrivateEndpointsServerTransport) dispatchBeginUpdate(req *http.R return resp, nil } + +// set this to conditionally intercept incoming requests to ManagedPrivateEndpointModelsServerTransport +var managedPrivateEndpointModelsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/dashboard/armdashboard/fake/operations_server.go b/sdk/resourcemanager/dashboard/armdashboard/fake/operations_server.go index 551a63568610..d7d095355da9 100644 --- a/sdk/resourcemanager/dashboard/armdashboard/fake/operations_server.go +++ b/sdk/resourcemanager/dashboard/armdashboard/fake/operations_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -15,7 +11,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard/v2" "net/http" ) @@ -51,21 +47,40 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return o.dispatchToMethodFake(req, method) +} - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -94,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/dashboard/armdashboard/fake/privateendpointconnections_server.go b/sdk/resourcemanager/dashboard/armdashboard/fake/privateendpointconnections_server.go index a1ebf53cf063..b6a37823582c 100644 --- a/sdk/resourcemanager/dashboard/armdashboard/fake/privateendpointconnections_server.go +++ b/sdk/resourcemanager/dashboard/armdashboard/fake/privateendpointconnections_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,7 +12,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard/v2" "net/http" "net/url" "regexp" @@ -25,11 +21,11 @@ import ( // PrivateEndpointConnectionsServer is a fake server for instances of the armdashboard.PrivateEndpointConnectionsClient type. type PrivateEndpointConnectionsServer struct { // BeginApprove is the fake for method PrivateEndpointConnectionsClient.BeginApprove - // HTTP status codes to indicate success: http.StatusCreated - BeginApprove func(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, body armdashboard.PrivateEndpointConnection, options *armdashboard.PrivateEndpointConnectionsClientBeginApproveOptions) (resp azfake.PollerResponder[armdashboard.PrivateEndpointConnectionsClientApproveResponse], errResp azfake.ErrorResponder) + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginApprove func(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, body armdashboard.PrivateEndpointConnection, accept string, options *armdashboard.PrivateEndpointConnectionsClientBeginApproveOptions) (resp azfake.PollerResponder[armdashboard.PrivateEndpointConnectionsClientApproveResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method PrivateEndpointConnectionsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, options *armdashboard.PrivateEndpointConnectionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armdashboard.PrivateEndpointConnectionsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method PrivateEndpointConnectionsClient.Get @@ -70,27 +66,46 @@ func (p *PrivateEndpointConnectionsServerTransport) Do(req *http.Request) (*http return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - switch method { - case "PrivateEndpointConnectionsClient.BeginApprove": - resp, err = p.dispatchBeginApprove(req) - case "PrivateEndpointConnectionsClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PrivateEndpointConnectionsClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateEndpointConnectionsClient.NewListPager": - resp, err = p.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *PrivateEndpointConnectionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if privateEndpointConnectionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateEndpointConnectionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateEndpointConnectionsClient.BeginApprove": + res.resp, res.err = p.dispatchBeginApprove(req) + case "PrivateEndpointConnectionsClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PrivateEndpointConnectionsClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateEndpointConnectionsClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginApprove(req *http.Request) (*http.Response, error) { @@ -102,7 +117,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginApprove(req *ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdashboard.PrivateEndpointConnection](req) @@ -121,7 +136,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginApprove(req *ht if err != nil { return nil, err } - respr, errRespr := p.srv.BeginApprove(req.Context(), resourceGroupNameParam, workspaceNameParam, privateEndpointConnectionNameParam, body, nil) + respr, errRespr := p.srv.BeginApprove(req.Context(), resourceGroupNameParam, workspaceNameParam, privateEndpointConnectionNameParam, body, getHeaderValue(req.Header, "Accept"), nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -134,9 +149,9 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginApprove(req *ht return nil, err } - if !contains([]int{http.StatusCreated}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { p.beginApprove.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusCreated", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} } if !server.PollerResponderMore(beginApprove) { p.beginApprove.remove(req) @@ -154,7 +169,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -182,9 +197,9 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *htt return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, 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)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { p.beginDelete.remove(req) @@ -200,7 +215,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchGet(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -239,7 +254,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchNewListPager(req *ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -270,3 +285,9 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchNewListPager(req *ht } return resp, nil } + +// set this to conditionally intercept incoming requests to PrivateEndpointConnectionsServerTransport +var privateEndpointConnectionsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/dashboard/armdashboard/fake/privatelinkresources_server.go b/sdk/resourcemanager/dashboard/armdashboard/fake/privatelinkresources_server.go index 1ccc7aee9216..7c9fb794c5de 100644 --- a/sdk/resourcemanager/dashboard/armdashboard/fake/privatelinkresources_server.go +++ b/sdk/resourcemanager/dashboard/armdashboard/fake/privatelinkresources_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,7 +12,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard/v2" "net/http" "net/url" "regexp" @@ -58,23 +54,42 @@ func (p *PrivateLinkResourcesServerTransport) Do(req *http.Request) (*http.Respo return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - switch method { - case "PrivateLinkResourcesClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateLinkResourcesClient.NewListPager": - resp, err = p.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *PrivateLinkResourcesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if privateLinkResourcesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateLinkResourcesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateLinkResourcesClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateLinkResourcesClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PrivateLinkResourcesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -84,7 +99,7 @@ func (p *PrivateLinkResourcesServerTransport) dispatchGet(req *http.Request) (*h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -123,7 +138,7 @@ func (p *PrivateLinkResourcesServerTransport) dispatchNewListPager(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Dashboard/grafana/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -154,3 +169,9 @@ func (p *PrivateLinkResourcesServerTransport) dispatchNewListPager(req *http.Req } return resp, nil } + +// set this to conditionally intercept incoming requests to PrivateLinkResourcesServerTransport +var privateLinkResourcesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/dashboard/armdashboard/fake/server_factory.go b/sdk/resourcemanager/dashboard/armdashboard/fake/server_factory.go index fb4bb5a0681b..5b554b0d5bb5 100644 --- a/sdk/resourcemanager/dashboard/armdashboard/fake/server_factory.go +++ b/sdk/resourcemanager/dashboard/armdashboard/fake/server_factory.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -19,11 +15,23 @@ import ( // ServerFactory is a fake server for instances of the armdashboard.ClientFactory type. type ServerFactory struct { - GrafanaServer GrafanaServer - ManagedPrivateEndpointsServer ManagedPrivateEndpointsServer - OperationsServer OperationsServer + // IntegrationFabricsServer contains the fakes for client IntegrationFabricsClient + IntegrationFabricsServer IntegrationFabricsServer + + // ManagedGrafanasServer contains the fakes for client ManagedGrafanasClient + ManagedGrafanasServer ManagedGrafanasServer + + // ManagedPrivateEndpointModelsServer contains the fakes for client ManagedPrivateEndpointModelsClient + ManagedPrivateEndpointModelsServer ManagedPrivateEndpointModelsServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // PrivateEndpointConnectionsServer contains the fakes for client PrivateEndpointConnectionsClient PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer - PrivateLinkResourcesServer PrivateLinkResourcesServer + + // PrivateLinkResourcesServer contains the fakes for client PrivateLinkResourcesClient + PrivateLinkResourcesServer PrivateLinkResourcesServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -38,13 +46,14 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armdashboard.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trGrafanaServer *GrafanaServerTransport - trManagedPrivateEndpointsServer *ManagedPrivateEndpointsServerTransport - trOperationsServer *OperationsServerTransport - trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport - trPrivateLinkResourcesServer *PrivateLinkResourcesServerTransport + srv *ServerFactory + trMu sync.Mutex + trIntegrationFabricsServer *IntegrationFabricsServerTransport + trManagedGrafanasServer *ManagedGrafanasServerTransport + trManagedPrivateEndpointModelsServer *ManagedPrivateEndpointModelsServerTransport + trOperationsServer *OperationsServerTransport + trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport + trPrivateLinkResourcesServer *PrivateLinkResourcesServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -60,14 +69,21 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { - case "GrafanaClient": - initServer(s, &s.trGrafanaServer, func() *GrafanaServerTransport { return NewGrafanaServerTransport(&s.srv.GrafanaServer) }) - resp, err = s.trGrafanaServer.Do(req) - case "ManagedPrivateEndpointsClient": - initServer(s, &s.trManagedPrivateEndpointsServer, func() *ManagedPrivateEndpointsServerTransport { - return NewManagedPrivateEndpointsServerTransport(&s.srv.ManagedPrivateEndpointsServer) + case "IntegrationFabricsClient": + initServer(s, &s.trIntegrationFabricsServer, func() *IntegrationFabricsServerTransport { + return NewIntegrationFabricsServerTransport(&s.srv.IntegrationFabricsServer) + }) + resp, err = s.trIntegrationFabricsServer.Do(req) + case "ManagedGrafanasClient": + initServer(s, &s.trManagedGrafanasServer, func() *ManagedGrafanasServerTransport { + return NewManagedGrafanasServerTransport(&s.srv.ManagedGrafanasServer) + }) + resp, err = s.trManagedGrafanasServer.Do(req) + case "ManagedPrivateEndpointModelsClient": + initServer(s, &s.trManagedPrivateEndpointModelsServer, func() *ManagedPrivateEndpointModelsServerTransport { + return NewManagedPrivateEndpointModelsServerTransport(&s.srv.ManagedPrivateEndpointModelsServer) }) - resp, err = s.trManagedPrivateEndpointsServer.Do(req) + resp, err = s.trManagedPrivateEndpointModelsServer.Do(req) case "OperationsClient": initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) resp, err = s.trOperationsServer.Do(req) diff --git a/sdk/resourcemanager/dashboard/armdashboard/fake/time_rfc3339.go b/sdk/resourcemanager/dashboard/armdashboard/fake/time_rfc3339.go deleted file mode 100644 index b0535a7b63e6..000000000000 --- a/sdk/resourcemanager/dashboard/armdashboard/fake/time_rfc3339.go +++ /dev/null @@ -1,86 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "regexp" - "strings" - "time" -) - -// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) - -const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` -) - -type dateTimeRFC3339 time.Time - -func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t dateTimeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { - layout = dateTimeJSON - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { - layout = time.RFC3339Nano - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = dateTimeRFC3339(p) - return err -} - -func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateTimeRFC3339)(t) -} - -func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { - return nil - } - var aux dateTimeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/dashboard/armdashboard/go.mod b/sdk/resourcemanager/dashboard/armdashboard/go.mod index b7f335395ffc..8374be9e957c 100644 --- a/sdk/resourcemanager/dashboard/armdashboard/go.mod +++ b/sdk/resourcemanager/dashboard/armdashboard/go.mod @@ -1,4 +1,4 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard/v2 go 1.23.0 diff --git a/sdk/resourcemanager/dashboard/armdashboard/grafana_client_example_test.go b/sdk/resourcemanager/dashboard/armdashboard/grafana_client_example_test.go deleted file mode 100644 index 802f85f7120d..000000000000 --- a/sdk/resourcemanager/dashboard/armdashboard/grafana_client_example_test.go +++ /dev/null @@ -1,588 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdashboard_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/78eac0bd58633028293cb1ec1709baa200bed9e2/specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/Grafana_List.json -func ExampleGrafanaClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdashboard.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGrafanaClient().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.ManagedGrafanaListResponse = armdashboard.ManagedGrafanaListResponse{ - // Value: []*armdashboard.ManagedGrafana{ - // { - // Name: to.Ptr("myWorkspace"), - // Type: to.Ptr("Microsoft.Dashboard/grafana"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/grafana/myWorkspace"), - // Location: to.Ptr("West US"), - // Properties: &armdashboard.ManagedGrafanaProperties{ - // APIKey: to.Ptr(armdashboard.APIKeyEnabled), - // AutoGeneratedDomainNameLabelScope: to.Ptr(armdashboard.AutoGeneratedDomainNameLabelScopeTenantReuse), - // DeterministicOutboundIP: to.Ptr(armdashboard.DeterministicOutboundIPEnabled), - // Endpoint: to.Ptr("https://myworkspace-abcdefghijklmnop.wus.grafana.azure.com"), - // EnterpriseConfigurations: &armdashboard.EnterpriseConfigurations{ - // MarketplaceAutoRenew: to.Ptr(armdashboard.MarketplaceAutoRenewEnabled), - // MarketplacePlanID: to.Ptr("myPlanId"), - // }, - // GrafanaConfigurations: &armdashboard.GrafanaConfigurations{ - // SMTP: &armdashboard.SMTP{ - // Enabled: to.Ptr(true), - // FromAddress: to.Ptr("test@sendemail.com"), - // FromName: to.Ptr("emailsender"), - // Host: to.Ptr("smtp.sendemail.com:587"), - // SkipVerify: to.Ptr(true), - // StartTLSPolicy: to.Ptr(armdashboard.StartTLSPolicyOpportunisticStartTLS), - // User: to.Ptr("username"), - // }, - // }, - // GrafanaIntegrations: &armdashboard.GrafanaIntegrations{ - // AzureMonitorWorkspaceIntegrations: []*armdashboard.AzureMonitorWorkspaceIntegration{ - // { - // AzureMonitorWorkspaceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"), - // }}, - // }, - // GrafanaMajorVersion: to.Ptr("9"), - // GrafanaPlugins: map[string]*armdashboard.GrafanaPlugin{ - // "sample-plugin-id": &armdashboard.GrafanaPlugin{ - // PluginID: to.Ptr("sample-plugin-id"), - // }, - // }, - // GrafanaVersion: to.Ptr("9.4.5"), - // OutboundIPs: []*string{ - // to.Ptr("192.168.0.1"), - // to.Ptr("192.168.0.2")}, - // ProvisioningState: to.Ptr(armdashboard.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armdashboard.PublicNetworkAccessEnabled), - // ZoneRedundancy: to.Ptr(armdashboard.ZoneRedundancyEnabled), - // }, - // SKU: &armdashboard.ResourceSKU{ - // Name: to.Ptr("Standard"), - // }, - // Tags: map[string]*string{ - // "Environment": to.Ptr("Dev"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/78eac0bd58633028293cb1ec1709baa200bed9e2/specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/Grafana_ListByResourceGroup.json -func ExampleGrafanaClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdashboard.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGrafanaClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedGrafanaListResponse = armdashboard.ManagedGrafanaListResponse{ - // Value: []*armdashboard.ManagedGrafana{ - // { - // Name: to.Ptr("myWorkspace"), - // Type: to.Ptr("Microsoft.Dashboard/grafana"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/grafana/myWorkspace"), - // Location: to.Ptr("West US"), - // Properties: &armdashboard.ManagedGrafanaProperties{ - // APIKey: to.Ptr(armdashboard.APIKeyEnabled), - // AutoGeneratedDomainNameLabelScope: to.Ptr(armdashboard.AutoGeneratedDomainNameLabelScopeTenantReuse), - // DeterministicOutboundIP: to.Ptr(armdashboard.DeterministicOutboundIPEnabled), - // Endpoint: to.Ptr("https://myworkspace-abcdefghijklmnop.wus.grafana.azure.com"), - // EnterpriseConfigurations: &armdashboard.EnterpriseConfigurations{ - // MarketplaceAutoRenew: to.Ptr(armdashboard.MarketplaceAutoRenewEnabled), - // MarketplacePlanID: to.Ptr("myPlanId"), - // }, - // GrafanaConfigurations: &armdashboard.GrafanaConfigurations{ - // SMTP: &armdashboard.SMTP{ - // Enabled: to.Ptr(true), - // FromAddress: to.Ptr("test@sendemail.com"), - // FromName: to.Ptr("emailsender"), - // Host: to.Ptr("smtp.sendemail.com:587"), - // SkipVerify: to.Ptr(true), - // StartTLSPolicy: to.Ptr(armdashboard.StartTLSPolicyOpportunisticStartTLS), - // User: to.Ptr("username"), - // }, - // }, - // GrafanaIntegrations: &armdashboard.GrafanaIntegrations{ - // AzureMonitorWorkspaceIntegrations: []*armdashboard.AzureMonitorWorkspaceIntegration{ - // { - // AzureMonitorWorkspaceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"), - // }}, - // }, - // GrafanaMajorVersion: to.Ptr("9"), - // GrafanaPlugins: map[string]*armdashboard.GrafanaPlugin{ - // "sample-plugin-id": &armdashboard.GrafanaPlugin{ - // PluginID: to.Ptr("sample-plugin-id"), - // }, - // }, - // GrafanaVersion: to.Ptr("9.4.5"), - // OutboundIPs: []*string{ - // to.Ptr("192.168.0.1"), - // to.Ptr("192.168.0.2")}, - // ProvisioningState: to.Ptr(armdashboard.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armdashboard.PublicNetworkAccessEnabled), - // ZoneRedundancy: to.Ptr(armdashboard.ZoneRedundancyEnabled), - // }, - // SKU: &armdashboard.ResourceSKU{ - // Name: to.Ptr("Standard"), - // }, - // Tags: map[string]*string{ - // "Environment": to.Ptr("Dev"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/78eac0bd58633028293cb1ec1709baa200bed9e2/specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/Grafana_Get.json -func ExampleGrafanaClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdashboard.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGrafanaClient().Get(ctx, "myResourceGroup", "myWorkspace", 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.ManagedGrafana = armdashboard.ManagedGrafana{ - // Name: to.Ptr("myWorkspace"), - // Type: to.Ptr("Microsoft.Dashboard/grafana"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/grafana/myWorkspace"), - // Location: to.Ptr("West US"), - // Properties: &armdashboard.ManagedGrafanaProperties{ - // APIKey: to.Ptr(armdashboard.APIKeyEnabled), - // AutoGeneratedDomainNameLabelScope: to.Ptr(armdashboard.AutoGeneratedDomainNameLabelScopeTenantReuse), - // DeterministicOutboundIP: to.Ptr(armdashboard.DeterministicOutboundIPEnabled), - // Endpoint: to.Ptr("https://myworkspace-abcdefghijklmnop.wus.grafana.azure.com"), - // EnterpriseConfigurations: &armdashboard.EnterpriseConfigurations{ - // MarketplaceAutoRenew: to.Ptr(armdashboard.MarketplaceAutoRenewEnabled), - // MarketplacePlanID: to.Ptr("myPlanId"), - // }, - // GrafanaConfigurations: &armdashboard.GrafanaConfigurations{ - // SMTP: &armdashboard.SMTP{ - // Enabled: to.Ptr(true), - // FromAddress: to.Ptr("test@sendemail.com"), - // FromName: to.Ptr("emailsender"), - // Host: to.Ptr("smtp.sendemail.com:587"), - // SkipVerify: to.Ptr(true), - // StartTLSPolicy: to.Ptr(armdashboard.StartTLSPolicyOpportunisticStartTLS), - // User: to.Ptr("username"), - // }, - // }, - // GrafanaIntegrations: &armdashboard.GrafanaIntegrations{ - // AzureMonitorWorkspaceIntegrations: []*armdashboard.AzureMonitorWorkspaceIntegration{ - // { - // AzureMonitorWorkspaceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"), - // }}, - // }, - // GrafanaMajorVersion: to.Ptr("9"), - // GrafanaPlugins: map[string]*armdashboard.GrafanaPlugin{ - // "sample-plugin-id": &armdashboard.GrafanaPlugin{ - // PluginID: to.Ptr("sample-plugin-id"), - // }, - // }, - // GrafanaVersion: to.Ptr("9.4.5"), - // OutboundIPs: []*string{ - // to.Ptr("192.168.0.1"), - // to.Ptr("192.168.0.2")}, - // ProvisioningState: to.Ptr(armdashboard.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armdashboard.PublicNetworkAccessEnabled), - // ZoneRedundancy: to.Ptr(armdashboard.ZoneRedundancyEnabled), - // }, - // SKU: &armdashboard.ResourceSKU{ - // Name: to.Ptr("Standard"), - // }, - // SystemData: &armdashboard.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-03T01:01:01.107Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armdashboard.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-04T02:03:01.197Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armdashboard.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "Environment": to.Ptr("Dev"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/78eac0bd58633028293cb1ec1709baa200bed9e2/specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/Grafana_Create.json -func ExampleGrafanaClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdashboard.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGrafanaClient().BeginCreate(ctx, "myResourceGroup", "myWorkspace", armdashboard.ManagedGrafana{ - Identity: &armdashboard.ManagedServiceIdentity{ - Type: to.Ptr(armdashboard.ManagedServiceIdentityTypeSystemAssigned), - }, - Location: to.Ptr("West US"), - Properties: &armdashboard.ManagedGrafanaProperties{ - APIKey: to.Ptr(armdashboard.APIKeyEnabled), - DeterministicOutboundIP: to.Ptr(armdashboard.DeterministicOutboundIPEnabled), - EnterpriseConfigurations: &armdashboard.EnterpriseConfigurations{ - MarketplaceAutoRenew: to.Ptr(armdashboard.MarketplaceAutoRenewEnabled), - MarketplacePlanID: to.Ptr("myPlanId"), - }, - GrafanaConfigurations: &armdashboard.GrafanaConfigurations{ - SMTP: &armdashboard.SMTP{ - Enabled: to.Ptr(true), - FromAddress: to.Ptr("test@sendemail.com"), - FromName: to.Ptr("emailsender"), - Host: to.Ptr("smtp.sendemail.com:587"), - Password: to.Ptr(""), - SkipVerify: to.Ptr(true), - StartTLSPolicy: to.Ptr(armdashboard.StartTLSPolicyOpportunisticStartTLS), - User: to.Ptr("username"), - }, - }, - GrafanaIntegrations: &armdashboard.GrafanaIntegrations{ - AzureMonitorWorkspaceIntegrations: []*armdashboard.AzureMonitorWorkspaceIntegration{ - { - AzureMonitorWorkspaceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"), - }}, - }, - GrafanaMajorVersion: to.Ptr("9"), - GrafanaPlugins: map[string]*armdashboard.GrafanaPlugin{ - "sample-plugin-id": {}, - }, - PublicNetworkAccess: to.Ptr(armdashboard.PublicNetworkAccessEnabled), - ZoneRedundancy: to.Ptr(armdashboard.ZoneRedundancyEnabled), - }, - SKU: &armdashboard.ResourceSKU{ - Name: to.Ptr("Standard"), - }, - Tags: map[string]*string{ - "Environment": to.Ptr("Dev"), - }, - }, 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.ManagedGrafana = armdashboard.ManagedGrafana{ - // Name: to.Ptr("myWorkspace"), - // Type: to.Ptr("Microsoft.Dashboard/grafana"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/grafana/myWorkspace"), - // Identity: &armdashboard.ManagedServiceIdentity{ - // Type: to.Ptr(armdashboard.ManagedServiceIdentityTypeSystemAssigned), - // }, - // Location: to.Ptr("West US"), - // Properties: &armdashboard.ManagedGrafanaProperties{ - // APIKey: to.Ptr(armdashboard.APIKeyEnabled), - // AutoGeneratedDomainNameLabelScope: to.Ptr(armdashboard.AutoGeneratedDomainNameLabelScopeTenantReuse), - // DeterministicOutboundIP: to.Ptr(armdashboard.DeterministicOutboundIPEnabled), - // Endpoint: to.Ptr("https://myworkspace-abcdefghijklmnop.wus.grafana.azure.com"), - // EnterpriseConfigurations: &armdashboard.EnterpriseConfigurations{ - // MarketplaceAutoRenew: to.Ptr(armdashboard.MarketplaceAutoRenewEnabled), - // MarketplacePlanID: to.Ptr("myPlanId"), - // }, - // GrafanaConfigurations: &armdashboard.GrafanaConfigurations{ - // SMTP: &armdashboard.SMTP{ - // Enabled: to.Ptr(true), - // FromAddress: to.Ptr("test@sendemail.com"), - // FromName: to.Ptr("emailsender"), - // Host: to.Ptr("smtp.sendemail.com:587"), - // SkipVerify: to.Ptr(true), - // StartTLSPolicy: to.Ptr(armdashboard.StartTLSPolicyOpportunisticStartTLS), - // User: to.Ptr("username"), - // }, - // }, - // GrafanaIntegrations: &armdashboard.GrafanaIntegrations{ - // AzureMonitorWorkspaceIntegrations: []*armdashboard.AzureMonitorWorkspaceIntegration{ - // { - // AzureMonitorWorkspaceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"), - // }}, - // }, - // GrafanaMajorVersion: to.Ptr("9"), - // GrafanaPlugins: map[string]*armdashboard.GrafanaPlugin{ - // "sample-plugin-id": &armdashboard.GrafanaPlugin{ - // PluginID: to.Ptr("sample-plugin-id"), - // }, - // }, - // GrafanaVersion: to.Ptr("9.4.5"), - // OutboundIPs: []*string{ - // to.Ptr("192.168.0.1"), - // to.Ptr("192.168.0.2")}, - // ProvisioningState: to.Ptr(armdashboard.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armdashboard.PublicNetworkAccessEnabled), - // ZoneRedundancy: to.Ptr(armdashboard.ZoneRedundancyEnabled), - // }, - // SKU: &armdashboard.ResourceSKU{ - // Name: to.Ptr("Standard"), - // }, - // SystemData: &armdashboard.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-03T01:01:01.107Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armdashboard.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-04T02:03:01.197Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armdashboard.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "Environment": to.Ptr("Dev"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/78eac0bd58633028293cb1ec1709baa200bed9e2/specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/Grafana_Update.json -func ExampleGrafanaClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdashboard.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGrafanaClient().Update(ctx, "myResourceGroup", "myWorkspace", armdashboard.ManagedGrafanaUpdateParameters{ - Properties: &armdashboard.ManagedGrafanaPropertiesUpdateParameters{ - APIKey: to.Ptr(armdashboard.APIKeyEnabled), - DeterministicOutboundIP: to.Ptr(armdashboard.DeterministicOutboundIPEnabled), - EnterpriseConfigurations: &armdashboard.EnterpriseConfigurations{ - MarketplaceAutoRenew: to.Ptr(armdashboard.MarketplaceAutoRenewEnabled), - MarketplacePlanID: to.Ptr("myPlanId"), - }, - GrafanaConfigurations: &armdashboard.GrafanaConfigurations{ - SMTP: &armdashboard.SMTP{ - Enabled: to.Ptr(true), - FromAddress: to.Ptr("test@sendemail.com"), - FromName: to.Ptr("emailsender"), - Host: to.Ptr("smtp.sendemail.com:587"), - Password: to.Ptr(""), - SkipVerify: to.Ptr(true), - StartTLSPolicy: to.Ptr(armdashboard.StartTLSPolicyOpportunisticStartTLS), - User: to.Ptr("username"), - }, - }, - GrafanaIntegrations: &armdashboard.GrafanaIntegrations{ - AzureMonitorWorkspaceIntegrations: []*armdashboard.AzureMonitorWorkspaceIntegration{ - { - AzureMonitorWorkspaceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"), - }}, - }, - GrafanaMajorVersion: to.Ptr("9"), - GrafanaPlugins: map[string]*armdashboard.GrafanaPlugin{ - "sample-plugin-id": {}, - }, - }, - SKU: &armdashboard.ResourceSKU{ - Name: to.Ptr("Standard"), - }, - Tags: map[string]*string{ - "Environment": to.Ptr("Dev 2"), - }, - }, 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.ManagedGrafana = armdashboard.ManagedGrafana{ - // Name: to.Ptr("myWorkspace"), - // Type: to.Ptr("Microsoft.Dashboard/grafana"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/grafana/myWorkspace"), - // Location: to.Ptr("West US"), - // Properties: &armdashboard.ManagedGrafanaProperties{ - // APIKey: to.Ptr(armdashboard.APIKeyEnabled), - // AutoGeneratedDomainNameLabelScope: to.Ptr(armdashboard.AutoGeneratedDomainNameLabelScopeTenantReuse), - // DeterministicOutboundIP: to.Ptr(armdashboard.DeterministicOutboundIPEnabled), - // Endpoint: to.Ptr("https://myworkspace-abcdefghijklmnop.wus.grafana.azure.com"), - // EnterpriseConfigurations: &armdashboard.EnterpriseConfigurations{ - // MarketplaceAutoRenew: to.Ptr(armdashboard.MarketplaceAutoRenewEnabled), - // MarketplacePlanID: to.Ptr("myPlanId"), - // }, - // GrafanaConfigurations: &armdashboard.GrafanaConfigurations{ - // SMTP: &armdashboard.SMTP{ - // Enabled: to.Ptr(true), - // FromAddress: to.Ptr("test@sendemail.com"), - // FromName: to.Ptr("emailsender"), - // Host: to.Ptr("smtp.sendemail.com:587"), - // SkipVerify: to.Ptr(true), - // StartTLSPolicy: to.Ptr(armdashboard.StartTLSPolicyOpportunisticStartTLS), - // User: to.Ptr("username"), - // }, - // }, - // GrafanaIntegrations: &armdashboard.GrafanaIntegrations{ - // AzureMonitorWorkspaceIntegrations: []*armdashboard.AzureMonitorWorkspaceIntegration{ - // { - // AzureMonitorWorkspaceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"), - // }}, - // }, - // GrafanaMajorVersion: to.Ptr("9"), - // GrafanaPlugins: map[string]*armdashboard.GrafanaPlugin{ - // "sample-plugin-id": &armdashboard.GrafanaPlugin{ - // PluginID: to.Ptr("sample-plugin-id"), - // }, - // }, - // GrafanaVersion: to.Ptr("9.4.5"), - // OutboundIPs: []*string{ - // to.Ptr("192.168.0.1"), - // to.Ptr("192.168.0.2")}, - // ProvisioningState: to.Ptr(armdashboard.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armdashboard.PublicNetworkAccessEnabled), - // ZoneRedundancy: to.Ptr(armdashboard.ZoneRedundancyEnabled), - // }, - // SKU: &armdashboard.ResourceSKU{ - // Name: to.Ptr("Standard"), - // }, - // Tags: map[string]*string{ - // "Environment": to.Ptr("Dev 2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/78eac0bd58633028293cb1ec1709baa200bed9e2/specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/Grafana_Delete.json -func ExampleGrafanaClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdashboard.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGrafanaClient().BeginDelete(ctx, "myResourceGroup", "myWorkspace", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/78eac0bd58633028293cb1ec1709baa200bed9e2/specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/EnterpriseDetails_Post.json -func ExampleGrafanaClient_CheckEnterpriseDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdashboard.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGrafanaClient().CheckEnterpriseDetails(ctx, "myResourceGroup", "myWorkspace", 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.EnterpriseDetails = armdashboard.EnterpriseDetails{ - // MarketplaceTrialQuota: &armdashboard.MarketplaceTrialQuota{ - // AvailablePromotion: to.Ptr(armdashboard.AvailablePromotionNone), - // GrafanaResourceID: to.Ptr("/subscriptions/e1e3b30d-e7ec-4e25-8587-db037bcb9a4d/resourcegroups/amg-local-script-test-rg/providers/microsoft.dashboard/grafana/eus2-enterprise-1001-07"), - // TrialEndAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-03T01:06:00.447Z"); return t}()), - // TrialStartAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-04T01:06:00.447Z"); return t}()), - // }, - // SaasSubscriptionDetails: &armdashboard.SaasSubscriptionDetails{ - // OfferID: to.Ptr("amg_test"), - // PlanID: to.Ptr("amg_globalplan"), - // PublisherID: to.Ptr("isvtestuklegacy"), - // Term: &armdashboard.SubscriptionTerm{ - // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-03T00:00:00.000Z"); return t}()), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-04T00:00:00.000Z"); return t}()), - // TermUnit: to.Ptr("P1M"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/78eac0bd58633028293cb1ec1709baa200bed9e2/specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/Grafana_FetchAvailablePlugins.json -func ExampleGrafanaClient_FetchAvailablePlugins() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdashboard.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGrafanaClient().FetchAvailablePlugins(ctx, "myResourceGroup", "myWorkspace", 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.GrafanaAvailablePluginListResponse = armdashboard.GrafanaAvailablePluginListResponse{ - // Value: []*armdashboard.GrafanaAvailablePlugin{ - // { - // Name: to.Ptr("Plugin A"), - // PluginID: to.Ptr("plugin-a"), - // }, - // { - // Name: to.Ptr("Plugin B"), - // PluginID: to.Ptr("plugin-b"), - // }}, - // } -} diff --git a/sdk/resourcemanager/dashboard/armdashboard/integrationfabrics_client.go b/sdk/resourcemanager/dashboard/armdashboard/integrationfabrics_client.go new file mode 100644 index 000000000000..acb4278ff4aa --- /dev/null +++ b/sdk/resourcemanager/dashboard/armdashboard/integrationfabrics_client.go @@ -0,0 +1,425 @@ +// 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 armdashboard + +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" +) + +// IntegrationFabricsClient contains the methods for the IntegrationFabrics group. +// Don't use this type directly, use NewIntegrationFabricsClient() instead. +type IntegrationFabricsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewIntegrationFabricsClient creates a new instance of IntegrationFabricsClient 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 NewIntegrationFabricsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*IntegrationFabricsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &IntegrationFabricsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Create a IntegrationFabric +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The workspace name of Azure Managed Grafana. +// - integrationFabricName - The integration fabric name of Azure Managed Grafana. +// - options - IntegrationFabricsClientBeginCreateOptions contains the optional parameters for the IntegrationFabricsClient.BeginCreate +// method. +func (client *IntegrationFabricsClient) BeginCreate(ctx context.Context, resourceGroupName string, workspaceName string, integrationFabricName string, requestBodyParameters IntegrationFabric, options *IntegrationFabricsClientBeginCreateOptions) (*runtime.Poller[IntegrationFabricsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, workspaceName, integrationFabricName, requestBodyParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[IntegrationFabricsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[IntegrationFabricsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Create a IntegrationFabric +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01 +func (client *IntegrationFabricsClient) create(ctx context.Context, resourceGroupName string, workspaceName string, integrationFabricName string, requestBodyParameters IntegrationFabric, options *IntegrationFabricsClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "IntegrationFabricsClient.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, workspaceName, integrationFabricName, requestBodyParameters, 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 *IntegrationFabricsClient) createCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, integrationFabricName string, requestBodyParameters IntegrationFabric, _ *IntegrationFabricsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/integrationFabrics/{integrationFabricName}" + 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 workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if integrationFabricName == "" { + return nil, errors.New("parameter integrationFabricName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{integrationFabricName}", url.PathEscape(integrationFabricName)) + 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-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, requestBodyParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a IntegrationFabric +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The workspace name of Azure Managed Grafana. +// - integrationFabricName - The integration fabric name of Azure Managed Grafana. +// - options - IntegrationFabricsClientBeginDeleteOptions contains the optional parameters for the IntegrationFabricsClient.BeginDelete +// method. +func (client *IntegrationFabricsClient) BeginDelete(ctx context.Context, resourceGroupName string, workspaceName string, integrationFabricName string, options *IntegrationFabricsClientBeginDeleteOptions) (*runtime.Poller[IntegrationFabricsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, workspaceName, integrationFabricName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[IntegrationFabricsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[IntegrationFabricsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a IntegrationFabric +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01 +func (client *IntegrationFabricsClient) deleteOperation(ctx context.Context, resourceGroupName string, workspaceName string, integrationFabricName string, options *IntegrationFabricsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "IntegrationFabricsClient.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, workspaceName, integrationFabricName, 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 *IntegrationFabricsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, integrationFabricName string, _ *IntegrationFabricsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/integrationFabrics/{integrationFabricName}" + 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 workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if integrationFabricName == "" { + return nil, errors.New("parameter integrationFabricName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{integrationFabricName}", url.PathEscape(integrationFabricName)) + 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-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a IntegrationFabric +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The workspace name of Azure Managed Grafana. +// - integrationFabricName - The integration fabric name of Azure Managed Grafana. +// - options - IntegrationFabricsClientGetOptions contains the optional parameters for the IntegrationFabricsClient.Get method. +func (client *IntegrationFabricsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, integrationFabricName string, options *IntegrationFabricsClientGetOptions) (IntegrationFabricsClientGetResponse, error) { + var err error + const operationName = "IntegrationFabricsClient.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, workspaceName, integrationFabricName, options) + if err != nil { + return IntegrationFabricsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return IntegrationFabricsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return IntegrationFabricsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *IntegrationFabricsClient) getCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, integrationFabricName string, _ *IntegrationFabricsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/integrationFabrics/{integrationFabricName}" + 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 workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if integrationFabricName == "" { + return nil, errors.New("parameter integrationFabricName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{integrationFabricName}", url.PathEscape(integrationFabricName)) + 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-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *IntegrationFabricsClient) getHandleResponse(resp *http.Response) (IntegrationFabricsClientGetResponse, error) { + result := IntegrationFabricsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationFabric); err != nil { + return IntegrationFabricsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List IntegrationFabric resources by ManagedGrafana +// +// Generated from API version 2024-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The workspace name of Azure Managed Grafana. +// - options - IntegrationFabricsClientListOptions contains the optional parameters for the IntegrationFabricsClient.NewListPager +// method. +func (client *IntegrationFabricsClient) NewListPager(resourceGroupName string, workspaceName string, options *IntegrationFabricsClientListOptions) *runtime.Pager[IntegrationFabricsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[IntegrationFabricsClientListResponse]{ + More: func(page IntegrationFabricsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *IntegrationFabricsClientListResponse) (IntegrationFabricsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "IntegrationFabricsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, workspaceName, options) + }, nil) + if err != nil { + return IntegrationFabricsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *IntegrationFabricsClient) listCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, _ *IntegrationFabricsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/integrationFabrics" + 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 workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + 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-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *IntegrationFabricsClient) listHandleResponse(resp *http.Response) (IntegrationFabricsClientListResponse, error) { + result := IntegrationFabricsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationFabricListResponse); err != nil { + return IntegrationFabricsClientListResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update a IntegrationFabric +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The workspace name of Azure Managed Grafana. +// - integrationFabricName - The integration fabric name of Azure Managed Grafana. +// - options - IntegrationFabricsClientBeginUpdateOptions contains the optional parameters for the IntegrationFabricsClient.BeginUpdate +// method. +func (client *IntegrationFabricsClient) BeginUpdate(ctx context.Context, resourceGroupName string, workspaceName string, integrationFabricName string, requestBodyParameters IntegrationFabricUpdateParameters, options *IntegrationFabricsClientBeginUpdateOptions) (*runtime.Poller[IntegrationFabricsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, workspaceName, integrationFabricName, requestBodyParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[IntegrationFabricsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[IntegrationFabricsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a IntegrationFabric +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01 +func (client *IntegrationFabricsClient) update(ctx context.Context, resourceGroupName string, workspaceName string, integrationFabricName string, requestBodyParameters IntegrationFabricUpdateParameters, options *IntegrationFabricsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "IntegrationFabricsClient.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, workspaceName, integrationFabricName, requestBodyParameters, 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 *IntegrationFabricsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, integrationFabricName string, requestBodyParameters IntegrationFabricUpdateParameters, _ *IntegrationFabricsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/integrationFabrics/{integrationFabricName}" + 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 workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if integrationFabricName == "" { + return nil, errors.New("parameter integrationFabricName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{integrationFabricName}", url.PathEscape(integrationFabricName)) + 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-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, requestBodyParameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/dashboard/armdashboard/integrationfabrics_client_example_test.go b/sdk/resourcemanager/dashboard/armdashboard/integrationfabrics_client_example_test.go new file mode 100644 index 000000000000..1b4756feb78a --- /dev/null +++ b/sdk/resourcemanager/dashboard/armdashboard/integrationfabrics_client_example_test.go @@ -0,0 +1,215 @@ +// 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 armdashboard_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard/v2" + "log" +) + +// Generated from example definition: 2024-10-01/IntegrationFabrics_Create.json +func ExampleIntegrationFabricsClient_BeginCreate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdashboard.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewIntegrationFabricsClient().BeginCreate(ctx, "myResourceGroup", "myWorkspace", "sampleIntegration", 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 = armdashboard.IntegrationFabricsClientCreateResponse{ + // IntegrationFabric: &armdashboard.IntegrationFabric{ + // Name: to.Ptr("sampleIntegration"), + // Type: to.Ptr("Microsoft.Dashboard/grafana/integrationFabrics"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Dashboard/grafana/myWorkspace/integrationFabrics/myIntegrationFabricName"), + // Location: to.Ptr("West US"), + // Properties: &armdashboard.IntegrationFabricProperties{ + // DataSourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/myAmw"), + // ProvisioningState: to.Ptr(armdashboard.ProvisioningStateSucceeded), + // Scenarios: []*string{ + // to.Ptr("scenario1"), + // to.Ptr("scenario2"), + // }, + // TargetResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerService/managedClusters/myAks"), + // }, + // }, + // } +} + +// Generated from example definition: 2024-10-01/IntegrationFabrics_Delete.json +func ExampleIntegrationFabricsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdashboard.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewIntegrationFabricsClient().BeginDelete(ctx, "myResourceGroup", "myWorkspace", "sampleIntegration", 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: 2024-10-01/IntegrationFabrics_Get.json +func ExampleIntegrationFabricsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdashboard.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewIntegrationFabricsClient().Get(ctx, "myResourceGroup", "myWorkspace", "sampleIntegration", 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 = armdashboard.IntegrationFabricsClientGetResponse{ + // IntegrationFabric: &armdashboard.IntegrationFabric{ + // Name: to.Ptr("sampleIntegration"), + // Type: to.Ptr("Microsoft.Dashboard/grafana/integrationFabrics"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Dashboard/grafana/myWorkspace/integrationFabrics/myIntegrationFabricName"), + // Location: to.Ptr("West US"), + // Properties: &armdashboard.IntegrationFabricProperties{ + // DataSourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/myAmw"), + // ProvisioningState: to.Ptr(armdashboard.ProvisioningStateSucceeded), + // Scenarios: []*string{ + // to.Ptr("scenario1"), + // to.Ptr("scenario2"), + // }, + // TargetResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerService/managedClusters/myAks"), + // }, + // }, + // } +} + +// Generated from example definition: 2024-10-01/IntegrationFabrics_List.json +func ExampleIntegrationFabricsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdashboard.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewIntegrationFabricsClient().NewListPager("myResourceGroup", "myWorkspace", 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 = armdashboard.IntegrationFabricsClientListResponse{ + // IntegrationFabricListResponse: armdashboard.IntegrationFabricListResponse{ + // Value: []*armdashboard.IntegrationFabric{ + // { + // Name: to.Ptr("sampleIntegration"), + // Type: to.Ptr("Microsoft.Dashboard/grafana/integrationFabrics"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Dashboard/grafana/myWorkspace/integrationFabrics/myIntegrationFabricName"), + // Location: to.Ptr("West US"), + // Properties: &armdashboard.IntegrationFabricProperties{ + // DataSourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/myAmw1"), + // ProvisioningState: to.Ptr(armdashboard.ProvisioningStateSucceeded), + // Scenarios: []*string{ + // to.Ptr("scenario1"), + // to.Ptr("scenario2"), + // }, + // TargetResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerService/managedClusters/myAks1"), + // }, + // }, + // { + // Name: to.Ptr("sampleIntegration"), + // Type: to.Ptr("Microsoft.Dashboard/grafana/integrationFabrics"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Dashboard/grafana/myWorkspace/integrationFabrics/myIntegrationFabricName"), + // Location: to.Ptr("West US"), + // Properties: &armdashboard.IntegrationFabricProperties{ + // DataSourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/myAmw2"), + // ProvisioningState: to.Ptr(armdashboard.ProvisioningStateSucceeded), + // Scenarios: []*string{ + // to.Ptr("scenario1"), + // to.Ptr("scenario2"), + // }, + // TargetResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerService/managedClusters/myAks2"), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-10-01/IntegrationFabrics_Update.json +func ExampleIntegrationFabricsClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdashboard.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewIntegrationFabricsClient().BeginUpdate(ctx, "myResourceGroup", "myWorkspace", "sampleIntegration", 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 = armdashboard.IntegrationFabricsClientUpdateResponse{ + // IntegrationFabric: &armdashboard.IntegrationFabric{ + // Name: to.Ptr("sampleIntegration"), + // Type: to.Ptr("Microsoft.Dashboard/grafana/integrationFabrics"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Dashboard/grafana/myWorkspace/integrationFabrics/myIntegrationFabricName"), + // Location: to.Ptr("West US"), + // Properties: &armdashboard.IntegrationFabricProperties{ + // DataSourceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/myAmw"), + // ProvisioningState: to.Ptr(armdashboard.ProvisioningStateSucceeded), + // Scenarios: []*string{ + // to.Ptr("scenario1"), + // }, + // TargetResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerService/managedClusters/myAks"), + // }, + // Tags: map[string]*string{ + // "Environment": to.Ptr("Dev 2"), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/dashboard/armdashboard/grafana_client.go b/sdk/resourcemanager/dashboard/armdashboard/managedgrafanas_client.go similarity index 56% rename from sdk/resourcemanager/dashboard/armdashboard/grafana_client.go rename to sdk/resourcemanager/dashboard/armdashboard/managedgrafanas_client.go index a15bc7935d8d..4ef226cc74be 100644 --- a/sdk/resourcemanager/dashboard/armdashboard/grafana_client.go +++ b/sdk/resourcemanager/dashboard/armdashboard/managedgrafanas_client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdashboard @@ -20,23 +16,23 @@ import ( "strings" ) -// GrafanaClient contains the methods for the Grafana group. -// Don't use this type directly, use NewGrafanaClient() instead. -type GrafanaClient struct { +// ManagedGrafanasClient contains the methods for the ManagedGrafanas group. +// Don't use this type directly, use NewManagedGrafanasClient() instead. +type ManagedGrafanasClient struct { internal *arm.Client subscriptionID string } -// NewGrafanaClient creates a new instance of GrafanaClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// NewManagedGrafanasClient creates a new instance of ManagedGrafanasClient 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 NewGrafanaClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GrafanaClient, error) { +func NewManagedGrafanasClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedGrafanasClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } - client := &GrafanaClient{ + client := &ManagedGrafanasClient{ subscriptionID: subscriptionID, internal: cl, } @@ -46,35 +42,35 @@ func NewGrafanaClient(subscriptionID string, credential azcore.TokenCredential, // CheckEnterpriseDetails - Retrieve enterprise add-on details information // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The workspace name of Azure Managed Grafana. -// - options - GrafanaClientCheckEnterpriseDetailsOptions contains the optional parameters for the GrafanaClient.CheckEnterpriseDetails +// - options - ManagedGrafanasClientCheckEnterpriseDetailsOptions contains the optional parameters for the ManagedGrafanasClient.CheckEnterpriseDetails // method. -func (client *GrafanaClient) CheckEnterpriseDetails(ctx context.Context, resourceGroupName string, workspaceName string, options *GrafanaClientCheckEnterpriseDetailsOptions) (GrafanaClientCheckEnterpriseDetailsResponse, error) { +func (client *ManagedGrafanasClient) CheckEnterpriseDetails(ctx context.Context, resourceGroupName string, workspaceName string, options *ManagedGrafanasClientCheckEnterpriseDetailsOptions) (ManagedGrafanasClientCheckEnterpriseDetailsResponse, error) { var err error - const operationName = "GrafanaClient.CheckEnterpriseDetails" + const operationName = "ManagedGrafanasClient.CheckEnterpriseDetails" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() req, err := client.checkEnterpriseDetailsCreateRequest(ctx, resourceGroupName, workspaceName, options) if err != nil { - return GrafanaClientCheckEnterpriseDetailsResponse{}, err + return ManagedGrafanasClientCheckEnterpriseDetailsResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return GrafanaClientCheckEnterpriseDetailsResponse{}, err + return ManagedGrafanasClientCheckEnterpriseDetailsResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return GrafanaClientCheckEnterpriseDetailsResponse{}, err + return ManagedGrafanasClientCheckEnterpriseDetailsResponse{}, err } resp, err := client.checkEnterpriseDetailsHandleResponse(httpResp) return resp, err } // checkEnterpriseDetailsCreateRequest creates the CheckEnterpriseDetails request. -func (client *GrafanaClient) checkEnterpriseDetailsCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *GrafanaClientCheckEnterpriseDetailsOptions) (*policy.Request, error) { +func (client *ManagedGrafanasClient) checkEnterpriseDetailsCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, _ *ManagedGrafanasClientCheckEnterpriseDetailsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/checkEnterpriseDetails" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -93,17 +89,17 @@ func (client *GrafanaClient) checkEnterpriseDetailsCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // checkEnterpriseDetailsHandleResponse handles the CheckEnterpriseDetails response. -func (client *GrafanaClient) checkEnterpriseDetailsHandleResponse(resp *http.Response) (GrafanaClientCheckEnterpriseDetailsResponse, error) { - result := GrafanaClientCheckEnterpriseDetailsResponse{} +func (client *ManagedGrafanasClient) checkEnterpriseDetailsHandleResponse(resp *http.Response) (ManagedGrafanasClientCheckEnterpriseDetailsResponse, error) { + result := ManagedGrafanasClientCheckEnterpriseDetailsResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.EnterpriseDetails); err != nil { - return GrafanaClientCheckEnterpriseDetailsResponse{}, err + return ManagedGrafanasClientCheckEnterpriseDetailsResponse{}, err } return result, nil } @@ -112,23 +108,23 @@ func (client *GrafanaClient) checkEnterpriseDetailsHandleResponse(resp *http.Res // grafana or update an existing grafana. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The workspace name of Azure Managed Grafana. -// - options - GrafanaClientBeginCreateOptions contains the optional parameters for the GrafanaClient.BeginCreate method. -func (client *GrafanaClient) BeginCreate(ctx context.Context, resourceGroupName string, workspaceName string, requestBodyParameters ManagedGrafana, options *GrafanaClientBeginCreateOptions) (*runtime.Poller[GrafanaClientCreateResponse], error) { +// - options - ManagedGrafanasClientBeginCreateOptions contains the optional parameters for the ManagedGrafanasClient.BeginCreate +// method. +func (client *ManagedGrafanasClient) BeginCreate(ctx context.Context, resourceGroupName string, workspaceName string, requestBodyParameters ManagedGrafana, options *ManagedGrafanasClientBeginCreateOptions) (*runtime.Poller[ManagedGrafanasClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.create(ctx, resourceGroupName, workspaceName, requestBodyParameters, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GrafanaClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedGrafanasClientCreateResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GrafanaClientCreateResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedGrafanasClientCreateResponse]{ Tracer: client.internal.Tracer(), }) } @@ -138,10 +134,10 @@ func (client *GrafanaClient) BeginCreate(ctx context.Context, resourceGroupName // or update an existing grafana. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 -func (client *GrafanaClient) create(ctx context.Context, resourceGroupName string, workspaceName string, requestBodyParameters ManagedGrafana, options *GrafanaClientBeginCreateOptions) (*http.Response, error) { +// Generated from API version 2024-10-01 +func (client *ManagedGrafanasClient) create(ctx context.Context, resourceGroupName string, workspaceName string, requestBodyParameters ManagedGrafana, options *ManagedGrafanasClientBeginCreateOptions) (*http.Response, error) { var err error - const operationName = "GrafanaClient.BeginCreate" + const operationName = "ManagedGrafanasClient.BeginCreate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() @@ -161,7 +157,7 @@ func (client *GrafanaClient) create(ctx context.Context, resourceGroupName strin } // createCreateRequest creates the Create request. -func (client *GrafanaClient) createCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, requestBodyParameters ManagedGrafana, options *GrafanaClientBeginCreateOptions) (*policy.Request, error) { +func (client *ManagedGrafanasClient) createCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, requestBodyParameters ManagedGrafana, _ *ManagedGrafanasClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -180,9 +176,10 @@ func (client *GrafanaClient) createCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, requestBodyParameters); err != nil { return nil, err } @@ -192,23 +189,23 @@ func (client *GrafanaClient) createCreateRequest(ctx context.Context, resourceGr // BeginDelete - Delete a workspace for Grafana resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The workspace name of Azure Managed Grafana. -// - options - GrafanaClientBeginDeleteOptions contains the optional parameters for the GrafanaClient.BeginDelete method. -func (client *GrafanaClient) BeginDelete(ctx context.Context, resourceGroupName string, workspaceName string, options *GrafanaClientBeginDeleteOptions) (*runtime.Poller[GrafanaClientDeleteResponse], error) { +// - options - ManagedGrafanasClientBeginDeleteOptions contains the optional parameters for the ManagedGrafanasClient.BeginDelete +// method. +func (client *ManagedGrafanasClient) BeginDelete(ctx context.Context, resourceGroupName string, workspaceName string, options *ManagedGrafanasClientBeginDeleteOptions) (*runtime.Poller[ManagedGrafanasClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, workspaceName, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GrafanaClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedGrafanasClientDeleteResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GrafanaClientDeleteResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedGrafanasClientDeleteResponse]{ Tracer: client.internal.Tracer(), }) } @@ -217,10 +214,10 @@ func (client *GrafanaClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Delete a workspace for Grafana resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 -func (client *GrafanaClient) deleteOperation(ctx context.Context, resourceGroupName string, workspaceName string, options *GrafanaClientBeginDeleteOptions) (*http.Response, error) { +// Generated from API version 2024-10-01 +func (client *ManagedGrafanasClient) deleteOperation(ctx context.Context, resourceGroupName string, workspaceName string, options *ManagedGrafanasClientBeginDeleteOptions) (*http.Response, error) { var err error - const operationName = "GrafanaClient.BeginDelete" + const operationName = "ManagedGrafanasClient.BeginDelete" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() @@ -240,7 +237,7 @@ func (client *GrafanaClient) deleteOperation(ctx context.Context, resourceGroupN } // deleteCreateRequest creates the Delete request. -func (client *GrafanaClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *GrafanaClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ManagedGrafanasClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, _ *ManagedGrafanasClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -259,44 +256,44 @@ func (client *GrafanaClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// FetchAvailablePlugins - +// FetchAvailablePlugins - A synchronous resource action. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The workspace name of Azure Managed Grafana. -// - options - GrafanaClientFetchAvailablePluginsOptions contains the optional parameters for the GrafanaClient.FetchAvailablePlugins +// - options - ManagedGrafanasClientFetchAvailablePluginsOptions contains the optional parameters for the ManagedGrafanasClient.FetchAvailablePlugins // method. -func (client *GrafanaClient) FetchAvailablePlugins(ctx context.Context, resourceGroupName string, workspaceName string, options *GrafanaClientFetchAvailablePluginsOptions) (GrafanaClientFetchAvailablePluginsResponse, error) { +func (client *ManagedGrafanasClient) FetchAvailablePlugins(ctx context.Context, resourceGroupName string, workspaceName string, options *ManagedGrafanasClientFetchAvailablePluginsOptions) (ManagedGrafanasClientFetchAvailablePluginsResponse, error) { var err error - const operationName = "GrafanaClient.FetchAvailablePlugins" + const operationName = "ManagedGrafanasClient.FetchAvailablePlugins" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() req, err := client.fetchAvailablePluginsCreateRequest(ctx, resourceGroupName, workspaceName, options) if err != nil { - return GrafanaClientFetchAvailablePluginsResponse{}, err + return ManagedGrafanasClientFetchAvailablePluginsResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return GrafanaClientFetchAvailablePluginsResponse{}, err + return ManagedGrafanasClientFetchAvailablePluginsResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return GrafanaClientFetchAvailablePluginsResponse{}, err + return ManagedGrafanasClientFetchAvailablePluginsResponse{}, err } resp, err := client.fetchAvailablePluginsHandleResponse(httpResp) return resp, err } // fetchAvailablePluginsCreateRequest creates the FetchAvailablePlugins request. -func (client *GrafanaClient) fetchAvailablePluginsCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *GrafanaClientFetchAvailablePluginsOptions) (*policy.Request, error) { +func (client *ManagedGrafanasClient) fetchAvailablePluginsCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, _ *ManagedGrafanasClientFetchAvailablePluginsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/fetchAvailablePlugins" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -315,17 +312,17 @@ func (client *GrafanaClient) fetchAvailablePluginsCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // fetchAvailablePluginsHandleResponse handles the FetchAvailablePlugins response. -func (client *GrafanaClient) fetchAvailablePluginsHandleResponse(resp *http.Response) (GrafanaClientFetchAvailablePluginsResponse, error) { - result := GrafanaClientFetchAvailablePluginsResponse{} +func (client *ManagedGrafanasClient) fetchAvailablePluginsHandleResponse(resp *http.Response) (ManagedGrafanasClientFetchAvailablePluginsResponse, error) { + result := ManagedGrafanasClientFetchAvailablePluginsResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.GrafanaAvailablePluginListResponse); err != nil { - return GrafanaClientFetchAvailablePluginsResponse{}, err + return ManagedGrafanasClientFetchAvailablePluginsResponse{}, err } return result, nil } @@ -333,34 +330,34 @@ func (client *GrafanaClient) fetchAvailablePluginsHandleResponse(resp *http.Resp // Get - Get the properties of a specific workspace for Grafana resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The workspace name of Azure Managed Grafana. -// - options - GrafanaClientGetOptions contains the optional parameters for the GrafanaClient.Get method. -func (client *GrafanaClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, options *GrafanaClientGetOptions) (GrafanaClientGetResponse, error) { +// - options - ManagedGrafanasClientGetOptions contains the optional parameters for the ManagedGrafanasClient.Get method. +func (client *ManagedGrafanasClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, options *ManagedGrafanasClientGetOptions) (ManagedGrafanasClientGetResponse, error) { var err error - const operationName = "GrafanaClient.Get" + const operationName = "ManagedGrafanasClient.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, workspaceName, options) if err != nil { - return GrafanaClientGetResponse{}, err + return ManagedGrafanasClientGetResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return GrafanaClientGetResponse{}, err + return ManagedGrafanasClientGetResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return GrafanaClientGetResponse{}, err + return ManagedGrafanasClientGetResponse{}, err } resp, err := client.getHandleResponse(httpResp) return resp, err } // getCreateRequest creates the Get request. -func (client *GrafanaClient) getCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *GrafanaClientGetOptions) (*policy.Request, error) { +func (client *ManagedGrafanasClient) getCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, _ *ManagedGrafanasClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -379,32 +376,33 @@ func (client *GrafanaClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // getHandleResponse handles the Get response. -func (client *GrafanaClient) getHandleResponse(resp *http.Response) (GrafanaClientGetResponse, error) { - result := GrafanaClientGetResponse{} +func (client *ManagedGrafanasClient) getHandleResponse(resp *http.Response) (ManagedGrafanasClientGetResponse, error) { + result := ManagedGrafanasClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedGrafana); err != nil { - return GrafanaClientGetResponse{}, err + return ManagedGrafanasClientGetResponse{}, err } return result, nil } // NewListPager - List all resources of workspaces for Grafana under the specified subscription. // -// Generated from API version 2023-09-01 -// - options - GrafanaClientListOptions contains the optional parameters for the GrafanaClient.NewListPager method. -func (client *GrafanaClient) NewListPager(options *GrafanaClientListOptions) *runtime.Pager[GrafanaClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[GrafanaClientListResponse]{ - More: func(page GrafanaClientListResponse) bool { +// Generated from API version 2024-10-01 +// - options - ManagedGrafanasClientListOptions contains the optional parameters for the ManagedGrafanasClient.NewListPager +// method. +func (client *ManagedGrafanasClient) NewListPager(options *ManagedGrafanasClientListOptions) *runtime.Pager[ManagedGrafanasClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedGrafanasClientListResponse]{ + More: func(page ManagedGrafanasClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *GrafanaClientListResponse) (GrafanaClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GrafanaClient.NewListPager") + Fetcher: func(ctx context.Context, page *ManagedGrafanasClientListResponse) (ManagedGrafanasClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedGrafanasClient.NewListPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -413,7 +411,7 @@ func (client *GrafanaClient) NewListPager(options *GrafanaClientListOptions) *ru return client.listCreateRequest(ctx, options) }, nil) if err != nil { - return GrafanaClientListResponse{}, err + return ManagedGrafanasClientListResponse{}, err } return client.listHandleResponse(resp) }, @@ -422,7 +420,7 @@ func (client *GrafanaClient) NewListPager(options *GrafanaClientListOptions) *ru } // listCreateRequest creates the List request. -func (client *GrafanaClient) listCreateRequest(ctx context.Context, options *GrafanaClientListOptions) (*policy.Request, error) { +func (client *ManagedGrafanasClient) listCreateRequest(ctx context.Context, _ *ManagedGrafanasClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Dashboard/grafana" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -433,34 +431,34 @@ func (client *GrafanaClient) listCreateRequest(ctx context.Context, options *Gra return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // listHandleResponse handles the List response. -func (client *GrafanaClient) listHandleResponse(resp *http.Response) (GrafanaClientListResponse, error) { - result := GrafanaClientListResponse{} +func (client *ManagedGrafanasClient) listHandleResponse(resp *http.Response) (ManagedGrafanasClientListResponse, error) { + result := ManagedGrafanasClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedGrafanaListResponse); err != nil { - return GrafanaClientListResponse{}, err + return ManagedGrafanasClientListResponse{}, err } return result, nil } // NewListByResourceGroupPager - List all resources of workspaces for Grafana under the specified resource group. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - GrafanaClientListByResourceGroupOptions contains the optional parameters for the GrafanaClient.NewListByResourceGroupPager +// - options - ManagedGrafanasClientListByResourceGroupOptions contains the optional parameters for the ManagedGrafanasClient.NewListByResourceGroupPager // method. -func (client *GrafanaClient) NewListByResourceGroupPager(resourceGroupName string, options *GrafanaClientListByResourceGroupOptions) *runtime.Pager[GrafanaClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[GrafanaClientListByResourceGroupResponse]{ - More: func(page GrafanaClientListByResourceGroupResponse) bool { +func (client *ManagedGrafanasClient) NewListByResourceGroupPager(resourceGroupName string, options *ManagedGrafanasClientListByResourceGroupOptions) *runtime.Pager[ManagedGrafanasClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedGrafanasClientListByResourceGroupResponse]{ + More: func(page ManagedGrafanasClientListByResourceGroupResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *GrafanaClientListByResourceGroupResponse) (GrafanaClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GrafanaClient.NewListByResourceGroupPager") + Fetcher: func(ctx context.Context, page *ManagedGrafanasClientListByResourceGroupResponse) (ManagedGrafanasClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedGrafanasClient.NewListByResourceGroupPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -469,7 +467,7 @@ func (client *GrafanaClient) NewListByResourceGroupPager(resourceGroupName strin return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) }, nil) if err != nil { - return GrafanaClientListByResourceGroupResponse{}, err + return ManagedGrafanasClientListByResourceGroupResponse{}, err } return client.listByResourceGroupHandleResponse(resp) }, @@ -478,7 +476,7 @@ func (client *GrafanaClient) NewListByResourceGroupPager(resourceGroupName strin } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *GrafanaClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *GrafanaClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *ManagedGrafanasClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *ManagedGrafanasClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -493,52 +491,128 @@ func (client *GrafanaClient) listByResourceGroupCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *GrafanaClient) listByResourceGroupHandleResponse(resp *http.Response) (GrafanaClientListByResourceGroupResponse, error) { - result := GrafanaClientListByResourceGroupResponse{} +func (client *ManagedGrafanasClient) listByResourceGroupHandleResponse(resp *http.Response) (ManagedGrafanasClientListByResourceGroupResponse, error) { + result := ManagedGrafanasClientListByResourceGroupResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedGrafanaListResponse); err != nil { - return GrafanaClientListByResourceGroupResponse{}, err + return ManagedGrafanasClientListByResourceGroupResponse{}, err } return result, nil } +// BeginRefresh - Refresh and sync managed private endpoints of a grafana resource to latest state. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The workspace name of Azure Managed Grafana. +// - options - ManagedGrafanasClientBeginRefreshOptions contains the optional parameters for the ManagedGrafanasClient.BeginRefresh +// method. +func (client *ManagedGrafanasClient) BeginRefresh(ctx context.Context, resourceGroupName string, workspaceName string, options *ManagedGrafanasClientBeginRefreshOptions) (*runtime.Poller[ManagedGrafanasClientRefreshResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.refresh(ctx, resourceGroupName, workspaceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedGrafanasClientRefreshResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedGrafanasClientRefreshResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Refresh - Refresh and sync managed private endpoints of a grafana resource to latest state. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01 +func (client *ManagedGrafanasClient) refresh(ctx context.Context, resourceGroupName string, workspaceName string, options *ManagedGrafanasClientBeginRefreshOptions) (*http.Response, error) { + var err error + const operationName = "ManagedGrafanasClient.BeginRefresh" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.refreshCreateRequest(ctx, resourceGroupName, workspaceName, 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 +} + +// refreshCreateRequest creates the Refresh request. +func (client *ManagedGrafanasClient) refreshCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, _ *ManagedGrafanasClientBeginRefreshOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/refreshManagedPrivateEndpoints" + 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 workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + // Update - Update a workspace for Grafana resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The workspace name of Azure Managed Grafana. -// - options - GrafanaClientUpdateOptions contains the optional parameters for the GrafanaClient.Update method. -func (client *GrafanaClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, requestBodyParameters ManagedGrafanaUpdateParameters, options *GrafanaClientUpdateOptions) (GrafanaClientUpdateResponse, error) { +// - options - ManagedGrafanasClientUpdateOptions contains the optional parameters for the ManagedGrafanasClient.Update method. +func (client *ManagedGrafanasClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, requestBodyParameters ManagedGrafanaUpdateParameters, options *ManagedGrafanasClientUpdateOptions) (ManagedGrafanasClientUpdateResponse, error) { var err error - const operationName = "GrafanaClient.Update" + const operationName = "ManagedGrafanasClient.Update" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, workspaceName, requestBodyParameters, options) if err != nil { - return GrafanaClientUpdateResponse{}, err + return ManagedGrafanasClientUpdateResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return GrafanaClientUpdateResponse{}, err + return ManagedGrafanasClientUpdateResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { err = runtime.NewResponseError(httpResp) - return GrafanaClientUpdateResponse{}, err + return ManagedGrafanasClientUpdateResponse{}, err } resp, err := client.updateHandleResponse(httpResp) return resp, err } // updateCreateRequest creates the Update request. -func (client *GrafanaClient) updateCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, requestBodyParameters ManagedGrafanaUpdateParameters, options *GrafanaClientUpdateOptions) (*policy.Request, error) { +func (client *ManagedGrafanasClient) updateCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, requestBodyParameters ManagedGrafanaUpdateParameters, _ *ManagedGrafanasClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -557,9 +631,10 @@ func (client *GrafanaClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, requestBodyParameters); err != nil { return nil, err } @@ -567,13 +642,10 @@ func (client *GrafanaClient) updateCreateRequest(ctx context.Context, resourceGr } // updateHandleResponse handles the Update response. -func (client *GrafanaClient) updateHandleResponse(resp *http.Response) (GrafanaClientUpdateResponse, error) { - result := GrafanaClientUpdateResponse{} - if val := resp.Header.Get("Azure-AsyncOperation"); val != "" { - result.AzureAsyncOperation = &val - } +func (client *ManagedGrafanasClient) updateHandleResponse(resp *http.Response) (ManagedGrafanasClientUpdateResponse, error) { + result := ManagedGrafanasClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedGrafana); err != nil { - return GrafanaClientUpdateResponse{}, err + return ManagedGrafanasClientUpdateResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/dashboard/armdashboard/managedgrafanas_client_example_test.go b/sdk/resourcemanager/dashboard/armdashboard/managedgrafanas_client_example_test.go new file mode 100644 index 000000000000..50adcbf8f023 --- /dev/null +++ b/sdk/resourcemanager/dashboard/armdashboard/managedgrafanas_client_example_test.go @@ -0,0 +1,604 @@ +// 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 armdashboard_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard/v2" + "log" +) + +// Generated from example definition: 2024-10-01/EnterpriseDetails_Post.json +func ExampleManagedGrafanasClient_CheckEnterpriseDetails() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdashboard.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewManagedGrafanasClient().CheckEnterpriseDetails(ctx, "myResourceGroup", "myWorkspace", 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 = armdashboard.ManagedGrafanasClientCheckEnterpriseDetailsResponse{ + // EnterpriseDetails: &armdashboard.EnterpriseDetails{ + // MarketplaceTrialQuota: &armdashboard.MarketplaceTrialQuota{ + // AvailablePromotion: to.Ptr(armdashboard.AvailablePromotionNone), + // GrafanaResourceID: to.Ptr("/subscriptions/e1e3b30d-e7ec-4e25-8587-db037bcb9a4d/resourcegroups/amg-local-script-test-rg/providers/microsoft.dashboard/grafana/eus2-enterprise-1001-07"), + // TrialEndAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-03T01:06:00.447Z"); return t}()), + // TrialStartAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-04T01:06:00.447Z"); return t}()), + // }, + // SaasSubscriptionDetails: &armdashboard.SaasSubscriptionDetails{ + // OfferID: to.Ptr("amg_test"), + // PlanID: to.Ptr("amg_globalplan"), + // PublisherID: to.Ptr("isvtestuklegacy"), + // Term: &armdashboard.SubscriptionTerm{ + // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-03T00:00:00Z"); return t}()), + // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-04T00:00:00Z"); return t}()), + // TermUnit: to.Ptr("P1M"), + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2024-10-01/Grafana_Create.json +func ExampleManagedGrafanasClient_BeginCreate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdashboard.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewManagedGrafanasClient().BeginCreate(ctx, "myResourceGroup", "myWorkspace", 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 = armdashboard.ManagedGrafanasClientCreateResponse{ + // ManagedGrafana: &armdashboard.ManagedGrafana{ + // Name: to.Ptr("myWorkspace"), + // Type: to.Ptr("Microsoft.Dashboard/grafana"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/grafana/myWorkspace"), + // Identity: &armdashboard.ManagedServiceIdentity{ + // Type: to.Ptr(armdashboard.ManagedServiceIdentityTypeSystemAssigned), + // }, + // Location: to.Ptr("West US"), + // Properties: &armdashboard.ManagedGrafanaProperties{ + // APIKey: to.Ptr(armdashboard.APIKeyEnabled), + // AutoGeneratedDomainNameLabelScope: to.Ptr(armdashboard.AutoGeneratedDomainNameLabelScopeTenantReuse), + // DeterministicOutboundIP: to.Ptr(armdashboard.DeterministicOutboundIPEnabled), + // Endpoint: to.Ptr("https://myworkspace-abcdefghijklmnop.wus.grafana.azure.com"), + // EnterpriseConfigurations: &armdashboard.EnterpriseConfigurations{ + // MarketplaceAutoRenew: to.Ptr(armdashboard.MarketplaceAutoRenewEnabled), + // MarketplacePlanID: to.Ptr("myPlanId"), + // }, + // GrafanaConfigurations: &armdashboard.GrafanaConfigurations{ + // Security: &armdashboard.Security{ + // CsrfAlwaysCheck: to.Ptr(false), + // }, + // SMTP: &armdashboard.SMTP{ + // Enabled: to.Ptr(true), + // FromAddress: to.Ptr("test@sendemail.com"), + // FromName: to.Ptr("emailsender"), + // Host: to.Ptr("smtp.sendemail.com:587"), + // SkipVerify: to.Ptr(true), + // StartTLSPolicy: to.Ptr(armdashboard.StartTLSPolicyOpportunisticStartTLS), + // User: to.Ptr("username"), + // }, + // Snapshots: &armdashboard.Snapshots{ + // ExternalEnabled: to.Ptr(true), + // }, + // Users: &armdashboard.Users{ + // ViewersCanEdit: to.Ptr(true), + // }, + // }, + // GrafanaIntegrations: &armdashboard.GrafanaIntegrations{ + // AzureMonitorWorkspaceIntegrations: []*armdashboard.AzureMonitorWorkspaceIntegration{ + // { + // AzureMonitorWorkspaceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"), + // }, + // }, + // }, + // GrafanaMajorVersion: to.Ptr("9"), + // GrafanaPlugins: map[string]*armdashboard.GrafanaPlugin{ + // "sample-plugin-id": &armdashboard.GrafanaPlugin{ + // PluginID: to.Ptr("sample-plugin-id"), + // }, + // }, + // GrafanaVersion: to.Ptr("9.4.5"), + // OutboundIPs: []*string{ + // to.Ptr("192.168.0.1"), + // to.Ptr("192.168.0.2"), + // }, + // ProvisioningState: to.Ptr(armdashboard.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr(armdashboard.PublicNetworkAccessEnabled), + // ZoneRedundancy: to.Ptr(armdashboard.ZoneRedundancyEnabled), + // }, + // SKU: &armdashboard.ResourceSKU{ + // Name: to.Ptr("Standard"), + // }, + // SystemData: &armdashboard.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-03T01:01:01.1075056Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armdashboard.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-04T02:03:01.1974346Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armdashboard.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // "Environment": to.Ptr("Dev"), + // }, + // }, + // } +} + +// Generated from example definition: 2024-10-01/Grafana_Delete.json +func ExampleManagedGrafanasClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdashboard.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewManagedGrafanasClient().BeginDelete(ctx, "myResourceGroup", "myWorkspace", 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 = armdashboard.ManagedGrafanasClientDeleteResponse{ + // } +} + +// Generated from example definition: 2024-10-01/Grafana_FetchAvailablePlugins.json +func ExampleManagedGrafanasClient_FetchAvailablePlugins() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdashboard.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewManagedGrafanasClient().FetchAvailablePlugins(ctx, "myResourceGroup", "myWorkspace", 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 = armdashboard.ManagedGrafanasClientFetchAvailablePluginsResponse{ + // GrafanaAvailablePluginListResponse: &armdashboard.GrafanaAvailablePluginListResponse{ + // Value: []*armdashboard.GrafanaAvailablePlugin{ + // { + // Name: to.Ptr("Plugin A"), + // PluginID: to.Ptr("plugin-a"), + // }, + // { + // Name: to.Ptr("Plugin B"), + // PluginID: to.Ptr("plugin-b"), + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2024-10-01/Grafana_Get.json +func ExampleManagedGrafanasClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdashboard.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewManagedGrafanasClient().Get(ctx, "myResourceGroup", "myWorkspace", 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 = armdashboard.ManagedGrafanasClientGetResponse{ + // ManagedGrafana: &armdashboard.ManagedGrafana{ + // Name: to.Ptr("myWorkspace"), + // Type: to.Ptr("Microsoft.Dashboard/grafana"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/grafana/myWorkspace"), + // Location: to.Ptr("West US"), + // Properties: &armdashboard.ManagedGrafanaProperties{ + // APIKey: to.Ptr(armdashboard.APIKeyEnabled), + // AutoGeneratedDomainNameLabelScope: to.Ptr(armdashboard.AutoGeneratedDomainNameLabelScopeTenantReuse), + // DeterministicOutboundIP: to.Ptr(armdashboard.DeterministicOutboundIPEnabled), + // Endpoint: to.Ptr("https://myworkspace-abcdefghijklmnop.wus.grafana.azure.com"), + // EnterpriseConfigurations: &armdashboard.EnterpriseConfigurations{ + // MarketplaceAutoRenew: to.Ptr(armdashboard.MarketplaceAutoRenewEnabled), + // MarketplacePlanID: to.Ptr("myPlanId"), + // }, + // GrafanaConfigurations: &armdashboard.GrafanaConfigurations{ + // Security: &armdashboard.Security{ + // CsrfAlwaysCheck: to.Ptr(false), + // }, + // SMTP: &armdashboard.SMTP{ + // Enabled: to.Ptr(true), + // FromAddress: to.Ptr("test@sendemail.com"), + // FromName: to.Ptr("emailsender"), + // Host: to.Ptr("smtp.sendemail.com:587"), + // SkipVerify: to.Ptr(true), + // StartTLSPolicy: to.Ptr(armdashboard.StartTLSPolicyOpportunisticStartTLS), + // User: to.Ptr("username"), + // }, + // Snapshots: &armdashboard.Snapshots{ + // ExternalEnabled: to.Ptr(true), + // }, + // Users: &armdashboard.Users{ + // ViewersCanEdit: to.Ptr(true), + // }, + // }, + // GrafanaIntegrations: &armdashboard.GrafanaIntegrations{ + // AzureMonitorWorkspaceIntegrations: []*armdashboard.AzureMonitorWorkspaceIntegration{ + // { + // AzureMonitorWorkspaceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"), + // }, + // }, + // }, + // GrafanaMajorVersion: to.Ptr("9"), + // GrafanaPlugins: map[string]*armdashboard.GrafanaPlugin{ + // "sample-plugin-id": &armdashboard.GrafanaPlugin{ + // PluginID: to.Ptr("sample-plugin-id"), + // }, + // }, + // GrafanaVersion: to.Ptr("9.4.5"), + // OutboundIPs: []*string{ + // to.Ptr("192.168.0.1"), + // to.Ptr("192.168.0.2"), + // }, + // ProvisioningState: to.Ptr(armdashboard.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr(armdashboard.PublicNetworkAccessEnabled), + // ZoneRedundancy: to.Ptr(armdashboard.ZoneRedundancyEnabled), + // }, + // SKU: &armdashboard.ResourceSKU{ + // Name: to.Ptr("Standard"), + // }, + // SystemData: &armdashboard.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-03T01:01:01.1075056Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armdashboard.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-04T02:03:01.1974346Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armdashboard.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // "Environment": to.Ptr("Dev"), + // }, + // }, + // } +} + +// Generated from example definition: 2024-10-01/Grafana_List.json +func ExampleManagedGrafanasClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdashboard.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewManagedGrafanasClient().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 = armdashboard.ManagedGrafanasClientListResponse{ + // ManagedGrafanaListResponse: armdashboard.ManagedGrafanaListResponse{ + // Value: []*armdashboard.ManagedGrafana{ + // { + // Name: to.Ptr("myWorkspace"), + // Type: to.Ptr("Microsoft.Dashboard/grafana"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/grafana/myWorkspace"), + // Location: to.Ptr("West US"), + // Properties: &armdashboard.ManagedGrafanaProperties{ + // APIKey: to.Ptr(armdashboard.APIKeyEnabled), + // AutoGeneratedDomainNameLabelScope: to.Ptr(armdashboard.AutoGeneratedDomainNameLabelScopeTenantReuse), + // DeterministicOutboundIP: to.Ptr(armdashboard.DeterministicOutboundIPEnabled), + // Endpoint: to.Ptr("https://myworkspace-abcdefghijklmnop.wus.grafana.azure.com"), + // EnterpriseConfigurations: &armdashboard.EnterpriseConfigurations{ + // MarketplaceAutoRenew: to.Ptr(armdashboard.MarketplaceAutoRenewEnabled), + // MarketplacePlanID: to.Ptr("myPlanId"), + // }, + // GrafanaConfigurations: &armdashboard.GrafanaConfigurations{ + // Security: &armdashboard.Security{ + // CsrfAlwaysCheck: to.Ptr(false), + // }, + // SMTP: &armdashboard.SMTP{ + // Enabled: to.Ptr(true), + // FromAddress: to.Ptr("test@sendemail.com"), + // FromName: to.Ptr("emailsender"), + // Host: to.Ptr("smtp.sendemail.com:587"), + // SkipVerify: to.Ptr(true), + // StartTLSPolicy: to.Ptr(armdashboard.StartTLSPolicyOpportunisticStartTLS), + // User: to.Ptr("username"), + // }, + // Snapshots: &armdashboard.Snapshots{ + // ExternalEnabled: to.Ptr(true), + // }, + // Users: &armdashboard.Users{ + // ViewersCanEdit: to.Ptr(true), + // }, + // }, + // GrafanaIntegrations: &armdashboard.GrafanaIntegrations{ + // AzureMonitorWorkspaceIntegrations: []*armdashboard.AzureMonitorWorkspaceIntegration{ + // { + // AzureMonitorWorkspaceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"), + // }, + // }, + // }, + // GrafanaMajorVersion: to.Ptr("9"), + // GrafanaPlugins: map[string]*armdashboard.GrafanaPlugin{ + // "sample-plugin-id": &armdashboard.GrafanaPlugin{ + // PluginID: to.Ptr("sample-plugin-id"), + // }, + // }, + // GrafanaVersion: to.Ptr("9.4.5"), + // OutboundIPs: []*string{ + // to.Ptr("192.168.0.1"), + // to.Ptr("192.168.0.2"), + // }, + // ProvisioningState: to.Ptr(armdashboard.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr(armdashboard.PublicNetworkAccessEnabled), + // ZoneRedundancy: to.Ptr(armdashboard.ZoneRedundancyEnabled), + // }, + // SKU: &armdashboard.ResourceSKU{ + // Name: to.Ptr("Standard"), + // }, + // Tags: map[string]*string{ + // "Environment": to.Ptr("Dev"), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-10-01/Grafana_ListByResourceGroup.json +func ExampleManagedGrafanasClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdashboard.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewManagedGrafanasClient().NewListByResourceGroupPager("myResourceGroup", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armdashboard.ManagedGrafanasClientListByResourceGroupResponse{ + // ManagedGrafanaListResponse: armdashboard.ManagedGrafanaListResponse{ + // Value: []*armdashboard.ManagedGrafana{ + // { + // Name: to.Ptr("myWorkspace"), + // Type: to.Ptr("Microsoft.Dashboard/grafana"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/grafana/myWorkspace"), + // Location: to.Ptr("West US"), + // Properties: &armdashboard.ManagedGrafanaProperties{ + // APIKey: to.Ptr(armdashboard.APIKeyEnabled), + // AutoGeneratedDomainNameLabelScope: to.Ptr(armdashboard.AutoGeneratedDomainNameLabelScopeTenantReuse), + // DeterministicOutboundIP: to.Ptr(armdashboard.DeterministicOutboundIPEnabled), + // Endpoint: to.Ptr("https://myworkspace-abcdefghijklmnop.wus.grafana.azure.com"), + // EnterpriseConfigurations: &armdashboard.EnterpriseConfigurations{ + // MarketplaceAutoRenew: to.Ptr(armdashboard.MarketplaceAutoRenewEnabled), + // MarketplacePlanID: to.Ptr("myPlanId"), + // }, + // GrafanaConfigurations: &armdashboard.GrafanaConfigurations{ + // Security: &armdashboard.Security{ + // CsrfAlwaysCheck: to.Ptr(false), + // }, + // SMTP: &armdashboard.SMTP{ + // Enabled: to.Ptr(true), + // FromAddress: to.Ptr("test@sendemail.com"), + // FromName: to.Ptr("emailsender"), + // Host: to.Ptr("smtp.sendemail.com:587"), + // SkipVerify: to.Ptr(true), + // StartTLSPolicy: to.Ptr(armdashboard.StartTLSPolicyOpportunisticStartTLS), + // User: to.Ptr("username"), + // }, + // Snapshots: &armdashboard.Snapshots{ + // ExternalEnabled: to.Ptr(true), + // }, + // Users: &armdashboard.Users{ + // ViewersCanEdit: to.Ptr(true), + // }, + // }, + // GrafanaIntegrations: &armdashboard.GrafanaIntegrations{ + // AzureMonitorWorkspaceIntegrations: []*armdashboard.AzureMonitorWorkspaceIntegration{ + // { + // AzureMonitorWorkspaceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"), + // }, + // }, + // }, + // GrafanaMajorVersion: to.Ptr("9"), + // GrafanaPlugins: map[string]*armdashboard.GrafanaPlugin{ + // "sample-plugin-id": &armdashboard.GrafanaPlugin{ + // PluginID: to.Ptr("sample-plugin-id"), + // }, + // }, + // GrafanaVersion: to.Ptr("9.4.5"), + // OutboundIPs: []*string{ + // to.Ptr("192.168.0.1"), + // to.Ptr("192.168.0.2"), + // }, + // ProvisioningState: to.Ptr(armdashboard.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr(armdashboard.PublicNetworkAccessEnabled), + // ZoneRedundancy: to.Ptr(armdashboard.ZoneRedundancyEnabled), + // }, + // SKU: &armdashboard.ResourceSKU{ + // Name: to.Ptr("Standard"), + // }, + // Tags: map[string]*string{ + // "Environment": to.Ptr("Dev"), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-10-01/ManagedPrivateEndpoints_Refresh.json +func ExampleManagedGrafanasClient_BeginRefresh() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdashboard.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewManagedGrafanasClient().BeginRefresh(ctx, "myResourceGroup", "myWorkspace", 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 = armdashboard.ManagedGrafanasClientRefreshResponse{ + // } +} + +// Generated from example definition: 2024-10-01/Grafana_Update.json +func ExampleManagedGrafanasClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdashboard.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewManagedGrafanasClient().Update(ctx, "myResourceGroup", "myWorkspace", 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 = armdashboard.ManagedGrafanasClientUpdateResponse{ + // ManagedGrafana: &armdashboard.ManagedGrafana{ + // Name: to.Ptr("myWorkspace"), + // Type: to.Ptr("Microsoft.Dashboard/grafana"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/grafana/myWorkspace"), + // Location: to.Ptr("West US"), + // Properties: &armdashboard.ManagedGrafanaProperties{ + // APIKey: to.Ptr(armdashboard.APIKeyEnabled), + // AutoGeneratedDomainNameLabelScope: to.Ptr(armdashboard.AutoGeneratedDomainNameLabelScopeTenantReuse), + // DeterministicOutboundIP: to.Ptr(armdashboard.DeterministicOutboundIPEnabled), + // Endpoint: to.Ptr("https://myworkspace-abcdefghijklmnop.wus.grafana.azure.com"), + // EnterpriseConfigurations: &armdashboard.EnterpriseConfigurations{ + // MarketplaceAutoRenew: to.Ptr(armdashboard.MarketplaceAutoRenewEnabled), + // MarketplacePlanID: to.Ptr("myPlanId"), + // }, + // GrafanaConfigurations: &armdashboard.GrafanaConfigurations{ + // Security: &armdashboard.Security{ + // CsrfAlwaysCheck: to.Ptr(false), + // }, + // SMTP: &armdashboard.SMTP{ + // Enabled: to.Ptr(true), + // FromAddress: to.Ptr("test@sendemail.com"), + // FromName: to.Ptr("emailsender"), + // Host: to.Ptr("smtp.sendemail.com:587"), + // SkipVerify: to.Ptr(true), + // StartTLSPolicy: to.Ptr(armdashboard.StartTLSPolicyOpportunisticStartTLS), + // User: to.Ptr("username"), + // }, + // Snapshots: &armdashboard.Snapshots{ + // ExternalEnabled: to.Ptr(true), + // }, + // Users: &armdashboard.Users{ + // ViewersCanEdit: to.Ptr(true), + // }, + // }, + // GrafanaIntegrations: &armdashboard.GrafanaIntegrations{ + // AzureMonitorWorkspaceIntegrations: []*armdashboard.AzureMonitorWorkspaceIntegration{ + // { + // AzureMonitorWorkspaceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"), + // }, + // }, + // }, + // GrafanaMajorVersion: to.Ptr("9"), + // GrafanaPlugins: map[string]*armdashboard.GrafanaPlugin{ + // "sample-plugin-id": &armdashboard.GrafanaPlugin{ + // PluginID: to.Ptr("sample-plugin-id"), + // }, + // }, + // GrafanaVersion: to.Ptr("9.4.5"), + // OutboundIPs: []*string{ + // to.Ptr("192.168.0.1"), + // to.Ptr("192.168.0.2"), + // }, + // ProvisioningState: to.Ptr(armdashboard.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr(armdashboard.PublicNetworkAccessEnabled), + // ZoneRedundancy: to.Ptr(armdashboard.ZoneRedundancyEnabled), + // }, + // SKU: &armdashboard.ResourceSKU{ + // Name: to.Ptr("Standard"), + // }, + // Tags: map[string]*string{ + // "Environment": to.Ptr("Dev 2"), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/dashboard/armdashboard/managedprivateendpoints_client.go b/sdk/resourcemanager/dashboard/armdashboard/managedprivateendpointmodels_client.go similarity index 58% rename from sdk/resourcemanager/dashboard/armdashboard/managedprivateendpoints_client.go rename to sdk/resourcemanager/dashboard/armdashboard/managedprivateendpointmodels_client.go index 2d47ebb70713..ac13148e6c8d 100644 --- a/sdk/resourcemanager/dashboard/armdashboard/managedprivateendpoints_client.go +++ b/sdk/resourcemanager/dashboard/armdashboard/managedprivateendpointmodels_client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdashboard @@ -20,23 +16,23 @@ import ( "strings" ) -// ManagedPrivateEndpointsClient contains the methods for the ManagedPrivateEndpoints group. -// Don't use this type directly, use NewManagedPrivateEndpointsClient() instead. -type ManagedPrivateEndpointsClient struct { +// ManagedPrivateEndpointModelsClient contains the methods for the ManagedPrivateEndpointModels group. +// Don't use this type directly, use NewManagedPrivateEndpointModelsClient() instead. +type ManagedPrivateEndpointModelsClient struct { internal *arm.Client subscriptionID string } -// NewManagedPrivateEndpointsClient creates a new instance of ManagedPrivateEndpointsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// NewManagedPrivateEndpointModelsClient creates a new instance of ManagedPrivateEndpointModelsClient 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 NewManagedPrivateEndpointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedPrivateEndpointsClient, error) { +func NewManagedPrivateEndpointModelsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedPrivateEndpointModelsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } - client := &ManagedPrivateEndpointsClient{ + client := &ManagedPrivateEndpointModelsClient{ subscriptionID: subscriptionID, internal: cl, } @@ -46,26 +42,26 @@ func NewManagedPrivateEndpointsClient(subscriptionID string, credential azcore.T // BeginCreate - Create or update a managed private endpoint for a grafana resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The workspace name of Azure Managed Grafana. // - managedPrivateEndpointName - The managed private endpoint name of Azure Managed Grafana. // - requestBodyParameters - The managed private endpoint to be created or updated. -// - options - ManagedPrivateEndpointsClientBeginCreateOptions contains the optional parameters for the ManagedPrivateEndpointsClient.BeginCreate +// - options - ManagedPrivateEndpointModelsClientBeginCreateOptions contains the optional parameters for the ManagedPrivateEndpointModelsClient.BeginCreate // method. -func (client *ManagedPrivateEndpointsClient) BeginCreate(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, requestBodyParameters ManagedPrivateEndpointModel, options *ManagedPrivateEndpointsClientBeginCreateOptions) (*runtime.Poller[ManagedPrivateEndpointsClientCreateResponse], error) { +func (client *ManagedPrivateEndpointModelsClient) BeginCreate(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, requestBodyParameters ManagedPrivateEndpointModel, options *ManagedPrivateEndpointModelsClientBeginCreateOptions) (*runtime.Poller[ManagedPrivateEndpointModelsClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.create(ctx, resourceGroupName, workspaceName, managedPrivateEndpointName, requestBodyParameters, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedPrivateEndpointsClientCreateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedPrivateEndpointModelsClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaOriginalURI, Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedPrivateEndpointsClientCreateResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedPrivateEndpointModelsClientCreateResponse]{ Tracer: client.internal.Tracer(), }) } @@ -74,10 +70,10 @@ func (client *ManagedPrivateEndpointsClient) BeginCreate(ctx context.Context, re // Create - Create or update a managed private endpoint for a grafana resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 -func (client *ManagedPrivateEndpointsClient) create(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, requestBodyParameters ManagedPrivateEndpointModel, options *ManagedPrivateEndpointsClientBeginCreateOptions) (*http.Response, error) { +// Generated from API version 2024-10-01 +func (client *ManagedPrivateEndpointModelsClient) create(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, requestBodyParameters ManagedPrivateEndpointModel, options *ManagedPrivateEndpointModelsClientBeginCreateOptions) (*http.Response, error) { var err error - const operationName = "ManagedPrivateEndpointsClient.BeginCreate" + const operationName = "ManagedPrivateEndpointModelsClient.BeginCreate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() @@ -97,7 +93,7 @@ func (client *ManagedPrivateEndpointsClient) create(ctx context.Context, resourc } // createCreateRequest creates the Create request. -func (client *ManagedPrivateEndpointsClient) createCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, requestBodyParameters ManagedPrivateEndpointModel, options *ManagedPrivateEndpointsClientBeginCreateOptions) (*policy.Request, error) { +func (client *ManagedPrivateEndpointModelsClient) createCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, requestBodyParameters ManagedPrivateEndpointModel, _ *ManagedPrivateEndpointModelsClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -120,9 +116,10 @@ func (client *ManagedPrivateEndpointsClient) createCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, requestBodyParameters); err != nil { return nil, err } @@ -132,25 +129,24 @@ func (client *ManagedPrivateEndpointsClient) createCreateRequest(ctx context.Con // BeginDelete - Delete a managed private endpoint for a grafana resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The workspace name of Azure Managed Grafana. // - managedPrivateEndpointName - The managed private endpoint name of Azure Managed Grafana. -// - options - ManagedPrivateEndpointsClientBeginDeleteOptions contains the optional parameters for the ManagedPrivateEndpointsClient.BeginDelete +// - options - ManagedPrivateEndpointModelsClientBeginDeleteOptions contains the optional parameters for the ManagedPrivateEndpointModelsClient.BeginDelete // method. -func (client *ManagedPrivateEndpointsClient) BeginDelete(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, options *ManagedPrivateEndpointsClientBeginDeleteOptions) (*runtime.Poller[ManagedPrivateEndpointsClientDeleteResponse], error) { +func (client *ManagedPrivateEndpointModelsClient) BeginDelete(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, options *ManagedPrivateEndpointModelsClientBeginDeleteOptions) (*runtime.Poller[ManagedPrivateEndpointModelsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, workspaceName, managedPrivateEndpointName, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedPrivateEndpointsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedPrivateEndpointModelsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedPrivateEndpointsClientDeleteResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedPrivateEndpointModelsClientDeleteResponse]{ Tracer: client.internal.Tracer(), }) } @@ -159,10 +155,10 @@ func (client *ManagedPrivateEndpointsClient) BeginDelete(ctx context.Context, re // Delete - Delete a managed private endpoint for a grafana resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 -func (client *ManagedPrivateEndpointsClient) deleteOperation(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, options *ManagedPrivateEndpointsClientBeginDeleteOptions) (*http.Response, error) { +// Generated from API version 2024-10-01 +func (client *ManagedPrivateEndpointModelsClient) deleteOperation(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, options *ManagedPrivateEndpointModelsClientBeginDeleteOptions) (*http.Response, error) { var err error - const operationName = "ManagedPrivateEndpointsClient.BeginDelete" + const operationName = "ManagedPrivateEndpointModelsClient.BeginDelete" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() @@ -182,7 +178,7 @@ func (client *ManagedPrivateEndpointsClient) deleteOperation(ctx context.Context } // deleteCreateRequest creates the Delete request. -func (client *ManagedPrivateEndpointsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, options *ManagedPrivateEndpointsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ManagedPrivateEndpointModelsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, _ *ManagedPrivateEndpointModelsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -205,7 +201,7 @@ func (client *ManagedPrivateEndpointsClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -214,36 +210,36 @@ func (client *ManagedPrivateEndpointsClient) deleteCreateRequest(ctx context.Con // Get - Get a specific managed private endpoint of a grafana resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The workspace name of Azure Managed Grafana. // - managedPrivateEndpointName - The managed private endpoint name of Azure Managed Grafana. -// - options - ManagedPrivateEndpointsClientGetOptions contains the optional parameters for the ManagedPrivateEndpointsClient.Get +// - options - ManagedPrivateEndpointModelsClientGetOptions contains the optional parameters for the ManagedPrivateEndpointModelsClient.Get // method. -func (client *ManagedPrivateEndpointsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, options *ManagedPrivateEndpointsClientGetOptions) (ManagedPrivateEndpointsClientGetResponse, error) { +func (client *ManagedPrivateEndpointModelsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, options *ManagedPrivateEndpointModelsClientGetOptions) (ManagedPrivateEndpointModelsClientGetResponse, error) { var err error - const operationName = "ManagedPrivateEndpointsClient.Get" + const operationName = "ManagedPrivateEndpointModelsClient.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, workspaceName, managedPrivateEndpointName, options) if err != nil { - return ManagedPrivateEndpointsClientGetResponse{}, err + return ManagedPrivateEndpointModelsClientGetResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return ManagedPrivateEndpointsClientGetResponse{}, err + return ManagedPrivateEndpointModelsClientGetResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return ManagedPrivateEndpointsClientGetResponse{}, err + return ManagedPrivateEndpointModelsClientGetResponse{}, err } resp, err := client.getHandleResponse(httpResp) return resp, err } // getCreateRequest creates the Get request. -func (client *ManagedPrivateEndpointsClient) getCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, options *ManagedPrivateEndpointsClientGetOptions) (*policy.Request, error) { +func (client *ManagedPrivateEndpointModelsClient) getCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, _ *ManagedPrivateEndpointModelsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -266,35 +262,35 @@ func (client *ManagedPrivateEndpointsClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // getHandleResponse handles the Get response. -func (client *ManagedPrivateEndpointsClient) getHandleResponse(resp *http.Response) (ManagedPrivateEndpointsClientGetResponse, error) { - result := ManagedPrivateEndpointsClientGetResponse{} +func (client *ManagedPrivateEndpointModelsClient) getHandleResponse(resp *http.Response) (ManagedPrivateEndpointModelsClientGetResponse, error) { + result := ManagedPrivateEndpointModelsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedPrivateEndpointModel); err != nil { - return ManagedPrivateEndpointsClientGetResponse{}, err + return ManagedPrivateEndpointModelsClientGetResponse{}, err } return result, nil } // NewListPager - List all managed private endpoints of a grafana resource. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The workspace name of Azure Managed Grafana. -// - options - ManagedPrivateEndpointsClientListOptions contains the optional parameters for the ManagedPrivateEndpointsClient.NewListPager +// - options - ManagedPrivateEndpointModelsClientListOptions contains the optional parameters for the ManagedPrivateEndpointModelsClient.NewListPager // method. -func (client *ManagedPrivateEndpointsClient) NewListPager(resourceGroupName string, workspaceName string, options *ManagedPrivateEndpointsClientListOptions) *runtime.Pager[ManagedPrivateEndpointsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[ManagedPrivateEndpointsClientListResponse]{ - More: func(page ManagedPrivateEndpointsClientListResponse) bool { +func (client *ManagedPrivateEndpointModelsClient) NewListPager(resourceGroupName string, workspaceName string, options *ManagedPrivateEndpointModelsClientListOptions) *runtime.Pager[ManagedPrivateEndpointModelsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedPrivateEndpointModelsClientListResponse]{ + More: func(page ManagedPrivateEndpointModelsClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *ManagedPrivateEndpointsClientListResponse) (ManagedPrivateEndpointsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedPrivateEndpointsClient.NewListPager") + Fetcher: func(ctx context.Context, page *ManagedPrivateEndpointModelsClientListResponse) (ManagedPrivateEndpointModelsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedPrivateEndpointModelsClient.NewListPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -303,7 +299,7 @@ func (client *ManagedPrivateEndpointsClient) NewListPager(resourceGroupName stri return client.listCreateRequest(ctx, resourceGroupName, workspaceName, options) }, nil) if err != nil { - return ManagedPrivateEndpointsClientListResponse{}, err + return ManagedPrivateEndpointModelsClientListResponse{}, err } return client.listHandleResponse(resp) }, @@ -312,7 +308,7 @@ func (client *ManagedPrivateEndpointsClient) NewListPager(resourceGroupName stri } // listCreateRequest creates the List request. -func (client *ManagedPrivateEndpointsClient) listCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *ManagedPrivateEndpointsClientListOptions) (*policy.Request, error) { +func (client *ManagedPrivateEndpointModelsClient) listCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, _ *ManagedPrivateEndpointModelsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -331,121 +327,43 @@ func (client *ManagedPrivateEndpointsClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // listHandleResponse handles the List response. -func (client *ManagedPrivateEndpointsClient) listHandleResponse(resp *http.Response) (ManagedPrivateEndpointsClientListResponse, error) { - result := ManagedPrivateEndpointsClientListResponse{} +func (client *ManagedPrivateEndpointModelsClient) listHandleResponse(resp *http.Response) (ManagedPrivateEndpointModelsClientListResponse, error) { + result := ManagedPrivateEndpointModelsClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedPrivateEndpointModelListResponse); err != nil { - return ManagedPrivateEndpointsClientListResponse{}, err + return ManagedPrivateEndpointModelsClientListResponse{}, err } return result, nil } -// BeginRefresh - Refresh and sync managed private endpoints of a grafana resource to latest state. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-09-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - workspaceName - The workspace name of Azure Managed Grafana. -// - options - ManagedPrivateEndpointsClientBeginRefreshOptions contains the optional parameters for the ManagedPrivateEndpointsClient.BeginRefresh -// method. -func (client *ManagedPrivateEndpointsClient) BeginRefresh(ctx context.Context, resourceGroupName string, workspaceName string, options *ManagedPrivateEndpointsClientBeginRefreshOptions) (*runtime.Poller[ManagedPrivateEndpointsClientRefreshResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.refresh(ctx, resourceGroupName, workspaceName, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedPrivateEndpointsClientRefreshResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedPrivateEndpointsClientRefreshResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Refresh - Refresh and sync managed private endpoints of a grafana resource to latest state. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-09-01 -func (client *ManagedPrivateEndpointsClient) refresh(ctx context.Context, resourceGroupName string, workspaceName string, options *ManagedPrivateEndpointsClientBeginRefreshOptions) (*http.Response, error) { - var err error - const operationName = "ManagedPrivateEndpointsClient.BeginRefresh" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.refreshCreateRequest(ctx, resourceGroupName, workspaceName, 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 -} - -// refreshCreateRequest creates the Refresh request. -func (client *ManagedPrivateEndpointsClient) refreshCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *ManagedPrivateEndpointsClientBeginRefreshOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/refreshManagedPrivateEndpoints" - 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 workspaceName == "" { - return nil, errors.New("parameter workspaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - // BeginUpdate - Update a managed private endpoint for an existing grafana resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The workspace name of Azure Managed Grafana. // - managedPrivateEndpointName - The managed private endpoint name of Azure Managed Grafana. // - requestBodyParameters - Properties that can be updated to an existing managed private endpoint. -// - options - ManagedPrivateEndpointsClientBeginUpdateOptions contains the optional parameters for the ManagedPrivateEndpointsClient.BeginUpdate +// - options - ManagedPrivateEndpointModelsClientBeginUpdateOptions contains the optional parameters for the ManagedPrivateEndpointModelsClient.BeginUpdate // method. -func (client *ManagedPrivateEndpointsClient) BeginUpdate(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, requestBodyParameters ManagedPrivateEndpointUpdateParameters, options *ManagedPrivateEndpointsClientBeginUpdateOptions) (*runtime.Poller[ManagedPrivateEndpointsClientUpdateResponse], error) { +func (client *ManagedPrivateEndpointModelsClient) BeginUpdate(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, requestBodyParameters ManagedPrivateEndpointUpdateParameters, options *ManagedPrivateEndpointModelsClientBeginUpdateOptions) (*runtime.Poller[ManagedPrivateEndpointModelsClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.update(ctx, resourceGroupName, workspaceName, managedPrivateEndpointName, requestBodyParameters, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedPrivateEndpointsClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedPrivateEndpointModelsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedPrivateEndpointsClientUpdateResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedPrivateEndpointModelsClientUpdateResponse]{ Tracer: client.internal.Tracer(), }) } @@ -454,10 +372,10 @@ func (client *ManagedPrivateEndpointsClient) BeginUpdate(ctx context.Context, re // Update - Update a managed private endpoint for an existing grafana resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 -func (client *ManagedPrivateEndpointsClient) update(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, requestBodyParameters ManagedPrivateEndpointUpdateParameters, options *ManagedPrivateEndpointsClientBeginUpdateOptions) (*http.Response, error) { +// Generated from API version 2024-10-01 +func (client *ManagedPrivateEndpointModelsClient) update(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, requestBodyParameters ManagedPrivateEndpointUpdateParameters, options *ManagedPrivateEndpointModelsClientBeginUpdateOptions) (*http.Response, error) { var err error - const operationName = "ManagedPrivateEndpointsClient.BeginUpdate" + const operationName = "ManagedPrivateEndpointModelsClient.BeginUpdate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() @@ -477,7 +395,7 @@ func (client *ManagedPrivateEndpointsClient) update(ctx context.Context, resourc } // updateCreateRequest creates the Update request. -func (client *ManagedPrivateEndpointsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, requestBodyParameters ManagedPrivateEndpointUpdateParameters, options *ManagedPrivateEndpointsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *ManagedPrivateEndpointModelsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, managedPrivateEndpointName string, requestBodyParameters ManagedPrivateEndpointUpdateParameters, _ *ManagedPrivateEndpointModelsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -500,9 +418,10 @@ func (client *ManagedPrivateEndpointsClient) updateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, requestBodyParameters); err != nil { return nil, err } diff --git a/sdk/resourcemanager/dashboard/armdashboard/managedprivateendpointmodels_client_example_test.go b/sdk/resourcemanager/dashboard/armdashboard/managedprivateendpointmodels_client_example_test.go new file mode 100644 index 000000000000..36fa97e0fae1 --- /dev/null +++ b/sdk/resourcemanager/dashboard/armdashboard/managedprivateendpointmodels_client_example_test.go @@ -0,0 +1,259 @@ +// 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 armdashboard_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard/v2" + "log" +) + +// Generated from example definition: 2024-10-01/ManagedPrivateEndpoints_Create.json +func ExampleManagedPrivateEndpointModelsClient_BeginCreate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdashboard.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewManagedPrivateEndpointModelsClient().BeginCreate(ctx, "myResourceGroup", "myWorkspace", "myMPEName", 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 = armdashboard.ManagedPrivateEndpointModelsClientCreateResponse{ + // ManagedPrivateEndpointModel: &armdashboard.ManagedPrivateEndpointModel{ + // Name: to.Ptr("myMPEName"), + // Type: to.Ptr("Microsoft.Dashboard/grafana/managedPrivateEndpoint"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/Microsoft.Dashboard/grafana/myWorkspace/managedPrivateEndpoints/myPrivateEndpointName"), + // Location: to.Ptr("West US"), + // Properties: &armdashboard.ManagedPrivateEndpointModelProperties{ + // GroupIDs: []*string{ + // to.Ptr("grafana"), + // }, + // PrivateLinkResourceID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-000000000000/resourceGroups/xx-rg/providers/Microsoft.Kusto/Clusters/sampleKustoResource"), + // PrivateLinkResourceRegion: to.Ptr("West US"), + // PrivateLinkServiceURL: to.Ptr("my-self-hosted-influxdb.westus.mydomain.com"), + // ProvisioningState: to.Ptr(armdashboard.ProvisioningStateSucceeded), + // RequestMessage: to.Ptr("Example Request Message"), + // }, + // SystemData: &armdashboard.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-03T01:01:01.1075056Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armdashboard.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-04T02:03:01.1974346Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armdashboard.CreatedByTypeUser), + // }, + // }, + // } +} + +// Generated from example definition: 2024-10-01/ManagedPrivateEndpoints_Delete.json +func ExampleManagedPrivateEndpointModelsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdashboard.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewManagedPrivateEndpointModelsClient().BeginDelete(ctx, "myResourceGroup", "myWorkspace", "myMPEName", 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 = armdashboard.ManagedPrivateEndpointModelsClientDeleteResponse{ + // } +} + +// Generated from example definition: 2024-10-01/ManagedPrivateEndpoints_Get.json +func ExampleManagedPrivateEndpointModelsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdashboard.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewManagedPrivateEndpointModelsClient().Get(ctx, "myResourceGroup", "myWorkspace", "myMPEName", 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 = armdashboard.ManagedPrivateEndpointModelsClientGetResponse{ + // ManagedPrivateEndpointModel: &armdashboard.ManagedPrivateEndpointModel{ + // Name: to.Ptr("myMPEName"), + // Type: to.Ptr("Microsoft.Dashboard/grafana/managedPrivateEndpoint"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/Microsoft.Dashboard/grafana/myWorkspace/managedPrivateEndpoints/myPrivateEndpointName"), + // Location: to.Ptr("West US"), + // Properties: &armdashboard.ManagedPrivateEndpointModelProperties{ + // ConnectionState: &armdashboard.ManagedPrivateEndpointConnectionState{ + // Description: to.Ptr("Auto-Approved"), + // Status: to.Ptr(armdashboard.ManagedPrivateEndpointConnectionStatusApproved), + // }, + // GroupIDs: []*string{ + // to.Ptr("grafana"), + // }, + // PrivateLinkResourceID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-000000000000/resourceGroups/xx-rg/providers/Microsoft.Kusto/Clusters/sampleKustoResource"), + // PrivateLinkResourceRegion: to.Ptr("West US"), + // ProvisioningState: to.Ptr(armdashboard.ProvisioningStateSucceeded), + // RequestMessage: to.Ptr("Example Request Message"), + // }, + // SystemData: &armdashboard.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-03T01:01:01.1075056Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armdashboard.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-04T02:03:01.1974346Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armdashboard.CreatedByTypeUser), + // }, + // }, + // } +} + +// Generated from example definition: 2024-10-01/ManagedPrivateEndpoints_List.json +func ExampleManagedPrivateEndpointModelsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdashboard.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewManagedPrivateEndpointModelsClient().NewListPager("myResourceGroup", "myWorkspace", 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 = armdashboard.ManagedPrivateEndpointModelsClientListResponse{ + // ManagedPrivateEndpointModelListResponse: armdashboard.ManagedPrivateEndpointModelListResponse{ + // Value: []*armdashboard.ManagedPrivateEndpointModel{ + // { + // Name: to.Ptr("myMPEName"), + // Type: to.Ptr("Microsoft.Dashboard/grafana/managedPrivateEndpoint"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/Microsoft.Dashboard/grafana/myWorkspace/managedPrivateEndpoints/myPrivateEndpointName"), + // Location: to.Ptr("West US"), + // Properties: &armdashboard.ManagedPrivateEndpointModelProperties{ + // ConnectionState: &armdashboard.ManagedPrivateEndpointConnectionState{ + // Description: to.Ptr("Auto-Approved"), + // Status: to.Ptr(armdashboard.ManagedPrivateEndpointConnectionStatusApproved), + // }, + // GroupIDs: []*string{ + // to.Ptr("grafana"), + // }, + // PrivateLinkResourceID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-000000000000/resourceGroups/xx-rg/providers/Microsoft.Kusto/Clusters/sampleKustoResource1"), + // PrivateLinkResourceRegion: to.Ptr("West US"), + // PrivateLinkServicePrivateIP: to.Ptr("10.0.0.5"), + // PrivateLinkServiceURL: to.Ptr("my-self-hosted-influxdb.westus.mydomain.com"), + // ProvisioningState: to.Ptr(armdashboard.ProvisioningStateSucceeded), + // RequestMessage: to.Ptr("Example Request Message"), + // }, + // }, + // { + // Name: to.Ptr("myMPEName2"), + // Type: to.Ptr("Microsoft.Dashboard/grafana/managedPrivateEndpoint"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/Microsoft.Dashboard/grafana/myWorkspace/managedPrivateEndpoints/myPrivateEndpointName2"), + // Location: to.Ptr("West US"), + // Properties: &armdashboard.ManagedPrivateEndpointModelProperties{ + // ConnectionState: &armdashboard.ManagedPrivateEndpointConnectionState{ + // Description: to.Ptr("Example Reject Reason"), + // Status: to.Ptr(armdashboard.ManagedPrivateEndpointConnectionStatusRejected), + // }, + // GroupIDs: []*string{ + // to.Ptr("grafana"), + // }, + // PrivateLinkResourceID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-000000000000/resourceGroups/xx-rg/providers/Microsoft.Kusto/Clusters/sampleKustoResource2"), + // PrivateLinkResourceRegion: to.Ptr("West US"), + // ProvisioningState: to.Ptr(armdashboard.ProvisioningStateSucceeded), + // RequestMessage: to.Ptr("Example Request Message 2"), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-10-01/ManagedPrivateEndpoints_Patch.json +func ExampleManagedPrivateEndpointModelsClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdashboard.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewManagedPrivateEndpointModelsClient().BeginUpdate(ctx, "myResourceGroup", "myWorkspace", "myMPEName", 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 = armdashboard.ManagedPrivateEndpointModelsClientUpdateResponse{ + // ManagedPrivateEndpointModel: &armdashboard.ManagedPrivateEndpointModel{ + // Name: to.Ptr("myMPEName"), + // Type: to.Ptr("Microsoft.Dashboard/grafana/managedPrivateEndpoint"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/Microsoft.Dashboard/grafana/myWorkspace/managedPrivateEndpoints/myPrivateEndpointName"), + // Location: to.Ptr("West US"), + // Properties: &armdashboard.ManagedPrivateEndpointModelProperties{ + // GroupIDs: []*string{ + // to.Ptr("grafana"), + // }, + // PrivateLinkResourceID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-000000000000/resourceGroups/xx-rg/providers/Microsoft.Kusto/Clusters/sampleKustoResource"), + // PrivateLinkResourceRegion: to.Ptr("West US"), + // PrivateLinkServicePrivateIP: to.Ptr("10.0.0.5"), + // PrivateLinkServiceURL: to.Ptr("my-self-hosted-influxdb.westus.mydomain.com"), + // ProvisioningState: to.Ptr(armdashboard.ProvisioningStateSucceeded), + // RequestMessage: to.Ptr("Example Request Message"), + // }, + // SystemData: &armdashboard.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-03T01:01:01.1075056Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armdashboard.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-04T02:03:01.1974346Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armdashboard.CreatedByTypeUser), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/dashboard/armdashboard/managedprivateendpoints_client_example_test.go b/sdk/resourcemanager/dashboard/armdashboard/managedprivateendpoints_client_example_test.go deleted file mode 100644 index e80ab588d9c5..000000000000 --- a/sdk/resourcemanager/dashboard/armdashboard/managedprivateendpoints_client_example_test.go +++ /dev/null @@ -1,282 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdashboard_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/78eac0bd58633028293cb1ec1709baa200bed9e2/specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/ManagedPrivateEndpoints_List.json -func ExampleManagedPrivateEndpointsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdashboard.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedPrivateEndpointsClient().NewListPager("myResourceGroup", "myWorkspace", 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.ManagedPrivateEndpointModelListResponse = armdashboard.ManagedPrivateEndpointModelListResponse{ - // Value: []*armdashboard.ManagedPrivateEndpointModel{ - // { - // Name: to.Ptr("myMPEName"), - // Type: to.Ptr("Microsoft.Dashboard/grafana/managedPrivateEndpoint"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/Microsoft.Dashboard/grafana/myWorkspace/managedPrivateEndpoints/myPrivateEndpointName"), - // Location: to.Ptr("West US"), - // Properties: &armdashboard.ManagedPrivateEndpointModelProperties{ - // ConnectionState: &armdashboard.ManagedPrivateEndpointConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // Status: to.Ptr(armdashboard.ManagedPrivateEndpointConnectionStatusApproved), - // }, - // GroupIDs: []*string{ - // to.Ptr("grafana")}, - // PrivateLinkResourceID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-000000000000/resourceGroups/xx-rg/providers/Microsoft.Kusto/Clusters/sampleKustoResource1"), - // PrivateLinkResourceRegion: to.Ptr("West US"), - // PrivateLinkServicePrivateIP: to.Ptr("10.0.0.5"), - // PrivateLinkServiceURL: to.Ptr("my-self-hosted-influxdb.westus.mydomain.com"), - // ProvisioningState: to.Ptr(armdashboard.ProvisioningStateSucceeded), - // RequestMessage: to.Ptr("Example Request Message"), - // }, - // }, - // { - // Name: to.Ptr("myMPEName2"), - // Type: to.Ptr("Microsoft.Dashboard/grafana/managedPrivateEndpoint"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/Microsoft.Dashboard/grafana/myWorkspace/managedPrivateEndpoints/myPrivateEndpointName2"), - // Location: to.Ptr("West US"), - // Properties: &armdashboard.ManagedPrivateEndpointModelProperties{ - // ConnectionState: &armdashboard.ManagedPrivateEndpointConnectionState{ - // Description: to.Ptr("Example Reject Reason"), - // Status: to.Ptr(armdashboard.ManagedPrivateEndpointConnectionStatusRejected), - // }, - // GroupIDs: []*string{ - // to.Ptr("grafana")}, - // PrivateLinkResourceID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-000000000000/resourceGroups/xx-rg/providers/Microsoft.Kusto/Clusters/sampleKustoResource2"), - // PrivateLinkResourceRegion: to.Ptr("West US"), - // ProvisioningState: to.Ptr(armdashboard.ProvisioningStateSucceeded), - // RequestMessage: to.Ptr("Example Request Message 2"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/78eac0bd58633028293cb1ec1709baa200bed9e2/specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/ManagedPrivateEndpoints_Refresh.json -func ExampleManagedPrivateEndpointsClient_BeginRefresh() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdashboard.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedPrivateEndpointsClient().BeginRefresh(ctx, "myResourceGroup", "myWorkspace", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/78eac0bd58633028293cb1ec1709baa200bed9e2/specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/ManagedPrivateEndpoints_Get.json -func ExampleManagedPrivateEndpointsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdashboard.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedPrivateEndpointsClient().Get(ctx, "myResourceGroup", "myWorkspace", "myMPEName", 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.ManagedPrivateEndpointModel = armdashboard.ManagedPrivateEndpointModel{ - // Name: to.Ptr("myMPEName"), - // Type: to.Ptr("Microsoft.Dashboard/grafana/managedPrivateEndpoint"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/Microsoft.Dashboard/grafana/myWorkspace/managedPrivateEndpoints/myPrivateEndpointName"), - // SystemData: &armdashboard.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-03T01:01:01.107Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armdashboard.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-04T02:03:01.197Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armdashboard.CreatedByTypeUser), - // }, - // Location: to.Ptr("West US"), - // Properties: &armdashboard.ManagedPrivateEndpointModelProperties{ - // ConnectionState: &armdashboard.ManagedPrivateEndpointConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // Status: to.Ptr(armdashboard.ManagedPrivateEndpointConnectionStatusApproved), - // }, - // GroupIDs: []*string{ - // to.Ptr("grafana")}, - // PrivateLinkResourceID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-000000000000/resourceGroups/xx-rg/providers/Microsoft.Kusto/Clusters/sampleKustoResource"), - // PrivateLinkResourceRegion: to.Ptr("West US"), - // ProvisioningState: to.Ptr(armdashboard.ProvisioningStateSucceeded), - // RequestMessage: to.Ptr("Example Request Message"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/78eac0bd58633028293cb1ec1709baa200bed9e2/specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/ManagedPrivateEndpoints_Create.json -func ExampleManagedPrivateEndpointsClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdashboard.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedPrivateEndpointsClient().BeginCreate(ctx, "myResourceGroup", "myWorkspace", "myMPEName", armdashboard.ManagedPrivateEndpointModel{ - Location: to.Ptr("West US"), - Properties: &armdashboard.ManagedPrivateEndpointModelProperties{ - GroupIDs: []*string{ - to.Ptr("grafana")}, - PrivateLinkResourceID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-000000000000/resourceGroups/xx-rg/providers/Microsoft.Kusto/Clusters/sampleKustoResource"), - PrivateLinkResourceRegion: to.Ptr("West US"), - PrivateLinkServiceURL: to.Ptr("my-self-hosted-influxdb.westus.mydomain.com"), - RequestMessage: to.Ptr("Example Request Message"), - }, - }, 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.ManagedPrivateEndpointModel = armdashboard.ManagedPrivateEndpointModel{ - // Name: to.Ptr("myMPEName"), - // Type: to.Ptr("Microsoft.Dashboard/grafana/managedPrivateEndpoint"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/Microsoft.Dashboard/grafana/myWorkspace/managedPrivateEndpoints/myPrivateEndpointName"), - // SystemData: &armdashboard.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-03T01:01:01.107Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armdashboard.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-04T02:03:01.197Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armdashboard.CreatedByTypeUser), - // }, - // Location: to.Ptr("West US"), - // Properties: &armdashboard.ManagedPrivateEndpointModelProperties{ - // GroupIDs: []*string{ - // to.Ptr("grafana")}, - // PrivateLinkResourceID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-000000000000/resourceGroups/xx-rg/providers/Microsoft.Kusto/Clusters/sampleKustoResource"), - // PrivateLinkResourceRegion: to.Ptr("West US"), - // PrivateLinkServiceURL: to.Ptr("my-self-hosted-influxdb.westus.mydomain.com"), - // ProvisioningState: to.Ptr(armdashboard.ProvisioningStateSucceeded), - // RequestMessage: to.Ptr("Example Request Message"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/78eac0bd58633028293cb1ec1709baa200bed9e2/specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/ManagedPrivateEndpoints_Patch.json -func ExampleManagedPrivateEndpointsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdashboard.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedPrivateEndpointsClient().BeginUpdate(ctx, "myResourceGroup", "myWorkspace", "myMPEName", armdashboard.ManagedPrivateEndpointUpdateParameters{ - Tags: map[string]*string{ - "Environment": to.Ptr("Dev 2"), - }, - }, 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.ManagedPrivateEndpointModel = armdashboard.ManagedPrivateEndpointModel{ - // Name: to.Ptr("myMPEName"), - // Type: to.Ptr("Microsoft.Dashboard/grafana/managedPrivateEndpoint"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/Microsoft.Dashboard/grafana/myWorkspace/managedPrivateEndpoints/myPrivateEndpointName"), - // SystemData: &armdashboard.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-03T01:01:01.107Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armdashboard.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-04T02:03:01.197Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armdashboard.CreatedByTypeUser), - // }, - // Location: to.Ptr("West US"), - // Properties: &armdashboard.ManagedPrivateEndpointModelProperties{ - // GroupIDs: []*string{ - // to.Ptr("grafana")}, - // PrivateLinkResourceID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-000000000000/resourceGroups/xx-rg/providers/Microsoft.Kusto/Clusters/sampleKustoResource"), - // PrivateLinkResourceRegion: to.Ptr("West US"), - // PrivateLinkServicePrivateIP: to.Ptr("10.0.0.5"), - // PrivateLinkServiceURL: to.Ptr("my-self-hosted-influxdb.westus.mydomain.com"), - // ProvisioningState: to.Ptr(armdashboard.ProvisioningStateSucceeded), - // RequestMessage: to.Ptr("Example Request Message"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/78eac0bd58633028293cb1ec1709baa200bed9e2/specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/ManagedPrivateEndpoints_Delete.json -func ExampleManagedPrivateEndpointsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdashboard.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedPrivateEndpointsClient().BeginDelete(ctx, "myResourceGroup", "myWorkspace", "myMPEName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/dashboard/armdashboard/models.go b/sdk/resourcemanager/dashboard/armdashboard/models.go index 58fb34b61f1d..f181bf956b6d 100644 --- a/sdk/resourcemanager/dashboard/armdashboard/models.go +++ b/sdk/resourcemanager/dashboard/armdashboard/models.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdashboard @@ -50,8 +46,18 @@ type GrafanaAvailablePluginListResponse struct { // GrafanaConfigurations - Server configurations of a Grafana instance type GrafanaConfigurations struct { - // Email server settings. https://grafana.com/docs/grafana/v9.0/setup-grafana/configure-grafana/#smtp + // Email server settings. + // https://grafana.com/docs/grafana/v9.0/setup-grafana/configure-grafana/#smtp SMTP *SMTP + + // Grafana security settings + Security *Security + + // Grafana Snapshots settings + Snapshots *Snapshots + + // Grafana users settings + Users *Users } // GrafanaIntegrations is a bundled observability experience (e.g. pre-configured data source, tailored Grafana dashboards, @@ -66,39 +72,103 @@ type GrafanaPlugin struct { PluginID *string } +// IntegrationFabric - The integration fabric resource type. +type IntegrationFabric struct { + // REQUIRED; The geo-location where the resource lives + Location *string + Properties *IntegrationFabricProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; The integration fabric name of Azure Managed Grafana. + 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 +} + +// IntegrationFabricListResponse - Paged collection of IntegrationFabric items +type IntegrationFabricListResponse struct { + // REQUIRED; The IntegrationFabric items on this page + Value []*IntegrationFabric + + // The link to the next page of items + NextLink *string +} + +type IntegrationFabricProperties struct { + // The resource Id of the Azure resource which is used to configure Grafana data source. E.g., an Azure Monitor Workspace, + // an Azure Data Explorer cluster, etc. + DataSourceResourceID *string + + // A list of integration scenarios covered by this integration fabric + Scenarios []*string + + // The resource Id of the Azure resource being integrated with Azure Managed Grafana. E.g., an Azure Kubernetes Service cluster. + TargetResourceID *string + + // READ-ONLY; Provisioning state of the resource. + ProvisioningState *ProvisioningState +} + +type IntegrationFabricPropertiesUpdateParameters struct { + // The new integration scenarios covered by this integration fabric. + Scenarios []*string +} + +// IntegrationFabricUpdateParameters - The parameters for a PATCH request to a Integration Fabric resource. +type IntegrationFabricUpdateParameters struct { + // The new properties of this Integration Fabric resource + Properties *IntegrationFabricPropertiesUpdateParameters + + // The new tags of the Integration Fabric resource. + Tags map[string]*string +} + // ManagedGrafana - The grafana resource type. type ManagedGrafana struct { - // The managed identity of the grafana resource. - Identity *ManagedServiceIdentity - - // The geo-location where the grafana resource lives + // REQUIRED; The geo-location where the resource lives Location *string + // READ-ONLY; The workspace name of Azure Managed Grafana. + Name *string + + // The managed service identities assigned to this resource. + Identity *ManagedServiceIdentity + // Properties specific to the grafana resource. Properties *ManagedGrafanaProperties // The Sku of the grafana resource. SKU *ResourceSKU - // The tags for grafana resource. + // Resource tags. Tags map[string]*string - // READ-ONLY; ARM id of the grafana resource + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Name of the grafana resource. - Name *string - - // READ-ONLY; The system meta data relating to this grafana resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the grafana resource. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } +// ManagedGrafanaListResponse - Paged collection of ManagedGrafana items type ManagedGrafanaListResponse struct { + // REQUIRED; The ManagedGrafana items on this page + Value []*ManagedGrafana + + // The link to the next page of items NextLink *string - Value []*ManagedGrafana } // ManagedGrafanaProperties - Properties specific to the grafana resource. @@ -215,12 +285,12 @@ type ManagedPrivateEndpointModel struct { // Resource tags. Tags map[string]*string + // READ-ONLY; The managed private endpoint name of Azure Managed Grafana. + Name *string + // 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 @@ -230,8 +300,11 @@ type ManagedPrivateEndpointModel struct { // ManagedPrivateEndpointModelListResponse - The list of managed private endpoints of a grafana resource type ManagedPrivateEndpointModelListResponse struct { + // REQUIRED; The ManagedPrivateEndpointModel items on this page + Value []*ManagedPrivateEndpointModel + + // The link to the next page of items NextLink *string - Value []*ManagedPrivateEndpointModel } // ManagedPrivateEndpointModelProperties - Properties specific to the managed private endpoint. @@ -270,14 +343,10 @@ type ManagedPrivateEndpointUpdateParameters struct { // ManagedServiceIdentity - Managed service identity (system assigned and/or user assigned identities) type ManagedServiceIdentity struct { - // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + // REQUIRED; The type of managed identity assigned to this resource. Type *ManagedServiceIdentityType - // The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM - // resource ids in the form: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - // The dictionary values can be empty objects ({}) in - // requests. + // 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 @@ -303,16 +372,18 @@ type MarketplaceTrialQuota struct { TrialStartAt *time.Time } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API Operation +// +// Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { // Localized display information for this particular operation. Display *OperationDisplay - // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + // READ-ONLY; Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. ActionType *ActionType - // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane - // operations. + // 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", @@ -324,7 +395,7 @@ type Operation struct { Origin *Origin } -// OperationDisplay - Localized display information for this particular operation. +// 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 @@ -345,16 +416,16 @@ type OperationDisplay struct { // 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 { - // READ-ONLY; URL to get the next set of operation list results (if there are any). - NextLink *string - - // READ-ONLY; List of operations supported by the resource provider + // REQUIRED; The Operation items on this page Value []*Operation + + // The link to the next page of items + NextLink *string } -// PrivateEndpoint - The Private Endpoint resource. +// PrivateEndpoint - The private endpoint resource. type PrivateEndpoint struct { - // READ-ONLY; The ARM identifier for Private Endpoint + // READ-ONLY; The resource identifier of the private endpoint ID *string } @@ -363,12 +434,12 @@ type PrivateEndpointConnection struct { // Resource properties. Properties *PrivateEndpointConnectionProperties + // READ-ONLY; The private endpoint connection name of Azure Managed Grafana. + Name *string + // 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 @@ -376,12 +447,12 @@ type PrivateEndpointConnection struct { Type *string } -// PrivateEndpointConnectionListResult - List of private endpoint connection associated with the specified storage account +// PrivateEndpointConnectionListResult - The response of a PrivateEndpointConnection list operation. type PrivateEndpointConnectionListResult struct { - // Array of private endpoint connections + // REQUIRED; The PrivateEndpointConnection items on this page Value []*PrivateEndpointConnection - // READ-ONLY; URL to get the next set of operation list results (if there are any). + // The link to the next page of items NextLink *string } @@ -396,7 +467,7 @@ type PrivateEndpointConnectionProperties struct { // The resource of private end point. PrivateEndpoint *PrivateEndpoint - // READ-ONLY; The provisioning state of the private endpoint connection resource. + // The provisioning state of the private endpoint connection resource. ProvisioningState *PrivateEndpointConnectionProvisioningState } @@ -405,12 +476,12 @@ type PrivateLinkResource struct { // Resource properties. Properties *PrivateLinkResourceProperties + // READ-ONLY + Name *string + // 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 @@ -418,12 +489,12 @@ type PrivateLinkResource struct { Type *string } -// PrivateLinkResourceListResult - A list of private link resources +// PrivateLinkResourceListResult - The response of a PrivateLinkResource list operation. type PrivateLinkResourceListResult struct { - // Array of private link resources + // REQUIRED; The PrivateLinkResource items on this page Value []*PrivateLinkResource - // READ-ONLY; URL to get the next set of operation list results (if there are any). + // The link to the next page of items NextLink *string } @@ -455,20 +526,24 @@ type PrivateLinkServiceConnectionState struct { Status *PrivateEndpointServiceConnectionStatus } +// ResourceSKU - Represents the SKU of a resource. type ResourceSKU struct { - // REQUIRED + // REQUIRED; The name of the SKU. Name *string } -// SMTP - Email server settings. https://grafana.com/docs/grafana/v9.0/setup-grafana/configure-grafana/#smtp +// SMTP - Email server settings. +// https://grafana.com/docs/grafana/v9.0/setup-grafana/configure-grafana/#smtp type SMTP struct { // Enable this to allow Grafana to send email. Default is false Enabled *bool - // Address used when sending out emails https://pkg.go.dev/net/mail#Address + // Address used when sending out emails + // https://pkg.go.dev/net/mail#Address FromAddress *string - // Name to be used when sending out emails. Default is "Azure Managed Grafana Notification" https://pkg.go.dev/net/mail#Address + // Name to be used when sending out emails. Default is "Azure Managed Grafana Notification" + // https://pkg.go.dev/net/mail#Address FromName *string // SMTP server hostname with port, e.g. test.email.net:587 @@ -477,10 +552,12 @@ type SMTP struct { // Password of SMTP auth. If the password contains # or ;, then you have to wrap it with triple quotes Password *string - // Verify SSL for SMTP server. Default is false https://pkg.go.dev/crypto/tls#Config + // Verify SSL for SMTP server. Default is false + // https://pkg.go.dev/crypto/tls#Config SkipVerify *bool - // The StartTLSPolicy setting of the SMTP configuration https://pkg.go.dev/github.com/go-mail/mail#StartTLSPolicy + // The StartTLSPolicy setting of the SMTP configuration + // https://pkg.go.dev/github.com/go-mail/mail#StartTLSPolicy StartTLSPolicy *StartTLSPolicy // User of SMTP auth @@ -502,6 +579,18 @@ type SaasSubscriptionDetails struct { Term *SubscriptionTerm } +// Security - Grafana security settings +type Security struct { + // Set to true to execute the CSRF check even if the login cookie is not in a request (default false). + CsrfAlwaysCheck *bool +} + +// Snapshots - Grafana Snapshots settings +type Snapshots struct { + // Set to false to disable external snapshot publish endpoint + ExternalEnabled *bool +} + // SubscriptionTerm - The current billing term of the SaaS Subscription. type SubscriptionTerm struct { // The date and time in UTC of when the billing term ends. @@ -543,3 +632,10 @@ type UserAssignedIdentity struct { // READ-ONLY; The principal ID of the assigned identity. PrincipalID *string } + +// Users - Grafana users settings +type Users struct { + // Set to true so viewers can access and use explore and perform temporary edits on panels in dashboards they have access + // to. They cannot save their changes. + ViewersCanEdit *bool +} diff --git a/sdk/resourcemanager/dashboard/armdashboard/models_serde.go b/sdk/resourcemanager/dashboard/armdashboard/models_serde.go index 9137b6a79f07..d104e20b5b49 100644 --- a/sdk/resourcemanager/dashboard/armdashboard/models_serde.go +++ b/sdk/resourcemanager/dashboard/armdashboard/models_serde.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdashboard @@ -170,6 +166,9 @@ func (g *GrafanaAvailablePluginListResponse) UnmarshalJSON(data []byte) error { func (g GrafanaConfigurations) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "smtp", g.SMTP) + populate(objectMap, "security", g.Security) + populate(objectMap, "snapshots", g.Snapshots) + populate(objectMap, "users", g.Users) return json.Marshal(objectMap) } @@ -185,6 +184,15 @@ func (g *GrafanaConfigurations) UnmarshalJSON(data []byte) error { case "smtp": err = unpopulate(val, "SMTP", &g.SMTP) delete(rawMsg, key) + case "security": + err = unpopulate(val, "Security", &g.Security) + delete(rawMsg, key) + case "snapshots": + err = unpopulate(val, "Snapshots", &g.Snapshots) + delete(rawMsg, key) + case "users": + err = unpopulate(val, "Users", &g.Users) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", g, err) @@ -247,6 +255,185 @@ func (g *GrafanaPlugin) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type IntegrationFabric. +func (i IntegrationFabric) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", i.ID) + populate(objectMap, "location", i.Location) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) + populate(objectMap, "tags", i.Tags) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IntegrationFabric. +func (i *IntegrationFabric) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &i.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &i.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IntegrationFabricListResponse. +func (i IntegrationFabricListResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IntegrationFabricListResponse. +func (i *IntegrationFabricListResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IntegrationFabricProperties. +func (i IntegrationFabricProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dataSourceResourceId", i.DataSourceResourceID) + populate(objectMap, "provisioningState", i.ProvisioningState) + populate(objectMap, "scenarios", i.Scenarios) + populate(objectMap, "targetResourceId", i.TargetResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IntegrationFabricProperties. +func (i *IntegrationFabricProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataSourceResourceId": + err = unpopulate(val, "DataSourceResourceID", &i.DataSourceResourceID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) + delete(rawMsg, key) + case "scenarios": + err = unpopulate(val, "Scenarios", &i.Scenarios) + delete(rawMsg, key) + case "targetResourceId": + err = unpopulate(val, "TargetResourceID", &i.TargetResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IntegrationFabricPropertiesUpdateParameters. +func (i IntegrationFabricPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "scenarios", i.Scenarios) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IntegrationFabricPropertiesUpdateParameters. +func (i *IntegrationFabricPropertiesUpdateParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "scenarios": + err = unpopulate(val, "Scenarios", &i.Scenarios) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IntegrationFabricUpdateParameters. +func (i IntegrationFabricUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "tags", i.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IntegrationFabricUpdateParameters. +func (i *IntegrationFabricUpdateParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &i.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ManagedGrafana. func (m ManagedGrafana) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1313,6 +1500,60 @@ func (s *SaasSubscriptionDetails) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Security. +func (s Security) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "csrfAlwaysCheck", s.CsrfAlwaysCheck) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Security. +func (s *Security) 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 "csrfAlwaysCheck": + err = unpopulate(val, "CsrfAlwaysCheck", &s.CsrfAlwaysCheck) + 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 Snapshots. +func (s Snapshots) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "externalEnabled", s.ExternalEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Snapshots. +func (s *Snapshots) 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 "externalEnabled": + err = unpopulate(val, "ExternalEnabled", &s.ExternalEnabled) + 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 SubscriptionTerm. func (s SubscriptionTerm) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1426,6 +1667,33 @@ func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Users. +func (u Users) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "viewersCanEdit", u.ViewersCanEdit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Users. +func (u *Users) 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 "viewersCanEdit": + err = unpopulate(val, "ViewersCanEdit", &u.ViewersCanEdit) + 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 @@ -1437,7 +1705,7 @@ func populate(m map[string]any, k string, v any) { } func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/sdk/resourcemanager/dashboard/armdashboard/operations_client.go b/sdk/resourcemanager/dashboard/armdashboard/operations_client.go index 4fc1be89fa16..c10a6130b96c 100644 --- a/sdk/resourcemanager/dashboard/armdashboard/operations_client.go +++ b/sdk/resourcemanager/dashboard/armdashboard/operations_client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdashboard @@ -37,9 +33,9 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// NewListPager - List all available API operations provided by Microsoft.Dashboard. +// NewListPager - List the operations for the provider // -// Generated from API version 2023-09-01 +// Generated from API version 2024-10-01 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -65,14 +61,14 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Dashboard/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", "2023-09-01") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dashboard/armdashboard/operations_client_example_test.go b/sdk/resourcemanager/dashboard/armdashboard/operations_client_example_test.go index 0e4fd282bb81..051f73ea3521 100644 --- a/sdk/resourcemanager/dashboard/armdashboard/operations_client_example_test.go +++ b/sdk/resourcemanager/dashboard/armdashboard/operations_client_example_test.go @@ -1,30 +1,24 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdashboard_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/78eac0bd58633028293cb1ec1709baa200bed9e2/specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/Operations_List.json +// Generated from example definition: 2024-10-01/Operations_List.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdashboard.NewClientFactory("", cred, nil) + clientFactory, err := armdashboard.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -39,19 +33,22 @@ func ExampleOperationsClient_NewListPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armdashboard.OperationListResult{ - // Value: []*armdashboard.Operation{ - // { - // Name: to.Ptr("Microsoft.Dashboard/grafana/write"), - // ActionType: to.Ptr(armdashboard.ActionTypeInternal), - // Display: &armdashboard.OperationDisplay{ - // Description: to.Ptr("Write grafana workspace resource"), - // Operation: to.Ptr("write"), - // Provider: to.Ptr("Microsoft.Dashboard"), - // Resource: to.Ptr("grafana"), + // page = armdashboard.OperationsClientListResponse{ + // OperationListResult: armdashboard.OperationListResult{ + // Value: []*armdashboard.Operation{ + // { + // Name: to.Ptr("Microsoft.Dashboard/grafana/write"), + // ActionType: to.Ptr(armdashboard.ActionTypeInternal), + // Display: &armdashboard.OperationDisplay{ + // Description: to.Ptr("Write grafana workspace resource"), + // Operation: to.Ptr("write"), + // Provider: to.Ptr("Microsoft.Dashboard"), + // Resource: to.Ptr("grafana"), + // }, + // Origin: to.Ptr(armdashboard.OriginUser), // }, - // Origin: to.Ptr(armdashboard.OriginUser), - // }}, + // }, + // }, // } } } diff --git a/sdk/resourcemanager/dashboard/armdashboard/options.go b/sdk/resourcemanager/dashboard/armdashboard/options.go index cbab7e05a8bf..82cd9f7e52c6 100644 --- a/sdk/resourcemanager/dashboard/armdashboard/options.go +++ b/sdk/resourcemanager/dashboard/armdashboard/options.go @@ -1,94 +1,121 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdashboard -// GrafanaClientBeginCreateOptions contains the optional parameters for the GrafanaClient.BeginCreate method. -type GrafanaClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. +// IntegrationFabricsClientBeginCreateOptions contains the optional parameters for the IntegrationFabricsClient.BeginCreate +// method. +type IntegrationFabricsClientBeginCreateOptions struct { + // Resumes the long-running operation from the provided token. ResumeToken string } -// GrafanaClientBeginDeleteOptions contains the optional parameters for the GrafanaClient.BeginDelete method. -type GrafanaClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. +// IntegrationFabricsClientBeginDeleteOptions contains the optional parameters for the IntegrationFabricsClient.BeginDelete +// method. +type IntegrationFabricsClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. ResumeToken string } -// GrafanaClientCheckEnterpriseDetailsOptions contains the optional parameters for the GrafanaClient.CheckEnterpriseDetails +// IntegrationFabricsClientBeginUpdateOptions contains the optional parameters for the IntegrationFabricsClient.BeginUpdate // method. -type GrafanaClientCheckEnterpriseDetailsOptions struct { - // placeholder for future optional parameters +type IntegrationFabricsClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string } -// GrafanaClientFetchAvailablePluginsOptions contains the optional parameters for the GrafanaClient.FetchAvailablePlugins -// method. -type GrafanaClientFetchAvailablePluginsOptions struct { +// IntegrationFabricsClientGetOptions contains the optional parameters for the IntegrationFabricsClient.Get method. +type IntegrationFabricsClientGetOptions struct { // placeholder for future optional parameters } -// GrafanaClientGetOptions contains the optional parameters for the GrafanaClient.Get method. -type GrafanaClientGetOptions struct { +// IntegrationFabricsClientListOptions contains the optional parameters for the IntegrationFabricsClient.NewListPager method. +type IntegrationFabricsClientListOptions struct { // placeholder for future optional parameters } -// GrafanaClientListByResourceGroupOptions contains the optional parameters for the GrafanaClient.NewListByResourceGroupPager +// ManagedGrafanasClientBeginCreateOptions contains the optional parameters for the ManagedGrafanasClient.BeginCreate method. +type ManagedGrafanasClientBeginCreateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ManagedGrafanasClientBeginDeleteOptions contains the optional parameters for the ManagedGrafanasClient.BeginDelete method. +type ManagedGrafanasClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ManagedGrafanasClientBeginRefreshOptions contains the optional parameters for the ManagedGrafanasClient.BeginRefresh method. +type ManagedGrafanasClientBeginRefreshOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ManagedGrafanasClientCheckEnterpriseDetailsOptions contains the optional parameters for the ManagedGrafanasClient.CheckEnterpriseDetails // method. -type GrafanaClientListByResourceGroupOptions struct { +type ManagedGrafanasClientCheckEnterpriseDetailsOptions struct { // placeholder for future optional parameters } -// GrafanaClientListOptions contains the optional parameters for the GrafanaClient.NewListPager method. -type GrafanaClientListOptions struct { +// ManagedGrafanasClientFetchAvailablePluginsOptions contains the optional parameters for the ManagedGrafanasClient.FetchAvailablePlugins +// method. +type ManagedGrafanasClientFetchAvailablePluginsOptions struct { // placeholder for future optional parameters } -// GrafanaClientUpdateOptions contains the optional parameters for the GrafanaClient.Update method. -type GrafanaClientUpdateOptions struct { +// ManagedGrafanasClientGetOptions contains the optional parameters for the ManagedGrafanasClient.Get method. +type ManagedGrafanasClientGetOptions struct { // placeholder for future optional parameters } -// ManagedPrivateEndpointsClientBeginCreateOptions contains the optional parameters for the ManagedPrivateEndpointsClient.BeginCreate +// ManagedGrafanasClientListByResourceGroupOptions contains the optional parameters for the ManagedGrafanasClient.NewListByResourceGroupPager // method. -type ManagedPrivateEndpointsClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string +type ManagedGrafanasClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ManagedGrafanasClientListOptions contains the optional parameters for the ManagedGrafanasClient.NewListPager method. +type ManagedGrafanasClientListOptions struct { + // placeholder for future optional parameters +} + +// ManagedGrafanasClientUpdateOptions contains the optional parameters for the ManagedGrafanasClient.Update method. +type ManagedGrafanasClientUpdateOptions struct { + // placeholder for future optional parameters } -// ManagedPrivateEndpointsClientBeginDeleteOptions contains the optional parameters for the ManagedPrivateEndpointsClient.BeginDelete +// ManagedPrivateEndpointModelsClientBeginCreateOptions contains the optional parameters for the ManagedPrivateEndpointModelsClient.BeginCreate // method. -type ManagedPrivateEndpointsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. +type ManagedPrivateEndpointModelsClientBeginCreateOptions struct { + // Resumes the long-running operation from the provided token. ResumeToken string } -// ManagedPrivateEndpointsClientBeginRefreshOptions contains the optional parameters for the ManagedPrivateEndpointsClient.BeginRefresh +// ManagedPrivateEndpointModelsClientBeginDeleteOptions contains the optional parameters for the ManagedPrivateEndpointModelsClient.BeginDelete // method. -type ManagedPrivateEndpointsClientBeginRefreshOptions struct { - // Resumes the LRO from the provided token. +type ManagedPrivateEndpointModelsClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. ResumeToken string } -// ManagedPrivateEndpointsClientBeginUpdateOptions contains the optional parameters for the ManagedPrivateEndpointsClient.BeginUpdate +// ManagedPrivateEndpointModelsClientBeginUpdateOptions contains the optional parameters for the ManagedPrivateEndpointModelsClient.BeginUpdate // method. -type ManagedPrivateEndpointsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. +type ManagedPrivateEndpointModelsClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. ResumeToken string } -// ManagedPrivateEndpointsClientGetOptions contains the optional parameters for the ManagedPrivateEndpointsClient.Get method. -type ManagedPrivateEndpointsClientGetOptions struct { +// ManagedPrivateEndpointModelsClientGetOptions contains the optional parameters for the ManagedPrivateEndpointModelsClient.Get +// method. +type ManagedPrivateEndpointModelsClientGetOptions struct { // placeholder for future optional parameters } -// ManagedPrivateEndpointsClientListOptions contains the optional parameters for the ManagedPrivateEndpointsClient.NewListPager +// ManagedPrivateEndpointModelsClientListOptions contains the optional parameters for the ManagedPrivateEndpointModelsClient.NewListPager // method. -type ManagedPrivateEndpointsClientListOptions struct { +type ManagedPrivateEndpointModelsClientListOptions struct { // placeholder for future optional parameters } @@ -100,14 +127,14 @@ type OperationsClientListOptions struct { // PrivateEndpointConnectionsClientBeginApproveOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginApprove // method. type PrivateEndpointConnectionsClientBeginApproveOptions struct { - // Resumes the LRO from the provided token. + // 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 LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/sdk/resourcemanager/dashboard/armdashboard/privateendpointconnections_client.go b/sdk/resourcemanager/dashboard/armdashboard/privateendpointconnections_client.go index 5080c6689276..d2a29064b2ca 100644 --- a/sdk/resourcemanager/dashboard/armdashboard/privateendpointconnections_client.go +++ b/sdk/resourcemanager/dashboard/armdashboard/privateendpointconnections_client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdashboard @@ -28,7 +24,7 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - 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) { @@ -46,21 +42,20 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginApprove - Manual approve private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The workspace name of Azure Managed Grafana. // - privateEndpointConnectionName - The private endpoint connection name of Azure Managed Grafana. // - options - PrivateEndpointConnectionsClientBeginApproveOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginApprove // method. -func (client *PrivateEndpointConnectionsClient) BeginApprove(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, body PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginApproveOptions) (*runtime.Poller[PrivateEndpointConnectionsClientApproveResponse], error) { +func (client *PrivateEndpointConnectionsClient) BeginApprove(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, body PrivateEndpointConnection, accept string, options *PrivateEndpointConnectionsClientBeginApproveOptions) (*runtime.Poller[PrivateEndpointConnectionsClientApproveResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.approve(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName, body, options) + resp, err := client.approve(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName, body, accept, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientApproveResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -73,14 +68,14 @@ func (client *PrivateEndpointConnectionsClient) BeginApprove(ctx context.Context // Approve - Manual approve private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 -func (client *PrivateEndpointConnectionsClient) approve(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, body PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginApproveOptions) (*http.Response, error) { +// Generated from API version 2024-10-01 +func (client *PrivateEndpointConnectionsClient) approve(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, body PrivateEndpointConnection, accept string, options *PrivateEndpointConnectionsClientBeginApproveOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginApprove" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.approveCreateRequest(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName, body, options) + req, err := client.approveCreateRequest(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName, body, accept, options) if err != nil { return nil, err } @@ -96,7 +91,7 @@ func (client *PrivateEndpointConnectionsClient) approve(ctx context.Context, res } // approveCreateRequest creates the Approve request. -func (client *PrivateEndpointConnectionsClient) approveCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, body PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginApproveOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) approveCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, body PrivateEndpointConnection, accept string, _ *PrivateEndpointConnectionsClientBeginApproveOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -119,9 +114,10 @@ func (client *PrivateEndpointConnectionsClient) approveCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Accept"] = []string{accept} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { return nil, err } @@ -131,7 +127,7 @@ func (client *PrivateEndpointConnectionsClient) approveCreateRequest(ctx context // BeginDelete - Delete private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The workspace name of Azure Managed Grafana. // - privateEndpointConnectionName - The private endpoint connection name of Azure Managed Grafana. @@ -144,8 +140,7 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -158,7 +153,7 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Delete private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-10-01 func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginDelete" @@ -181,7 +176,7 @@ func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Cont } // deleteCreateRequest creates the Delete request. -func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, _ *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -204,7 +199,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -213,7 +208,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Get private endpoint connections. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The workspace name of Azure Managed Grafana. // - privateEndpointConnectionName - The private endpoint connection name of Azure Managed Grafana. @@ -242,7 +237,7 @@ func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourc } // getCreateRequest creates the Get request. -func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, _ *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -265,7 +260,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -282,7 +277,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListPager - Get private endpoint connection // -// Generated from API version 2023-09-01 +// Generated from API version 2024-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The workspace name of Azure Managed Grafana. // - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager @@ -311,7 +306,7 @@ func (client *PrivateEndpointConnectionsClient) NewListPager(resourceGroupName s } // listCreateRequest creates the List request. -func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *PrivateEndpointConnectionsClientListOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, _ *PrivateEndpointConnectionsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateEndpointConnections" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -330,7 +325,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dashboard/armdashboard/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/dashboard/armdashboard/privateendpointconnections_client_example_test.go index e9f0b1c60b03..3c4ea1ab1c35 100644 --- a/sdk/resourcemanager/dashboard/armdashboard/privateendpointconnections_client_example_test.go +++ b/sdk/resourcemanager/dashboard/armdashboard/privateendpointconnections_client_example_test.go @@ -1,72 +1,49 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdashboard_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/78eac0bd58633028293cb1ec1709baa200bed9e2/specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/PrivateEndpointConnections_Get.json -func ExamplePrivateEndpointConnectionsClient_Get() { +// Generated from example definition: 2024-10-01/PrivateEndpointConnections_Approve.json +func ExamplePrivateEndpointConnectionsClient_BeginApprove() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdashboard.NewClientFactory("", cred, nil) + clientFactory, err := armdashboard.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "myResourceGroup", "myWorkspace", "myConnection", nil) + poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginApprove(ctx, "myResourceGroup", "myWorkspace", "myConnection", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armdashboard.PrivateEndpointConnection{ - // Name: to.Ptr("myConnection"), - // Type: to.Ptr("Microsoft.Dashboard/grafana/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/Microsoft.Dashboard/grafana/myWorkspace/privateEndpointConnections/myConnection"), - // Properties: &armdashboard.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("grafana")}, - // PrivateEndpoint: &armdashboard.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/Microsoft.Network/privateEndpoint/myEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armdashboard.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("string"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armdashboard.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armdashboard.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/78eac0bd58633028293cb1ec1709baa200bed9e2/specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/PrivateEndpointConnections_Approve.json -func ExamplePrivateEndpointConnectionsClient_BeginApprove() { +// Generated from example definition: 2024-10-01/PrivateEndpointConnections_Delete.json +func ExamplePrivateEndpointConnectionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdashboard.NewClientFactory("", cred, nil) + clientFactory, err := armdashboard.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginApprove(ctx, "myResourceGroup", "myWorkspace", "myConnection", armdashboard.PrivateEndpointConnection{}, nil) + poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "myResourceGroup", "myWorkspace", "myConnection", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -76,35 +53,55 @@ func ExamplePrivateEndpointConnectionsClient_BeginApprove() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/78eac0bd58633028293cb1ec1709baa200bed9e2/specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/PrivateEndpointConnections_Delete.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete() { +// Generated from example definition: 2024-10-01/PrivateEndpointConnections_Get.json +func ExamplePrivateEndpointConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdashboard.NewClientFactory("", cred, nil) + clientFactory, err := armdashboard.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "myResourceGroup", "myWorkspace", "myConnection", nil) + res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "myResourceGroup", "myWorkspace", "myConnection", 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) - } + // 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 = armdashboard.PrivateEndpointConnectionsClientGetResponse{ + // PrivateEndpointConnection: &armdashboard.PrivateEndpointConnection{ + // Name: to.Ptr("myConnection"), + // Type: to.Ptr("Microsoft.Dashboard/grafana/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/Microsoft.Dashboard/grafana/myWorkspace/privateEndpointConnections/myConnection"), + // Properties: &armdashboard.PrivateEndpointConnectionProperties{ + // GroupIDs: []*string{ + // to.Ptr("grafana"), + // }, + // PrivateEndpoint: &armdashboard.PrivateEndpoint{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/Microsoft.Network/privateEndpoint/myEndpoint"), + // }, + // PrivateLinkServiceConnectionState: &armdashboard.PrivateLinkServiceConnectionState{ + // Description: to.Ptr("string"), + // ActionsRequired: to.Ptr("None"), + // Status: to.Ptr(armdashboard.PrivateEndpointServiceConnectionStatusPending), + // }, + // ProvisioningState: to.Ptr(armdashboard.PrivateEndpointConnectionProvisioningState("Accepted")), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/78eac0bd58633028293cb1ec1709baa200bed9e2/specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/PrivateEndpointConnections_List.json +// Generated from example definition: 2024-10-01/PrivateEndpointConnections_List.json func ExamplePrivateEndpointConnectionsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdashboard.NewClientFactory("", cred, nil) + clientFactory, err := armdashboard.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -119,15 +116,17 @@ func ExamplePrivateEndpointConnectionsClient_NewListPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateEndpointConnectionListResult = armdashboard.PrivateEndpointConnectionListResult{ - // Value: []*armdashboard.PrivateEndpointConnection{ - // { - // Name: to.Ptr("myConnection"), - // Type: to.Ptr("Microsoft.Dashboard/grafana/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/Microsoft.Dashboard/grafana/myWorkspace/privateEndpointConnections/myConnection"), - // Properties: &armdashboard.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("grafana")}, + // page = armdashboard.PrivateEndpointConnectionsClientListResponse{ + // PrivateEndpointConnectionListResult: armdashboard.PrivateEndpointConnectionListResult{ + // Value: []*armdashboard.PrivateEndpointConnection{ + // { + // Name: to.Ptr("myConnection"), + // Type: to.Ptr("Microsoft.Dashboard/grafana/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/Microsoft.Dashboard/grafana/myWorkspace/privateEndpointConnections/myConnection"), + // Properties: &armdashboard.PrivateEndpointConnectionProperties{ + // GroupIDs: []*string{ + // to.Ptr("grafana"), + // }, // PrivateEndpoint: &armdashboard.PrivateEndpoint{ // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/Microsoft.Network/privateEndpoint/myEndpoint"), // }, @@ -136,9 +135,11 @@ func ExamplePrivateEndpointConnectionsClient_NewListPager() { // ActionsRequired: to.Ptr("None"), // Status: to.Ptr(armdashboard.PrivateEndpointServiceConnectionStatusPending), // }, - // ProvisioningState: to.Ptr(armdashboard.PrivateEndpointConnectionProvisioningStateSucceeded), + // ProvisioningState: to.Ptr(armdashboard.PrivateEndpointConnectionProvisioningState("Accepted")), // }, - // }}, - // } + // }, + // }, + // }, + // } } } diff --git a/sdk/resourcemanager/dashboard/armdashboard/privatelinkresources_client.go b/sdk/resourcemanager/dashboard/armdashboard/privatelinkresources_client.go index 383fd8610b51..57c7a86f4bf1 100644 --- a/sdk/resourcemanager/dashboard/armdashboard/privatelinkresources_client.go +++ b/sdk/resourcemanager/dashboard/armdashboard/privatelinkresources_client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdashboard @@ -28,7 +24,7 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { @@ -46,7 +42,7 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // Get - Get specific private link resource information for this grafana resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2024-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The workspace name of Azure Managed Grafana. // - options - PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get @@ -74,7 +70,7 @@ func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroup } // getCreateRequest creates the Get request. -func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, privateLinkResourceName string, options *PrivateLinkResourcesClientGetOptions) (*policy.Request, error) { +func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, privateLinkResourceName string, _ *PrivateLinkResourcesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateLinkResources/{privateLinkResourceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -97,7 +93,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -114,7 +110,7 @@ func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) // NewListPager - List all private link resources information for this grafana resource // -// Generated from API version 2023-09-01 +// Generated from API version 2024-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The workspace name of Azure Managed Grafana. // - options - PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListPager @@ -143,7 +139,7 @@ func (client *PrivateLinkResourcesClient) NewListPager(resourceGroupName string, } // listCreateRequest creates the List request. -func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *PrivateLinkResourcesClientListOptions) (*policy.Request, error) { +func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, _ *PrivateLinkResourcesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateLinkResources" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -162,7 +158,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dashboard/armdashboard/privatelinkresources_client_example_test.go b/sdk/resourcemanager/dashboard/armdashboard/privatelinkresources_client_example_test.go index 523b90efd24b..3e585e37cc39 100644 --- a/sdk/resourcemanager/dashboard/armdashboard/privatelinkresources_client_example_test.go +++ b/sdk/resourcemanager/dashboard/armdashboard/privatelinkresources_client_example_test.go @@ -1,30 +1,60 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdashboard_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dashboard/armdashboard/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/78eac0bd58633028293cb1ec1709baa200bed9e2/specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/PrivateLinkResources_List.json +// Generated from example definition: 2024-10-01/PrivateLinkResources_Get.json +func ExamplePrivateLinkResourcesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdashboard.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrivateLinkResourcesClient().Get(ctx, "myResourceGroup", "myWorkspace", "grafana", 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 = armdashboard.PrivateLinkResourcesClientGetResponse{ + // PrivateLinkResource: &armdashboard.PrivateLinkResource{ + // Name: to.Ptr("grafana"), + // Type: to.Ptr("Microsoft.Dashboard/grafana/PrivateLinkResources"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/Microsoft.Dashboard/grafana/myWorkspace/privateLinkResources/grafana"), + // Properties: &armdashboard.PrivateLinkResourceProperties{ + // GroupID: to.Ptr("grafana"), + // RequiredMembers: []*string{ + // to.Ptr("grafana"), + // }, + // RequiredZoneNames: []*string{ + // to.Ptr("grafana-test.azure.com"), + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2024-10-01/PrivateLinkResources_List.json func ExamplePrivateLinkResourcesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armdashboard.NewClientFactory("", cred, nil) + clientFactory, err := armdashboard.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -39,52 +69,25 @@ func ExamplePrivateLinkResourcesClient_NewListPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateLinkResourceListResult = armdashboard.PrivateLinkResourceListResult{ - // Value: []*armdashboard.PrivateLinkResource{ - // { - // Name: to.Ptr("grafana"), - // Type: to.Ptr("Microsoft.Dashboard/grafana/PrivateLinkResources"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/Microsoft.Dashboard/grafana/myWorkspace/privateLinkResources/grafana"), - // Properties: &armdashboard.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("grafana"), - // RequiredMembers: []*string{ - // to.Ptr("grafana")}, + // page = armdashboard.PrivateLinkResourcesClientListResponse{ + // PrivateLinkResourceListResult: armdashboard.PrivateLinkResourceListResult{ + // Value: []*armdashboard.PrivateLinkResource{ + // { + // Name: to.Ptr("grafana"), + // Type: to.Ptr("Microsoft.Dashboard/grafana/PrivateLinkResources"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/Microsoft.Dashboard/grafana/myWorkspace/privateLinkResources/grafana"), + // Properties: &armdashboard.PrivateLinkResourceProperties{ + // GroupID: to.Ptr("grafana"), + // RequiredMembers: []*string{ + // to.Ptr("grafana"), + // }, // RequiredZoneNames: []*string{ - // to.Ptr("grafana-test.azure.com")}, + // to.Ptr("grafana-test.azure.com"), // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/78eac0bd58633028293cb1ec1709baa200bed9e2/specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/PrivateLinkResources_Get.json -func ExamplePrivateLinkResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) + // }, + // }, + // }, + // }, + // } } - ctx := context.Background() - clientFactory, err := armdashboard.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourcesClient().Get(ctx, "myResourceGroup", "myWorkspace", "grafana", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkResource = armdashboard.PrivateLinkResource{ - // Name: to.Ptr("grafana"), - // Type: to.Ptr("Microsoft.Dashboard/grafana/PrivateLinkResources"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/Microsoft.Dashboard/grafana/myWorkspace/privateLinkResources/grafana"), - // Properties: &armdashboard.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("grafana"), - // RequiredMembers: []*string{ - // to.Ptr("grafana")}, - // RequiredZoneNames: []*string{ - // to.Ptr("grafana-test.azure.com")}, - // }, - // } } diff --git a/sdk/resourcemanager/dashboard/armdashboard/response_types.go b/sdk/resourcemanager/dashboard/armdashboard/response_types.go deleted file mode 100644 index fe95e5df4887..000000000000 --- a/sdk/resourcemanager/dashboard/armdashboard/response_types.go +++ /dev/null @@ -1,131 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdashboard - -// GrafanaClientCheckEnterpriseDetailsResponse contains the response from method GrafanaClient.CheckEnterpriseDetails. -type GrafanaClientCheckEnterpriseDetailsResponse struct { - // Enterprise details of a Grafana instance - EnterpriseDetails -} - -// GrafanaClientCreateResponse contains the response from method GrafanaClient.BeginCreate. -type GrafanaClientCreateResponse struct { - // The grafana resource type. - ManagedGrafana -} - -// GrafanaClientDeleteResponse contains the response from method GrafanaClient.BeginDelete. -type GrafanaClientDeleteResponse struct { - // placeholder for future response values -} - -// GrafanaClientFetchAvailablePluginsResponse contains the response from method GrafanaClient.FetchAvailablePlugins. -type GrafanaClientFetchAvailablePluginsResponse struct { - GrafanaAvailablePluginListResponse -} - -// GrafanaClientGetResponse contains the response from method GrafanaClient.Get. -type GrafanaClientGetResponse struct { - // The grafana resource type. - ManagedGrafana -} - -// GrafanaClientListByResourceGroupResponse contains the response from method GrafanaClient.NewListByResourceGroupPager. -type GrafanaClientListByResourceGroupResponse struct { - ManagedGrafanaListResponse -} - -// GrafanaClientListResponse contains the response from method GrafanaClient.NewListPager. -type GrafanaClientListResponse struct { - ManagedGrafanaListResponse -} - -// GrafanaClientUpdateResponse contains the response from method GrafanaClient.Update. -type GrafanaClientUpdateResponse struct { - // The grafana resource type. - ManagedGrafana - - // AzureAsyncOperation contains the information returned from the Azure-AsyncOperation header response. - AzureAsyncOperation *string -} - -// ManagedPrivateEndpointsClientCreateResponse contains the response from method ManagedPrivateEndpointsClient.BeginCreate. -type ManagedPrivateEndpointsClientCreateResponse struct { - // The managed private endpoint resource type. - ManagedPrivateEndpointModel -} - -// ManagedPrivateEndpointsClientDeleteResponse contains the response from method ManagedPrivateEndpointsClient.BeginDelete. -type ManagedPrivateEndpointsClientDeleteResponse struct { - // placeholder for future response values -} - -// ManagedPrivateEndpointsClientGetResponse contains the response from method ManagedPrivateEndpointsClient.Get. -type ManagedPrivateEndpointsClientGetResponse struct { - // The managed private endpoint resource type. - ManagedPrivateEndpointModel -} - -// ManagedPrivateEndpointsClientListResponse contains the response from method ManagedPrivateEndpointsClient.NewListPager. -type ManagedPrivateEndpointsClientListResponse struct { - // The list of managed private endpoints of a grafana resource - ManagedPrivateEndpointModelListResponse -} - -// ManagedPrivateEndpointsClientRefreshResponse contains the response from method ManagedPrivateEndpointsClient.BeginRefresh. -type ManagedPrivateEndpointsClientRefreshResponse struct { - // placeholder for future response values -} - -// ManagedPrivateEndpointsClientUpdateResponse contains the response from method ManagedPrivateEndpointsClient.BeginUpdate. -type ManagedPrivateEndpointsClientUpdateResponse struct { - // The managed private endpoint resource type. - ManagedPrivateEndpointModel -} - -// 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 -} - -// PrivateEndpointConnectionsClientApproveResponse contains the response from method PrivateEndpointConnectionsClient.BeginApprove. -type PrivateEndpointConnectionsClientApproveResponse struct { - // The Private Endpoint Connection resource. - PrivateEndpointConnection -} - -// 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 { - // The Private Endpoint Connection resource. - PrivateEndpointConnection -} - -// PrivateEndpointConnectionsClientListResponse contains the response from method PrivateEndpointConnectionsClient.NewListPager. -type PrivateEndpointConnectionsClientListResponse struct { - // List of private endpoint connection associated with the specified storage account - PrivateEndpointConnectionListResult -} - -// PrivateLinkResourcesClientGetResponse contains the response from method PrivateLinkResourcesClient.Get. -type PrivateLinkResourcesClientGetResponse struct { - // A private link resource - PrivateLinkResource -} - -// PrivateLinkResourcesClientListResponse contains the response from method PrivateLinkResourcesClient.NewListPager. -type PrivateLinkResourcesClientListResponse struct { - // A list of private link resources - PrivateLinkResourceListResult -} diff --git a/sdk/resourcemanager/dashboard/armdashboard/responses.go b/sdk/resourcemanager/dashboard/armdashboard/responses.go new file mode 100644 index 000000000000..a67a53a1d2ac --- /dev/null +++ b/sdk/resourcemanager/dashboard/armdashboard/responses.go @@ -0,0 +1,155 @@ +// 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 armdashboard + +// IntegrationFabricsClientCreateResponse contains the response from method IntegrationFabricsClient.BeginCreate. +type IntegrationFabricsClientCreateResponse struct { + // The integration fabric resource type. + IntegrationFabric +} + +// IntegrationFabricsClientDeleteResponse contains the response from method IntegrationFabricsClient.BeginDelete. +type IntegrationFabricsClientDeleteResponse struct { + // placeholder for future response values +} + +// IntegrationFabricsClientGetResponse contains the response from method IntegrationFabricsClient.Get. +type IntegrationFabricsClientGetResponse struct { + // The integration fabric resource type. + IntegrationFabric +} + +// IntegrationFabricsClientListResponse contains the response from method IntegrationFabricsClient.NewListPager. +type IntegrationFabricsClientListResponse struct { + // Paged collection of IntegrationFabric items + IntegrationFabricListResponse +} + +// IntegrationFabricsClientUpdateResponse contains the response from method IntegrationFabricsClient.BeginUpdate. +type IntegrationFabricsClientUpdateResponse struct { + // The integration fabric resource type. + IntegrationFabric +} + +// ManagedGrafanasClientCheckEnterpriseDetailsResponse contains the response from method ManagedGrafanasClient.CheckEnterpriseDetails. +type ManagedGrafanasClientCheckEnterpriseDetailsResponse struct { + // Enterprise details of a Grafana instance + EnterpriseDetails +} + +// ManagedGrafanasClientCreateResponse contains the response from method ManagedGrafanasClient.BeginCreate. +type ManagedGrafanasClientCreateResponse struct { + // The grafana resource type. + ManagedGrafana +} + +// ManagedGrafanasClientDeleteResponse contains the response from method ManagedGrafanasClient.BeginDelete. +type ManagedGrafanasClientDeleteResponse struct { + // placeholder for future response values +} + +// ManagedGrafanasClientFetchAvailablePluginsResponse contains the response from method ManagedGrafanasClient.FetchAvailablePlugins. +type ManagedGrafanasClientFetchAvailablePluginsResponse struct { + GrafanaAvailablePluginListResponse +} + +// ManagedGrafanasClientGetResponse contains the response from method ManagedGrafanasClient.Get. +type ManagedGrafanasClientGetResponse struct { + // The grafana resource type. + ManagedGrafana +} + +// ManagedGrafanasClientListByResourceGroupResponse contains the response from method ManagedGrafanasClient.NewListByResourceGroupPager. +type ManagedGrafanasClientListByResourceGroupResponse struct { + // Paged collection of ManagedGrafana items + ManagedGrafanaListResponse +} + +// ManagedGrafanasClientListResponse contains the response from method ManagedGrafanasClient.NewListPager. +type ManagedGrafanasClientListResponse struct { + // Paged collection of ManagedGrafana items + ManagedGrafanaListResponse +} + +// ManagedGrafanasClientRefreshResponse contains the response from method ManagedGrafanasClient.BeginRefresh. +type ManagedGrafanasClientRefreshResponse struct { + // placeholder for future response values +} + +// ManagedGrafanasClientUpdateResponse contains the response from method ManagedGrafanasClient.Update. +type ManagedGrafanasClientUpdateResponse struct { + // The grafana resource type. + ManagedGrafana +} + +// ManagedPrivateEndpointModelsClientCreateResponse contains the response from method ManagedPrivateEndpointModelsClient.BeginCreate. +type ManagedPrivateEndpointModelsClientCreateResponse struct { + // The managed private endpoint resource type. + ManagedPrivateEndpointModel +} + +// ManagedPrivateEndpointModelsClientDeleteResponse contains the response from method ManagedPrivateEndpointModelsClient.BeginDelete. +type ManagedPrivateEndpointModelsClientDeleteResponse struct { + // placeholder for future response values +} + +// ManagedPrivateEndpointModelsClientGetResponse contains the response from method ManagedPrivateEndpointModelsClient.Get. +type ManagedPrivateEndpointModelsClientGetResponse struct { + // The managed private endpoint resource type. + ManagedPrivateEndpointModel +} + +// ManagedPrivateEndpointModelsClientListResponse contains the response from method ManagedPrivateEndpointModelsClient.NewListPager. +type ManagedPrivateEndpointModelsClientListResponse struct { + // The list of managed private endpoints of a grafana resource + ManagedPrivateEndpointModelListResponse +} + +// ManagedPrivateEndpointModelsClientUpdateResponse contains the response from method ManagedPrivateEndpointModelsClient.BeginUpdate. +type ManagedPrivateEndpointModelsClientUpdateResponse struct { + // The managed private endpoint resource type. + ManagedPrivateEndpointModel +} + +// 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 +} + +// PrivateEndpointConnectionsClientApproveResponse contains the response from method PrivateEndpointConnectionsClient.BeginApprove. +type PrivateEndpointConnectionsClientApproveResponse struct { + // The Private Endpoint Connection resource. + PrivateEndpointConnection +} + +// 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 { + // The Private Endpoint Connection resource. + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsClientListResponse contains the response from method PrivateEndpointConnectionsClient.NewListPager. +type PrivateEndpointConnectionsClientListResponse struct { + // The response of a PrivateEndpointConnection list operation. + PrivateEndpointConnectionListResult +} + +// PrivateLinkResourcesClientGetResponse contains the response from method PrivateLinkResourcesClient.Get. +type PrivateLinkResourcesClientGetResponse struct { + // A private link resource + PrivateLinkResource +} + +// PrivateLinkResourcesClientListResponse contains the response from method PrivateLinkResourcesClient.NewListPager. +type PrivateLinkResourcesClientListResponse struct { + // The response of a PrivateLinkResource list operation. + PrivateLinkResourceListResult +} diff --git a/sdk/resourcemanager/dashboard/armdashboard/time_rfc3339.go b/sdk/resourcemanager/dashboard/armdashboard/time_rfc3339.go index 186c0b81648f..76313fc1b8fd 100644 --- a/sdk/resourcemanager/dashboard/armdashboard/time_rfc3339.go +++ b/sdk/resourcemanager/dashboard/armdashboard/time_rfc3339.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdashboard @@ -19,12 +15,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +40,36 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +80,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +97,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/dashboard/armdashboard/tsp-location.yaml b/sdk/resourcemanager/dashboard/armdashboard/tsp-location.yaml new file mode 100644 index 000000000000..b8e133d2859c --- /dev/null +++ b/sdk/resourcemanager/dashboard/armdashboard/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/dashboard/Dashboard.Management +commit: 47f760346502e0c466d9acf3e07a8b5370d32f83 +repo: Azure/azure-rest-api-specs +additionalDirectories: